code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@array_function_from_c_func_and_dispatcher(_multiarray_umath.is_busday) <NEW_LINE> def is_busday(dates, weekmask=None, holidays=None, busdaycal=None, out=None): <NEW_LINE> <INDENT> return (dates, weekmask, holidays, out)
is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) Calculates which of the given dates are valid days, and which are not. .. versionadded:: 1.7.0 Parameters ---------- dates : array_like of datetime64[D] The array of dates to process. weekmask : str or array_like of bool, optional ...
625941d563f4b57ef0001324
def computeVoronoiDiagram(points): <NEW_LINE> <INDENT> siteList = SiteList(points) <NEW_LINE> context = Context() <NEW_LINE> voronoi(siteList,context) <NEW_LINE> return (context.vertices,context.lines,context.edges)
Takes a list of point objects (which must have x and y fields). Returns a 3-tuple of: (1) a list of 2-tuples, which are the x,y coordinates of the Voronoi diagram vertices (2) a list of 3-tuples (a,b,c) which are the equations of the lines in the Voronoi diagram: a*x + b*y = c (3) a list of 3-t...
625941d5711fe17d82542577
def load_backends(self): <NEW_LINE> <INDENT> backends = {} <NEW_LINE> for target in config.options.target_backends.keys(): <NEW_LINE> <INDENT> if config.options.target_backends[target]: <NEW_LINE> <INDENT> backend = OS.default_backend_for_target(target) <NEW_LINE> if backend != "disabled": <NEW_LINE> <INDENT> config.op...
Initialize the default backends for the targets with the give names. The default backends for the local os will be retrieved and the corresponding modules will be loaded out of the backends subdirectories and target classes instantiated and returned
625941d5cb5e8a47e48b7cb6
def isTwin(self, other): <NEW_LINE> <INDENT> if not hasattr(other, "obj"): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if (self.obj is other.obj or self.obj == other.obj): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
A weaker form of equality. a.isTwin(b) is true if a and b store either the same object OR objects that are equal. In other words, it is essentially the same object in a different context >>> import copy >>> import music21 >>> from music21 import note >>> aE = music21.ElementWrapper(obj = "hello") >>> bE = copy.copy...
625941d54f6381625f114c4a
def bC_Na_ClO4_MP98(T, P): <NEW_LINE> <INDENT> b0 = MP98_eq15( T, [ 0.0554, -0.611, 12.96, ], ) <NEW_LINE> b1 = MP98_eq15( T, [ 0.2755, -6.35, 22.97, ], ) <NEW_LINE> b2 = 0 <NEW_LINE> Cphi = MP98_eq15( T, [ -0.00118, 0.0562, -1.623, ], ) <NEW_LINE> C0 = Cphi / (2 * np.sqrt(np.abs(i2c["Na"] * i2c["ClO4"]))) <NEW_LINE> C...
c-a: sodium perchlorate [MP98].
625941d5cb5e8a47e48b7cb7
def get(self, idx): <NEW_LINE> <INDENT> cur_chunk = None <NEW_LINE> chunk_idx = 0 <NEW_LINE> for chunk in self.chunks: <NEW_LINE> <INDENT> chunk_idx += chunk.size <NEW_LINE> cur_chunk = chunk <NEW_LINE> if chunk_idx > idx: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> if cur_chunk is None: <NEW_LINE> <INDENT> ...
Gets the specified parseklog entry from the klog @param idx @return the ParseklogEntry at idx
625941d576e4537e8c351882
def acquire(self): <NEW_LINE> <INDENT> pass
Lockによる排他制御開始のダミーメソッド.
625941d5046cf37aa974cf55
def nextGreaterElements(self, nums): <NEW_LINE> <INDENT> N = len(nums) <NEW_LINE> ret = [-1]*N <NEW_LINE> stk = collections.deque() <NEW_LINE> for i in range(2*N): <NEW_LINE> <INDENT> idx = i%N <NEW_LINE> while len(stk) and nums[stk[-1]]<nums[idx]: <NEW_LINE> <INDENT> ret[stk.pop()] = nums[idx] <NEW_LINE> <DEDENT> if i...
:type nums: List[int] :rtype: List[int]
625941d5d10714528d5ffef3
def get_tuple(i, orientation): <NEW_LINE> <INDENT> if orientation == 0 or orientation == "east": <NEW_LINE> <INDENT> new_tuple = tuple([i[0], i[1] + 1]) <NEW_LINE> <DEDENT> elif orientation == 2 or orientation == "west": <NEW_LINE> <INDENT> new_tuple = tuple([i[0], i[1] - 1]) <NEW_LINE> <DEDENT> elif orientation == 1 o...
Return a new location tuple alone given orientation
625941d5de87d2750b85ffa2
def set_rasterized(self, rasterized): <NEW_LINE> <INDENT> if rasterized and not hasattr(self.draw, "_supports_rasterization"): <NEW_LINE> <INDENT> _api.warn_external(f"Rasterization of '{self}' will be ignored") <NEW_LINE> <DEDENT> self._rasterized = rasterized
Force rasterized (bitmap) drawing for vector graphics output. Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued. This setting is ignored for pixel-based output. See also :doc:`/gallery/misc/raste...
625941d5ec188e330fd5a9ab
def create_xml_root(self): <NEW_LINE> <INDENT> self.xml_root = create_xml_project(self.attributes) <NEW_LINE> if self.attributes.has_key('Files'): <NEW_LINE> <INDENT> self.xml_root = add_xml_files(self.attributes, self.xml_root) <NEW_LINE> <DEDENT> if self.attributes.has_key('Models'): <NEW_LINE> <INDENT> self.xml_root...
Creates the XML object
625941d5596a897236089cce
def custom_compare_type(context: MigrationContext, inspected_column: Column, metadata_column: Column, inspected_type: TypeEngine, metadata_type: TypeEngine) -> Optional[bool]: <NEW_LINE> <INDENT> checkers = ( is_tinyint_and_bool, is_longtext_and_unicode, ) <NEW_LINE> for types_equivalent in checkers: <NEW_LINE> <INDENT...
Perform type comparison? Args: context: frontend to database inspected_column: column from the database metadata_column: column from the SQLAlchemy metadata inspected_type: column type reflected from the database metadata_type: column type from the SQLAlchemy metadata Returns: False if the met...
625941d5435de62698dfde5c
def licenseKeyFormatting4(self, S, K): <NEW_LINE> <INDENT> formatted = [] <NEW_LINE> S = S.replace('-', '') <NEW_LINE> for i in xrange(len(S), 0, -K): <NEW_LINE> <INDENT> start = i - K <NEW_LINE> if start < 0: <NEW_LINE> <INDENT> start = 0 <NEW_LINE> <DEDENT> formatted.insert(0, '-' + S[start:i].upper()) <NEW_LINE> <DE...
Beats 90.58% submissions on 10.02.2017 (42 ms) :type S: str :type K: int :rtype: str
625941d5442bda511e8be625
def generar_n_caracteres(n, caracter): <NEW_LINE> <INDENT> if len(caracter) == 1: <NEW_LINE> <INDENT> print(caracter * n) <NEW_LINE> <DEDENT> elif len(caracter) == 0: <NEW_LINE> <INDENT> raise NoCaracter("Ningun caracter") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Caracteres
Escribe un caracter dado tantas veces como se le diga.
625941d5be383301e01b5693
def crear(): <NEW_LINE> <INDENT> m = [ [' ',' ',' '], [' ',' ',' '], [' ',' ',' '] ] <NEW_LINE> return m
Crea una matriz 3x3 vacia
625941d5b57a9660fec33a95
def str2onehot(str): <NEW_LINE> <INDENT> word2int = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10 , 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25} <NEW_LINE> element_vector = [0] * 26 <NEW_...
字符串转 one hot 向量 :param str: 字符串 :return: one hot 向量
625941d5d268445f265b507d
def getWorkId(self, *args, **kwargs): <NEW_LINE> <INDENT> return _VISHNU.Job_getWorkId(self, *args, **kwargs)
getWorkId(self) -> ELong
625941d5ab23a570cc250392
def get_train_data(): <NEW_LINE> <INDENT> train_x = np.random.uniform(0.0, 2 * np.pi, (1)) <NEW_LINE> train_y = np.sin(train_x) <NEW_LINE> return train_x, train_y
返回一个训练样本(train_x, train_y) 其中,train_x是随机的自变量,train_y是train_x的sin函数值
625941d5c432627299f04e56
def gitroot(dir=""): <NEW_LINE> <INDENT> git_cmd = "git rev-parse --show-toplevel " + dir + " 2> " + os.devnull <NEW_LINE> if dir: <NEW_LINE> <INDENT> original_cwd = os.getcwd() <NEW_LINE> os.chdir(dir) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> sub_out = subprocess.check_output(git_cmd, shell=True) <NEW_LINE> cmd_ou...
Get the Git root directory of any path inside the repo
625941d5d18da76e235326e6
def play_color_tone(color_id, wait = 1.0): <NEW_LINE> <INDENT> if color_id == RED_ID[0]: <NEW_LINE> <INDENT> cpx.pixels[RED_ID[1]] = RED_ID[3] <NEW_LINE> cpx.play_tone(RED_ID[2], wait) <NEW_LINE> cpx.pixels[RED_ID[1]] = RED_ID[4] <NEW_LINE> <DEDENT> elif color_id == YELLOW_ID[0]: <NEW_LINE> <INDENT> cpx.pixels[YELLOW_I...
Play selected tone and highlight color
625941d58e05c05ec3eea585
def tag(token, name, tag): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> r = getFromURL("/tag?file=%s&tag=%s" % (name, tag), token) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> raise storeClientError (r.content) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "OK"
Annotate a file/directory in the store manager service
625941d5f9cc0f698b140809
def require_admin_and_privacy(view): <NEW_LINE> <INDENT> @functools.wraps(view) <NEW_LINE> def wrapped_view(request, *nargs, **kwargs): <NEW_LINE> <INDENT> admin_cookie = get_admin_cookie(request) <NEW_LINE> if admin_cookie and (request.is_secure() or not settings.REQUIRE_HTTPS): <NEW_LINE> <INDENT> return view(request...
Wrap a view with a function which checks that the user is an admin connecting over HTTPS (or REQUIRE_HTTPS is False). If so, run the view. Otherwise, return an error page.
625941d54a966d76dd551220
def updateRGBPage(self): <NEW_LINE> <INDENT> rgb255 = [int(i) for i in self.color.rgb255] <NEW_LINE> self.sldRedChannel.SetValue(rgb255[0]) <NEW_LINE> self.sldGreenChannel.SetValue(rgb255[1]) <NEW_LINE> self.sldBlueChannel.SetValue(rgb255[2]) <NEW_LINE> if self.rgbInputMode == 0: <NEW_LINE> <INDENT> spnColVals = self.c...
Update values on the RGB page. This is called when some other page is used to pick the color and the RGB page needs to reflect that.
625941d5b7558d58953c5121
def _siblings( self, term ): <NEW_LINE> <INDENT> parent = self._parent(term) <NEW_LINE> if parent: <NEW_LINE> <INDENT> return [t for t in self._children(parent) if t != term] <NEW_LINE> <DEDENT> return []
List of other terms with same parent_id.
625941d5bd1bec0571d9083f
@pytest.mark.parametrize('side_effect, expected', [ ((True, exceptions.InvalidMessageError()), 'schema1'), ((exceptions.InvalidMessageError(), True), 'schema2'), ((exceptions.InvalidMessageError(), exceptions.InvalidMessageError()), None), ]) <NEW_LINE> def test_get_and_validate_pubsub_msg_schema(mocker, pubsub_msg, va...
Validate & return schema of a pubsub message's data.
625941d5fff4ab517eb2f64b
def _context_menu_default(self): <NEW_LINE> <INDENT> context_menu_manager = MenuManager( name="Resource", id="puddle.resource.context_menu" ) <NEW_LINE> self.action_manager_builder.initialize_action_manager( context_menu_manager, "Resource" ) <NEW_LINE> return context_menu_manager
Trait initialiser
625941d5be8e80087fb20e50
def test_post_training_status_code_bad_request(self): <NEW_LINE> <INDENT> data = { "name": "test2", "distance": 10, "time_in_seconds": 3600, } <NEW_LINE> response = self.client.post( path="trainings/", data=json.dumps(data), headers={ "Content-Type": "application/json", "Authorization": f"Bearer {self.access_token}", }...
Test if the status code is 400 if the user enters a name which already exists among their trainings
625941d55fcc89381b1e18d0
def load_model(self, load_model): <NEW_LINE> <INDENT> if( self._model is None ): <NEW_LINE> <INDENT> raise Exception("NeuralNetwork model not configured and trained !") <NEW_LINE> <DEDENT> self._model.load_weights( load_model ) <NEW_LINE> print("NeuralNetwork model loaded from the path: ", load_model, "\n") <NEW_LINE> ...
Loads the saved model from the disk. :param none :return none :raises NotImplementedError: Implement this method.
625941d58c0ade5d55d3ebcb
def convert_col_string_to_list(colstr, with_format=True): <NEW_LINE> <INDENT> columns = re.findall(r'\$\S+\{.*\}|[^,\s]+', colstr) <NEW_LINE> if not with_format: <NEW_LINE> <INDENT> columns = remove_column_format(columns) <NEW_LINE> <DEDENT> return columns
Convert a column string to list of columns.
625941d550485f2cf553cfaa
def test_load_fallback(self): <NEW_LINE> <INDENT> config_settings = {'TEST_KEY': 'yessir'} <NEW_LINE> _, temp_config_path = tempfile.mkstemp() <NEW_LINE> self.addCleanup(os.remove, temp_config_path) <NEW_LINE> with open(temp_config_path, 'w') as temp_config: <NEW_LINE> <INDENT> temp_config.write(yaml.dump(config_settin...
Verify our YAML load works as expected.
625941d53317a56b86939e64
def sequence(self): <NEW_LINE> <INDENT> if self: <NEW_LINE> <INDENT> if not self.sequence_data: self.sequence_data = upper(self.fasta_sequence()[1]) <NEW_LINE> return self.sequence_data
Returns the nucleotide sequence of this hit, obtained with lazy computing principle
625941d538b623060ff0affd
def _normalize_alleles(self, var, boundary): <NEW_LINE> <INDENT> ref, alt = self._get_ref_alt(var, boundary) <NEW_LINE> win_size = hgvs.global_config.normalizer.window_size <NEW_LINE> if self.shuffle_direction == 3: <NEW_LINE> <INDENT> if var.posedit.edit.type == "ins": <NEW_LINE> <INDENT> base = var.posedit.pos.start....
Normalize the variant until it could not be shuffled
625941d5e76e3b2f99f3aa18
def lf_unapply(tm): <NEW_LINE> <INDENT> if isinstance(tm, oma.OMA): <NEW_LINE> <INDENT> if tm.fun == ~LF.apply and len(tm.args) > 0: <NEW_LINE> <INDENT> return (tm.args[0], tm.args[1:]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return (tm.fun, tm.args) <NEW_LINE> <DEDENT> <DEDENT> raise ValueError("not an LF-apply"...
Unpacks an lf-function from a term into a pair of (f, args)
625941d576e4537e8c351883
def plotPublishTime_Pie(datafilename, savefile): <NEW_LINE> <INDENT> with open(datafilename, 'r+') as f: <NEW_LINE> <INDENT> data = json.loads(f.read()) <NEW_LINE> size1 = data["Books_lessthan_2016"]["Bookslessthan2016Num"] <NEW_LINE> size2 = data["Books_2016"]["Books2016Num"] <NEW_LINE> size3 = data["Books_2017"]["Boo...
根据出版日期的统计信息绘制相应的饼图 :param datafilename: 保存出版日期统计信息的文件,用于读取 :param savefile: 保存绘制的饼图的文件
625941d5cc40096d61595b60
@commandWrap <NEW_LINE> def OutlinerToggleConnected(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.OutlinerToggleConnected(*args, **kwargs)
:rtype: list|str|DagNode|AttrObject|ArrayAttrObject|Components1Base
625941d57cff6e4e81117b95
def detect_format(fileobj): <NEW_LINE> <INDENT> for format in FORMATS.values(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if format.is_correct_format(fileobj): <NEW_LINE> <INDENT> return format <NEW_LINE> <DEDENT> <DEDENT> except IOError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDENT> if isinstance(fileobj, s...
Returns the StreamlinesFile object guessed from the file-like object. Parameters ---------- fileobj : string or file-like object If string, a filename; otherwise an open file-like object pointing to a tractogram file (and ready to read from the beginning of the header) Returns ------- tractogram_file : :c...
625941d5fbf16365ca6f63d5
def splitChildren(self, a, fv, c1, c2, asserts = EDIT_ASSERTS): <NEW_LINE> <INDENT> if asserts: <NEW_LINE> <INDENT> if not self.containsNode(a): <NEW_LINE> <INDENT> print("Trying to split the children of a node that's not in the tree") <NEW_LINE> return -1 <NEW_LINE> <DEDENT> if not set(c1 + c2) == set(a.children): <NE...
Split the children c = c1 union c2 of node a by creating a new node v as a child of a, with f(a) > f(v) > f(c2), so that a now has the children c1,v and v has children c2. :returns: Cost f(a) - f(v)
625941d5dc8b845886cb5745
@can_write_and_read_now <NEW_LINE> @login_required <NEW_LINE> @require_POST <NEW_LINE> def dislike_post(request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> post_pk = int(request.GET["message"]) <NEW_LINE> <DEDENT> except (KeyError, ValueError): <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <DEDENT> resp = {} <NEW_LIN...
The current user dislikes the post, or stops to dislike it if it was already liked. A dislike replaces the eventual existing like on this post. As the "like/dislike" data is de-normalized for performance purposes, also this also updates the de-normalized data at `Post` level.
625941d57b180e01f3dc4a0a
def nfd(filename): <NEW_LINE> <INDENT> return unicodedata.normalize('NFD', filename)
NFD変換
625941d571ff763f4b54989e
def test_onchange_one2many_with_domain_on_related_field(self): <NEW_LINE> <INDENT> discussion = self.env.ref('test_new_api.discussion_0') <NEW_LINE> demo = self.env.ref('base.user_demo') <NEW_LINE> view_info = self.Discussion.fields_view_get( view_id=self.env.ref('test_new_api.discussion_form').id, view_type='form') <N...
test the value of the one2many field when defined with a domain on a related field
625941d58e7ae83300e4b1dd
def list_tc_filters(device, parent, namespace=None): <NEW_LINE> <INDENT> parent = iproute_linux.transform_handle(parent) <NEW_LINE> filters = priv_tc_lib.list_tc_filters(device, parent, namespace=namespace) <NEW_LINE> retval = [] <NEW_LINE> for filter in filters: <NEW_LINE> <INDENT> tca_options = _get_attr(filter, 'TCA...
List TC filter in a device :param device: (string) device name :param parent: (string) qdisc parent class ('root', 'ingress', '2:10') :param namespace: (string) (optional) namespace name
625941d5009cb60464c635c0
def solveOneStep(self): <NEW_LINE> <INDENT> self.visited[self.currentState] = True <NEW_LINE> if self.currentState.state == self.victoryCondition: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> possible_moves = self.gm.getMovables() <NEW_LINE> if len(self.currentState.children) == 0: <NEW_LINE> <INDENT> for i in p...
Go to the next state that has not been explored. If a game state leads to more than one unexplored game states, explore in the order implied by the GameMaster.getMovables() function. If all game states reachable from a parent state has been explored, the next explored state should conform to the specifications of the D...
625941d57d847024c06be4cd
def is_slot_available(req_all, timetable_np, c, r_day, r_slot, req_id, theory_roomgroup, lab_roomgroup): <NEW_LINE> <INDENT> n_classes, n_days, n_slots, n_maxlecsperslot = timetable_np.shape <NEW_LINE> SlotsAvailable = 0 <NEW_LINE> SlotRequirement=int(req_all.loc[int(req_id), 'eachSlot']) <NEW_LINE> if(n_slots-r_slot <...
Checks if slot is available considering 1. Consecutive slot availability 2. Max theory and max lab per slot
625941d5a05bb46b383eca31
def validate(self, response): <NEW_LINE> <INDENT> if response and response.find('"success": true') > 0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Determine if JSON response indicated success.
625941d5091ae3566866716b
def getComponent(self, innerFlag=False): <NEW_LINE> <INDENT> if self._currentIdx is None: <NEW_LINE> <INDENT> raise error.PyAsn1Error('Component not chosen') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> c = self._componentValues[self._currentIdx] <NEW_LINE> if innerFlag and isinstance(c, Choice): <NEW_LINE> <INDENT> r...
Return currently assigned component of the |ASN.1| object. Returns ------- : :py:class:`~pyasn1.type.base.PyAsn1Item` a PyASN1 object
625941d5046cf37aa974cf56
def CountFloatingWindows(): <NEW_LINE> <INDENT> return _DigitalMicrograph.CountFloatingWindows()
CountFloatingWindows() -> long
625941d523e79379d52ee771
def _eval_subject_codes(self): <NEW_LINE> <INDENT> for s in _eval_subjects: <NEW_LINE> <INDENT> yield s
Get an iterable of subject codes for evaluation.
625941d5f8510a7c17cf990c
def test_create_success_gcp(self): <NEW_LINE> <INDENT> url = reverse('file_repository') <NEW_LINE> data = { 'title': 'Test file repository', 'type': 'gcp_cloud_storage', 'gcp_cloud_storage_bucket': 'abc', 'gcp_cloud_storage_json_key': '{}' } <NEW_LINE> self.client.force_authenticate(user=self.test_user_obj) <NEW_LINE> ...
Tests to create a file repository for gcp
625941d5287bf620b61d3c72
def empirical_overlaps(n_nodes, eta_list, n_samples, d, filename=None): <NEW_LINE> <INDENT> n_eta = eta_list.size <NEW_LINE> true_vecs = true_eigenvectors(eta_list, n_nodes) <NEW_LINE> overlap = np.zeros((2, 2, n_eta, n_samples)) <NEW_LINE> for (i, eta) in enumerate(eta_list): <NEW_LINE> <INDENT> print(f"Step {i+1}/{n_...
Computes the scalar products between the eigenvectors a path-DSBM random graph and their expected values. Input: - n_nodes: number of nodes in the graph - eta_list: list of asymmetry parameters eta to consider. - n_samples: number of graphs generated for each value of eta - d: degree parameter for the ...
625941d57d847024c06be4ce
def __init__( self, *, credentials: ga_credentials.Credentials = None, transport: Union[str, AnalyticsAdminServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: <NEW_LINE> <INDENT> self._client = AnalyticsAdminServiceClie...
Instantiates the analytics admin service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the...
625941d531939e2706e4d078
def test_hapd_ctrl_set_accept_mac_file_vlan(dev, apdev): <NEW_LINE> <INDENT> ssid = "hapd-ctrl" <NEW_LINE> filename = hostapd.acl_file(dev, apdev, 'hostapd.accept') <NEW_LINE> params = {"ssid": ssid} <NEW_LINE> hapd = hostapd.add_ap(apdev[0], params) <NEW_LINE> dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412") <N...
hostapd and SET accept_mac_file ctrl_iface command (VLAN ID)
625941d5851cf427c661a71d
def test_fail_run(self): <NEW_LINE> <INDENT> filename = 'fixtures/templates/bad/json_parse.json' <NEW_LINE> try: <NEW_LINE> <INDENT> json.load(open(filename), cls=cfnlint.decode.cfn_json.CfnJSONDecoder) <NEW_LINE> <DEDENT> except cfnlint.decode.cfn_json.JSONDecodeError: <NEW_LINE> <INDENT> assert(True) <NEW_LINE> retur...
Test failure run
625941d5c432627299f04e57
def build_attrs(self, extra_attrs=None, **kwargs): <NEW_LINE> <INDENT> self.attrs = self.widget.build_attrs(extra_attrs=None, **kwargs) <NEW_LINE> return self.attrs
Helper function for building an attribute dictionary.
625941d58e05c05ec3eea586
def buffers(): <NEW_LINE> <INDENT> buffers = filter(None, imap(lambda b: b.name, vim.buffers)) <NEW_LINE> return filter(lambda b: buflisted(b), unicode(buffers))
To return a list of all listed buffers.
625941d5baa26c4b54cb132e
def add(self, obj): <NEW_LINE> <INDENT> if not isinstance(obj, sge.StellarClass): <NEW_LINE> <INDENT> obj = sge.game.objects[obj] <NEW_LINE> <DEDENT> if obj not in self.objects: <NEW_LINE> <INDENT> new_objects = list(self.objects) <NEW_LINE> new_objects.append(obj) <NEW_LINE> self.objects = tuple(new_objects) <NEW_LINE...
Add a StellarClass object to the room. Arguments: - ``obj`` -- The :class:`sge.StellarClass` object to add.
625941d567a9b606de4a80c8
def get_file_name(file_path): <NEW_LINE> <INDENT> return file_path.split("/")[-1]
Gets the name of a file from a path :param file_path: str :return: str
625941d597e22403b379d1aa
def test_clear(self): <NEW_LINE> <INDENT> file_descriptor, path = tempfile.mkstemp() <NEW_LINE> io_file = File(unicode(path)) <NEW_LINE> self.assertIsInstance(io_file.content, list) <NEW_LINE> io_file.content = FILE_CONTENT <NEW_LINE> io_file.write() <NEW_LINE> self.assertTrue(io_file.clear()) <NEW_LINE> io_file.cache(...
Tests :meth:`foundations.io.File.clear` method.
625941d5b5575c28eb68e211
def __call__(self, funcion): <NEW_LINE> <INDENT> @functools.wraps(funcion) <NEW_LINE> def wrapper_timer(*args, **kwargs): <NEW_LINE> <INDENT> with self: <NEW_LINE> <INDENT> return funcion(*args, **kwargs) <NEW_LINE> <DEDENT> <DEDENT> return wrapper_timer
Support using Timer as a decorator
625941d5cad5886f8bd271e9
def unzip_files(file_list, force=False): <NEW_LINE> <INDENT> result_list = [] <NEW_LINE> for zip_path in file_list: <NEW_LINE> <INDENT> working_dir = os.path.dirname(zip_path) <NEW_LINE> zip_name = os.path.splitext(os.path.basename(zip_path))[0] <NEW_LINE> new_folder_path = os.path.join(working_dir, zip_name) <NEW_LINE...
Given a list of file paths, unzip them in place. Attempts to skip it if the extracted folder exists. Parameters ---------- file_list : list of str Files to extract. force : bool, default=False Force the unzip if the file exists. Returns ------- List of created outputs.
625941d51b99ca400220acc1
def __init__(self, size=None, bytes=None, usage=None, maxmempool=None, mempoolminfee=None, minrelaytxfee=None): <NEW_LINE> <INDENT> self._size = None <NEW_LINE> self._bytes = None <NEW_LINE> self._usage = None <NEW_LINE> self._maxmempool = None <NEW_LINE> self._mempoolminfee = None <NEW_LINE> self._minrelaytxfee = None...
MemoryPool - a model defined in Swagger
625941d599cbb53fe6792df6
def Ne_Oster_S_cal(SII15, SII30): <NEW_LINE> <INDENT> b = 1.49 <NEW_LINE> c = 3.77 <NEW_LINE> d = 12.8 <NEW_LINE> T=1 <NEW_LINE> if isinstance(SII15, (int, float)) and isinstance(SII30, (int, float)): <NEW_LINE> <INDENT> SII16SII30 = SII15 / SII30 <NEW_LINE> x = (SII16SII30/b-1)/(c-SII16SII30*d/b) <NEW_LINE> Ne = np.na...
Electronic density calculation based on SII16SII30 ratio SII15SII30 = SIIl6716/SIIl6730 ratio ref: 1989Osterbrock_book Parameters ---------- SII15 : float SIIl6716 flux SII30 : float SIIl6730 flux Returns ------- Ne : float Electronic density
625941d5236d856c2ad449ec
def __delete_column(self, column): <NEW_LINE> <INDENT> self.columns -= 1 <NEW_LINE> for row in self.matrix: <NEW_LINE> <INDENT> del row[column]
Deletes a column in the specified index :param column: The column index to delete
625941d5507cdc57c6306eee
def p_assignment_operator(self, p): <NEW_LINE> <INDENT> p[0] = p[1]
assignment_operator : ASSIGN | PLUSASSIGN | MINUSASSIGN | TIMESASSIGN | DIVIDEASSIGN
625941d5187af65679ca532f
@_dispatch.add_dispatch_list <NEW_LINE> @tf_export('math.less', 'less') <NEW_LINE> def less(x, y, name=None): <NEW_LINE> <INDENT> _ctx = _context._context or _context.context() <NEW_LINE> if _ctx is not None and _ctx._thread_local_data.is_eager: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _result = _pywrap_tensorflow....
Returns the truth value of (x < y) element-wise. *NOTE*: `math.less` supports broadcasting. More about broadcasting [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) Args: x: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `int64`, `bfloat...
625941d530bbd722463cbfd7
@app.route('/') <NEW_LINE> def index(): <NEW_LINE> <INDENT> return 'the dash button server is running\n'
For debugging purposes
625941d5eab8aa0e5d26dd69
@app.route('/contacts/delete/<string:username>', methods=['DELETE']) <NEW_LINE> def delete_contact(username: str) -> Response: <NEW_LINE> <INDENT> Contact.query.filter_by(username=username).delete() <NEW_LINE> db.session.commit() <NEW_LINE> return Response(status=200)
API endpoint for contacts/delete/<username>. Deletes existing contact by given username. :return: New contact serialized to JSON
625941d599cbb53fe6792df7
def test_entity_create(self): <NEW_LINE> <INDENT> self.login_client() <NEW_LINE> entity_create_url = reverse('django_ledger:entity-create') <NEW_LINE> response = self.CLIENT.get(entity_create_url, follow=False) <NEW_LINE> if response.status_code == 302: <NEW_LINE> <INDENT> response = self.CLIENT.get(entity_create_url) ...
Testing the creation of a number of entities.
625941d5377c676e912723b8
def delete(self, columns=[]): <NEW_LINE> <INDENT> if self._key: <NEW_LINE> <INDENT> cols = [self._getFieldName(c) for c in columns] <NEW_LINE> self._conn.delete(self._key, cols)
delete object or columns
625941d59f2886367277aa9d
def getContent(url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with closing(get(url, stream=True)) as resp: <NEW_LINE> <INDENT> if is_good_response(resp): <NEW_LINE> <INDENT> return resp.content <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> except RequestException as...
Attempts to get the content at `url` by making an HTTP GET request. If the content-type of response is some kind of HTML/XML, return the text content, otherwise return None.
625941d563b5f9789fde72f5
@tf_export('spectral.ifft2d', 'ifft2d') <NEW_LINE> def ifft2d(input, name=None): <NEW_LINE> <INDENT> _ctx = _context._context <NEW_LINE> if _ctx is None or not _ctx._eager_context.is_eager: <NEW_LINE> <INDENT> _, _, _op = _op_def_lib._apply_op_helper( "IFFT2D", input=input, name=name) <NEW_LINE> _result = _op.outputs[:...
Inverse 2D fast Fourier transform. Computes the inverse 2-dimensional discrete Fourier transform over the inner-most 2 dimensions of `input`. Args: input: A `Tensor` of type `complex64`. A complex64 tensor. name: A name for the operation (optional). Returns: A `Tensor` of type `complex64`.
625941d5ff9c53063f47c403
def walls_to_graph(maze): <NEW_LINE> <INDENT> h, w = maze.shape <NEW_LINE> graph = Graph() <NEW_LINE> nodes_dict = {} <NEW_LINE> for x in range(w): <NEW_LINE> <INDENT> for y in range(h): <NEW_LINE> <INDENT> if maze[y, x] != W: <NEW_LINE> <INDENT> nodes_dict[(x, y)] = graph.add_node((x, y)) <NEW_LINE> <DEDENT> <DEDENT> ...
Transform a maze in a graph. The data on the nodes correspond to their coordinates, data on edges is the actions to take to transition to that edge. Returns: graph -- a Graph nodes_dict -- a dictionary that maps coordinates into nodes e.g. nodes_dict[(3,4)] == node that represents coord x=3,y=4
625941d5099cdd3c635f0e6a
def _delete_prev_iteration(self): <NEW_LINE> <INDENT> assert self.store_all == False, 'Should only be used when store_all=False' <NEW_LINE> self.weights.pop(0) <NEW_LINE> self.weights_diff.pop(0)
Delete weights no longer needed.
625941d5a8370b7717052aaf
def test_teams_id_members_delete(self): <NEW_LINE> <INDENT> pass
Test case for teams_id_members_delete Deletes all members of this model.
625941d59f2886367277aa9c
def __init__(self, parameters, objective, controller, constraints = [], maximize = False, **kwargs): <NEW_LINE> <INDENT> super().__init__(parameters, [objective], controller, constraints) <NEW_LINE> self.maximize = maximize <NEW_LINE> self.beta = kwargs.get('beta',2.0) <NEW_LINE> self.logger.info('Initialized single ob...
Initialize optimizer Arguments --------- parameters : list of parameters List of parameter.Parameter() objects used for optimization objectives : list of observations_list.Observation Objective objects to minimize controller : controller.AWAController Controller object used to control the accelerator ...
625941d5bf627c535bc133df
def edges(graph): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> lstmap = map.valueSet(graph['vertices']) <NEW_LINE> lstresp = lt.newList('SINGLE_LINKED', e.compareedges) <NEW_LINE> for lstedge in lt.iterator(lstmap): <NEW_LINE> <INDENT> for edge in lt.iterator(lstedge): <NEW_LINE> <INDENT> if (graph['directed']): <NEW_L...
Retorna una lista con todos los arcos del grafo graph Args: graph: El grafo sobre el que se ejecuta la operacion Returns: Una lista con los arcos del grafo Raises: Exception
625941d54f88993c3716c277
def build_ThetaZ(self): <NEW_LINE> <INDENT> initTheta_a = 1. <NEW_LINE> initTheta_b = 1. <NEW_LINE> initTheta_qE = None <NEW_LINE> self.init_model.initThetaZ(self.data_opts['samples_groups'], qa=initTheta_a, qb=initTheta_b, qE=initTheta_qE)
Build node ThetaZ for the Spike and Slab prior on the factors
625941d5090684286d50eef7
def is_exist(tld_zone_name): <NEW_LINE> <INDENT> return bool(Zone.zones.filter(name=tld_zone_name).first())
Return `True` if such zone exists, doing query in Zone table.
625941d5e76e3b2f99f3aa19
def set_dashes(self, seq): <NEW_LINE> <INDENT> if seq == (None, None) or len(seq) == 0: <NEW_LINE> <INDENT> self.set_linestyle('-') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.set_linestyle((0, seq))
Set the dash sequence. The dash sequence is a sequence of floats of even length describing the length of dashes and spaces in points. For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point dashes separated by 2 point spaces. Parameters ---------- seq : sequence of floats (on/off ink in points) or (Non...
625941d57d43ff24873a2eb1
def do_forget_me(self, line): <NEW_LINE> <INDENT> self.spotify_queue.put(('forget_me',))
forget_me -- forget the previous logged in user
625941d5099cdd3c635f0e6b
def __init__(self, name, branch, treeStableTimer, builderNames, fileIsImportant=None, properties={}, categories=None, builderDependencies=[], changeDir=".", priorities=[]): <NEW_LINE> <INDENT> Scheduler.__init__(self, name, branch, treeStableTimer, builderNames, fileIsImportant, properties, categories) <NEW_LINE> self....
priorities : list of (branch, priorities) tuples that map branches to priorities (int)
625941d5f8510a7c17cf990d
def test_valid_labels(self): <NEW_LINE> <INDENT> for label in "hello", "hello-world", "hello-world-goodbye", "blah-35": <NEW_LINE> <INDENT> Label(label)
Test that valid labels instantiate as expected.
625941d5442bda511e8be626
def _qfunc_pure(psi, alpha_vec): <NEW_LINE> <INDENT> n = np.prod(psi.shape) <NEW_LINE> nmax = 170 <NEW_LINE> if isinstance(psi, Qobj): <NEW_LINE> <INDENT> psi = psi.full().flatten() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> psi = psi.T <NEW_LINE> <DEDENT> if n < nmax: <NEW_LINE> <INDENT> qvec = abs(polyval(fliplr([...
Calculate the Q-function for a pure state.
625941d58a349b6b435e8384
def from_table(self, table_name): <NEW_LINE> <INDENT> self._table_name = table_name <NEW_LINE> self._primary_key = None <NEW_LINE> self._fields = None <NEW_LINE> self.clear() <NEW_LINE> return self
设置需要处理的表 :param table_name: 待处理的表
625941d5fb3f5b602dac38a5
@blueprint.record_once <NEW_LINE> def init(state): <NEW_LINE> <INDENT> app = state.app <NEW_LINE> registry = app.extensions["invenio-records-resources"].registry <NEW_LINE> ext = app.extensions["invenio-records-marc21"] <NEW_LINE> registry.register(ext.records_service, service_id="marc21-records") <NEW_LINE> registry.r...
Init app.
625941d5435de62698dfde5d
def entropy(self): <NEW_LINE> <INDENT> n = paddle.full( shape=[1], fill_value=self.total_count, dtype=self.probs.dtype) <NEW_LINE> support = paddle.arange( self.total_count + 1, dtype=self.probs.dtype).reshape((-1, ) + ( 1, ) * len(self.probs.shape))[1:] <NEW_LINE> binomial_pmf = paddle.exp(self._binomial_logpmf(n, sup...
entropy of multinomial distribution Returns: Tensor: entropy value
625941d5d99f1b3c44c6779d
@content_type('application/json') <NEW_LINE> def json(content, **kwargs): <NEW_LINE> <INDENT> if hasattr(content, 'read'): <NEW_LINE> <INDENT> return content <NEW_LINE> <DEDENT> if isinstance(content, tuple) and getattr(content, '_fields', None): <NEW_LINE> <INDENT> content = {field: getattr(content, field) for field i...
JSON (Javascript Serialized Object Notation)
625941d567a9b606de4a80c9
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, V1ClairReportList): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941d53c8af77a43ae39b2
def peek(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._container.head.val <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return None
Look at next value in the Deque without removing.
625941d5498bea3a759b9cbf
def getTime( filename, func, *args): <NEW_LINE> <INDENT> os.chdir('/tmp/') <NEW_LINE> f = open(filename, 'a+') <NEW_LINE> starttime = time.time() <NEW_LINE> returnvalue = func( *args ) <NEW_LINE> endtime = time.time() <NEW_LINE> f.write( '{}\n'.format(endtime-starttime) ) <NEW_LINE> return returnvalue
Returns the time to implement the function
625941d5ac7a0e7691ed42da
@curry <NEW_LINE> def apply_spec(spec): <NEW_LINE> <INDENT> def spec_applier(*args): <NEW_LINE> <INDENT> out = clone(spec) <NEW_LINE> for k, v in spec.items(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> v.items() <NEW_LINE> out[k] = apply_spec(v)(*args) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> o...
Given a spec object recursively mapping properties to functions, creates a function producing an object of the same structure, by mapping each property to the result of calling its associated function with the supplied arguments
625941d531939e2706e4d079
def jump(self, A): <NEW_LINE> <INDENT> start, end, max_reach = 0,0,0 <NEW_LINE> count = 0 <NEW_LINE> while max_reach < len(A)-1: <NEW_LINE> <INDENT> for i in range(start,end+1): <NEW_LINE> <INDENT> max_reach = max(max_reach, i+A[i]) <NEW_LINE> <DEDENT> count += 1 <NEW_LINE> start, end = end+1, max_reach <NEW_LINE> <DED...
2 3 1 1 4 * -> | | 人在 A[0] 最远到 A[1],A[2] * * -> | | 人在 A[1] - A[2], 最远可到 A[1+3] * *
625941d5cb5e8a47e48b7cb9
def printWarning(): <NEW_LINE> <INDENT> printColored("Warning", bcolors.YELLOW)
Print a yellow "Warning" :return:
625941d576e4537e8c351884
def create_video_from_frames( sequence_dir: str, output_dir: str, framerate: int, file_prefix: str = None, file_suffix: str = None, ): <NEW_LINE> <INDENT> output_path = os.path.join(output_dir, "output.mp4") <NEW_LINE> logger.info(f"Output path : {output_path}") <NEW_LINE> ffmpeg.input( os.path.join(sequence_dir, f"{fi...
Function converts the sequence of frames into a MPEG-4 video this function is a wrapper for the following ffmpeg command :: ffmpeg -framerate 25 -pattern_type glob -i '*.jpg' -c:v libx264 -preset veryslow -pix_fmt yuv420p -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" out.mp4 Args: ...
625941d5596a897236089ccf
def _get(self, episode_id): <NEW_LINE> <INDENT> if episode_id in self._finished: <NEW_LINE> <INDENT> raise ValueError( "Episode {} has already completed.".format(episode_id)) <NEW_LINE> <DEDENT> if episode_id not in self._episodes: <NEW_LINE> <INDENT> raise ValueError("Episode {} not found.".format(episode_id)) <NEW_LI...
Get a started episode or raise an error.
625941d5bde94217f3683000
def _register_supervisor(self): <NEW_LINE> <INDENT> api_supervisor = APISupervisor() <NEW_LINE> api_supervisor.coresys = self.coresys <NEW_LINE> self.webapp.add_routes([ web.get('/supervisor/ping', api_supervisor.ping), web.get('/supervisor/info', api_supervisor.info), web.get('/supervisor/stats', api_supervisor.stats)...
Register supervisor function.
625941d592d797404e30439b
def delEntry(self, name): <NEW_LINE> <INDENT> indices_to_remove = [] <NEW_LINE> current_long_name_entries = [] <NEW_LINE> logger.debug('directory: del entry: name: %s', name) <NEW_LINE> for i in range(self.num_entries): <NEW_LINE> <INDENT> entry = self[i] <NEW_LINE> if entry.isFree(): <NEW_LINE> <INDENT> continue <NEW_...
remove the entries (including both DIRECTORY_ENTRY and LONG_DIRECTORY_ENTRY) associated with the given name. param name: the short or long name of the item to remove. type name: unicode
625941d566673b3332b922a2
def plusOne(self, digits): <NEW_LINE> <INDENT> i = -1 <NEW_LINE> carry = 0 <NEW_LINE> while i >= -len(digits): <NEW_LINE> <INDENT> if digits[i] == 9: <NEW_LINE> <INDENT> digits[i] = 0 <NEW_LINE> carry = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> digits[i] += 1 <NEW_LINE> carry = 0 <NEW_LINE> break <NEW_LINE> <DEDE...
:type digits: List[int] :rtype: List[int]
625941d53cc13d1c6d3c758a
def run(self): <NEW_LINE> <INDENT> global transactionsList <NEW_LINE> while True : <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> walletsToRead, wlist, xlist = select.select(self.connectedWallets, [], [], 0.05) <NEW_LINE> <DEDENT> except select.error: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>...
Code à exécuter pendant l'exécution du thread.
625941d5167d2b6e31218da6
def __init__(self, id_field=None, name=None, service_path=None): <NEW_LINE> <INDENT> self._id_field = None <NEW_LINE> self._name = None <NEW_LINE> self._service_path = None <NEW_LINE> self.discriminator = None <NEW_LINE> self.id_field = id_field <NEW_LINE> self.name = name <NEW_LINE> self.service_path = service_path
ResourceTypeDescription - a model defined in Swagger
625941d5507cdc57c6306eef
def fit(self, x: pd.DataFrame, y: pd.Series): <NEW_LINE> <INDENT> self.root = C45._split_data(x, y, x.columns)
训练C4.5模型 :param x: pandas.DataFrame 训练特征数据 :param y: pandas.Series 目标数据 :return:
625941d5596a897236089cd0