code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _translate_step_name(self, internal_name): <NEW_LINE> <INDENT> if not self._job_graph: <NEW_LINE> <INDENT> raise ValueError( 'Could not translate the internal step name %r since job graph is ' 'not available.' % internal_name) <NEW_LINE> <DEDENT> user_step_name = None <NEW_LINE> from apache_beam.runners.dataflow.in...
Translate between internal step names (e.g. "s1") and user step names.
625941c815baa723493c3fe3
def host_os_info(self): <NEW_LINE> <INDENT> result = ( os.name, platform.system(), platform.release(), platform.version(), sys.platform, ) <NEW_LINE> return result
Return information about host OS. Returns: Tuple with information about OS and host platform.
625941c82eb69b55b151c91d
def get_access_token(self, code): <NEW_LINE> <INDENT> if not (isinstance(code, str) or isinstance(code, str)): <NEW_LINE> <INDENT> code = code['code'] <NEW_LINE> <DEDENT> body = urllib.parse.urlencode({ 'grant_type': 'authorization_code', 'client_id': self.client_id, 'client_secret': self.client_secret, 'code': code, '...
Exhanges a code for an access token. Args: code: string or dict, either the code as a string, or a dictionary of the query parameters to the redirect_uri, which contains the code.
625941c8c4546d3d9de72aa2
def flask_obj(self, status_code=200, drop_dev=None, with_version=True, expires=None, headers=None, not_to_be_exposed=None): <NEW_LINE> <INDENT> del_keys = [] <NEW_LINE> if drop_dev is None: <NEW_LINE> <INDENT> drop_dev = self.drop_dev <NEW_LINE> <DEDENT> if drop_dev: <NEW_LINE> <INDENT> del_keys.append('_dev') <NEW_LIN...
Generate a :py:class:`flask.Response` object for current application response object. Args: status_code (int): HTTP status code, default 200 drop_dev (bool): Drop development information with_version (bool): include version information expires: expiration specification headers (dict): headers n...
625941c85fc7496912cc39ec
def _clear(self, *args): <NEW_LINE> <INDENT> self._text.setText('') <NEW_LINE> self._set_console_button(attention=False) <NEW_LINE> self.close()
Erase the log
625941c85fc7496912cc39ed
def is_right_from(self, ann): <NEW_LINE> <INDENT> return ann.end_idx < self.start_idx
Checks if this annotation is right from another annotation `ann`. :param ann: another annotation :return:True if right from `ann` :rtype: bool
625941c85e10d32532c5ef96
def __init__(self, alignment, css_class_suffix, title, icon, action, *args, **kwargs): <NEW_LINE> <INDENT> super(PostButton, self).__init__(alignment, css_class_suffix) <NEW_LINE> self.title = title <NEW_LINE> self.icon = _media(icon) <NEW_LINE> self.action = action <NEW_LINE> self.args = args <NEW_LINE> self.kwargs = ...
title: name of the button icon: icon of the button, relative to MEDIA_URL action: target of the request *args, **kwargs: data to POST A csrfmiddlewaretoken is always injected into the request.
625941c876d4e153a657eb9f
def extract_zip(source, remove=False, fatal=True): <NEW_LINE> <INDENT> tempdir = tempfile.mkdtemp() <NEW_LINE> zip = SafeUnzip(source) <NEW_LINE> try: <NEW_LINE> <INDENT> if zip.is_valid(fatal): <NEW_LINE> <INDENT> zip.extract_to_dest(tempdir) <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> rm_local_tmp_dir(te...
Extracts the zip file. If remove is given, removes the source file.
625941c87047854f462a147a
def do_reload(self, args): <NEW_LINE> <INDENT> self.cyb.load_json(show_all=args == 'all') <NEW_LINE> self.do_help("") <NEW_LINE> print("Data ble lastet inn på nytt")
Laster all data på nytt
625941c89f2886367277a8fd
def fetch_20newsgroups(data_home=None, subset='train', categories=None, shuffle=True, random_state=42, download_if_missing=True): <NEW_LINE> <INDENT> data_home = get_data_home(data_home=data_home) <NEW_LINE> twenty_home = os.path.join(data_home, "20news_home") <NEW_LINE> archive_path = os.path.join(twenty_home, ARCHIVE...
Load the filenames of the 20 newsgroups dataset Parameters ---------- subset: 'train' or 'test', optional Select the dataset to load: 'train' for the training set, 'test' for the test set. data_home: optional, default: None Specify an download and cache folder for the datasets. If None, all scikit-lea...
625941c87cff6e4e811179f5
def find_subscriber(self, search): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> key_column = search[0] <NEW_LINE> value = search[1] <NEW_LINE> customer_id = self.client.service.findSubscriber(self.username, self.password, key_column, value) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> customer_id = 0 <NEW_...
Method to find openemm subscriber args : key column and value returns : subscriber/customer id
625941c8097d151d1a222ec9
def test_continueTaskNoLogger(self): <NEW_LINE> <INDENT> originalAction = Action(None, "uniq456", TaskLevel(level=[3, 4]), "mytype") <NEW_LINE> taskId = originalAction.serializeTaskId() <NEW_LINE> messages = [] <NEW_LINE> add_destination(messages.append) <NEW_LINE> self.addCleanup(remove_destination, messages.append) <...
L{Action.continue_task} can be called without a logger.
625941c84d74a7450ccd4233
def next_stage(self, mappings: Dict[str, str]) -> None: <NEW_LINE> <INDENT> pass
Propagate mappings to the bottom of the pipeline in order to compute nested loop joins
625941c8f548e778e58cd5ec
def __init__(self, tblname: str, tblbases: tuple, class_body: dict, register: bool = True, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(tblname, tblbases, class_body) <NEW_LINE> if register is False: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> elif not hasattr(self, "metadata"): <NEW_LINE> <INDENT> raise T...
Creates a new Table instance. :param register: Should this table be registered in the TableMetadata? :param table_name: The name for this table.
625941c87d847024c06be329
def getBinaryRep(n, numDigits): <NEW_LINE> <INDENT> result = '' <NEW_LINE> while n > 0: <NEW_LINE> <INDENT> result = str(n%2) + result <NEW_LINE> n=n//2 <NEW_LINE> <DEDENT> if len(result) > numDigits: <NEW_LINE> <INDENT> raise ValueError('not enough digits') <NEW_LINE> <DEDENT> for i in range(numDigits - len(result)): ...
assumes n and numDigits are non-negative ints return a numDigits str that is binary representation of n
625941c830dc7b76659019d6
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.header is None: <NEW_LINE> <INDENT> self.header = std_msgs.msg.Header() <NEW_LINE> <DEDENT> if self.status is None: <NEW_LINE> <INDENT> self.status = actionlib_msgs.msg.GoalStatus() <NEW_LINE> <DEDENT> if self.feedback is None: <NEW_LINE> ...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941c845492302aab5e331
def dispatch_keras_h5_to_tensorflowjs_conversion( h5_path, output_dir=None, quantization_dtype=None, split_weights_by_layer=False): <NEW_LINE> <INDENT> if not os.path.exists(h5_path): <NEW_LINE> <INDENT> raise ValueError('Nonexistent path to HDF5 file: %s' % h5_path) <NEW_LINE> <DEDENT> elif os.path.isdir(h5_path): <NE...
Converts a Keras HDF5 saved-model file to TensorFlow.js format. Auto-detects saved_model versus weights-only and generates the correct json in either case. This function accepts Keras HDF5 files in two formats: - A weights-only HDF5 (e.g., generated with Keras Model's `save_weights()` method), - A topology+wei...
625941c845492302aab5e332
def chhome(name, home, persist=False, root=None): <NEW_LINE> <INDENT> return _chattrib(name, "home", home, "-d", persist=persist, root=root)
Change the home directory of the user, pass True for persist to move files to the new home directory if the old home directory exist. name User to modify home New home directory for the user account persist Move contents of the home directory to the new location root Directory to chroot into CLI Ex...
625941c807f4c71912b114f1
def delete_project(self, project_id, immediate="false"): <NEW_LINE> <INDENT> query_params = { "immediate": str(immediate) } <NEW_LINE> response = self.delete( endpoint=f"/project/{project_id}", params=query_params ) <NEW_LINE> return response
Method to delete a project. :param project_id: the id of the project being deleted :param immediate: whether or not the project should be deleted immediately :returns: the API response form the DELETE request
625941c82c8b7c6e89b35830
def send_campaign(self, campaign_id): <NEW_LINE> <INDENT> return self.wrapper.post( endpoint='%s/%d/%s' % ( CampaignsManager.ENDPOINT, campaign_id, '/schedules/now' ) )
Send a Campaign Args: campaign_id: (int) Campaign ID Reference: https://sendgrid.com/docs/API_Reference/Web_API_v3 /Marketing_Campaigns/campaigns.html#Send-a-Campaign-POST
625941c876e4537e8c3516e1
def main(): <NEW_LINE> <INDENT> rospy.init_node('Path', anonymous=True) <NEW_LINE> 'Definir o ponto de destino' <NEW_LINE> goalx = 7 <NEW_LINE> goaly = 13 <NEW_LINE> 'Iniciar os tópicos' <NEW_LINE> sub = rospy.Subscriber("base_scan", LaserScan, lasercallback, queue_size=10) <NEW_LINE> sub1 = rospy.Subscriber("base_pose...
Iniciar o nodo
625941c8aad79263cf390aaf
def SetDrawingSizeF(self,item_name,*__args): <NEW_LINE> <INDENT> pass
SetDrawingSizeF(self: GH_Chunk,item_name: str,item_index: int,item_value: SizeF) Add a new data item to this chunk. The combination of name and index must be unique or an exception will be thrown. item_name: Name of item to add. item_index: Index of item to add. item_value: Value of item to add. S...
625941c891af0d3eaac9ba87
def __init__(self, dist_type: DistType, argument: str) -> None: <NEW_LINE> <INDENT> self._dist_type = dist_type <NEW_LINE> self._argument = argument
Creates a new `DistInfo` object. Args: dist_type: The type of the distribution (release or snapshot). argument: For release distributions the version number, for snapshot builds the path to the distribution on the local file system.
625941c87b25080760e394c9
@app.route("/history") <NEW_LINE> @login_required <NEW_LINE> def history(): <NEW_LINE> <INDENT> r = db.execute("SELECT companyName as Name, latestPrice as Price, Symbol, Shares as Shares, Total, Time FROM Buy WHERE Buyer = :id ORDER BY Time DESC", id=session["user_id"]) <NEW_LINE> return render_template("history.html",...
Show history of transactions
625941c8e64d504609d748af
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> _cmf_core.waterbalance_integrator_swiginit(self, _cmf_core.new_waterbalance_integrator(*args, **kwargs))
__init__(waterbalance_integrator self, cmf::water::flux_node::ptr node) -> waterbalance_integrator waterbalance_integrator(cmf::water::flux_node::ptr node)
625941c86fece00bbac2d7ad
def __init__(self, cubie_input: List[CubieItem]): <NEW_LINE> <INDENT> assert len(cubie_input) == CUBIE_LENGTH, WRONG_CUBIE_INPUT <NEW_LINE> self._content = deque(cubie_input)
Create a queue to hold the input four CubieItems. :param cubie_input: List of four CubieItem.
625941c8ec188e330fd5a810
def do(self): <NEW_LINE> <INDENT> print('okcoincn_rest_ltc_ticker') <NEW_LINE> self.set_interval(1) <NEW_LINE> api_key = 'c3b622bc-8255-40f2-9585-138928ae376d' <NEW_LINE> secret_key = '7C1DDC1745C93B87BE1643A689938459' <NEW_LINE> okcoin_rest_url = 'www.okcoin.cn' <NEW_LINE> okcoin_spot = okcoin_spot_api.OKCoinSpot(okco...
date: 返回数据时服务器时间 buy: 买一价 high: 最高价 last: 最新成交价 low: 最低价 sell: 卖一价 vol: 成交量(最近的24小时) symbol String 否(默认btc_cny) btc_cny:比特币 ltc_cny :莱特币 :param symbol: 'btc_cny' 'ltc_cny' :return:
625941c88a349b6b435e81e2
def parsehtml(self, htmlsource): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> tree = fromstring(htmlsource) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> logger.warning("HTML tree cannot be parsed") <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> category = tree.xpath('//*[@class="park-section-breadcrumb__link "]//span/...
Parses the html source to retrieve info that is not in the RSS-keys In particular, it extracts the following keys (which should be available in most online news: section sth. like economy, sports, ... text the plain text of the article byline the author, e.g. "Bob Smith" byline_source sth like ANP
625941c801c39578d7e74eaa
def text(self, text): <NEW_LINE> <INDENT> self.meta_slice(TEXT, text)
Text event text: string
625941c8a219f33f346289da
def fastRunoff_lag_agriDitch_reInfilt(self, k): <NEW_LINE> <INDENT> if self.FR_L: <NEW_LINE> <INDENT> self.Qa = pcr.areatotal( self.Qa_[k] * self.percentArea, pcr.nominal(self.TopoId) ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.Qa = self.Qa_[k] <NEW_LINE> <DEDENT> self.Qfain = self.Qa <NEW_LINE> if self.convQa...
- Lag is applied before inflow into the fast reservoir - Lag formula is derived from Fenicia (2011) - Outgoing fluxes are determined based on (value in previous timestep + inflow) and if this leads to negative storage, the outgoing fluxes are corrected to rato - not a semi analytical solution for Sf anymore - very fa...
625941c844b2445a33932106
def get_items(self, user, collection, **kwds): <NEW_LINE> <INDENT> colmgr = self._get_collection_manager(collection) <NEW_LINE> return colmgr.get_items(user, **kwds)
Returns items from a collection
625941c8091ae35668666fcf
def iterkeys(self): <NEW_LINE> <INDENT> for obj in self.__imro__: <NEW_LINE> <INDENT> for k in obj.iterkeys(): <NEW_LINE> <INDENT> yield k
D.iterkeys() -> an iterator over *ALL* the keys of D
625941c81d351010ab855b8b
def _set_timelike_axis(self, axis): <NEW_LINE> <INDENT> self.timelike = axis
Set axis index `axis` to be the time-like axis for this grid.
625941c856b00c62f0f146c8
def delete(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ExerciseImage, self).delete(*args, **kwargs) <NEW_LINE> if not ExerciseImage.objects.accepted() .filter(exercise=self.exercise, is_main=True).count() and ExerciseImage.objects.accepted() .filter(exercise=self.exercise) ...
Reset all cached infos
625941c88a43f66fc4b540d5
def _build_stack(self): <NEW_LINE> <INDENT> self.eth = EthernetProtocol(self.interface) <NEW_LINE> ip = IPProtocol() <NEW_LINE> self.eth.register_layer(ip) <NEW_LINE> arp = ARPProtocol(self.interface) <NEW_LINE> self.eth.register_layer(arp) <NEW_LINE> self.tcp = TCPProtocol() <NEW_LINE> ip.register_layer(self.tcp) <NEW...
Create all the layer and link them together. Of course other layer could be added if implemented.
625941c88e71fb1e9831d819
def trim_start(self, names_with_path): <NEW_LINE> <INDENT> all_paths = [] <NEW_LINE> for _, paths in names_with_path: <NEW_LINE> <INDENT> all_paths.extend(paths) <NEW_LINE> <DEDENT> contains_louter = False <NEW_LINE> lookup_tables = [ t for t in self.alias_map if t in self._lookup_joins or t == self.base_table ] <NEW_L...
Trim joins from the start of the join path. The candidates for trim are the PathInfos in names_with_path structure that are m2m joins. Also set the select column so the start matches the join. This method is meant to be used for generating the subquery joins & cols in split_exclude(). Return a lookup usable for doin...
625941c8498bea3a759b9b1e
def validate_arguments(self): <NEW_LINE> <INDENT> if not self.args[0].is_vector() or not self.args[1].is_vector(): <NEW_LINE> <INDENT> raise TypeError("The arguments to conv must resolve to vectors." ) <NEW_LINE> <DEDENT> if not self.args[0].is_constant(): <NEW_LINE> <INDENT> raise TypeError("The first argument to conv...
Checks that both arguments are vectors, and the first is constant.
625941c8097d151d1a222eca
def GetViewpointVisibleTo(self, viewpoint_id): <NEW_LINE> <INDENT> key = viewpoint_id <NEW_LINE> if key not in self.vp_vt_acc_dict: <NEW_LINE> <INDENT> self.vp_vt_acc_dict[key] = Accounting.CreateViewpointVisibleTo(viewpoint_id) <NEW_LINE> <DEDENT> return self.vp_vt_acc_dict[key]
Returns the viewpoint visible_to accounting for the given viewpoint.
625941c83c8af77a43ae380f
def gf_to_int_poly(f, p, symmetric=True): <NEW_LINE> <INDENT> if symmetric: <NEW_LINE> <INDENT> return [ gf_int(c, p) for c in f ] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return f
Convert a ``GF(p)[x]`` polynomial to ``Z[x]``. Examples ======== >>> from sympy.polys.galoistools import gf_to_int_poly >>> gf_to_int_poly([2, 3, 3], 5) [2, -2, -2] >>> gf_to_int_poly([2, 3, 3], 5, symmetric=False) [2, 3, 3]
625941c8d8ef3951e32435ad
def query_yes_no(question, default="no"): <NEW_LINE> <INDENT> valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} <NEW_LINE> if default is None: <NEW_LINE> <INDENT> prompt = " [y/n] " <NEW_LINE> <DEDENT> elif default == "yes": <NEW_LINE> <INDENT> prompt = " [Y/n] " <NEW_LINE> <DEDENT> elif default == ...
Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "...
625941c8442bda511e8be489
def __delitem__(self, key): <NEW_LINE> <INDENT> if not isinstance(key, (str, utils.Index)): <NEW_LINE> <INDENT> raise DGLError('Argument "key" must be either str or utils.Index type.') <NEW_LINE> <DEDENT> if isinstance(key, str): <NEW_LINE> <INDENT> del self._frame[key] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sel...
Delete data in the frame. If the provided key is a string, the corresponding column will be deleted. If the provided key is an index object or a slice, the corresponding rows will be deleted. Please note that "deleted" rows are not really deleted, but simply removed in the reference. As a result, if two FrameRefs poi...
625941c84e696a04525c94bb
def stop_nbd_server(self): <NEW_LINE> <INDENT> logging.info("Stop nbd server") <NEW_LINE> return self._vm.monitor.nbd_server_stop()
Stop internal nbd server, it also unregisters all devices
625941c8cad5886f8bd27049
def info(self, message, verbosity=0): <NEW_LINE> <INDENT> if self.verbosity >= verbosity: <NEW_LINE> <INDENT> color = self.verbosity_colors.get(verbosity, self.yellow) <NEW_LINE> self.print_message(message, color=color)
:type message: str :type verbosity: int
625941c894891a1f4081bb19
def test_compile_time_multiple_engine_urls(self): <NEW_LINE> <INDENT> tsv_engine_url = "tsv://" + EXAMPLE_TSV_PATH <NEW_LINE> csv_engine_url = "csv://" + EXAMPLE_CSV_PATH <NEW_LINE> c = Connect(engine_url=[tsv_engine_url, csv_engine_url]) <NEW_LINE> all_the_animals = [] <NEW_LINE> for index, data_connector in enumerate...
engine_url could be a list of engine_urls. In the future, a dictionary version might be added
625941c89b70327d1c4e0e44
def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> slug = kwargs['slug'] <NEW_LINE> course = Course.objects.get(slug=slug) <NEW_LINE> enrolled_count = CourseEnrollment.objects.filter( is_enabled=True, course=course).count() <NEW_LINE> video_count = ModuleVideo.objects.filter( ~Q(public_url='') & Q(module__cou...
Returns enrolled and video count for a given a course slug
625941c8d18da76e23532545
def return_frame(self): <NEW_LINE> <INDENT> return self.image
Call this function to get the last value of self.image :return: self.image, array of shape [H, W, 3] channels in the order RGB
625941c830c21e258bdfa50c
def trackAngleKalman(self): <NEW_LINE> <INDENT> thread.start_new_thread(self.track_angle_thread_kalman, ())
Starting a new thread define in method track_angle_thread_kalman. :return:
625941c863f4b57ef000118b
def gaussJacobian(S,ele,gaussPoint,dim,basisArray,mCount,mSize,nodeCoords,eleNodesArray): <NEW_LINE> <INDENT> detArray = detAssemble(dim,mCount) <NEW_LINE> intScalFact = np.zeros([dim,dim]) <NEW_LINE> hardCodedJac = np.zeros([3,3]) <NEW_LINE> for i in range(dim): <NEW_LINE> <INDENT> intScalFact[:,i] = np.matmul(basisSe...
Returns the jacobian matrix of the gauss point for member S of elemenet ele INPUT: S- member number ele- element number gaussPoint- gauss point number OUTPUT: intScalFact- The Integral Scaling Factor hardCodedJac- The 3x3 jacobian matrix of the form [[dx/dn,dx/dm,dx/do],[dy/dn,dy/dm,dy/do],[dz/dn,dz...
625941c82ae34c7f2600d1a1
def getSig(hdr): <NEW_LINE> <INDENT> if hdr[rpm.RPMTAG_DSAHEADER] or hdr[rpm.RPMTAG_RSAHEADER]: <NEW_LINE> <INDENT> keyid = getSigInfo(hdr)[1][2][16:] <NEW_LINE> try: <NEW_LINE> <INDENT> return (getPkgNevra(hdr), pubkeys[keyid]) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pubkeys[keyid] = 'Unknown key {0}'...
Given an rpm header object, extract the signing key, if any. Returns a tuple of the name of the package nevra, and the name of the signing key.
625941c81f037a2d8b94626e
def parse_cmds(self, data): <NEW_LINE> <INDENT> logger.debug("Data: " + str(data)) <NEW_LINE> try: <NEW_LINE> <INDENT> cmd = data.decode('utf-16').strip() <NEW_LINE> cmd_split = cmd.split(',') <NEW_LINE> logger.debug("Command: " + cmd) <NEW_LINE> if len(cmd_split) > 0: <NEW_LINE> <INDENT> cur_cmd = cmd_split[0].strip()...
Parse the commands given by the user.
625941c838b623060ff0ae5e
def _delete_golden(self): <NEW_LINE> <INDENT> from shutil import rmtree <NEW_LINE> try: <NEW_LINE> <INDENT> rmtree(self.golden) <NEW_LINE> <DEDENT> except FileNotFoundError: <NEW_LINE> <INDENT> pass
:param str output_string: log string to process :rtype: List[Dict[str, str]]
625941c8c4546d3d9de72aa3
def gradient(self): <NEW_LINE> <INDENT> dFdx = zeros(self.F.shape,float64) <NEW_LINE> dFdy = zeros(self.F.shape,float64) <NEW_LINE> dFdx[:,1:-1] = (self.F[:,2:] - self.F[:,:-2]) /(2*self.dx) <NEW_LINE> dFdy[1:-1,:] = (self.F[2:,:] - self.F[:-2,:]) /(2*self.dy) <NEW_LINE> dFdx[:,0] = (self.F[:,1] - self.F[:,0])/self.dx ...
compute 2-D gradient of the field, returning a pair of fields of the same size (one-sided differences are used at the boundaries, central elsewhere). returns fields: dFdx,dFdy
625941c8f548e778e58cd5ed
def is_target_expander(self, target_id): <NEW_LINE> <INDENT> target = self.node[target_id] <NEW_LINE> if "object" not in target: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if not isinstance(target["object"], builder.expanders.Expander): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
Returns if the id passed in relates to a target node or not
625941c83d592f4c4ed1d0e0
def get_from(json): <NEW_LINE> <INDENT> first_colon = json.index(':') <NEW_LINE> start = json.index('"',first_colon) <NEW_LINE> end = json.index('"', start+1) <NEW_LINE> return json[start+1:end]
JSON response to a currency query, his returns the string inside double quotes (") immediately following the keyword "from. This will return The FROM value in the response to a currency query. Parameter json: a json string to parse Precondition: json is the response to a currency query
625941c830bbd722463cbe35
def problem11(grid, nr_adjacent): <NEW_LINE> <INDENT> result = 0 <NEW_LINE> GRID_SHAPE = grid.shape <NEW_LINE> for row in range(0, GRID_SHAPE[0] - (nr_adjacent-1)): <NEW_LINE> <INDENT> for col in range(0, GRID_SHAPE[1] - (nr_adjacent-1)): <NEW_LINE> <INDENT> subgrid = GRID[row:row+nr_adjacent, col:col+nr_adjacent] <NEW...
Problem 11 - Largest product in a grid
625941c856b00c62f0f146c9
def tanh(x): <NEW_LINE> <INDENT> return get_protocol().tanh(x)
Computes tanh of x element-wise
625941c8bd1bec0571d9069f
def makeAdresa(self, model, row): <NEW_LINE> <INDENT> cislo_domovni = model.value(row, u"opsub_cislo_domovni") <NEW_LINE> cislo_orientacni = model.value(row, u"opsub_cislo_orientacni") <NEW_LINE> ulice = model.value(row, u"opsub_nazev_ulice") <NEW_LINE> cast_obce = model.value(row, u"opsub_cast_obce") <NEW_LINE> obec =...
:type model: VfkTableModel :type row: int :return: str
625941c857b8e32f5248350a
def send_command(self, location: Location, device: Device, command: Command): <NEW_LINE> <INDENT> _LOGGER.info("Sending command for location id %s, device id %s: %s", location.id, device.id, command) <NEW_LINE> url = "devices/{device.id}/abilities/{command.ability}/command".format(device=device, command=command) <NEW_L...
Sends a command for the given device at the location. This methods does not check if the device actually implements the ability necessary for the command.
625941c87c178a314d6ef4ce
def show_model_perm(self, menu): <NEW_LINE> <INDENT> view_perm = 'model' in menu and self.user.has_perm( '%s.view_%s' % (menu['model']._meta.app_label, menu['model']._meta.model_name)) <NEW_LINE> show_perm = self.user.has_perm('%s.show_%s' % (menu['model']._meta.app_label, menu['model']._meta.model_name)) <NEW_LINE> hi...
是否在侧边栏展示 :param menu: :return:
625941c82eb69b55b151c91e
def create_label(input_file_name): <NEW_LINE> <INDENT> input_df = pd.DataFrame(pd.read_csv(input_file_name)) <NEW_LINE> input_df['ValueDate'] = pd.to_datetime(input_df.ValueDate.values) <NEW_LINE> return pd.DataFrame(input_df.set_index('ValueDate').Return)
return label dataframe (Return column) for back test. Parameters ---------- input_file_name: csv file of weekly data which has weekly date column
625941c83346ee7daa2b2ddb
def __repr__(self): <NEW_LINE> <INDENT> return self.__str__()
For pretty-printing of our object
625941c8dd821e528d63b21a
def build_gmd_log_likelihood(c=12, m=12): <NEW_LINE> <INDENT> if not (c > 0 and isinstance(c, int)): <NEW_LINE> <INDENT> raise ValueError('c must be a positive integer.') <NEW_LINE> <DEDENT> if not (m > 0 and isinstance(m, int)): <NEW_LINE> <INDENT> raise ValueError('m must be a positive integer.') <NEW_LINE> <DEDENT> ...
Build log-likelihood loss for Gaussian Mixture Densities. Args: c (int): Number of output dimensions. m (int): Number of gaussians in the mixture. Returns: Loss function.
625941c8d268445f265b4ede
def test_clone_from_root(self): <NEW_LINE> <INDENT> orig_transport = self.get_transport() <NEW_LINE> root_transport = orig_transport.clone('/') <NEW_LINE> self.assertEqual(root_transport.base + '.bzr/', root_transport.clone('.bzr').base)
At the root, cloning to a simple dir should just do string append.
625941c816aa5153ce3624e9
def return_pass_sql(self, sql): <NEW_LINE> <INDENT> command = "{}".format(sql) <NEW_LINE> data = DB.return_sql(None, command) <NEW_LINE> return data
Returns the item the user requested. WARNING: This method will be replaced with return_sql() :param sql: the SQL code that is passed to return_sql()
625941c8b57a9660fec338f3
def _compile_collect(self, exprs, with_kwargs=False, dict_display=False, oldpy_unpack=False): <NEW_LINE> <INDENT> compiled_exprs = [] <NEW_LINE> ret = Result() <NEW_LINE> keywords = [] <NEW_LINE> oldpy_starargs = None <NEW_LINE> oldpy_kwargs = None <NEW_LINE> exprs_iter = iter(exprs) <NEW_LINE> for expr in exprs_iter: ...
Collect the expression contexts from a list of compiled expression. This returns a list of the expression contexts, and the sum of the Result objects passed as arguments.
625941c8be383301e01b54f7
def test_new_project_existing_user(self): <NEW_LINE> <INDENT> user = fake_clients.FakeUser( name="test@example.com", password="123", email="test@example.com" ) <NEW_LINE> setup_identity_cache(users=[user]) <NEW_LINE> task = Task.objects.create(keystone_user={}) <NEW_LINE> data = { "domain_id": "default", "parent_id": N...
Create a project for a user that already exists.
625941c87cff6e4e811179f6
def export_mesh(fname, faces, verts, flip=True): <NEW_LINE> <INDENT> my_mesh = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype)) <NEW_LINE> for i, f in enumerate(faces): <NEW_LINE> <INDENT> for j in range(3): <NEW_LINE> <INDENT> if flip: <NEW_LINE> <INDENT> my_mesh.vectors[i][j] = verts[f[-j], :] <NEW_LINE> <D...
:param str/Path fname: Path to the output file :param np.array faces: Numpy array of size #faces x 3 :param np.array verts: Numpy array of size #vertices x 3 :param bool flip : Whether to flip the orientation of the faces by reversing the order of its vertices :return:
625941c85166f23b2e1a51c9
def checkImage(url): <NEW_LINE> <INDENT> if not path.exists(url): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> mime = mimetypes.guess_type(url, strict = True)[0] <NEW_LINE> if not mime.split('/')[0] == 'image': <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> return mime
Checks if image path exists and if it's an image. @returns mime MIME type of the image or `None` if it's not an image.
625941c8fb3f5b602dac3702
def test(): <NEW_LINE> <INDENT> start = [2, 3, 6, 1, 5, 8, 4, 0, 7] <NEW_LINE> target = [1, 2, 3, 4, 5, 6, 7, 8, 0] <NEW_LINE> target_node = Node(target) <NEW_LINE> start_node = Node(start) <NEW_LINE> path = bfs(target_node) <NEW_LINE> if path[start_node.status]: <NEW_LINE> <INDENT> print('共需要 {} 步'.format(len(path[sta...
测试用例
625941c824f1403a92600bd8
def get_failures(self): <NEW_LINE> <INDENT> return self.failures
Retrieve failures bookeeping dictionary.
625941c88c0ade5d55d3ea2a
def unload(self): <NEW_LINE> <INDENT> for action in self.actions: <NEW_LINE> <INDENT> self.iface.removePluginMenu( self.tr(u'&abc'), action) <NEW_LINE> self.iface.removeToolBarIcon(action) <NEW_LINE> <DEDENT> del self.toolbar
Removes the plugin menu item and icon from QGIS GUI.
625941c8711fe17d825423de
def __init__(self, myRoot, myRelLoc, **fileArgs): <NEW_LINE> <INDENT> self._properties = {} <NEW_LINE> self._location = objLoc(myRoot, myRelLoc) <NEW_LINE> self._properties["fileName"] = "tempfile" <NEW_LINE> self._properties["fileExt"] = ".log" <NEW_LINE> self._isMutable = False <NEW_LINE> for fileArg in fileArgs: <NE...
Constructor for fManager class objects Required Arguments --------- myRoot: string Absolute base path for files myRelLoc: string Relative child path for files DEFAULT: 'logs' Optional KW Arguments ------------------ fileName: string Log file name DEFAULT: 'log-main' fileExt: String File extens...
625941c810dbd63aa1bd2c14
def _register_damped_input_and_output_inverses(self, damping): <NEW_LINE> <INDENT> self._input_damping, self._output_damping = compute_pi_adjusted_damping( self._input_factor.get_cov(), self._output_factor.get_cov(), damping**0.5) <NEW_LINE> self._input_factor.register_damped_inverse(self._input_damping) <NEW_LINE> sel...
Registers damped inverses for both the input and output factors. Sets the instance members _input_damping and _output_damping. Requires the instance members _input_factor and _output_factor. Args: damping: The base damping factor (float or Tensor) for the damped inverse.
625941c8f9cc0f698b14066d
def cost_func_01(self, saver, model, y, data, T, lr, lmd=None, name=None): <NEW_LINE> <INDENT> x = model.inp[0] <NEW_LINE> train_s = data.train.create_supplier(x, y) <NEW_LINE> valid_s = data.validation.create_supplier(x, y) <NEW_LINE> error2 = tf.reduce_mean(lmd * hozo.cross_entropy_loss(y, model.out)) <NEW_LINE> corr...
BASELINE EXECUTION (valid also for oracle and final training, with optimized values of lambda) :param saver: `Saver` object (can be None) :param name: optional name for the saver :param data: `Datasets` object :param T: number of iterations :param lmd: weights for the examples, if None sets to 1. :param model: a model...
625941c857b8e32f5248350b
def remove_from_reference_set(qset,value,settings): <NEW_LINE> <INDENT> headers = {'Version': '2.0', 'Accept': 'application/json','SEC':settings['SEC']} <NEW_LINE> resp=requests.delete(settings['base_url']+'reference_data/sets/'+qset+'/'+value,headers=headers,verify=False) <NEW_LINE> if resp.status_code==200 or resp.st...
removes an indicator from the qset reference set
625941c8be7bc26dc91cd672
def _DELETE_COLLECTION_RESOURCE(self, resource, log_id): <NEW_LINE> <INDENT> url = "%s/%s/user/-/%s/%s.json" % ( self.API_ENDPOINT, self.API_VERSION, resource, log_id, ) <NEW_LINE> response = self.make_request(url, method='DELETE') <NEW_LINE> return response
deleting each type of collection data Arguments: resource, defined automatically via curry log_id, required, log entry to delete This builds the following methods:: delete_body(log_id) delete_activities(log_id) delete_foods(log_id) delete_water(log_id) delete_sleep(log_id) delete_hear...
625941c8be383301e01b54f8
def __init__(self, video, params=None): <NEW_LINE> <INDENT> if params is None: <NEW_LINE> <INDENT> params = {} <NEW_LINE> <DEDENT> if 'bins' in params and params['bins'] is not None: <NEW_LINE> <INDENT> bins = params['bins'] <NEW_LINE> assert isinstance(bins, tuple) and len(bins) == 2 <NEW_LINE> <DEDENT> else: <NEW_LIN...
Initialize the StoryBoard class. See the module docstring for parameters and exceptions.
625941c8b7558d58953c4f86
def print_lol(the_list,indent=False,level=0,fh=sys.stdout): <NEW_LINE> <INDENT> for each_item in the_list: <NEW_LINE> <INDENT> if (isinstance(each_item,list)): <NEW_LINE> <INDENT> print_lol(each_item,indent,level+1,fh) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if indent: <NEW_LINE> <INDENT> for tab_stop in range (l...
method 2, printtab is a bool value, if it is ture,in each sub list, it will print a TAB the_list: type:list indent: if this true, will print tab,决定着输出是否缩进 level: 缩进的起始量,负数的话不缩进
625941c8fff4ab517eb2f4ac
def run(self): <NEW_LINE> <INDENT> self.log = logging.getLogger(module) <NEW_LINE> logging.basicConfig(stream=sys.stderr, level=logging.DEBUG, format='%(name)s (%(levelname)s): %(message)s') <NEW_LINE> try: <NEW_LINE> <INDENT> args = self.parse_command_line() <NEW_LINE> self.set_log_level() <NEW_LINE> output = args.out...
Run the injector
625941c8b545ff76a8913e87
def configure(config): <NEW_LINE> <INDENT> for alias, metric in _OBJECTS_.iteritems(): <NEW_LINE> <INDENT> view = config_view(config, alias) <NEW_LINE> logging.info('Configuring %s: %s', alias, view) <NEW_LINE> metric.configure(view)
configure mteval modules
625941c8460517430c3941f8
def __init__(self, error = ''): <NEW_LINE> <INDENT> IPRO_Error.__init__(self, error)
The initialization of the SharingError class
625941c8b57a9660fec338f4
def debug(msg, msgbox=False, parent="auto"): <NEW_LINE> <INDENT> stack = inspect.stack()[1][0] <NEW_LINE> log(msg, logging.DEBUG, msgbox, parent, stack)
docstring for error
625941c8d10714528d5ffd53
def update_wcs_matrix(header, x0, y0, naxis1, naxis2): <NEW_LINE> <INDENT> h = copy.deepcopy(header) <NEW_LINE> wcs = wcsutil.WCS(h) <NEW_LINE> CRVAL1, CRVAL2 = wcs.image2sky(x0, y0) <NEW_LINE> CRPIX1 = int(naxis1 / 2.0) <NEW_LINE> CRPIX2 = int(naxis2 / 2.0) <NEW_LINE> h['CRVAL1'] = CRVAL1 <NEW_LINE> h['CRVAL2'] = CRVA...
Update the wcs header object with the right CRPIX[1, 2] CRVAL[1, 2] for a given subsection Parameters: header: fits style header The header to work with x0, y0: float The new center of the image naxis1, naxis2: int The number of pixels on each axis. Returns: fits style header with the new center.
625941c8e8904600ed9f1f9d
def mouseReleaseEvent(self, event: QGraphicsSceneMouseEvent): <NEW_LINE> <INDENT> MOVE_THRESHOLD = 0.01 <NEW_LINE> if self._right_mouse_move and event.button() == Qt.RightButton: <NEW_LINE> <INDENT> self._right_mouse_move = False <NEW_LINE> delta = self.pos() - self.handle_start <NEW_LINE> dz = delta.x() <NEW_LINE> if ...
Args: event: Description
625941c8e64d504609d748b0
def _get_train_w_emb_i(self, a_word): <NEW_LINE> <INDENT> a_word = _norm_word(a_word) <NEW_LINE> if a_word in self.w2emb_i: <NEW_LINE> <INDENT> return self.w2emb_i[a_word] <NEW_LINE> <DEDENT> elif self._w_stat[a_word] < 2 and UNK_PROB(): <NEW_LINE> <INDENT> self.w2emb_i[a_word] = self.unk_w_i <NEW_LINE> return self.unk...
Obtain embedding index for the given word. Args: a_word (str): word whose embedding index should be retrieved Returns: int: embedding index od the given word
625941c8d58c6744b4257cd1
def get_user_details_dict(self, user, **kwargs): <NEW_LINE> <INDENT> domain_id = kwargs.get('domain_id', None) <NEW_LINE> domain = kwargs.get('domain', None) <NEW_LINE> if not domain_id: <NEW_LINE> <INDENT> if not domain: <NEW_LINE> <INDENT> raise RuntimeError( "Can't resolve a domain as no domain or domain_id " "suppl...
Get the user details dictionary for a user. This fetches the user details for a user and domain or domain_id. It uses the lowercase name for the user; all users as far as the keystone charm are concerned are the same if lower cased. :param user: the user name to look for. :type user: str :returns: a dictionary of key...
625941c8d99f1b3c44c67600
def load_from_raw(self): <NEW_LINE> <INDENT> for field_name in RawDisposition._meta.get_all_field_names(): <NEW_LINE> <INDENT> if field_name == "disposition": <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> self.load_field_from_raw(field_name) <NEW_LINE> <DEDENT> return self
Load fields from related RawDisposition model
625941c8cc40096d615959c1
def _sortBuildMessages(records): <NEW_LINE> <INDENT> for record in records: <NEW_LINE> <INDENT> for key in ("lnum", "nr", "col"): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> record[key] = int(record[key]) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> records.sort...
Sorts the build messages using Vim's terminology
625941c807f4c71912b114f2
def retrieveLastInsertId(self, conn, cur): <NEW_LINE> <INDENT> return cur.lastrowid
Return the id of the last INSERT operation by this connection. This id is typically a 32-bit int. Used by commitInserts() to get the correct serial number for the last inserted object.
625941c876d4e153a657eba1
def timedelta_format(units=None, add_units=True, usetex=False): <NEW_LINE> <INDENT> abbreviations = { 'ns': 'ns', 'us': '$\mu s$' if usetex else 'us', 'ms': 'ms', 's': 's', 'm': ' minute', 'h': ' hour', 'd': ' day', 'w': ' week', 'M': ' month', 'y': ' year'} <NEW_LINE> _mpl_format = mpl_format() <NEW_LINE> def _timedel...
Timedelta formatter Returns ------- out : function Formatting function. It takes a sequence of timedelta values and returns a sequence of strings. >>> from datetime import timedelta >>> x = [timedelta(days=31*i) for i in range(5)] >>> timedelta_format()(x) ['0', '1 month', '2 months', '3 months', '4 mont...
625941c850485f2cf553ce0a
def remove(self, key): <NEW_LINE> <INDENT> bucket, index = self._index(key) <NEW_LINE> if index >= 0: bucket.remove(key)
:type key: int :rtype: None
625941c899cbb53fe6792c57
def _initWidgets(self): <NEW_LINE> <INDENT> self.wg_mainTree = mainTree.MainTree(self) <NEW_LINE> self.vl_treeDn.addWidget(self.wg_mainTree) <NEW_LINE> self.wg_infoView = infoView.InfoView(self) <NEW_LINE> self.vl_data.addWidget(self.wg_infoView)
Init main ui widgets
625941c87d847024c06be32b
def _make_figure_wrapper(self, name): <NEW_LINE> <INDENT> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> self._commands.append(NodeCommand(name, args, kwargs)) <NEW_LINE> <DEDENT> return wrapper
Return a wrapper for a command
625941c830dc7b76659019d8
def test_import_split_is_word_boundary_aware() -> None: <NEW_LINE> <INDENT> test_input = ( "from mycompany.model.size_value_array_import_func import \\\n" " get_size_value_array_import_func_jobs" ) <NEW_LINE> test_output = isort.code( code=test_input, multi_line_output=WrapModes.VERTICAL_HANGING_INDENT, line_length=...
Test to ensure that isort splits words in a boundary aware manner
625941c8dc8b845886cb55a5
def test_type(self): <NEW_LINE> <INDENT> self.__test_cloudinary_url(options={"type": "facebook"}, expected_url=DEFAULT_ROOT_PATH + "image/facebook/test")
should use type from options
625941c807f4c71912b114f3
@set_cmd('norelativenumber') <NEW_LINE> def no_relative_number(editor): <NEW_LINE> <INDENT> editor.relative_number = False
Disable relative number
625941c821a7993f00bc7d5f
def settings(self): <NEW_LINE> <INDENT> return [ self.input_type, self.image_name, self.objects_name, self.main_object_id, ]
Return all of the settings in a consistent order
625941c8462c4b4f79d1d742
@app.route('/catalog/<path:category>/<path:item>.json') <NEW_LINE> def showItemJson(category, item): <NEW_LINE> <INDENT> item = session.query(Item).filter_by(name=item).one() <NEW_LINE> return jsonify(Item=item.serialize)
json endpoint route for showing the data for the current item only
625941c876d4e153a657eba2
@render_to('i18n/language_dashboard.html') <NEW_LINE> def language_dashboard(request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(get_language_pack_availability_filepath()) as f: <NEW_LINE> <INDENT> lang_availability = json.load(f) <NEW_LINE> <DEDENT> ordered_versions = sort_version_list([pack["software_ver...
Return context for language dashboard, organized by version context = { 'lang_pack_by_version': [ '0.12.0': { meta data here.... } ] }
625941c8d164cc6175782dbe
def countPlayers(): <NEW_LINE> <INDENT> dbh = connect() <NEW_LINE> sth = dbh.cursor() <NEW_LINE> sth.execute("SELECT count(players) FROM players") <NEW_LINE> result = sth.fetchone() <NEW_LINE> dbh.commit() <NEW_LINE> dbh.close() <NEW_LINE> return result[0]
Returns the number of players currently registered.
625941c826068e7796caed4f