code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _b2i(byte): <NEW_LINE> <INDENT> return byte if int(sys.version[0]) == 3 else ord(byte)
Converts byte to integer (for Python 2 compatability)
625941d644b2445a339322c4
def _verify_dmi(self, path, version, downgrade=False): <NEW_LINE> <INDENT> dmi_info = self._read_dmi() <NEW_LINE> path_metainfo = os.path.join(path, "firmware.metainfo.xml") <NEW_LINE> tree = ET.parse(path_metainfo) <NEW_LINE> root = tree.getroot() <NEW_LINE> vendor = root.find("developer_name").text <NEW_LINE> if vend...
Verifies DMI tables for BIOS updates. Keywords arguments: path -- absolute path of the updates files version -- version of the update downgrade -- downgrade flag
625941d6091ae3566866718b
def get_test_examples(self): <NEW_LINE> <INDENT> raise NotImplementedError()
Gets a collection of `InputExample`s for prediction.
625941d6ab23a570cc2503b3
def edit_questions(self): <NEW_LINE> <INDENT> return self.go("edit ggov questions")
Click <edit> in the ggov questions component Goes to SCR_0612b
625941d6a8370b7717052ace
def representation(ket0): <NEW_LINE> <INDENT> M,P,Q,R = ket0 <NEW_LINE> nb = M+P+Q+R <NEW_LINE> dim = int((nb+3)*(nb+2)*(nb+1)/6) <NEW_LINE> s, s0 = 0,0 <NEW_LINE> for i in range(0, nb+1): <NEW_LINE> <INDENT> for j in range(0, nb+1-i): <NEW_LINE> <INDENT> for k in range(0, nb+1-i-j): <NEW_LINE> <INDENT> l = nb - k - j ...
Parameters ---------- ket0 : list/np.array Ket |N1, N2, N3, N4> as: "[N1, N2, N3, N4]". Returns ------- psi : np.array Vector representation of the quantum state.
625941d6566aa707497f4796
def end(self): <NEW_LINE> <INDENT> self._dont_watch_anything() <NEW_LINE> self.con_man.end_con(self) <NEW_LINE> self.sock.shutdown(socket.SHUT_RDWR) <NEW_LINE> self.sock.close()
Ends a connection, closing the socket if need be.
625941d6851cf427c661a73d
def cos_signal(freq=440, amp=1.0, offset=0): <NEW_LINE> <INDENT> return Sinusoid(freq, amp, offset, func=np.cos)
Makes a cosine Sinusoid. freq: float frequency in Hz amp: float amplitude, 1.0 is nominal max offset: float phase offset in radians returns: Sinusoid object
625941d6b7558d58953c5141
def test_removecategories_link(self): <NEW_LINE> <INDENT> result = self.app.get('/removeCategories') <NEW_LINE> self.assertEqual(result.status_code, 404)
This method tests the route of the removecategories link
625941d6656771135c3ebaa0
def destroy(self): <NEW_LINE> <INDENT> pass
--- responses: 200: description: OK
625941d68c3a8732951585ec
def setfoundin152(self, what): <NEW_LINE> <INDENT> self._foundin152 = what
This is the docstring.
625941d6287bf620b61d3c92
def t20140515c(): <NEW_LINE> <INDENT> logging.basicConfig(filename="%s/pyctp2_t2014032701.log" % (INFO_PATH,),level=logging.DEBUG,format='%(name)s:%(funcName)s:%(lineno)d:%(asctime)s %(levelname)s %(message)s') <NEW_LINE> return make_users_c([ZSUser1,ZSUser2],[CM_ALL])
当前使用版本
625941d6507cdc57c6306f0e
def DrawLeftArrow(self, pageContainer, dc): <NEW_LINE> <INDENT> pc = pageContainer <NEW_LINE> style = pc.GetParent().GetWindowStyleFlag() <NEW_LINE> if style & FNB_NO_NAV_BUTTONS: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not pc._pagesInfoVec: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if pc._nLeftButtonSta...
Draws the left navigation arrow. :param `pageContainer`: an instance of L{FlatNotebook}; :param `dc`: an instance of `wx.DC`.
625941d6377c676e912723d8
def testStructureViewPandas(self): <NEW_LINE> <INDENT> parm = load_file(get_fn('tip4p.parm7')) <NEW_LINE> parm.load_rst7(get_fn('tip4p.rst7')) <NEW_LINE> df = parm.view[:10,:].to_dataframe() <NEW_LINE> self.assertEqual(df.shape[0], sum(len(res) for res in parm.residues[:10])) <NEW_LINE> for i, r1 in df.iterrows(): <NEW...
Tests creating a pandas DataFrame from a StructureView
625941d67d847024c06be4ee
def constructFromPrePost(self, pre, post): <NEW_LINE> <INDENT> def helper(pre_start, pre_end, post_start, post_end): <NEW_LINE> <INDENT> if pre_start == pre_end: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> root = TreeNode(pre[pre_start]) <NEW_LINE> if post_end == post_start + 1: <NEW_LINE> <INDENT> return root ...
:type pre: List[int] :type post: List[int] :rtype: TreeNode
625941d6d4950a0f3b08c57d
def next_arc(self): <NEW_LINE> <INDENT> raise NotImplementedError
Moves to the next outgoing arc from the previous node.
625941d61b99ca400220ace2
@templatekeyword('tags') <NEW_LINE> def showtags(**args): <NEW_LINE> <INDENT> return shownames('tags', **args)
List of strings. Any tags associated with the changeset.
625941d607d97122c4178abf
def beam_search(self, z_batch, beam_width, max_timestep): <NEW_LINE> <INDENT> sm = nn.LogSoftmax() <NEW_LINE> (batch_size, dim_latent) = z_batch.size() <NEW_LINE> h_batch = z_batch <NEW_LINE> c_batch = torch.zeros((batch_size, dim_latent), device=self.device) <NEW_LINE> completed_hypothesis = [] <NEW_LINE> for h, c in ...
@param z: tensor of size (batch_size, dim_latent) @param beam_width: search beam width @returns completed_hypothesis: List of size (batch_size, beam_width, max_timestep)
625941d6167d2b6e31218dc5
def create_instrument(self): <NEW_LINE> <INDENT> self._n = ci.CreateInstrument(self)
create a new sample, ask the name with a dialog.
625941d6004d5f362079a562
def __init__(self, bc=None, fpdtype=None): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> from numpy import empty <NEW_LINE> from .conf import env <NEW_LINE> if fpdtype == None: <NEW_LINE> <INDENT> if bc == None: <NEW_LINE> <INDENT> self.fpdtype = env.fpdtype <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.fpdtyp...
Initialize object with empty values or from another BC object. @param bc: Another BC object. @type bc: solvcon.boundcond.BC
625941d6ac7a0e7691ed42f9
def initialise_run_params(create_files): <NEW_LINE> <INDENT> start = datetime.now() <NEW_LINE> trackers.time_list.append(time()) <NEW_LINE> if params['RANDOM_SEED'] is None: <NEW_LINE> <INDENT> params['RANDOM_SEED'] = int(start.microsecond) <NEW_LINE> <DEDENT> seed(params['RANDOM_SEED']) <NEW_LINE> hms = "%02d%02d%02d"...
Initialises all lists and trackers. Generates save folders and initial parameter files if debugging is not active. :return: Nothing
625941d61f037a2d8b94642e
@api_view(["GET"]) <NEW_LINE> @permission_classes((IsAuthenticated,)) <NEW_LINE> def get_list_group_can_read_workspace(request, pk): <NEW_LINE> <INDENT> return _list_of_users_or_groups_to_response( pk, workspace_api.get_list_group_can_read_workspace, request.user, GroupSerializer, )
Get list of groups that have read access to workspace Args: request: HTTP request Returns: - code: 200 content: list of group - code: 403 content: Authentication error - code: 404 content: Object was not found - code: 500 content: Internal server error
625941d630bbd722463cbff7
def impute_missing_values(self, data): <NEW_LINE> <INDENT> self.logger_object.log(self.file_object, 'Entered the impute_missing_values method of the Preprocessor class') <NEW_LINE> self.data= data <NEW_LINE> try: <NEW_LINE> <INDENT> imputer=KNNImputer(n_neighbors=3, weights='uniform',missing_values=np.nan) <NEW_LINE> s...
Method Name: impute_missing_values Description: This method replaces all the missing values in the Dataframe using KNN Imputer. Output: A Dataframe which has all the missing values imputed. On Failure: Raise Exception Version: 1.0 Revisions: None
625941d685dfad0860c3b08b
def deviation_position(data,data_of_one_sat): <NEW_LINE> <INDENT> new_coord = copy.deepcopy(data_of_one_sat) <NEW_LINE> lign15 = organiser_ligne(data[14]) <NEW_LINE> number = float(lign15[1]) <NEW_LINE> for k in range(len(data_of_one_sat)): <NEW_LINE> <INDENT> if len(data_of_one_sat[k])>=9: <NEW_LINE> <INDENT> new_coor...
Cette fonction remplace les exposants des déviations de la position par les valeurs de déviations en millimètres. Parameters ---------- data : TYPE list of str DESCRIPTION. fichier brute d'ephemerides' data_of_one_sat : TYPE list of lists DESCRIPTION. list des positions, correction horloge, exposants deviation...
625941d697e22403b379d1cb
def addBinary(a, b): <NEW_LINE> <INDENT> return addBinaryHelper(a, b, 0)
:type a: str :type b: str :rtype: str
625941d67b25080760e39688
def add_cast(self, desired_type: Type[T_DESIRED], actual_type: Type[T_ACTUAL], conversion: Callable[[T_ACTUAL], Optional[T_DESIRED]], also_add_inherited_conversions: bool = True, overwrite_existing: bool = False) -> None: <NEW_LINE> <INDENT> self.add_recursive_cast( desired_type, actual_type, lambda _, v: conversion(v)...
Adds a way to turn one type of thing into another. Args: desired_type: The type that the casting caller wants. actual_type: The type of the value that the casting caller has. conversion: A function that takes the value the casting caller has, and returns a value that is an instance of the type the ...
625941d6baa26c4b54cb134e
def append(self, item): <NEW_LINE> <INDENT> self._data[self._head] = item <NEW_LINE> self._head += 1
Add item to fifo.
625941d67d43ff24873a2ed0
def test_not_set_auth_type(self): <NEW_LINE> <INDENT> token = factory_token(user=self.user) <NEW_LINE> header = {'HTTP_AUTHORIZATION': token.token} <NEW_LINE> res = self.client.post(COMBI_CREATE_URL, json.dumps({ 'name': 'ブラックマヨネーズ', 'office': '吉本興業', }), content_type='application/json', **header) <NEW_LINE> self.asser...
認証タイプを含めずコンビ作成
625941d67d43ff24873a2ed1
def __init__(self, objective): <NEW_LINE> <INDENT> super(MPEnv, self).__init__() <NEW_LINE> self.obj = objective <NEW_LINE> self.environment = self.obj.environment <NEW_LINE> self.at_space_dim = self.obj.opt_num * 2 <NEW_LINE> self.action_space = spaces.Box(low=-10, high=10, shape=(self.at_space_dim,), dtype=np.float32...
Args: objective: Objective object that the reinforcement learning framework is based on
625941d6a79ad161976cc376
def add_notification_topic(self, topic: str): <NEW_LINE> <INDENT> self.notification_topics.append(topic)
Announce that the plugin will emit notifications for the topic.
625941d67b25080760e39689
def make_hone_cache_wrapper(inner_func, maxsize, maxage, finder, store_partials): <NEW_LINE> <INDENT> hits = misses = partials = 0 <NEW_LINE> cache = TTLMapping(maxsize, maxage) <NEW_LINE> def wrapper(*args): <NEW_LINE> <INDENT> nonlocal hits, misses, partials <NEW_LINE> radix = args[-1] <NEW_LINE> try: <NEW_LINE> <IND...
Keeps a cache of requests we've already made and use that for generating results if possible. If the user asked for a root prior to this call we can use it to skip a new lookup using `finder`. A top-level lookup will effectively serves as a global cache.
625941d60383005118ecf812
def synchronize_unknown_block(self, peer, block_hash, force=False): <NEW_LINE> <INDENT> log.debug('sync unknown', peer=peer, block=encode_hex(block_hash)) <NEW_LINE> if block_hash == self.chain_manager.genesis.hash or block_hash in self.chain_manager: <NEW_LINE> <INDENT> log.debug('known_hash, skipping', peer=peer, has...
Case: block with unknown parent. Fetches unknown ancestors and this block
625941d6cad5886f8bd27209
def add_all(tap_stream_id): <NEW_LINE> <INDENT> return tap_stream_id.split('-')[0] + '_all'
Adds all to the generic term e.g. groups_all for groups
625941d601c39578d7e7506c
def test_provide_machine1(self): <NEW_LINE> <INDENT> title=self.dd.title() <NEW_LINE> warehouse=self.dd.warehouse() <NEW_LINE> shebei=self.dd.goodsname_zhongduanji() <NEW_LINE> modle=self.dd.modle() <NEW_LINE> remake = self.dd.Remarks() <NEW_LINE> reason=self.dd.reason() <NEW_LINE> money=self.dd.Money() <NEW_LINE> self...
资源发放,暂存终端机
625941d63617ad0b5ed68126
def save(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> tmpfile_path = self.path(self.SAVE_FILE + '.tmp') <NEW_LINE> with open(tmpfile_path, 'wb') as tmpfile: <NEW_LINE> <INDENT> pickle.dump(self, tmpfile) <NEW_LINE> <DEDENT> shutil.move(tmpfile_path, self.path(self.SAVE_FILE)) <NEW_LINE> return True <NEW_LINE> <D...
Saves the job to disk as a pickle file Suppresses errors, but returns False if something goes wrong
625941d6004d5f362079a563
@app.route('/entities/<_id>/attrs/<_attr>', methods=['DELETE']) <NEW_LINE> def entityAttrDelete(_id,_attr): <NEW_LINE> <INDENT> accepted, content_type = hiascdi.process_headers(request) <NEW_LINE> if accepted is False: <NEW_LINE> <INDENT> return hiascdi.respond( 406, hiascdi.confs["errorMessages"][str(406)], "applicati...
Responds to DELETE requests sent to the /v1/entities/<_id>/attrs/<_attr> API endpoint.
625941d6e1aae11d1e749ee9
def inv_radius_intersection(self, temperature_list, window_width, std_low_limit, r_maj): <NEW_LINE> <INDENT> temperature_list = np.transpose(temperature_list) <NEW_LINE> mean = sum(temperature_list[0]) / len(temperature_list[0]) <NEW_LINE> area = int((len(temperature_list[0]) - (len(temperature_list[0]) % window_width)...
----------------------------------------- version: 0.2.1 desc: define if list of nums increase or decrease :param temperature_list: 2d array of nums normalised on 1 :param std_low_limit: float val to skip flat regions :param window_width: int val of len by which make plane indicating :return mai...
625941d6c4546d3d9de72c65
def status_text(self): <NEW_LINE> <INDENT> bstr_status_text = c_void_p() <NEW_LINE> _WinHttpRequest._StatusText(self, byref(bstr_status_text)) <NEW_LINE> bstr_status_text = ctypes.cast(bstr_status_text, c_wchar_p) <NEW_LINE> status_text = bstr_status_text.value <NEW_LINE> _SysFreeString(bstr_status_text) <NEW_LINE> ret...
Gets status text of response.
625941d6a934411ee37518c4
def load_config(self) -> Dict[str, Any]: <NEW_LINE> <INDENT> config: Dict[str, Any] = {} <NEW_LINE> for path in self.args.config: <NEW_LINE> <INDENT> logger.info('Using config: %s ...', path) <NEW_LINE> config = deep_merge_dicts(self._load_config_file(path),config) <NEW_LINE> <DEDENT> if 'internals' not in config: <NEW...
Extract information for sys.argv and load the bot configuration :return: Configuration dictionary
625941d630bbd722463cbff8
def __build_torrent(self, all_rows): <NEW_LINE> <INDENT> all_torrents = [] <NEW_LINE> for row in all_rows: <NEW_LINE> <INDENT> cols = row.findAll('td') <NEW_LINE> cat_col = cols[0].findAll('a') <NEW_LINE> [category, sub_category] = [c.string for c in cat_col] <NEW_LINE> links = cols[1].findAll('a') <NEW_LINE> title = l...
Builds and returns a list of Torrent objects from the passed source.
625941d64f88993c3716c296
def test_ignore_unknown_volumes(self): <NEW_LINE> <INDENT> unit = Unit(name=u'site-example.com', container_name=u'site-example.com', container_image=u"clusterhq/wordpress:latest", volumes=frozenset( [DockerVolume( node_path=FilePath(b"/some/random/path"), container_path=FilePath(b'/var/lib/data') )], ), activation_stat...
Docker volumes that cannot be matched to a dataset are ignored.
625941d6627d3e7fe0d69081
def p_for_loop(p): <NEW_LINE> <INDENT> pass
FORLOOP : FOR ID '=' INTNUM ':' INTNUM '{' INSTR_BLOCK '}' | FOR ID '=' INTNUM ':' ID '{' INSTR_BLOCK '}' | FOR ID '=' ID ':' INTNUM '{' INSTR_BLOCK '}' | FOR ID '=' ID ':' ID '{' INSTR_BLOCK '}'
625941d64e696a04525c967c
def reverse(self, x): <NEW_LINE> <INDENT> if not -2 ** 31 <= x <= 2 ** 31 - 1: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> s = str(x) <NEW_LINE> if s[0] not in "0123456789": <NEW_LINE> <INDENT> r = int(s[0] + "".join(reversed(s[1:]))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> r = int("".join(reversed(s))) <NEW...
:type x: int :rtype: int
625941d6b5575c28eb68e232
def _get_host_attributes(self, host_id, atype_id): <NEW_LINE> <INDENT> atts = DBSession.query(Attribute).filter(and_( Attribute.host_id == host_id, Attribute.attribute_type_id == atype_id)) <NEW_LINE> if atts is None: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> return {att.index: att for att in atts}
Return a list of Attributes for the given hosts for a given AttributeType
625941d6e5267d203edcdecb
def set_parameters(d, w, b, alpha, beta, net): <NEW_LINE> <INDENT> w = w.reshape(10*d,d) <NEW_LINE> b = b.reshape(10*d,) <NEW_LINE> alpha = alpha.reshape(1,10*d) <NEW_LINE> beta = beta.reshape(1,) <NEW_LINE> set_w = False; set_b = False; set_alpha = False; set_beta = False <NEW_LINE> print(net) <NEW_LINE> for p in net....
This function assigns parameters in the network based on matching shape
625941d6f8510a7c17cf992d
def render(self, aa=True): <NEW_LINE> <INDENT> if aa: <NEW_LINE> <INDENT> scale = 4 <NEW_LINE> L = self.L * scale <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> scale = 1 <NEW_LINE> L = self.L <NEW_LINE> <DEDENT> gridsize = self.gridsize * scale <NEW_LINE> mat = np.zeros((L, L, 3)) <NEW_LINE> l = self.L <NEW_LINE> for o...
Renders the environment, returns a rasterized image as a numpy array.
625941d61f5feb6acb0c4d7e
def test_pw_too_short(self): <NEW_LINE> <INDENT> payload = { 'email': 'test@email.com', 'password': 'test', 'name': 'Test name' } <NEW_LINE> response = self.client.post(CREATE_USER_URL, payload) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) <NEW_LINE> user_exists = get_user_model().obje...
pw must more than 5 characters
625941d64527f215b584c685
def test_bad_content_type(self): <NEW_LINE> <INDENT> session = MockPublisherSession(self) <NEW_LINE> resource = PublisherResource({}, session) <NEW_LINE> with LogCapturer("debug") as l: <NEW_LINE> <INDENT> request = self.successResultOf(renderResource( resource, b"/", method=b"POST", headers={b"Content-Type": [b"applic...
An incorrect content type will mean the request is rejected.
625941d6507cdc57c6306f0f
def __repr__(self): <NEW_LINE> <INDENT> return '"{sdsd}"'.format(self.name)
Print the reprenstation this intance.
625941d6442bda511e8be646
def update_group_mapping_settings_with_http_info(self, json_body, **kwargs): <NEW_LINE> <INDENT> all_params = ['json_body'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <IND...
Update the LDAP group to Graylog role mapping Corresponds directly to the output of GET /system/ldap/settings/groups This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(re...
625941d65fdd1c0f98dc0464
def _add_timing_to_mod(mod): <NEW_LINE> <INDENT> if "UW_ENABLE_TIMING" not in _os.environ: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> import inspect <NEW_LINE> moddir = _os.path.dirname(inspect.getfile(mod)) <NEW_LINE> lendir = len(moddir) <NEW_LINE> mods = [] <NEW_LINE> for guy in dir(mod): <NEW_LINE> <INDENT> obj...
This function walks the provided module, seeking out classes to replace via the _class_timer_decorator.
625941d6be7bc26dc91cd82e
def post(self,request): <NEW_LINE> <INDENT> nid = request.GET.get('id', "") <NEW_LINE> print(nid) <NEW_LINE> obj = CreateIdcForm(request.POST) <NEW_LINE> if obj.is_valid(): <NEW_LINE> <INDENT> virIP = obj.cleaned_data.get('virIP') <NEW_LINE> physicalIP = obj.cleaned_data.get('physicalIP') <NEW_LINE> application = obj.c...
更新业务数据
625941d68a43f66fc4b54294
@APP.route("/admin/userpermission/change", methods=['POST']) <NEW_LINE> def admin_userpermission_change(): <NEW_LINE> <INDENT> admin_info = request.get_json() <NEW_LINE> other.admin_userpermission_change(admin_info['token'], int(admin_info['u_id']), int(admin_info['permission_id'])) <NEW_LINE> return dumps({})
POST HTTP method for admin_userpermission_change.
625941d6fbf16365ca6f63f6
def maxCoins(self, nums): <NEW_LINE> <INDENT> n = len(nums) <NEW_LINE> nums = [1] + nums + [1] <NEW_LINE> dp = [[0 for _ in range(n+2)] for _ in range(n+2)] <NEW_LINE> for i in range(1, n+1): <NEW_LINE> <INDENT> dp[i][i] = nums[i-1] * nums[i] * nums[i+1] <NEW_LINE> <DEDENT> for i in range(1, n): <NEW_LINE> <INDENT> for...
:type nums: List[int] :rtype: int
625941d6b7558d58953c5142
def stumpify_axon(self, count=10): <NEW_LINE> <INDENT> axon_root = None <NEW_LINE> for seg in self.node_list: <NEW_LINE> <INDENT> if seg.t == Morphology.AXON: <NEW_LINE> <INDENT> par_id = seg.parent <NEW_LINE> if par_id >= 0: <NEW_LINE> <INDENT> par = self.node_list[par_id] <NEW_LINE> if par.t != Morphology.AXON: <NEW_...
Remove all axon nodes except the first 'count' nodes, as counted from the connected axon root. Parameters ---------- count: Integer The length of the axon 'stump', in number of nodes
625941d6d53ae8145f87a49e
def extract_objective_measure(R, portfolio, **kwargs): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> import pandas as pd <NEW_LINE> import math as math <NEW_LINE> import random <NEW_LINE> if not (portfolio.weights == None): <NEW_LINE> <INDENT> w = portfolio.weights <NEW_LINE> <DEDENT> elif (portfolio.weights == Non...
Function to extract objective measures of optimal weights. Parameters ---------- R : pd.DataFrame, dataframe of returns of assets in portfolio portfolio : portfolio_spec, an object of class portfolio_spec. kwargs : additional arguments, optional any additional argument to be passed. Returns ------- dict...
625941d6377c676e912723d9
def collect(self): <NEW_LINE> <INDENT> cpu_info = psutil.cpu_times_percent() <NEW_LINE> target_info = { "user":cpu_info.user, "nice":cpu_info.nice, "system":cpu_info.system, "idle":cpu_info.idle, "iowait":cpu_info.iowait, "irq":cpu_info.irq, "softirq":cpu_info.softirq, "steal":cpu_info.steal, "guest":cpu_info.guest, "g...
收集CPU使用率方法 参数: 无 返回: CPU使用率dict
625941d68e71fb1e9831d9d9
@APP.post('/_supprimerdossier/<nom>/<element:path>') <NEW_LINE> @b.auth_basic(a.editeur, _('Réservé aux éditeurs')) <NEW_LINE> @page <NEW_LINE> def dossier_supprimer(nom, element=False): <NEW_LINE> <INDENT> if not element: <NEW_LINE> <INDENT> b.abort(404) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if rq.forms.action...
Suppression effective du dossier
625941d65166f23b2e1a5389
def display_txt(self): <NEW_LINE> <INDENT> shape = self._shape <NEW_LINE> nrows, ncols = shape <NEW_LINE> charr = np.full(shape, '.', dtype=str) <NEW_LINE> charr[self._nzrows, self._nzcols] = 'x' <NEW_LINE> if self._fwd: <NEW_LINE> <INDENT> full_rows = np.arange(nrows, dtype=INT_DTYPE) <NEW_LINE> col2row = self._fwd[1]...
Print the structure of a boolean array with coloring info for each nonzero value. Forward mode colored nonzeros are denoted by 'f', reverse mode nonzeros by 'r', overlapping nonzeros by 'O' and uncolored nonzeros by 'x'. Zeros are denoted by '.'. Note that x's and O's should never appear unless there is a bug in the ...
625941d66fece00bbac2d971
def time_stamp(self): <NEW_LINE> <INDENT> return(str(datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")))
Return timestamp (UTC) YYYY-mm-ddTHH:MM:SS.
625941d6be383301e01b56b4
def on_deploy_completed(self): <NEW_LINE> <INDENT> pass
Hook that is executed just before completing deployment
625941d623849d37ff7b32bf
def handle(self, msg): <NEW_LINE> <INDENT> self.log('<< %s' % (msg.raw)) <NEW_LINE> SpaghettiHandler(self, msg)
Handles Messages
625941d691af0d3eaac9bc4b
def maximize_r(data, r, norm=None): <NEW_LINE> <INDENT> rd = rderivs() <NEW_LINE> (rmax, maxpow) = max_r_arr(data, r, rd) <NEW_LINE> maxpow = maxpow / rd.locpow if norm is None else maxpow / norm <NEW_LINE> return [maxpow, rmax, rd]
maximize_r(data, r, norm = None): Optimize the detection of a signal at Fourier frequency 'r' in a FFT 'data'. The routine returns a list containing the optimized values of the maximum normalized power, rmax, and an rderivs structure for the peak.
625941d65fcc89381b1e18f2
def _compareIgnoreVersion(self, loc1, loc2, msg=None): <NEW_LINE> <INDENT> if loc1.for_branch(None) != loc2.for_branch(None): <NEW_LINE> <INDENT> self.fail(self._formatMessage(msg, u"{} != {}".format(unicode(loc1), unicode(loc2))))
AssertEqual replacement for CourseLocator
625941d6fff4ab517eb2f66d
def test_keystone_v3_endpoint_in_clients_keystone_config(self): <NEW_LINE> <INDENT> cfg.CONF.set_override('auth_uri', 'http://xyz', group='clients_keystone') <NEW_LINE> importutils.import_module('keystonemiddleware.auth_token') <NEW_LINE> cfg.CONF.set_override('auth_uri', 'http://abc/v2.0', group='keystone_authtoken') ...
Ensure that the [clients_keystone] section is the preferred source. Ensure that the [clients_keystone] section of the configuration is the preferred source when the context does not have the auth_uri.
625941d699fddb7c1c9de5c2
def camelcase_to_underscore(string): <NEW_LINE> <INDENT> s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', string) <NEW_LINE> return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
Used to rename columns like MatchId -> match_id :param string: CamelCase string :return: _underscore string
625941d6091ae3566866718c
def min_dist_neighbor(ch1: mp.Chain, ch2: mp.Chain, dist: int=3) -> list: <NEW_LINE> <INDENT> min_dist, min_dist_res = 10000, None <NEW_LINE> for r1 in ch1.values(): <NEW_LINE> <INDENT> for r2 in ch2.values(): <NEW_LINE> <INDENT> temp_min = r1.min_distance_res(r2) <NEW_LINE> if temp_min < min_dist: <NEW_LINE> <INDENT> ...
:type ch1: Chain :type ch2: Chain :param ch1: chain of interest :param ch2: other chain in possible interface :param dist: number of neigbors from each side to find :return: a list of Residue instances from ch1 that are close to ch2
625941d6a4f1c619b28b0267
def revert(self, language): <NEW_LINE> <INDENT> if not self.publisher_is_draft: <NEW_LINE> <INDENT> raise PublicIsUnmodifiable('The public instance cannot be reverted. Use draft.') <NEW_LINE> <DEDENT> if not self.publisher_public: <NEW_LINE> <INDENT> raise PublicVersionNeeded('A public version of this page is needed') ...
Revert the draft version to the same state as the public version
625941d676d4e153a657ed63
def forward(self, trans_output, pred_output): <NEW_LINE> <INDENT> if self.dropout is not None: <NEW_LINE> <INDENT> trans_input = self.dropout(trans_output) <NEW_LINE> pred_input = self.dropout(pred_output) <NEW_LINE> <DEDENT> trans_project = self.trans_project_nn(trans_input) <NEW_LINE> pred_project = self.pred_project...
args: trans_output: float32 2D Tensor with shape [batch, trans_size], values are the outputs of the trancription network. pred_output: float 32 2D Tensor with shape [batch, pred_size], values are the outputs of the prediction network. return: (trans_project, pred_project): tuple each is a float32 2...
625941d6b57a9660fec33ab8
def isWorse(a, b): <NEW_LINE> <INDENT> if(a<b): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
¿Is Worse? Regresa si a es peor que b.
625941d6fbf16365ca6f63f7
def __init__( self, prop: Optional[int] = None) -> None: <NEW_LINE> <INDENT> self.prop = prop
Initializes with the given values.
625941d6aad79263cf390c75
def warning(*objs): <NEW_LINE> <INDENT> print("WARNING:", *objs, file=sys.stderr)
Print a warning message to stderr, prefixed with 'WARNING'
625941d6a219f33f34628b98
def testSequenceDisplay(self): <NEW_LINE> <INDENT> li = random.randint(10,25) <NEW_LINE> im = imageMb(displayer=self.testDisp) <NEW_LINE> seq = sequenceMb(im, li, displayer=self.testDisp) <NEW_LINE> seq.showAllImages() <NEW_LINE> self.assertTrue(self.testDisp.getStatsOnFun("addWindow")==li) <NEW_LINE> self.assertTrue(s...
Verifies sequence display front-end method
625941d67cff6e4e81117bb6
@pytest.mark.skipif(ping_response != 0, reason="cannot ping CPPM") <NEW_LINE> def test_exp_days_f(): <NEW_LINE> <INDENT> user = 'test_pass_expiry' <NEW_LINE> exp_days_tuple = exp_days_f(connect_class, user) <NEW_LINE> assert exp_days_tuple[0] <= int(connect_class.days_to_passw_exp) <NEW_LINE> assert exp_days_tuple[1] i...
Testing expiration password function from main app file
625941d691af0d3eaac9bc4c
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gallary.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are you sure...
Run administrative tasks.
625941d6d6c5a1020814427d
def create_append_blob_service(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> from azure.storage.blob.appendblobservice import AppendBlobService <NEW_LINE> return AppendBlobService(self.account_name, self.account_key, sas_token=self.sas_token, is_emulated=self.is_emulated) <NEW_LINE> <DEDENT> except ImportError: <...
Creates a AppendBlobService object with the settings specified in the CloudStorageAccount. :return: A service object. :rtype: :class:`~azure.storage.blob.appendblobservice.AppendBlobService`
625941d6d268445f265b509f
def __init__(self, skip, reason): <NEW_LINE> <INDENT> self.skip = skip <NEW_LINE> self.reason = reason
:param skip: if True the method wont be called :param reason: reason why test was skipped
625941d67cff6e4e81117bb7
def abort_dag_on(self, job_name, exit_value, retcode=''): <NEW_LINE> <INDENT> self.abort_conditions.append({'job_name': job_name, 'exit_value': exit_value, 'retcode': retcode})
Abort the entire dag, removing all jobs, if a job returns the specified value Args: job_name (string): Name of the job exit_value (string): Value to abort on retcode (string, optional): Return code when aborting
625941d63539df3088e2e57c
def start(self): <NEW_LINE> <INDENT> if self.mode != 0: <NEW_LINE> <INDENT> raise Exception("Camera is not ready to start new acquisition") <NEW_LINE> <DEDENT> self._assertParamAvailable(LIB.PARAM_CIRC_BUFFER) <NEW_LINE> exposure = self.getParam('exposure') <NEW_LINE> exp = self._parseExposure(exposure) <NEW_LINE> expM...
Start continuous frame acquisition. Return a buffer into which frames will be written as they are acquired. Use lastFrame() to detect the arrival of new frames.
625941d673bcbd0ca4b2c2a7
def check_pose(hin): <NEW_LINE> <INDENT> x = hin[0,3] <NEW_LINE> y = hin[1,3] <NEW_LINE> z = hin[2,3] <NEW_LINE> if x < XYZ_MIN[0] or x > XYZ_MAX[0] or y < XYZ_MIN[1] or y > XYZ_MAX[1] or z < XYZ_MIN[2] or z > XYZ_MAX[2]: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif x*x + y*y < R_MIN*R_MIN and z < R_MIN_Z:...
Returns true if the pose is within the accepted limits.
625941d6d7e4931a7ee9e14f
def map_and_filter(s, map_fn, filter_fn): <NEW_LINE> <INDENT> return [map_fn(s[i]) for i in range(len(s)) if filter_fn(s[i])]
Returns a new list containing the results of calling map_fn on each element of sequence s for which filter_fn returns a true value. >>> square = lambda x: x * x >>> is_odd = lambda x: x % 2 == 1 >>> map_and_filter([1, 2, 3, 4, 5], square, is_odd) [1, 9, 25]
625941d6b830903b967e9b3b
def loss(self, X, y=None, reg=0.0): <NEW_LINE> <INDENT> W1, b1 = self.params['W1'], self.params['b1'] <NEW_LINE> W2, b2 = self.params['W2'], self.params['b2'] <NEW_LINE> N, D = X.shape <NEW_LINE> scores = None <NEW_LINE> h1 = np.maximum(0, np.dot(X, W1) + b1) <NEW_LINE> h2 = np.dot(h1, W2) + b2 <NEW_LINE> scores = h2 <...
Compute the loss and gradients for a two layer fully connected neural network. Inputs: - X: Input data of shape (N, D). Each X[i] is a training sample. - y: Vector of training labels. y[i] is the label for X[i], and each y[i] is an integer in the range 0 <= y[i] < C. This parameter is optional; if it is not passed...
625941d6cad5886f8bd2720a
def callLoopStartAndLoopEndOnNotRecordedMethodCall(self, p1): <NEW_LINE> <INDENT> b = ClassLoopTagOnMethodNotInRecordFlow() <NEW_LINE> b.doLoopStartAndLoopEndOnNotRecordedMethodCall(p1)
Entry method of our sequence diagram.
625941d60383005118ecf813
def stop_episode(self, observation, reward, done=False): <NEW_LINE> <INDENT> if self.mode == AgentMode.Training: <NEW_LINE> <INDENT> self._agent.stop_episode_and_train(observation, reward, done) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._agent.stop_episode()
Stops an episode. Args: observation -- the final observation reward -- the final reward Keyword Args: done -- whether the episode is complete as of this method being called [False]
625941d621bff66bcd684b82
def maximumProduct(self, nums): <NEW_LINE> <INDENT> k = sorted(nums) <NEW_LINE> return max(k[-1]*k[-2]*k[-3], k[0]*k[1]*k[-1])
:type nums: List[int] :rtype: int
625941d6d268445f265b50a0
def import_tdx_stock(path, ld): <NEW_LINE> <INDENT> from datetime import datetime, timedelta <NEW_LINE> from quantdigger.util import ProgressBar <NEW_LINE> for path, dirs, files in os.walk(path): <NEW_LINE> <INDENT> progressbar = ProgressBar(total=len(files)) <NEW_LINE> for file_ in files: <NEW_LINE> <INDENT> filepath ...
导入通达信的股票数据 Args: path (str): 数据文件夹 ld (LocalData): 本地数据库对象
625941d66fece00bbac2d972
def _generate_examples(self, filepath): <NEW_LINE> <INDENT> with open(filepath) as f: <NEW_LINE> <INDENT> data = json.load(f) <NEW_LINE> for example in data["data"]: <NEW_LINE> <INDENT> for paragraph in example["paragraphs"]: <NEW_LINE> <INDENT> context = paragraph["context"].strip() <NEW_LINE> for qa in paragraph["qas...
Yields examples.
625941d666656f66f7cbc3dd
def setEdges(self, nodePairs=None): <NEW_LINE> <INDENT> nodePairs = self._optimNodePairs() if nodePairs is None else nodePairs <NEW_LINE> for i, pair in enumerate(nodePairs): <NEW_LINE> <INDENT> self.tree.add_edge(pair[0], pair[1], weight=pair[2], pc= pc.PairCopula(self.tree.nod...
! @brief Sets the node to node connections in the tree. @param nodePairs <b>list</b> List of len 3 <b>tuples</b>: [(dataLabel_1, dataLabel_2, kTau), ...]
625941d6be8e80087fb20e72
def __init__(self, algName): <NEW_LINE> <INDENT> super(DrillParameterController, self).__init__() <NEW_LINE> self.daemon = True <NEW_LINE> self._signals = DrillControllerSignals() <NEW_LINE> self._paramQueue = queue.Queue() <NEW_LINE> self._alg = sapi.AlgorithmManager.createUnmanaged(algName) <NEW_LINE> self._alg.initi...
Create a controller for a specific algorithm. Args: algName (str): algorithm name
625941d6a17c0f6771cbe282
def get_pos_y(self): <NEW_LINE> <INDENT> pass
Return y position. :return: :rtype: float, int
625941d685dfad0860c3b08d
@flask_app.route("/latest_software_version", methods=["POST"]) <NEW_LINE> def set_latest_software_version() -> Response: <NEW_LINE> <INDENT> if not _get_values_from_process_monitor()["beta_2_mode"]: <NEW_LINE> <INDENT> return Response(status="403 Route cannot be called in beta 1 mode") <NEW_LINE> <DEDENT> try: <NEW_LIN...
Set the latest available software version.
625941d6a79ad161976cc378
def _indent(self, text): <NEW_LINE> <INDENT> if not text.startswith("\n"): <NEW_LINE> <INDENT> text = "\n" + text <NEW_LINE> <DEDENT> return text.replace('\n', '\n' + self.formatdict['indent'])
Indent blocks for formats where indent is significant
625941d6baa26c4b54cb1350
def __init__(self, action_fn=None, numTraining=100, epsilon=0.5, alpha=0.5, gamma=1): <NEW_LINE> <INDENT> super(ReinforcementAgent, self).__init__(alpha, epsilon, gamma, numTraining) <NEW_LINE> if action_fn is None: <NEW_LINE> <INDENT> action_fn = lambda state: state.getLegalActions() <NEW_LINE> <DEDENT> self.actionFn ...
actionFn: Function which takes a state and returns the list of legal actions alpha - learning rate epsilon - exploration rate gamma - discount factor numTraining - number of training episodes, i.e. no learning after these many episodes
625941d6be8e80087fb20e73
def index(request): <NEW_LINE> <INDENT> if request.method != 'GET': <NEW_LINE> <INDENT> return HttpResponseNotAllowed(['GET']) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> user = ReportsUser.objects.get(user=request.user) <NEW_LINE> <DEDENT> except ReportsUser.DoesNotExist: <NEW_LINE> <INDENT> user = ReportsUser(user=r...
Handle index page. Create internal user if it doesn't exist. Expose UI functions for reporting, oauth, updating.
625941d63617ad0b5ed68128
def numpy_resize_insert(arr, val, index, growth_factor=1.5, min_growth=1000, max_growth=1000000): <NEW_LINE> <INDENT> if index < arr.size: <NEW_LINE> <INDENT> arr[index] = val <NEW_LINE> return arr <NEW_LINE> <DEDENT> required_growth = (index - arr.size) + 1 <NEW_LINE> factor_growth = int(arr.size * growth_factor) <NEW...
Append a value to a 1D numpy array. Resize dynamically if required. Returns the new array (which may be the same as the old array). No resize is performed if the array is already large enough Supports non-continous insertion of values (i.e. index must not grow monotonically). After finishing to call numpy_resize_inse...
625941d69c8ee82313fbb9a8
def __str__(self): <NEW_LINE> <INDENT> return str(self.data)
for printing Node data
625941d6c4546d3d9de72c67
def path_tree(self): <NEW_LINE> <INDENT> return self.__file_db.get_files_according_to_path_list(self.__path_db.path_tree())
返回来自数据库信息的目录树 :return: 返回目录树 :rtype: list
625941d626238365f5f0f0a3
def pc_input_buffers_full(self, *args): <NEW_LINE> <INDENT> return _analog_swig.sig_source_c_sptr_pc_input_buffers_full(self, *args)
pc_input_buffers_full(sig_source_c_sptr self, int which) -> float pc_input_buffers_full(sig_source_c_sptr self) -> pmt_vector_float
625941d62c8b7c6e89b359f2
@task <NEW_LINE> def prepare(c): <NEW_LINE> <INDENT> HOTOSM_HOST = "export.hotosm.org" <NEW_LINE> HOTOSM_PATH = "/downloads/8a430b3a-7b16-4c88-9b36-7da085b4d141/" <NEW_LINE> ZIP_FILE = "austin-tx_shp.zip" <NEW_LINE> SAMPLE_DIR = "sample/input_datasets" <NEW_LINE> OUTPUT_DIR = "osm-austin" <NEW_LINE> CHUNK_SIZE = 8192 <...
Prepare input datasets.
625941d699cbb53fe6792e19
def main(): <NEW_LINE> <INDENT> member_num_str = check_arg(sys.argv) <NEW_LINE> member_num_str = keyaki_member.check_member_number(member_num_str) <NEW_LINE> url = "http://www.keyakizaka46.com/s/k46o/diary/member/list?ima=0000&ct=" + member_num_str <NEW_LINE> html = urllib.request.urlopen(url) <NEW_LINE> soup = Beautif...
main関数
625941d64d74a7450ccd43f6
def loads(self, json_data, many=False, *args, **kwargs): <NEW_LINE> <INDENT> data = self.opts.json_module.loads(json_data, *args, **kwargs) <NEW_LINE> return self.load(data, many=many)
Same as :meth:`load`, except it takes a JSON string as input. :param str json_data: A JSON string of the data to deserialize. :param bool many: Whether to deserialize `obj` as a collection. If `None`, the value for `self.many` is used. :return: A tuple of the form (``data``, ``errors``) :rtype: `UnmarshalResult`, ...
625941d682261d6c526ab6d4