code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def pc_output_buffers_full_avg(self, *args): <NEW_LINE> <INDENT> return _blocks_swig2.deinterleave_sptr_pc_output_buffers_full_avg(self, *args)
pc_output_buffers_full_avg(deinterleave_sptr self, int which) -> float pc_output_buffers_full_avg(deinterleave_sptr self) -> pmt_vector_float
625941d68e71fb1e9831d9d6
def includeme(config): <NEW_LINE> <INDENT> config.commit() <NEW_LINE> log.debug('Loading participants discussion API') <NEW_LINE> config.scan('caliopen_api.discussion.participants')
Serve discussion related REST API.
625941d6498bea3a759b9cdc
def _validate_and_reorder_params( parts: List[QueryPart], vars: Params, order: Optional[List[str]] ) -> Sequence[Any]: <NEW_LINE> <INDENT> t = type(vars) <NEW_LINE> if t is list or t is tuple: <NEW_LINE> <INDENT> sequence = True <NEW_LINE> <DEDENT> elif t is dict: <NEW_LINE> <INDENT> sequence = False <NEW_LINE> <DEDENT...
Verify the compatibility between a query and a set of params.
625941d6009cb60464c635dd
def get(self, user_id): <NEW_LINE> <INDENT> abort_if_user_doesnt_exist(user_id) <NEW_LINE> user_items = copy.deepcopy(db.USERS[user_id]) <NEW_LINE> user_items['items_bid'] = list(set([db.BIDS[i]['bid']['item'] for i in db.USERBIDS[user_id]])) <NEW_LINE> return user_items
Get list of all items that this user bid on --- parameters: - name: user_id in: path description: User identification type: string required: true responses: 200: description: List of items that this user bid on examples: user: { "name": "Albert", "items_bid": [ "item1" ] }
625941d6d8ef3951e324376a
def display(self, size_map, lvl, item, character, win, loose): <NEW_LINE> <INDENT> pygame.draw.rect(self.screen, (128, 128, 128), (0, 0, self.size[0], self.size[1])) <NEW_LINE> for j in range(0, len(size_map)): <NEW_LINE> <INDENT> for i in range(0, size_map[j]): <NEW_LINE> <INDENT> a = lvl[(i, j)].data <NEW_LINE> self....
display the game
625941d65fc7496912cc3bab
def gen_key(self, prefix='', suffix=''): <NEW_LINE> <INDENT> return self.mirror_devices[0].gen_key(prefix, suffix)
使用uuid生成一个未使用的key, 生成随机的两级目录 :param prefix: 可选前缀 :param suffix: 可选后缀 :return: 设备唯一的key
625941d650485f2cf553cfc8
def mac_move_detect_enable(self, **kwargs): <NEW_LINE> <INDENT> callback = kwargs.pop('callback', self._callback) <NEW_LINE> mac_move = getattr(self._mac_address_table, 'mac_address_table_mac_move_mac_move_' 'detect_enable') <NEW_LINE> config = mac_move() <NEW_LINE> if kwargs.pop('get', False): <NEW_LINE> <INDENT> outp...
Enable mac move detect enable on vdx switches Args: get (bool): Get config instead of editing config. (True, False) delete (bool): True, delete the mac-move-detect-enable. (True, False) callback (function): A function executed upon completion of the method. The only parameter pas...
625941d6cdde0d52a9e53261
def flip_coin(): <NEW_LINE> <INDENT> return random.randint(0, 1)
:return: a coin flip - random integer between 0 and 1 if 1 - the coin lands on heads if 0 - the coin lands on tails
625941d6187af65679ca534c
def __init__(self, text, window, lang_en, def_counter): <NEW_LINE> <INDENT> QtCore.QObject.__init__(self) <NEW_LINE> self.word_list = re.split('\s', text) <NEW_LINE> self.window = window <NEW_LINE> self.sentence_list = regex.split("(?V1)(?<=\.|:|;|-|,|\!)", text) <NEW_LINE> self.sentence_list = self.join_short_sentence...
:param text: Complete tale/story :param window: Story_UI window
625941d676d4e153a657ed5f
def test_post_answer_to_question(self): <NEW_LINE> <INDENT> response = self.client.post("/api/v1/questions", content_type='application/json', data=json.dumps(self.question)) <NEW_LINE> self.assertEqual(response.status_code, 201) <NEW_LINE> res = self.client.post("api/v1/questions/1/answers", content_type='application/j...
tests that a user can post an answer to an existing question
625941d6d18da76e23532705
def build_eval_session(model_info, class_count): <NEW_LINE> <INDENT> eval_graph, bottleneck_tensor, _ = create_model_graph(model_info) <NEW_LINE> eval_sess = tf.Session(graph=eval_graph) <NEW_LINE> with eval_graph.as_default(): <NEW_LINE> <INDENT> (_, _, bottleneck_input, ground_truth_input, final_tensor) = add_final_r...
Builds an restored eval session without train operations for exporting. Args: model_info: Model info dictionary from create_model_info() class_count: Number of classes Returns: Eval session containing the restored eval graph. The bottleneck input, ground truth, eval step, and prediction tensors.
625941d615baa723493c41a4
def _get_year_from_request(request): <NEW_LINE> <INDENT> return convert_to_int(request.matchdict['year'], datetime.date.today().year)
Retrieve the current year from the request Usefull for ExpenseKmType edition :param obj request: The Pyramid request object :returns: A year :rtype: int
625941d6d58c6744b4257e8c
def gmt_file_converter(): <NEW_LINE> <INDENT> with open("/home/mate/code/ed/src/data/cav1ko/KEGG_2016_EV_Vesi.gmt","r") as inF: <NEW_LINE> <INDENT> with open("/home/mate/code/ed/src/data/cav1ko/KEGG_2016_EV_Vesi_short.gmt","w") as outF: <NEW_LINE> <INDENT> for inLine in inF: <NEW_LINE> <INDENT> inL = inLine.split("_Hom...
remove _homo sapiens_hsaxxx tags from group names to get shorter descriptions
625941d6a219f33f34628b94
def edit_article(request): <NEW_LINE> <INDENT> return None
Render the page for editing an article Should require the log on user be the author of this article
625941d610dbd63aa1bd2dd0
def create_file(cls=File, dataset=None): <NEW_LINE> <INDENT> if dataset is None: <NEW_LINE> <INDENT> dataset = create_dataset() <NEW_LINE> <DEDENT> name = _get_random_text() <NEW_LINE> return cls.objects.create(dataset=dataset, name=name)
Create a File instance with a random name. :param cls: (Optional) The type of data file to instantiate (default: `File`). :type cls: File :param dataset: The dataset to which the new file is to be added. If None, a new randomised dataset is created. :type dataset: Dataset :return: The const...
625941d6dc8b845886cb5763
def apply_operation(self, symmop): <NEW_LINE> <INDENT> def operate_site(site): <NEW_LINE> <INDENT> new_cart = symmop.operate(site.coords) <NEW_LINE> return Site(site.species_and_occu, new_cart, properties=site.properties) <NEW_LINE> <DEDENT> self._sites = [operate_site(s) for s in self._sites]
Apply a symmetry operation to the molecule. Args: symmop (SymmOp): Symmetry operation to apply.
625941d63539df3088e2e578
def render_template_block_nodelist(nodelist, block, context): <NEW_LINE> <INDENT> for node in nodelist: <NEW_LINE> <INDENT> if isinstance(node, BlockNode) and node.name == block: <NEW_LINE> <INDENT> return node.render(context) <NEW_LINE> <DEDENT> for key in ('nodelist', 'nodelist_true', 'nodelist_false'): <NEW_LINE> <I...
Searches a template and any extended parent templates for a block with the given name and renders it.
625941d6d6c5a10208144279
@register() <NEW_LINE> def delete_orphans(path=None): <NEW_LINE> <INDENT> printed_header = False <NEW_LINE> if path is None: <NEW_LINE> <INDENT> path = Path.cwd() <NEW_LINE> <DEDENT> timestamp = datetime.now().timestamp() <NEW_LINE> threshold = 60 * 60 * 24 * 10 <NEW_LINE> for filepath in path.glob('**/.*.un~'): <NEW_L...
Delete orphaned vim undo (.*.un~) files. Parameters: path (Path): The directory to clear of orphans.
625941d6dd821e528d63b3d5
def _test_convolution3d( opname, tensor_in_sizes, filter_in_sizes, dilations, strides, padding, data_format, deconv_output_shape=[], add_shapes_to_graph_def=True, ): <NEW_LINE> <INDENT> total_size_1 = np.prod(tensor_in_sizes) <NEW_LINE> total_size_2 = np.prod(filter_in_sizes) <NEW_LINE> data_array = [f * 1.0 for f in r...
One iteration of 3D convolution with given shapes and attributes
625941d64c3428357757c555
def setup(hass, config): <NEW_LINE> <INDENT> pub_topic = config[DOMAIN].get("publish_topic", DEFAULT_TOPIC) <NEW_LINE> global PAYLOAD <NEW_LINE> PAYLOAD = dict(states=None, details=None) <NEW_LINE> PAYLOAD["details"] = hass.config.as_dict() <NEW_LINE> def mqtt_event_listener(event): <NEW_LINE> <INDENT> state = event.da...
Set up the MQTT export component.
625941d623849d37ff7b32bc
def process_view(self, request, callback, callback_args, callback_kwargs): <NEW_LINE> <INDENT> if self.is_enabled(request) and corsheaders_settings.CORS_REPLACE_HTTPS_REFERER: <NEW_LINE> <INDENT> self._https_referer_replace(request) <NEW_LINE> <DEDENT> return None
Do the referer replacement here as well
625941d69b70327d1c4e1003
def geo_color_map(self): <NEW_LINE> <INDENT> cmaplist = [(0.5, 0.5, 0.5), (1, 1, 1), (0, 0, 0)] <NEW_LINE> boundaries = [-0.5, 0.5, 1.5, 2.5] <NEW_LINE> cmap = mpl.colors.LinearSegmentedColormap.from_list( 'custom_cmap', cmaplist, N=len(cmaplist)) <NEW_LINE> norm = mpl.colors.BoundaryNorm(boundaries, cmap.N, clip=True)...
Returns colormap for geographic background. Water (white), land (grey), uninhabitable landcells (black).
625941d6ab23a570cc2503b1
def set_page_context(self, page_context): <NEW_LINE> <INDENT> self.page_context = page_context
Set page context. Args: page_context(instance): Page context object.
625941d68da39b475bd651a3
def _get_next_link(self, request, identifier, collection_name): <NEW_LINE> <INDENT> params = request.params.copy() <NEW_LINE> params["marker"] = identifier <NEW_LINE> prefix = self._update_link_prefix(get_request_url(request), CONF.public_endpoint) <NEW_LINE> url = os.path.join(prefix, request.environ["cinder.context"]...
Return href string with proper limit and marker params.
625941d6566aa707497f4794
def advice(aa): <NEW_LINE> <INDENT> for ab in aa.split(): <NEW_LINE> <INDENT> if ab.lower() in advice_questions: <NEW_LINE> <INDENT> return rndm.choice(advice_reply)
If a user asks for health advice or tips, then bot wil reply with an randomly generated advice
625941d6cc0a2c11143dd0be
def TR2(rv): <NEW_LINE> <INDENT> rv = bottom_up(rv, TR2) <NEW_LINE> if rv.func is tan: <NEW_LINE> <INDENT> a = rv.args[0] <NEW_LINE> return sin(a)/cos(a) <NEW_LINE> <DEDENT> elif rv.func is cot: <NEW_LINE> <INDENT> a = rv.args[0] <NEW_LINE> return cos(a)/sin(a) <NEW_LINE> <DEDENT> return rv
Replace tan and cot with sin/cos and cos/sin Examples ======== >>> from sympy.simplify.fu import TR2 >>> from sympy.abc import x >>> from sympy import tan, cot, sin, cos >>> TR2(tan(x)) sin(x)/cos(x) >>> TR2(cot(x)) cos(x)/sin(x) >>> TR2(tan(tan(x) - sin(x)/cos(x))) 0
625941d6097d151d1a223086
def _get_line_specs_and_lpoint_specs(self, guids): <NEW_LINE> <INDENT> line_specs = [] <NEW_LINE> lpoint_specs = [] <NEW_LINE> line_type = 4 <NEW_LINE> textdot_type = 8192 <NEW_LINE> for guid in guids: <NEW_LINE> <INDENT> guid_type = rs.ObjectType(guid) <NEW_LINE> if guid_type == line_type: <NEW_LINE> <INDENT> line_spe...
Receives a list of line or textdot guids: [guid, ...] Returns a list of coord-coord pairs and a list of coord-label pairs: ( [((num, num, num), (num, num, num)), ...], [((num, num, num), str), ...] )
625941d6a05bb46b383eca4f
def get(self, pid=None, gid=None): <NEW_LINE> <INDENT> if pid is not None: <NEW_LINE> <INDENT> _id = bson.ObjectId(pid) <NEW_LINE> if not self.app.db.projects.find_one({'_id': _id}): <NEW_LINE> <INDENT> self.abort(404, 'no such project') <NEW_LINE> <DEDENT> query = {'project': _id} <NEW_LINE> <DEDENT> elif gid is not N...
Return the list of project or group sessions.
625941d67d847024c06be4ec
def build_schema(): <NEW_LINE> <INDENT> return schema.load('Python.asdl')
Build a schema from Python.asdl
625941d601c39578d7e75069
def to_cybox_observable(self, exclude=None): <NEW_LINE> <INDENT> if exclude == None: <NEW_LINE> <INDENT> exclude = [] <NEW_LINE> <DEDENT> observables = [] <NEW_LINE> obj = EmailMessage() <NEW_LINE> obj.header = EmailHeader() <NEW_LINE> if 'message_id' not in exclude: <NEW_LINE> <INDENT> obj.header.message_id = String(s...
Convert an email to a CybOX Observables. Pass parameter exclude to specify fields that should not be included in the returned object. Returns a tuple of (CybOX object, releasability list). To get the cybox object as xml or json, call to_xml() or to_json(), respectively, on the resulting CybOX object.
625941d655399d3f055888e2
def dismiss_setup_message(opp): <NEW_LINE> <INDENT> opp.components.persistent_notification.dismiss(HOMEKIT_NOTIFY_ID)
Dismiss persistent notification and remove QR code.
625941d631939e2706e4d095
def test_list_user_accounts(self): <NEW_LINE> <INDENT> self.client.force_login(user=self.admin_user) <NEW_LINE> response = self.client.get( "/api/accounts/getAll" ) <NEW_LINE> self.assertEqual( response.status_code, 200 ) <NEW_LINE> response_json = response.json() <NEW_LINE> self.assertEqual(len(response_json), 1) <NEW...
Test that all user accounts are listed excluding super users.
625941d630c21e258bdfa6cc
def __defaults__(self): <NEW_LINE> <INDENT> self.propellant = None <NEW_LINE> self.oxidizer = None <NEW_LINE> self.number_of_engines = 0.0 <NEW_LINE> self.efficiency = .37 <NEW_LINE> self.volume = 0.0 <NEW_LINE> self.rated_power = 0.0 <NEW_LINE> self...
This sets the default values for the component to function. Assumptions: None Source: https://new.siemens.com/global/en/products/energy/power-generation/gas-turbines/sgt-a30-a35-rb.html Inputs: None Outputs: None Properties Used: None
625941d6a17c0f6771cbe27e
def __check_data_type(self, data_type: Union[str, int, Flag, None]): <NEW_LINE> <INDENT> if data_type is None: <NEW_LINE> <INDENT> instance_example, _, _ = self.__getitem__(index=0) <NEW_LINE> data_type = self.__estimate_data_type(instance_example) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> data_type = get_correspon...
AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Check the data type If the data type given is None we try to estimate it (errors can occur with complex types) Else we directly get the data type given by the user PARAMETERS: ----------- :param data_type (Union[str, int, None]: The data type in a raw...
625941d6b5575c28eb68e22f
def delete_tags(configurationIds=None, tags=None): <NEW_LINE> <INDENT> pass
Deletes the association between configuration items and one or more tags. This API accepts a list of multiple configuration items. See also: AWS API Documentation Exceptions :example: response = client.delete_tags( configurationIds=[ 'string', ], tags=[ ...
625941d621a7993f00bc7f20
def getEigen(i_array): <NEW_LINE> <INDENT> evals, evecs = np.linalg.eigh(i_array, UPLO='U') <NEW_LINE> eigen = sortEigen(evals, evecs) <NEW_LINE> return eigen
Calculates the eigenvalues and eigenvectors in descending order as 1D and 2D arrays, respectively. Inputs ------ i_array - Array type that contains the original dataset of a numeric type or the variance-covariance matrix of original dataset. Outputs ------- Returns the sorted (in descending order) eigen...
625941d61b99ca400220ace0
def set_endtime(self, endtime): <NEW_LINE> <INDENT> self.endsAt = maya.when(endtime).rfc3339()
Set an endtime for the alert. Alert Manager has a default configuration for the amount of time an Alert will persist beyond it's firing. This method allows us to specify the endsAt key with a datetime string in order to specify how long our alerts should persist beyond their first firing. Parameters ---------- endtim...
625941d6e8904600ed9f215d
def generate(self, image_format='PNG'): <NEW_LINE> <INDENT> height = self.cleaned_data['height'] <NEW_LINE> width = self.cleaned_data['width'] <NEW_LINE> key = '{}.{}.{}'.format(width, height, image_format) <NEW_LINE> content = cache.get(key) <NEW_LINE> if content is None: <NEW_LINE> <INDENT> image = Image.new('RGB', (...
Generate an image of the given type and return as raw bytes.
625941d6462c4b4f79d1d8fe
def spiralOrder(self, matrix): <NEW_LINE> <INDENT> if not matrix: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> m, n = len(matrix), len(matrix[0]) <NEW_LINE> min_r, max_r = 0, m-1 <NEW_LINE> min_c, max_c = 0, n-1 <NEW_LINE> r, c = 0, 0 <NEW_LINE> direction = 'Right' <NEW_LINE> ans = [] <NEW_LINE> for _ in range(m*n): ...
:type matrix: List[List[int]] :rtype: List[int]
625941d6ec188e330fd5a9ca
def __init__(self, symbol, data_point, i): <NEW_LINE> <INDENT> self.symbol = symbol <NEW_LINE> self.data_point = data_point <NEW_LINE> self.iteration = i <NEW_LINE> data = ut.read_price_from_csv(symbol, self.data_point, i) <NEW_LINE> self.__time__ = [ut.convert_to_time(i) for i in data[0]] <NEW_LINE> self.__bars__ = da...
Constructor of the class :param symbol: symbol name :param bars: historical prices :param short_window: short period looking back in time :param long_window: long period looking back in time :return: N/A
625941d697e22403b379d1c9
def processhitran(hfile, scutoff=1e-20, vabmin=3250, vabmax=3800): <NEW_LINE> <INDENT> hdata = filterhitran(hfile, scutoff, vabmin, vabmax) <NEW_LINE> vab = atm.WAVENUM_TO_HZ*hdata['wnum_ab'] <NEW_LINE> Aba = hdata['A'] <NEW_LINE> ga = hdata['g_low'] <NEW_LINE> gb = hdata['g_up'] <NEW_LINE> Bba = oh.b21(Aba, vab) <NEW_...
Extract parameters needed for IR-UV LIF kinetics modeling from HITRAN file. Extract N quantum numbers, UV energies, Einstein coefficients, Doppler broadening, quenching rate constants, beam parameters. Use functions and parameters in 'atmcalcs' and 'ohcalcs' modules. Parameters: ----------- hfile : str Input HITRAN ...
625941d630bbd722463cbff5
def query_file_hash(self, hash_value=None, algorithm=None, block_size=None, md5=None, sha1=None, sha256=None, mmh3=None, raw=False): <NEW_LINE> <INDENT> if (mmh3 or (algorithm and algorithm.lower() == 'mmh3')) and self.__logger: <NEW_LINE> <INDENT> self.__logger.warning( "No results will be returned for deprecated mmh3...
Search for existing analysis results with the given file-hash. :param hash_value: The (partial) file-hash. :param algorithm: One of MD5/SHA1/SHA256 :param block_size: Size of the block (at file start) used for generating the hash-value. By default (or if 0), the entire file is assumed. :param md5: Helper to quickl...
625941d6baa26c4b54cb134c
def _get_control_text(self): <NEW_LINE> <INDENT> raise NotImplementedError()
Get the text on the control. Returns ---------- text : str The text to displayed in the widget.
625941d694891a1f4081bcd8
def transform(self, X, y=None, exraise=None, verbose=False): <NEW_LINE> <INDENT> if exraise is None: <NEW_LINE> <INDENT> exraise = self._exraise <NEW_LINE> <DEDENT> if self._compound_prec(X): <NEW_LINE> <INDENT> if verbose: <NEW_LINE> <INDENT> msg = '- ' + '\n '.join(textwrap.wrap(self._appmsg)) <NEW_LINE> print(msg, ...
Transforms the given dataframe without fitting this stage. If this stage is fittable but is not fitter, an UnfittedPipelineStageError is raised. Parameters ---------- X : pandas.DataFrame The dataframe to be transformed. y : array-like, optional Targets for supervised learning. exraise : bool, default None ...
625941d6be7bc26dc91cd82b
def isSameKindAs(self, *args): <NEW_LINE> <INDENT> return _osgSim.DirectionalSector_isSameKindAs(self, *args)
isSameKindAs(DirectionalSector self, Object obj) -> bool
625941d6004d5f362079a561
def update_litinfantojuv_cmd(litinfantojuv_id, **litinfantojuv_properties): <NEW_LINE> <INDENT> return UpdateLitinfantojuvCommand(litinfantojuv_id, **litinfantojuv_properties)
Command to update Litinfantojuv entity with id equals 'litinfantojuv_id' :param litinfantojuv_properties: a dict of properties to update model :return: a Command that update Litinfantojuv, validating and localizing properties received as strings
625941d63617ad0b5ed68124
def getSaveStateString(): <NEW_LINE> <INDENT> return str()
Returns the previously-saved state string (string). Can be used to retrieve the last-set save state string at any time, although this string is also passed to the resumeLoadedGame(savedStateString) Python function when a game is loaded, so this function isn't necessary to use if resumeLoadedGame stores the passed strin...
625941d69c8ee82313fbb9a3
def uri2path(func): <NEW_LINE> <INDENT> def WrapURI(*args, **kwargs): <NEW_LINE> <INDENT> args = list(args) <NEW_LINE> args[0] = GetPathFromURI(args[0]) <NEW_LINE> return func(*args, **kwargs) <NEW_LINE> <DEDENT> WrapURI.__name__ = func.__name__ <NEW_LINE> WrapURI.__doc__ = func.__doc__ <NEW_LINE> return WrapURI
Decorator method to convert path arguments that may be uri's to real file system paths. Arg 0 must be a file path or uri.
625941d69c8ee82313fbb9a4
def read_modified_alert_ids(): <NEW_LINE> <INDENT> if not os.path.exists(MODIFIED_ALERTS_FILE): <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> lock = filelock.FileLock(MODIFIED_ALERTS_FILE, 5) <NEW_LINE> lock.acquire() <NEW_LINE> fp = open(MODIFIED_ALERTS_FILE, "r+") <NEW_LINE> ids = fp.read().split("\n") <NEW_LINE>...
Read modified alert IDs from file, then remove them from the file.
625941d60c0af96317bb8417
def get_resume_url(self, about_me: AboutMe) -> str: <NEW_LINE> <INDENT> return about_me.resume.url
Builds the URL of the resume file.
625941d6c4546d3d9de72c63
def gnews(self): <NEW_LINE> <INDENT> if "GNEWS_APIKEY" in os.environ: <NEW_LINE> <INDENT> if len(self._messageobject.strip().split(" ")) > 1: <NEW_LINE> <INDENT> gnewscase = SwitchCaseGnews(self._messageobject.strip().split(" ")[1:]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> gnewscase = SwitchCaseGnews('science') <...
Return news related content.
625941d6a8ecb033257d32fa
def binary_trees(self): <NEW_LINE> <INDENT> for ip in self.lower_contained_intervals(): <NEW_LINE> <INDENT> yield ip.upper_binary_tree()
Return an iterator on all the binary trees in the interval represented by ``self``. EXAMPLES:: sage: list(TamariIntervalPoset(4,[(2,4),(3,4),(2,1),(3,1)]).binary_trees()) [[., [[., [., .]], .]], [[., [., [., .]]], .], [., [[[., .], .], .]], [[., [[., .], .]], .]] sage: set(TamariIntervalPos...
625941d6a934411ee37518c2
def url_for_plugin(endpoint, **values): <NEW_LINE> <INDENT> endpoint = 'plugin_{}'.format(endpoint) <NEW_LINE> return url_for(endpoint, **values)
Like url_for but prepending plugin_ to endpoint.
625941d6627d3e7fe0d6907f
def correct(corrector, entries, file_format): <NEW_LINE> <INDENT> dict_entries = qdict(entries) <NEW_LINE> result = [] <NEW_LINE> ignore = set() <NEW_LINE> for cur in entries: <NEW_LINE> <INDENT> if cur.qid in ignore: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> blends = __find_mergable(dict_entries, cur, file_form...
Backbone to correct wrong splits or blends Delegate 'corrector' may not be None and implements: * find_mergable_with_state(states, state) * find_mergable_with_line(lines, line) * merge_lines(blends) * merge_states(blends) * split_line(lines, line, flag_require_all_spilts) * split_state(states, state)
625941d626238365f5f0f09f
def add_transition(self, condition, target, **kw): <NEW_LINE> <INDENT> transition = { 'condition': condition, 'target': target, } <NEW_LINE> transition.update(kw) <NEW_LINE> self._data['transitions'].append(transition) <NEW_LINE> return self
TODO doc return this state to allow chaining IMPORTANT: 'target' may not exist yet, so it not checked. Hence, check_structure should be called in the end.
625941d656ac1b37e62643fb
def setup_logging( default_path=os.path.dirname(__file__) + os.sep + "energyathome.ini", default_level=logging.DEBUG, env_key='LOG_CFG' ): <NEW_LINE> <INDENT> path = default_path <NEW_LINE> value = os.getenv(env_key, None) <NEW_LINE> if value: <NEW_LINE> <INDENT> path = value <NEW_LINE> <DEDENT> if os.path.exists(path)...
Setup logging configuration
625941d6bd1bec0571d9085e
def __unicode__(self): <NEW_LINE> <INDENT> return self.question_text
__str__ or __unicode__? On Python 3, it’s easy, just use __str__(). On Python 2, you should define __unicode__() methods returning unicode values instead. Django models have a default __str__() method that calls __unicode__() and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unic...
625941d6f8510a7c17cf992b
def make_id_lookup(face_arr): <NEW_LINE> <INDENT> x, y = np.nonzero(face_arr) <NEW_LINE> segids = face_arr[(x, y)] <NEW_LINE> lookup = dict() <NEW_LINE> for (segid, i, j) in zip(segids, x, y): <NEW_LINE> <INDENT> if segid not in lookup: <NEW_LINE> <INDENT> lookup[segid] = [(i, j)] <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
Takes a 2D numpy array, and finds where the values are nonzero. Returns a lookup from segid to the coords at which it exists
625941d623e79379d52ee790
def test_write_to_read_only_export(self): <NEW_LINE> <INDENT> self._test_create_cluster() <NEW_LINE> self._create_export(export_id='1', create_fs=True, extra_cmd=[self.pseudo_path, '--readonly']) <NEW_LINE> port, ip = self._get_port_ip_info() <NEW_LINE> self._write_to_read_only_export(self.pseudo_path, port, ip) <NEW_L...
Test write to readonly export.
625941d61f5feb6acb0c4d7b
def __init__ (self, parent, config): <NEW_LINE> <INDENT> wx.Panel.__init__ (self, parent, style=wx.TAB_TRAVERSAL) <NEW_LINE> global _ <NEW_LINE> _ = get_() <NEW_LINE> self.__createGui() <NEW_LINE> self.__controller = PrefPanelController (self, config)
parent - родитель панели (должен быть wx.Treebook) config - настройки из plugin._application.config
625941d657b8e32f524836ca
def get(self): <NEW_LINE> <INDENT> album_id = self.request.get('album') <NEW_LINE> device_urlsafe_key = self.request.get('key') <NEW_LINE> group_key = get_group_key(ndb.Key(urlsafe=device_urlsafe_key)) <NEW_LINE> if not group_key: <NEW_LINE> <INDENT> self.abort(403,'This device is not part of your group!') <NEW_LINE> <...
Gets all songs and/or album details if applicable and renders the page
625941d6656771135c3eba9f
def get_tuple_elements(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.list_element=[eval(element) for element in input("Enter the Tuples Elements : ").split(",")] <NEW_LINE> self.original_tuple=tuple(self.list_element) <NEW_LINE> user_element=eval(input("Enter User Element")) <NEW_LINE> if user_element in sel...
This Method Takes comma seperated input elements from user andf store in tuple and Take element that need to be removed from the tuple
625941d6442bda511e8be644
def set(self, cluster: str, namespace: str, type: str, labels: Labels) -> Labels: <NEW_LINE> <INDENT> with self._lock: <NEW_LINE> <INDENT> self._ns(cluster, namespace)[type] = labels <NEW_LINE> return labels
Sets the given cluster / namespace / type to 'labels'
625941d6a8ecb033257d32fb
def setup_db(app, database_path=DATABASE_URL): <NEW_LINE> <INDENT> app.config["SQLALCHEMY_DATABASE_URI"] = database_path <NEW_LINE> app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False <NEW_LINE> db.app = app <NEW_LINE> db.init_app(app) <NEW_LINE> db.create_all()
binds a flask application and a SQLAlchemy service
625941d65e10d32532c5f155
def create_database(): <NEW_LINE> <INDENT> for sql in [ "PRAGMA foreign_keys = ON;", "create table users (user char(255) primary key, pass char(255), salt char(255));", "create table clients (id char(255) primary key, secret char(255), salt char(255), user char(255), foreign key(user) references users(user) on update c...
create and initially fill in the database
625941d67c178a314d6ef690
def prepare(self, **kwargs): <NEW_LINE> <INDENT> pass
prepare plugin for execution override this to set instance properties and prepare for execution
625941d68a43f66fc4b54292
def prepare_test(test) : <NEW_LINE> <INDENT> test = test.assign(date_block_num = 34) <NEW_LINE> test.drop('ID', axis=1, inplace=True) <NEW_LINE> test = test.astype('int32') <NEW_LINE> test = test.assign(month = 11).astype('int32') <NEW_LINE> test = test.assign(year = 2015).astype('int32') <NEW_LINE> return test
prepare minimum test set. add all the features which are added to the train set.
625941d62eb69b55b151cae0
def __init__(self, base=None, **attributes): <NEW_LINE> <INDENT> self.base = base or self.default_base <NEW_LINE> self.name = None <NEW_LINE> self.stylesheet = None <NEW_LINE> for attribute in attributes: <NEW_LINE> <INDENT> if attribute not in self._supported_attributes(): <NEW_LINE> <INDENT> raise TypeError('%s is no...
Style attributes are as passed as keyword arguments. Supported attributes include those defined in the :attr:`attributes` attribute of this style class and those defined in style classes this one inherits from. Optionally, a `base` (:class:`Style`) is passed, where attributes are looked up when they have not been spec...
625941d6bf627c535bc133fe
def _ClassicalHessian(self, function, x_value): <NEW_LINE> <INDENT> pass
Abstract method for using the classical Hessian method :param function: the function to be optimized :param x_value: the x value :returns: the next Hessian
625941d621a7993f00bc7f21
def __init__(self, fset): <NEW_LINE> <INDENT> self.fset = fset <NEW_LINE> self.rules = [] <NEW_LINE> self.output = None
Initialization of consequent. Args: fset: reference to a fuzzy set. rules: list of rules which have this consequent.
625941d6d10714528d5fff14
def from_url(url, db=None, **kwargs): <NEW_LINE> <INDENT> from ledis.client import Ledis <NEW_LINE> return Ledis.from_url(url, db, **kwargs)
Returns an active Ledis client generated from the given database URL. Will attempt to extract the database id from the path url fragment, if none is provided.
625941d638b623060ff0b01c
def upload_files_from(sourcedir, bucket_name, aws_key_id, aws_key, ): <NEW_LINE> <INDENT> os.environ['S3_USE_SIGV4'] = 'True' <NEW_LINE> connection = boto.connect_s3(aws_key_id, aws_key, host=AWS_BUCKET_HOST) <NEW_LINE> bucket = connection.get_bucket(bucket_name) <NEW_LINE> for (root, _, filenames) in os.walk(sourcedir...
Crawl sourcedir and upload all files to bucket
625941d67c178a314d6ef691
def testConstructor_005(self): <NEW_LINE> <INDENT> self.assertRaises(ValueError, CdWriter, device="/dev/null", scsiId="blech", unittest=True)
Test the constructor with device ``/dev/null`` (which is writable and exists). Use an invalid SCSI id and defaults for the remaining arguments. Make sure that ``unittest=True``.
625941d66fb2d068a760f2ce
def mpdConnect(client, con_id): <NEW_LINE> <INDENT> print() <NEW_LINE> print("---------- BEGIN ---- mpdConnect(client, con_id) ------------") <NEW_LINE> print("trying to connect to mpd...") <NEW_LINE> try: <NEW_LINE> <INDENT> client.connect(**con_id) <NEW_LINE> <DEDENT> except SocketError as err: <NEW_LINE> <INDENT> pr...
Simple wrapper to connect MPD.
625941d67b180e01f3dc4a29
def find_cfg_file(file_name=None): <NEW_LINE> <INDENT> check_files = [ '.netmiko.yml', os.path.expanduser('~') + '/.netmiko.yml', ] <NEW_LINE> if file_name: <NEW_LINE> <INDENT> check_files.insert(0, file_name) <NEW_LINE> <DEDENT> for test_file in check_files: <NEW_LINE> <INDENT> if os.path.isfile(test_file): <NEW_LINE>...
Look for .netmiko.yml in current dir, then ~/.netmiko.yml.
625941d666673b3332b922c0
def block_stream(self, start=None, mode="irreversible"): <NEW_LINE> <INDENT> config = self.get_config() <NEW_LINE> block_interval = config["GOLOSIT_BLOCK_INTERVAL"] <NEW_LINE> if not start: <NEW_LINE> <INDENT> props = self.get_dynamic_global_properties() <NEW_LINE> if mode == "head": <NEW_LINE> <INDENT> start = props['...
Yields blocks starting from ``start``. :param int start: Starting block :param str mode: We here have the choice between * "head": the last block * "irreversible": the block that is confirmed by 2/3 of all block producers and is thus irreversible!
625941d61d351010ab855d4a
def main(argv=None): <NEW_LINE> <INDENT> if argv is None: <NEW_LINE> <INDENT> argv = sys.argv <NEW_LINE> <DEDENT> parser = E.OptionParser(version="%prog version: $Id$", usage=globals()["__doc__"]) <NEW_LINE> parser.add_option("-p", "--pipeline", dest="pipeline", type="string", help="Path to pipeline script") <NEW_LINE>...
script main. parses command line options in sys.argv, unless *argv* is given.
625941d6b545ff76a8914045
def _process_datum(self, data, input_reader, ctx, transient_shard_state): <NEW_LINE> <INDENT> if data is not input_readers.ALLOW_CHECKPOINT: <NEW_LINE> <INDENT> self.slice_context.incr(context.COUNTER_MAPPER_CALLS) <NEW_LINE> handler = transient_shard_state.handler <NEW_LINE> if isinstance(handler, map_job.Mapper): <NE...
Process a single data piece. Call mapper handler on the data. Args: data: a datum to process. input_reader: input reader. ctx: mapreduce context transient_shard_state: transient shard state. Returns: True if scan should be continued, False if scan should be stopped.
625941d6046cf37aa974cf75
def __init__(self, action_size, buffer_size, batch_size, device): <NEW_LINE> <INDENT> self.action_size = action_size <NEW_LINE> self.memory = deque(maxlen=buffer_size) <NEW_LINE> self.batch_size = batch_size <NEW_LINE> self.device = device <NEW_LINE> self.experience = namedtuple("Experience", field_names=["state", "act...
Initialize a ReplayBuffer object. Params ====== action_size (int): dimension of each action buffer_size (int): maximum size of buffer batch_size (int): size of each training batch
625941d66fb2d068a760f2cf
def trevor_arm(self): <NEW_LINE> <INDENT> arm_signal = self.left_joystick.getRawButton(3) + -self.left_joystick.getRawButton(2) <NEW_LINE> val = 0.9 * arm_signal <NEW_LINE> self.arm_motor.set(-0.5 * val)
Feed arm controller raw values from the joystick Left joystick button 3 goes forward, 2 goes backward
625941d64428ac0f6e5baa22
def load(self): <NEW_LINE> <INDENT> filename = self._filename <NEW_LINE> if not os.path.exists(filename): <NEW_LINE> <INDENT> self.service.log.store('Cannot load %s, does not exist' % filename) <NEW_LINE> return False <NEW_LINE> <DEDENT> self.service.log.store('Loading %s' % filename) <NEW_LINE> f = open(filename, 'r')...
Load stored data from disk Returns True if loaded, False if not
625941d68e71fb1e9831d9d8
def relu(Z): <NEW_LINE> <INDENT> A = maximum(0, Z) <NEW_LINE> assert(A.shape == Z.shape) <NEW_LINE> cache = Z <NEW_LINE> return A, cache
Implement the RELU function. Arguments: Z -- Output of the linear layer, of any shape Returns: A -- Post-activation parameter, of the same shape as Z cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently
625941d65fc7496912cc3bad
@login_required <NEW_LINE> def delete_task(request, pk): <NEW_LINE> <INDENT> task = get_object_or_404(EventTask, pk=pk) <NEW_LINE> task.delete() <NEW_LINE> return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
Deletes a task
625941d6b57a9660fec33ab6
def global_init_serializer(init): <NEW_LINE> <INDENT> serializer = ap_global_pb2.APInitMsg() <NEW_LINE> if 'major' in init: <NEW_LINE> <INDENT> serializer.MajorVer = init['major'] <NEW_LINE> <DEDENT> if 'minor' in init: <NEW_LINE> <INDENT> serializer.MinorVer = init['minor'] <NEW_LINE> <DEDENT> if 'sub_ver' in init: <N...
Global Init Message serializer.
625941d6596a897236089cee
def test_create_scaling_group_with_CLBs_but_no_ServiceNet(self): <NEW_LINE> <INDENT> create_group_response = self.autoscale_client.create_scaling_group( gc_name='test_no_servicenet', gc_cooldown=self.gc_cooldown, gc_min_entities=self.gc_min_entities, lc_name=self.lc_name, lc_image_ref=self.lc_image_ref, lc_flavor_ref=s...
Scaling group creation fails with a 400 when a launch config has one or more CLBs configured, but no ServiceNet configured.
625941d6925a0f43d254a0a7
def __init__(self, overlay, *args, **kwargs): <NEW_LINE> <INDENT> aux_file = overlay.strval('aux_file').lower() <NEW_LINE> if aux_file.startswith('mgh'): <NEW_LINE> <INDENT> aux_file = 'freesurfercolorlut' <NEW_LINE> <DEDENT> lut = 'random' <NEW_LINE> if aux_file != '': <NEW_LINE> <INDENT> luts = colourmaps.getLookupTa...
Create a ``LabelOpts`` instance for the specified ``overlay``. All arguments are passed through to the :class:`.NiftiOpts` constructor.
625941d63346ee7daa2b2f9c
def add_data(self, x): <NEW_LINE> <INDENT> self.lock.acquire() <NEW_LINE> self.xdata = np.append(self.xdata, x) <NEW_LINE> self.lock.release()
Adds the data (a single value or array) to the buffer
625941d6293b9510aa2c34c3
def isPalindrome(self, x): <NEW_LINE> <INDENT> if(x<0): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> c=self.count(deepcopy(x)) <NEW_LINE> while(x!=0): <NEW_LINE> <INDENT> if(x/(10**(c-1))==x%10): <NEW_LINE> <INDENT> x=x%(10**(c-1)) <NEW_LINE> x=x/10 <NEW_LINE> c-=2 <NEW_LINE> <DEDENT> ...
:type x: int :rtype: bool
625941d63d592f4c4ed1d299
def testTheadTempGet(self): <NEW_LINE> <INDENT> self.GUI.mainInput()
Test the main running thread with and getting the detector temperature
625941d696565a6dacc8f8fa
def set_from_list(self, qs): <NEW_LINE> <INDENT> self.clear() <NEW_LINE> for q in qs: <NEW_LINE> <INDENT> question = Question() <NEW_LINE> question.set_from_obj(q) <NEW_LINE> self.append(question)
Set Questions from a Python list, that looks like [{'q': 'ABC', 'a': ['CAB']}, ... ]
625941d6d486a94d0b98e375
def update_state(self, DU, DF, dt): <NEW_LINE> <INDENT> ndim = self.ndim <NEW_LINE> nnodes = len(self.nodes) <NEW_LINE> loc = self.get_H_loc() <NEW_LINE> U = zeros(nnodes) <NEW_LINE> dF = zeros(ndim*nnodes) <NEW_LINE> dQ = zeros(nnodes) <NEW_LINE> locK = self.get_K_loc() <NEW_LINE> dU = DU[locK] <NEW_...
Updates system natural vector ============================= INPUT: DU: system essential vector (Pore-pressure) DF: system natural vector (Flow) RETURNS: None
625941d691af0d3eaac9bc4a
def CreateBinary(InFile,OutPath,Coords): <NEW_LINE> <INDENT> Ras=gdal.Open(InFile,GA_ReadOnly) <NEW_LINE> cols=Ras.RasterXSize <NEW_LINE> rows=Ras.RasterYSize <NEW_LINE> Array=Ras.ReadAsArray(0,0,cols,rows) <NEW_LINE> Binary=np.where(Array==-32768,1,0) <NEW_LINE> WriteRaster(Ras,OutPath+'/Binary_'+Coords+'.bil',cols,ro...
Convert input raster to array, then construct binary array where cells with 'nodata' value in input array get 1, all others get 0. Save binary array as raster with spatial reference info from input raster
625941d624f1403a92600d94
def extraParam(request,name): <NEW_LINE> <INDENT> return HttpResponse('我的名字是:{}'.format(name))
设置额外参数,非前台请求,默认添加 :param request: :param name: 在定义url时直接定义name的值 :return:
625941d671ff763f4b5498be
def __getitem__(name): <NEW_LINE> <INDENT> pass
Return the `ISectionSchema` with the matching name. :raise `NoSectionError`: if the no ISectionSchema has the name.
625941d638b623060ff0b01d
def release(src=None, name=None, location=None, archive_id=None, archive_offset='archive', archive_only=False): <NEW_LINE> <INDENT> if archive_id is True: <NEW_LINE> <INDENT> raise NotImplementedError( "Archive ID from app version is not supported yet!") <NEW_LINE> <DEDENT> _name = name or origen.app.website_release_na...
General purpose release script that should cover basic cases. In the general sense, *releasing* the webpages amounts to just moving the contents somewhere and optionally performing some RC check-in function. Will leverage much of the RC driver for this so that the flow is just: 1. Populate the repo 2. Move the conte...
625941d63cc13d1c6d3c75a9
def myAtoi(self, str_val, var_type): <NEW_LINE> <INDENT> num = 0 <NEW_LINE> ret = False <NEW_LINE> try: <NEW_LINE> <INDENT> li_char = [] <NEW_LINE> char_arr = list(str_val) <NEW_LINE> print("arr:", char_arr) <NEW_LINE> for char in char_arr: <NEW_LINE> <INDENT> print("char:", char) <NEW_LINE> if char in self.li: <NEW_LI...
:type str: str :rtype: int
625941d6e5267d203edcdeca
def get_state_text(self): <NEW_LINE> <INDENT> return self.text_function(self.fieldscont)
Return text desription of current state.
625941d6f8510a7c17cf992c
def getStationAltitude(self): <NEW_LINE> <INDENT> return self.altitude
Return the station's altitude above the sea in meters.
625941d6d486a94d0b98e376
def join_game(request): <NEW_LINE> <INDENT> LOG.debug('enter') <NEW_LINE> if request.method != 'POST': <NEW_LINE> <INDENT> LOG.info(__('attempted non-supported method {0}', request.method)) <NEW_LINE> request.session['error_title'] = 'Unsupported method' <NEW_LINE> request.session['error_description'] = ( 'You\'re not ...
Proccess data that a user sends when they want to join a game.
625941d6cad5886f8bd27208
def insert_at_nth(self, index: int, data): <NEW_LINE> <INDENT> if not 0 <= index <= len(self): <NEW_LINE> <INDENT> raise IndexError("list index out of range") <NEW_LINE> <DEDENT> new_node = Node(data) <NEW_LINE> if self.head is None: <NEW_LINE> <INDENT> self.head = new_node <NEW_LINE> <DEDENT> elif index == 0: <NEW_LIN...
>>> linked_list = LinkedList() >>> linked_list.insert_at_nth(-1, 666) Traceback (most recent call last): .... IndexError: list index out of range >>> linked_list.insert_at_nth(1, 666) Traceback (most recent call last): ...... IndexError: list index out of range >>> linked_list.insert_at_nth(0, 2) >>> linked_list.insert...
625941d64c3428357757c557