code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def inv_debye_len(mat): <NEW_LINE> <INDENT> return np.sqrt(Parameters.q * mat.dope * 1E2**3 / (mat.eps_0 * Parameters.kT))
Calculates the inverse debye length Parameters ---------- dope : float doping concentration of the material mat : class material class Returns ------- float inverse debye length
625941f14f6381625f114fef
def get(self, sql, sets=None): <NEW_LINE> <INDENT> rows = self.query(sql, sets) <NEW_LINE> if not rows: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> elif len(rows) > 1: <NEW_LINE> <INDENT> raise Exception("Multiple rows returned for get() query") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return rows[0]
sets can be list: sets = [ 'SET mapred.job.name = myjobname', 'set mapreduce.job.queuename=root.offline.myhadoop.queue', ] or string: sets = 'SET mapred.job.name = myjobname'
625941f156b00c62f0f14c11
def convert_dtype(srcdt, ctx): <NEW_LINE> <INDENT> msg = "convert dtype: {}, type: {},".format(srcdt, type(srcdt)) <NEW_LINE> logging.info(msg) <NEW_LINE> if len(srcdt) > 0: <NEW_LINE> <INDENT> fields = [] <NEW_LINE> for name in srcdt.fields: <NEW_LINE> <INDENT> item = srcdt.fields[name] <NEW_LINE> field_dt = convert_d...
Return a dtype based on input dtype, converting any Reference types from h5py style to h5pyd and vice-versa.
625941f15166f23b2e1a570d
def _inputMap(self, file): <NEW_LINE> <INDENT> mapFile = open(file) <NEW_LINE> mapString = mapFile.readline().split(" ") <NEW_LINE> winVal = mapString[0] <NEW_LINE> loseVal = mapString[1] <NEW_LINE> mapString = mapFile.read().split('\n') <NEW_LINE> xPlace = 0 <NEW_LINE> rowList = [] <NEW_LINE> for x in mapString: <NEW_...
This takes the input from the file containing the map layout and converts it into a 2-D list. Locations on the map will be represented (x, y), but the 2-D list refers to its locations as (y, x)
625941f1be7bc26dc91cdba8
@post ('/<resource:path>') <NEW_LINE> def helloResourcePost (resource): <NEW_LINE> <INDENT> normalizeScriptName (request) <NEW_LINE> resource = normalizeResource (resource) <NEW_LINE> return template ("Post child resource under '/{{resource}}'", resource=resource)
Post a new child resource underneath the specified resource.
625941f1be7bc26dc91cdba9
def get_RTCODE(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.hashcat.poll() <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> return -99
status codes on exit: ===================== -1 = error 0 = cracked 1 = exhausted 2 = aborted
625941f130bbd722463cc37d
def dcc(self, *args, **kwargs): <NEW_LINE> <INDENT> dcc = self.reactor.dcc(*args, **kwargs) <NEW_LINE> self.dcc_connections.append(dcc) <NEW_LINE> return dcc
Create and associate a new DCCConnection object. Use the returned object to listen for or connect to a DCC peer.
625941f163d6d428bbe44aa5
def __contains__(self, pointTime): <NEW_LINE> <INDENT> raise Exception('This should not be used! Switch to the TW method!')
DEPRECATED METHOD.
625941f1dc8b845886cb5aeb
def entity_order_type_by_id_get_with_http_info(self, id, **kwargs): <NEW_LINE> <INDENT> all_params = ['id', 'fields'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LI...
EntityOrderTypeById_GET # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.entity_order_type_by_id_get_with_http_info(id, async_req=True) >>> result = thread.get() :param async_req bool :param float id...
625941f13317a56b8693a1fd
def forward(self, data): <NEW_LINE> <INDENT> output = self.layers(self.input_layer(data, self.mask.t() @ self.adjacency_matrix)) <NEW_LINE> return th.cat([f.softmax(output[:, idx, :i], dim=1) if i>0 else th.output[:, idx, :i] for idx, i in enumerate(self.o_sizes)], 1)
Forward through all the generators.
625941f18e71fb1e9831dd5a
def mark_as(self, viewed_or_not): <NEW_LINE> <INDENT> self.viewed = viewed_or_not <NEW_LINE> self.save()
Mark a notification as viewed or not
625941f1099cdd3c635f120c
def pointSIFT_select(xyz, radius): <NEW_LINE> <INDENT> idx = pointSIFT_module.cube_select(xyz, radius) <NEW_LINE> return idx
:param xyz: (b, n, 3) float :param radius: float :return: (b, n, 8) int
625941f1b5575c28eb68e5ba
def get_fixed_mask(same_key_group): <NEW_LINE> <INDENT> mask = None <NEW_LINE> fields = None <NEW_LINE> edge_with_mask = None <NEW_LINE> for edge in same_key_group: <NEW_LINE> <INDENT> fixed_mask_constraints = utility_calls.locate_constraints_of_type( edge.constraints, KeyAllocatorFixedMaskConstraint) <NEW_LINE> for fi...
Get a fixed mask from a group of partitioned edges if a :py:class:`pacman.model.constraints.key_allocator_same_key_constraint.KeyAllocatorFixedMaskConstraint` constraint exists in any of the edges in the group. :param same_key_group: Set of partitioned edges that are to be assigned the sam...
625941f14e696a04525c9a02
def show_boundary(self): <NEW_LINE> <INDENT> self.itemconfig("boundary", fill="red", width=2)
Show boundary on canvas.
625941f1d10714528d60029e
def myAtoi(self, str): <NEW_LINE> <INDENT> str = str.strip() <NEW_LINE> if str == '': <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> num, sign = 0, 1 <NEW_LINE> if str.isdigit(): <NEW_LINE> <INDENT> num = int(str) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if str[0] == '-': <NEW_LINE> <INDENT> sign = -1 <NEW_LINE>...
:type str: str :rtype: int
625941f1adb09d7d5db6cd40
def run(self): <NEW_LINE> <INDENT> from dials.util.options import flatten_experiments, flatten_reflections <NEW_LINE> params, options = self.parser.parse_args(show_diff_phil=True) <NEW_LINE> self.params = params <NEW_LINE> if params.plots.all_plots: <NEW_LINE> <INDENT> for attr in dir(params.plots): <NEW_LINE> <INDENT>...
Parse the options.
625941f16aa9bd52df03735c
def test_music_songview_fullplay(self): <NEW_LINE> <INDENT> music_app = Music(self.marionette) <NEW_LINE> music_app.launch() <NEW_LINE> music_app.wait_for_music_tiles_displayed() <NEW_LINE> self.take_screenshot() <NEW_LINE> list_view = music_app.tap_songs_tab() <NEW_LINE> music_app.wait_for_view_displayed('Songs') <NEW...
play a song until the end in the song list view
625941f1cad5886f8bd2758c
@user_blue.route('/news_list') <NEW_LINE> @user_login_data <NEW_LINE> def user_news_list(): <NEW_LINE> <INDENT> user = g.user <NEW_LINE> if not user: <NEW_LINE> <INDENT> return redirect(url_for('index.index')) <NEW_LINE> <DEDENT> page = request.args.get('p', '1') <NEW_LINE> try: <NEW_LINE> <INDENT> page = int(page) <NE...
我发布的新闻列表
625941f163b5f9789fde769a
def immutable_hd(self): <NEW_LINE> <INDENT> raise
Make a harddisk immutable or normal.
625941f16fece00bbac2dcfa
def __BuildPanel(self, **kwds): <NEW_LINE> <INDENT> wx.Panel.__init__(self, self.parent, -1, **kwds) <NEW_LINE> self.fig = Figure(self.figsize,dpi=self.dpi) <NEW_LINE> self.axes = self.fig.add_axes([0.15,0.15,0.75,0.75], axisbg='#FEFEFE') <NEW_LINE> self.canvas = FigureCanvasWxAgg(self, -1, self.fig) <NEW_LINE> self...
builds basic GUI panel and popup menu
625941f1442bda511e8be9c4
def ExportProgressBarOperation(self, pProgressBar): <NEW_LINE> <INDENT> pass
ExportProgressBarOperation(self: CDelegateWrapper, pProgressBar: dotProgressBar_t) -> (int, dotProgressBar_t)
625941f1507cdc57c630729d
def _get_issue_counts(self, scores): <NEW_LINE> <INDENT> issue_counts = {} <NEW_LINE> for score in scores: <NEW_LINE> <INDENT> for (criteria, default) in constants.CRITERIA: <NEW_LINE> <INDENT> for i, rank in enumerate(constants.RANKING): <NEW_LINE> <INDENT> label = '{0}.{1}'.format(criteria, rank) <NEW_LINE> if label ...
Get issue counts aggregated by confidence/severity rankings. :param scores: list of scores to aggregate / count :return: aggregated total (count) of issues identified
625941f1aad79263cf390ffe
def get_table_details(paths, row_start=2): <NEW_LINE> <INDENT> tables = {} <NEW_LINE> for path in paths: <NEW_LINE> <INDENT> sep = "\t" <NEW_LINE> if path.endswith("csv"): <NEW_LINE> <INDENT> sep = "," <NEW_LINE> <DEDENT> with open(path, "r") as f: <NEW_LINE> <INDENT> reader = csv.DictReader(f, delimiter=sep) <NEW_LINE...
Build a dictionary of table details. :param paths: list of table paths :param row_start: row number that contents to validate start on :return: dict of table name -> {fields, rows}
625941f14d74a7450ccd477a
def get_surface(offer_markup): <NEW_LINE> <INDENT> html_parser = BeautifulSoup(offer_markup, "html.parser") <NEW_LINE> try: <NEW_LINE> <INDENT> surface = html_parser.sup.parent.previous_sibling <NEW_LINE> return float(surface.replace("m2", "").strip().replace(",", ".").replace(" ", "")) <NEW_LINE> <DEDENT> except Attri...
Searches for surface in offer markup :param offer_markup: Class "sidebar" from offer page markup :type offer_markup: str :return: Surface or None if there is no surface :rtype: float, None :except: When there is no offer surface it will return None
625941f1d6c5a10208144604
@plugins.register <NEW_LINE> def slr_range_bias(dset): <NEW_LINE> <INDENT> return dset.range_bias
Calculate the station dependent range bias Args: dset: A dataset containing the data Returns: Numpy array: Bias for each observation in meters
625941f1e5267d203edce24a
def updateCanvas(image, hor, ver): <NEW_LINE> <INDENT> size = canvas1.CanvasSize <NEW_LINE> positionX = int(np.shape(image)[1]/100*hor) <NEW_LINE> positionY = int(np.shape(image)[0]/100*ver) <NEW_LINE> if positionX > np.shape(image)[1]-size[1]: <NEW_LINE> <INDENT> positionX = np.shape(image)[1]-size[1]-1 <NEW_LINE> <DE...
Draw a given image in the Canvas given the horizontal and vertical position. The image is buffered in a binary stream Parameters ---------- image : TYPE RGB image. hor : TYPE Initial horizontal position in the image. ver : TYPE Initial vertical position in the image. Returns ------- image : TYPE RGB i...
625941f107f4c71912b11a39
def __sub__(self, other): <NEW_LINE> <INDENT> from .agglimbs import AggTags <NEW_LINE> if isinstance(other, (AggTags, Tags, set, list)): <NEW_LINE> <INDENT> return set(self) - set(other) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise TypeError("Operands must be AggTags, tags, a set, or list.")
Return a set giving the Tags in `a` that are not in `b`.
625941f129b78933be1e5c59
def sharecontent(self, qclass, qclass2, rclass, options=('exo',), verbose=False, code=None, **kwargs): <NEW_LINE> <INDENT> params = { **self.params, **{ 'job': 'sharecontent', 'code': code if code else random_code(), 'qclass': qclass, 'rclass': rclass, 'option': ','.join(options), 'data1': qclass2, } } <NEW_LINE>...
Declares neighbour classes, allowing class "qclass" to share content with class "data1". Condition : Both 2 classes must be linked by. Parameters: qclass - (int) identifier of the class on the receiving server. qclass2 - (int) identifier of the second class on the receiving server. rclass - (str) identifi...
625941f17047854f462a19b7
def presses(self, press=True): <NEW_LINE> <INDENT> releases, presses, level = self._changes() <NEW_LINE> return presses if press else releases
Returns the number of presses since presses/releases were last queried. Button presses and releases are queued up - this function reads all the presses/releases from the queue and returns the total number of presses. Reading the full queue effectively resets the number of presses and releases to zero. Alternatively,...
625941f11f5feb6acb0c50fe
def prof_cswap(self): <NEW_LINE> <INDENT> for p, q, b in randargs(self.opts['prof_count'], [c_longlong, (16, 4)], [c_longlong, (16, 4)], [c_ubyte]): <NEW_LINE> <INDENT> P = ptr(c_longlong, p, (16, 4)) <NEW_LINE> Q = ptr(c_longlong, q, (16, 4)) <NEW_LINE> B = c_ubyte(b) <NEW_LINE> self.tweetnacl.call_fcn('cswap', P, Q, ...
test cswap functions
625941f15510c4643540f989
def load_config(): <NEW_LINE> <INDENT> filename = 'config.dev.json' <NEW_LINE> if 'PY_ENV' in os.environ: <NEW_LINE> <INDENT> if os.environ['PY_ENV'].lower() == 'production': <NEW_LINE> <INDENT> filename = 'config.prod.json' <NEW_LINE> <DEDENT> <DEDENT> filepath = os.path.dirname(__file__) +'/'+ filename <NEW_LINE> pr...
Loads application settings from config file based on environment variable PY_ENV; defaults to dev
625941f1f8510a7c17cf9cb5
def histsearch_start(buffer): <NEW_LINE> <INDENT> global saved_input, old_input, commands_pos <NEW_LINE> hook_all() <NEW_LINE> saved_input = w.buffer_get_string(buffer, "input") <NEW_LINE> w.buffer_set(buffer, "input", "") <NEW_LINE> old_input = None <NEW_LINE> commands_pos = 0
Start histsearch on buffer
625941f15fc7496912cc3f32
def get_func_name(f): <NEW_LINE> <INDENT> if isinstance(f, FunctionType): <NEW_LINE> <INDENT> return f.__name__ <NEW_LINE> <DEDENT> elif isinstance(f, partial): <NEW_LINE> <INDENT> return get_func_name(f.func) <NEW_LINE> <DEDENT> raise ValueError("Can't get func_name of provided function {}".format(f))
Recursively look for the original function's name. Works for both regular functions created with `def` as well as functions created with `functools.partial`.
625941f157b8e32f52483a53
def generateCsr(self, argsAPI): <NEW_LINE> <INDENT> return self._callServer('POST', '/api/actions/generate_csr', argsAPI)
generateCsr : Allows Syslog and TLS/HTTPS certificates to be uploaded and deleted. Basic information can also be viewed for certificates installed on the system. Sample usage: >>> nto.generateCsr({'csr_use' : 'SYSLOG', 'tls_cert_request_info' : {'city' : 'Austin', 'common_name' : 'Test API', 'country' : 'US', 'organiz...
625941f11d351010ab8560cf
@app.route('/predict',methods=['POST']) <NEW_LINE> def predict(): <NEW_LINE> <INDENT> int_features = [int(x) for x in request.form.values()] <NEW_LINE> final_features = [np.array(int_features)] <NEW_LINE> prediction = model.predict(final_features) <NEW_LINE> output = prediction[0] <NEW_LINE> if output == 0: <NEW_LINE> ...
For rendering results on HTML GUI
625941f155399d3f05588c6d
def can_contain(self, other): <NEW_LINE> <INDENT> return self.container and not self.ant and not other.container
*** YOUR CODE HERE ***
625941f1ad47b63b2c50a534
def test_name_repeat(self): <NEW_LINE> <INDENT> settingPage = SettingPage(self.driver, CompInfo.BASE_URL) <NEW_LINE> page = ContactPage(self.driver) <NEW_LINE> readExcel = ReadExcel(self.add_contact_data_dir) <NEW_LINE> alertPage = AlertPage(self.driver) <NEW_LINE> settingPage.go_to_contact_page() <NEW_LINE> add_contac...
8.往来信息-测试往来名称重复,保存失败
625941f121bff66bcd684f01
def MakeFlatRDFClass(self, value): <NEW_LINE> <INDENT> def Flatten(self, metadata, value_to_flatten): <NEW_LINE> <INDENT> if metadata: <NEW_LINE> <INDENT> self.metadata = metadata <NEW_LINE> <DEDENT> for desc in value_to_flatten.type_infos: <NEW_LINE> <INDENT> if desc.name == "metadata": <NEW_LINE> <INDENT> continue <N...
Generates flattened RDFValue class definition for the given value.
625941f176e4537e8c351c2c
def pcap_name(self, devname): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pcap_name = self.data[devname].pcap_name <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise ValueError("Unknown network interface %r" % devname) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return pcap_name
Return pcap device name for given Windows device name.
625941f18c3a873295158977
def __init__(self, name, layer_specs, activation_fn=leaky_relu, regularizer=None): <NEW_LINE> <INDENT> full_layer_specs = [] <NEW_LINE> for i, layer_spec in enumerate(layer_specs): <NEW_LINE> <INDENT> stride = 2 if i == 0 else 1 <NEW_LINE> full_layer_spec = [3, layer_spec[0], layer_spec[1], stride] <NEW_LINE> full_laye...
:param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimension consists of [num_output_features, dilation]. :param activation_fn: Tensorflow activation function. This will not be applied on the last c...
625941f12eb69b55b151ce6c
def cm_q(cm_i, l_t, mac): <NEW_LINE> <INDENT> cm_q = 2. * 1.1 * cm_i * l_t / mac <NEW_LINE> return cm_q
This calculates the damping in pitch coefficient Assumptions: None Source: J.H. Blakelock, "Automatic Control of Aircraft and Missiles" Wiley & Sons, Inc. New York, 1991, (pg 23) Inputs: cm_i [dimensionless] l_t [meters] mac [meters] Outputs: cm_q ...
625941f1cc40096d61595f02
def asteroidCollision(self, asteroids): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> for i in range(len(asteroids)): <NEW_LINE> <INDENT> if len(ret) == 0 or ret[-1] < 0 or (ret[-1] > 0) == (asteroids[i] > 0): <NEW_LINE> <INDENT> ret.append(asteroids[i]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> while len(ret) and ret[-1...
:type asteroids: List[int] :rtype: List[int]
625941f15f7d997b87175052
def get_next_month_start(key_date: Union['date', 'datetime']) -> 'date': <NEW_LINE> <INDENT> if key_date.month == 12: <NEW_LINE> <INDENT> next_month_start = date(key_date.year + 1, 1, 1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> next_month_start = date(key_date.year, key_date.month + 1, 1) <NEW_LINE> <DEDENT> retur...
获取下月开始日期
625941f13346ee7daa2b3326
def copy_depends_files(machine_name, machines_dir, output_dir, compiler): <NEW_LINE> <INDENT> makefiles_done = False <NEW_LINE> both = "{}.{}".format(machine_name, compiler) <NEW_LINE> for suffix in [both, machine_name, compiler]: <NEW_LINE> <INDENT> for extra_suffix in ["", ".cmake"]: <NEW_LINE> <INDENT> if extra_suff...
Copy any system or compiler Depends files if they do not exist in the output directory If there is a match for Depends.machine_name.compiler copy that and ignore the others
625941f1d58c6744b4258212
def overlay_mask(img_path, mask): <NEW_LINE> <INDENT> dicom = cv2.imread(img_path) <NEW_LINE> width, height = mask.shape <NEW_LINE> for i in range(width): <NEW_LINE> <INDENT> for j in range(height): <NEW_LINE> <INDENT> if mask[i, j]: <NEW_LINE> <INDENT> dicom[i, j] = [0, 60, 0] <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> cv2...
Overlays the mask over an input image source for better visualization. Arguments: img_path {string} -- Path to an image representation of the dicom file mask {np 2d binary array} -- Mask of the organ to be overlayedzation. Arguments: img_path {string} -- Path to an image representation of the dicom file ...
625941f12eb69b55b151ce6d
def is_nonterminal(sym: str) -> bool: <NEW_LINE> <INDENT> return not is_terminal(sym)
Used to check if a symbol is a valid nonterminal.
625941f132920d7e50b2878a
def rbegin(self): <NEW_LINE> <INDENT> return _osgAnimation.vectorVec2Keyframe_rbegin(self)
rbegin(vectorVec2Keyframe self) -> std::vector< osgAnimation::TemplateKeyframe< osg::Vec2f > >::reverse_iterator
625941f14428ac0f6e5badac
def sanitizeMatrix(M, eps = 10**-8, full = False): <NEW_LINE> <INDENT> rows, cols = M.shape <NEW_LINE> for i, row in enumerate(M): <NEW_LINE> <INDENT> for j, col in enumerate(row): <NEW_LINE> <INDENT> if not full: <NEW_LINE> <INDENT> diff = np.abs(col - round(col)) <NEW_LINE> if j < (cols-1): <NEW_LINE> <INDENT> if dif...
One inefficient attempt to avoid floating point errors. This checks every entry of a matrix to see if it is sufficiently close to some integer value. If it is, it rounds it to that integer. This is useful to run on matrices that have been manipulated and may be carrying floating point errors. Inputs: M: The matri...
625941f19b70327d1c4e138d
def get_higher_paid_employees(self) -> List[Employee]: <NEW_LINE> <INDENT> head = self.get_organization_head() <NEW_LINE> return head.get_employees_paid_more_than(self.salary)
Return a list of all employees in the Organization that are paid more than self.current_employee. Employees must be returned with IDs in increasing order.
625941f14a966d76dd5515ca
def test_negate(self): <NEW_LINE> <INDENT> t = ast.Constant(True) <NEW_LINE> f = ast.Constant(False) <NEW_LINE> n = ast.NegateOperator(t) <NEW_LINE> c, r = optimizer.optimization_pass(n) <NEW_LINE> assert c == 1 <NEW_LINE> assert isinstance(r, ast.Constant) <NEW_LINE> assert r.value == False <NEW_LINE> n = ast.NegateOp...
Test negation static analysis
625941f176e4537e8c351c2d
def findDateField(self, fields): <NEW_LINE> <INDENT> patterns = ['date$', '^date'] <NEW_LINE> for p in patterns: <NEW_LINE> <INDENT> for f in fields: <NEW_LINE> <INDENT> if re.search(p, f.name()): <NEW_LINE> <INDENT> return f.name() <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return ''
Find the field name that is most reasonable to use for date
625941f1f8510a7c17cf9cb6
def event_m10_10_111262(): <NEW_LINE> <INDENT> event_m10_10_x2(z161=104181, z162=10104100, z163=86, z164=7510) <NEW_LINE> Quit()
OBJ: Mapping: Grave
625941f1e1aae11d1e74a272
def clean_database(self, option): <NEW_LINE> <INDENT> if (option == 'electoral_roll'): <NEW_LINE> <INDENT> self.db[self.distelect_table_or_collection].delete_many({}) <NEW_LINE> self.db[self.elector_table_or_collection].delete_many({}) <NEW_LINE> <DEDENT> elif (option == 'stats'): <NEW_LINE> <INDENT> self.db[self.distr...
Cleans the database before to start the insertion process
625941f1090684286d50f2a4
def getNLL(self, feats): <NEW_LINE> <INDENT> if isinstance(feats,numpy.ndarray): <NEW_LINE> <INDENT> assert(len(feats.shape)==2) <NEW_LINE> return self.doGetNLL(feats) <NEW_LINE> <DEDENT> elif isinstance(feats,list): <NEW_LINE> <INDENT> if isinstance(feats[0],numpy.ndarray): <NEW_LINE> <INDENT> data = numpy.vstack(feat...
Given a set of features returns the negative log likelihood of the given features being generated by the model. Note that as the k-means model is not probabilistic this is technically wrong, but it hacks it by treating each cluster as a symmetric Gaussian with a standard deviation calculated using the provided features...
625941f1cad5886f8bd2758d
def get_in_dim(self) -> int: <NEW_LINE> <INDENT> return self.in_dim
Returns the dimension of the input Tensor that the decoder accepts.
625941f1bf627c535bc13784
def _clean_unicode(url): <NEW_LINE> <INDENT> urllist = list(urlsplit(url)) <NEW_LINE> netloc = urllist[1] <NEW_LINE> if _has_unicode(netloc): <NEW_LINE> <INDENT> domains = netloc.split(".") <NEW_LINE> for i, d in enumerate(domains): <NEW_LINE> <INDENT> if _has_unicode(d): <NEW_LINE> <INDENT> d = "xn--" + d.encode("puny...
Clean up URLs, which use punycode to handle unicode chars. Applies percent encoding to URL path and query if required. Parameters ---------- url : str URL that should be cleaned from unicode Returns ------- str Cleaned URL
625941f1167d2b6e31219149
def get_response(self,request): <NEW_LINE> <INDENT> if request.method.upper() == "GET": <NEW_LINE> <INDENT> resp = requests.get(request.url,headers=request.headers,params=request.params) <NEW_LINE> <DEDENT> elif request.method.upper() == "POST": <NEW_LINE> <INDENT> resp = requests.post(request.url,headers=request.heade...
实现结构请求对象,发送请求,获取响应 :param request: :return:
625941f17b25080760e39a0a
def shrinkage_multi(pdf, z, index, y, tupleLR): <NEW_LINE> <INDENT> l, r = tupleLR[0], tupleLR[1] <NEW_LINE> tmp = z.copy() <NEW_LINE> while 1: <NEW_LINE> <INDENT> u = np.random.rand() <NEW_LINE> sample = l + u * (r - l) <NEW_LINE> tmp[index] = sample <NEW_LINE> if y < pdf(tmp): <NEW_LINE> <INDENT> return sample <NEW_L...
Multidimension version of shrinkage.
625941f19c8ee82313fbbd2c
def AddMapping(self, filename, new_mapping): <NEW_LINE> <INDENT> for field in self._REQUIRED_MAPPING_FIELDS: <NEW_LINE> <INDENT> if field not in new_mapping: <NEW_LINE> <INDENT> raise problems.InvalidMapping(field) <NEW_LINE> <DEDENT> <DEDENT> if filename in self.GetKnownFilenames(): <NEW_LINE> <INDENT> raise problems....
Adds an entry to the list of known filenames. Args: filename: The filename whose mapping is being added. new_mapping: A dictionary with the mapping to add. Must contain all fields in _REQUIRED_MAPPING_FIELDS. Raises: DuplicateMapping if the filename already exists in the mapping InvalidMappi...
625941f1cc40096d61595f03
def check_constraints(self): <NEW_LINE> <INDENT> threading.Timer(60.0, self.check_constraints).start() <NEW_LINE> now = datetime.now() <NEW_LINE> print("checking constraints...", now) <NEW_LINE> self.regulate_ww()
check if all obey the rule
625941f145492302aab5e87e
def _pmf(pmf, **options): <NEW_LINE> <INDENT> xs, ps = pmf._render() <NEW_LINE> if pmf.name: <NEW_LINE> <INDENT> options = _under_ride(options, label=pmf.name) <NEW_LINE> <DEDENT> _plot(xs, ps, **options)
Plots a Pmf or Hist as a line. Args: pmf: Hist or Pmf object options: keyword args passed to pyplot.plot
625941f1b7558d58953c54bc
def randint(self, a, b): <NEW_LINE> <INDENT> assert a <= b, "a must be <= b." <NEW_LINE> r = self._generator.random() * (b - a + 1) + a <NEW_LINE> return int(r)
Returns a random integer in [a, b].
625941f13617ad0b5ed684ab
def __init__(self, incoming_queue): <NEW_LINE> <INDENT> super(WindowsServicesPlugin, self).__init__(incoming_queue) <NEW_LINE> self._output_format = u'text' <NEW_LINE> self._service_collection = WindowsServiceCollection()
Initializes the Windows Services plugin Args: incoming_queue: A queue to read events from.
625941f13c8af77a43ae3d5c
def clear_statistics(self, sniff_port_list): <NEW_LINE> <INDENT> pass
Clear statistics - number of frames. Args: sniff_port_list(list): List of interface names. Returns: None
625941f1de87d2750b86034e
@app.route('/register', methods=['GET', 'POST']) <NEW_LINE> def register(): <NEW_LINE> <INDENT> session.clear() <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> username, password, confirmation = ( request.form.get('username'), request.form.get('password'), request.form.get('confirmation') ) <NEW_LINE> if no...
Register user
625941f1091ae3566866750a
def classify(self, tweet): <NEW_LINE> <INDENT> return None
Must be implemented by subclass :param tweet: Preprocessed tweet to classify :return: A string that is either "positive", "negative" or "neutral"
625941f14f88993c3716c616
def lines(self, formset): <NEW_LINE> <INDENT> lines = [] <NEW_LINE> lines.append([str(key) for key in self._map.values()]) <NEW_LINE> if isinstance(formset, list): <NEW_LINE> <INDENT> forms = formset <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> forms = formset.forms <NEW_LINE> <DEDENT> for form in forms: <NEW_LINE> <I...
Dumps to a list of lines
625941f1bf627c535bc13785
def max_pool_backward_naive(dout, cache): <NEW_LINE> <INDENT> dx = None <NEW_LINE> x, pool_param = cache <NEW_LINE> pool_height = pool_param['pool_height'] <NEW_LINE> pool_weight = pool_param['pool_width'] <NEW_LINE> stride = pool_param['stride'] <NEW_LINE> _, _, out_height, out_weight = dout.shape <NEW_LINE> dx = np.z...
A naive implementation of the backward pass for a max pooling layer. Inputs: - dout: Upstream derivatives - cache: A tuple of (x, pool_param) as in the forward pass. Returns: - dx: Gradient with respect to x
625941f1566aa707497f4b15
def undistinguish(self): <NEW_LINE> <INDENT> self.distinguish(how="no")
Remove mod, admin, or special distinguishing from an object. Also unstickies the object if applicable. Example usage: .. code-block:: python # undistinguish a comment: comment = reddit.comment('dkk4qjd') comment.mod.undistinguish() # undistinguish a submission: submission = reddit.submission(id='5or8...
625941f163d6d428bbe44aa6
def test_filter_complete(self): <NEW_LINE> <INDENT> self.assertRaises( Exception, navigator.filter_complete, None )
Tests the filter_complete
625941f1796e427e537b0b80
def flatten(items, seq_types=(list, tuple)): <NEW_LINE> <INDENT> for c, item in enumerate(items): <NEW_LINE> <INDENT> while c < len(items) and isinstance(items[c], seq_types): <NEW_LINE> <INDENT> items[c : c + 1] = items[c] <NEW_LINE> <DEDENT> <DEDENT> return items
convert nested list to flat list
625941f115baa723493c452f
def list_available_ssl_predefined_policies( self, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_version = "2020-07-01" <...
Lists all SSL predefined policies for configuring Ssl policy. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGatewayAvailableSslPredefinedPolicies or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure...
625941f1a219f33f34628f16
def __init__(self, device, channel, pulseLength, pulseSpacing, pulseRepeat): <NEW_LINE> <INDENT> self.taskHandle = TaskHandle(0) <NEW_LINE> self.device = device <NEW_LINE> self.channelName = "Dev1/port0/line1,Dev1/port0/line0" <NEW_LINE> CHK(nidaq.DAQmxCreateTask("PulseOut",ctypes.byref(self.taskHandle))) <NEW_LINE> CH...
Set up a voltage measurement task
625941f13cc13d1c6d3c792c
def insert(self, intervals, newInterval): <NEW_LINE> <INDENT> if not intervals: <NEW_LINE> <INDENT> return [newInterval] <NEW_LINE> <DEDENT> s,b= newInterval.start, newInterval.end <NEW_LINE> left=right=[] <NEW_LINE> for i in range(len(intervals)): <NEW_LINE> <INDENT> if intervals[i].end>=newInterval.start: <NEW_LINE> ...
:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]
625941f115baa723493c4530
def _create_widgets(self): <NEW_LINE> <INDENT> self.create_interpolation() <NEW_LINE> self.create_layout() <NEW_LINE> self.create_view() <NEW_LINE> self.pack_start(self._box_interpolation, False, False) <NEW_LINE> self.pack_start(self._box_layout, False, False) <NEW_LINE> self.pack_start(self._box_view, False, False)
Design all
625941f1377c676e9127275c
def make_random_matrix(n): <NEW_LINE> <INDENT> tm = np.random.random((n, n)) <NEW_LINE> return normalise_by_row(tm)
Make a random transition matrix on n points.
625941f1dc8b845886cb5aec
def calculate_page_limit_and_offset( paginate: bool, page_size: int, page: int, result_length: int, offset: int, limit: int, ) -> Tuple[int, int]: <NEW_LINE> <INDENT> if limit is not None: <NEW_LINE> <INDENT> page_size = limit <NEW_LINE> <DEDENT> if paginate is True: <NEW_LINE> <INDENT> if offset is None: <NEW_LINE> <I...
Calculate page limit and offset for pagination. :param paginate: Showing whether pagination is enable/disable. :param page_size: Number maximum elements showed in a page. :param page: page number. :param result_length: Length of the list containing desired elements. :param offset: offset value. :param limit: page limit...
625941f1c4546d3d9de72fef
@commandWrap <NEW_LINE> def HypershadeConvertToFileTextureOptionBox(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.HypershadeConvertToFileTextureOptionBox(*args, **kwargs)
:rtype: list|str|DagNode|AttrObject|ArrayAttrObject|Components1Base
625941f13cc13d1c6d3c792d
def category_detail(request, slug_rubric, pk): <NEW_LINE> <INDENT> context = {} <NEW_LINE> category_qs = Category.objects.filter( pk=pk, rubric_id__slug=slug_rubric ).first() <NEW_LINE> adv_qs = Advertisement.objects.all() <NEW_LINE> context['adv_list'] = adv_qs <NEW_LINE> context['category'] = category_qs <NEW_LINE> r...
Детальная информация о категории
625941f16fb2d068a760f65c
def set_current_seed(self, seed): <NEW_LINE> <INDENT> r <NEW_LINE> if self.contains_seed(seed): <NEW_LINE> <INDENT> self._seed = seed <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError("This is not a seed in this cluster algebra.")
Set ``self._seed`` to ``seed`` if it makes sense.
625941f124f1403a92601116
def __init__(self, mapper='default', version='1.0', distribution=None): <NEW_LINE> <INDENT> self.distribution_raw = distribution <NEW_LINE> super(Distribution, self).__init__(_wrapper_type='distribution', _mapper=mapper, _version=version)
Init de la clase Distribution().
625941f191af0d3eaac9bfd4
def testScheduledDeletionCallsRemoveActor(self): <NEW_LINE> <INDENT> self.w.addZone(self.z1) <NEW_LINE> self._sched_done = 0 <NEW_LINE> self.a1.linkEvent(serge.events.E_REMOVED_FROM_WORLD, self._sched1) <NEW_LINE> self.w.scheduleActorRemoval(self.a1) <NEW_LINE> self.w.updateWorld(1000) <NEW_LINE> self.assertEqual(1, se...
testScheduledDeletionCallsRemoveActor: should still call remove actor event when scheduled
625941f124f1403a92601117
def test_get_gains(self): <NEW_LINE> <INDENT> pass
Test case for get_gains Monthly Gain # noqa: E501
625941f166673b3332b92646
@pytest.mark.parametrize( "columns", [ [(True, "a"), (True, "b"), (True, "c")], [(True, "a"), (True, "b")], [(False, "a"), (False, "b"), (True, "c")], [(False, "a"), (True, "c")], ], ) <NEW_LINE> def test_mixed_columns_not_from_df(columns): <NEW_LINE> <INDENT> def get_columns(df): <NEW_LINE> <INDENT> return [(df[name] ...
Unlike the previous test, in this case the Series is not just a column from the original DataFrame, so you can't use a fasttrack.
625941f18a349b6b435e8728
def match_preferences(self, pcr=None, issuer=None): <NEW_LINE> <INDENT> if not pcr: <NEW_LINE> <INDENT> pcr = self.provider_info[issuer] <NEW_LINE> <DEDENT> for _pref, _prov in PREFERENCE2PROVIDER.items(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> vals = self.client_prefs[_pref] <NEW_LINE> <DEDENT> except KeyError: ...
Match the clients preferences against what the provider can do. :param pcr: Provider configuration response if available :param issuer: The issuer identifier
625941f1442bda511e8be9c5
def _get_as_path_options(self): <NEW_LINE> <INDENT> return self.__as_path_options
Getter method for as_path_options, mapped from YANG variable /bgp/neighbors/neighbor/as_path_options (container) YANG Description: AS_PATH manipulation parameters for the BGP neighbor or group
625941f166673b3332b92647
def test_can_search_with_pagination(self): <NEW_LINE> <INDENT> PostFactory.create_batch( 40, topic=self.topic_1, poster=self.user, content=self.post_1.content ) <NEW_LINE> management.call_command('rebuild_index', interactive=False) <NEW_LINE> correct_url = reverse('forum_search:search') <NEW_LINE> expected_string = str...
Check that pagination has well formed links
625941f1d18da76e23532a93
def get_fastq_dxfile_objects(self,barcode=None): <NEW_LINE> <INDENT> bc_reg = re.compile("[ACGT]{6,}-[ACGT]{6,}",re.I) <NEW_LINE> fq_ext_glob = "*{}".format(self.FQEXT) <NEW_LINE> name = fq_ext_glob <NEW_LINE> fastqs = list(dxpy.find_data_objects(project=self.dx_project_id,folder=self.DX_FASTQ_FOLDER,name=name,name_mod...
Retrieves all the FASTQ files in project self.dx_project_name as DXFile objects. Args: barcode: `str`. If set, then only FASTQ file properties for FASTQ files having the specified barcode are returned. Returns: `list` of DXFile objects representing FASTQ files. Raises: `dnanexus_utils.FastqNotFound`: No...
625941f1ec188e330fd5ad48
def sigmoid(x): <NEW_LINE> <INDENT> return 1 / (1 + math.exp(-x))
Apply the sigmoid function. Args: x (float): The value to apply the sigmoid to.
625941f173bcbd0ca4b2c62b
def search_for_procedures(index: int, xs: str, procedure: str = "subroutine") -> Optional[Tuple[int, int]]: <NEW_LINE> <INDENT> start = re.search(f" {procedure}", xs[index:]) <NEW_LINE> if start is not None: <NEW_LINE> <INDENT> end = re.search(r"(?i) end\s*\n", xs[index + start.start():]) <NEW_LINE> return in...
Search for string slice containing the procedure.
625941f11b99ca400220b06a
def getType(self) -> typing.Type['transports.Transport']: <NEW_LINE> <INDENT> return transports.factory().lookup(self.data_type) or transports.Transport
Get the type of the object this record represents. The type is Python type, it obtains this type from TransportsFactory and associated record field. Returns: The python type for this record object :note: We only need to get info from this, not access specific data (class specific info)
625941f130bbd722463cc37f
def _restore(self, builder): <NEW_LINE> <INDENT> builder.with_trashed() <NEW_LINE> return builder.update({ builder.get_model().get_deleted_at_column(): None })
The restore extension. :param builder: The query builder :type builder: orator.orm.builder.Builder
625941f1435de62698dfe203
def vector(x, y, z): <NEW_LINE> <INDENT> return np.array([x, y, z])
A shortcut for creating 3D-space vectors; in case you need a lot of manual np.array([...])
625941f156ac1b37e6264779
def get_value(self, node): <NEW_LINE> <INDENT> if not isinstance(node, ast.Dict): <NEW_LINE> <INDENT> raise TypeError("must be a dictionary") <NEW_LINE> <DEDENT> evaluator = SafeEvaluator() <NEW_LINE> try: <NEW_LINE> <INDENT> value = evaluator.run(node) <NEW_LINE> <DEDENT> except Exception as ex: <NEW_LINE> <INDENT> ra...
Convert value from an AST node.
625941f14e4d5625662d4985
def process_install(request): <NEW_LINE> <INDENT> if config.get_bool("app_installed", True): <NEW_LINE> <INDENT> return redirect("/") <NEW_LINE> <DEDENT> form = forms.InstallForm(request.POST) <NEW_LINE> if not form.is_valid(): <NEW_LINE> <INDENT> save_form(request, form) <NEW_LINE> return redirect("/install") <NEW_LIN...
Processes the application installation form. :return: Response
625941f1293b9510aa2c3846
def test_add_keyvalue_request_data(self): <NEW_LINE> <INDENT> self.sdp.add_keyvalue('AAS', '?') <NEW_LINE> d = self.sdp.get_data('AAS') <NEW_LINE> self.assertTrue(isinstance(d, str)) <NEW_LINE> self.assertEqual(d, '?') <NEW_LINE> self.assertEqual(self.sdp.get_data('AAs'), None) <NEW_LINE> self.assertEqual(self.sdp.get_...
Test setting/getting key:val where val == '?'
625941f107d97122c4178e4f
def make_pfp(fleamarkets): <NEW_LINE> <INDENT> return json.dumps(fleamarkets, indent=4)
To convert the list into .pfp format.
625941f1b5575c28eb68e5bc
def p_object_dim_list_empty(p): <NEW_LINE> <INDENT> p[0] = []
object_dim_list : empty
625941f13346ee7daa2b3327
def estimate_pee(self, cand, seed): <NEW_LINE> <INDENT> p_all = {} <NEW_LINE> body = self.generate_search_body_multi(seed) <NEW_LINE> n_e = self.__tes.estimate_number_complex(body) <NEW_LINE> for entity in cand: <NEW_LINE> <INDENT> body = self.generate_search_body_multi([entity]) <NEW_LINE> n_e_i = self.__tes.estimate_...
Estimate P(c|e_i+1) for candidates
625941f1e1aae11d1e74a273
def _checkError(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.target.halt() <NEW_LINE> pc = self.target.readCoreRegister('pc') <NEW_LINE> hardFault = 0x000 <NEW_LINE> WrongRes = 0x000 <NEW_LINE> if pc == hardFault: <NEW_LINE> <INDENT> self.hardFault = 1 <NEW_LINE> logging.info("----HardFault----") <NEW_LINE>...
Function to check if the injected fault had an effect
625941f1d10714528d6002a0