code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def local_fit(y): <NEW_LINE> <INDENT> x = np.arange(len(y)) <NEW_LINE> f = lowess(y, x, frac=1/7.) <NEW_LINE> return f[:, 1]
LOWESS fit of the data (set to 1 week fraction). Gives better view than rolling avg
625941f19f2886367277ae33
def add_flag(self, flag): <NEW_LINE> <INDENT> if '.' not in flag: <NEW_LINE> <INDENT> flag += '.jpg' <NEW_LINE> <DEDENT> flag = Image.open(flag, 'r').convert("RGBA") <NEW_LINE> flag = flag.resize((self.width, self.height), Image.BILINEAR) <NEW_LINE> return Image.blend(self.picture, flag, 0.5)
:param flag: path to flag picture :return: Image object
625941f163b5f9789fde7690
@follows(selectUpRegulatedSubsetCeRNAs, selectUpRegulatedCeRNAs) <NEW_LINE> @transform(selectUpRegulatedSubsetCeRNAs, regex("ceRNA.dir/(.+)_(.+)-ceRNAs_upregulated.tsv"), add_inputs(r"expression.dir/\1-average_expression.tsv.gz"), r"ceRNA.dir/\1_\2-ceRNAs_upregulated.genexpr.tsv") <NEW_LINE> def addSubsetGeneExpression...
Annotated ceRNA candidates with expression profiles of partner genes
625941f144b2445a3393263c
def stimulus_pre(self): <NEW_LINE> <INDENT> self.log.debug("presenting stimulus %s" % self.this_trial.stimulus) <NEW_LINE> self.log.debug("from file %s" % self.this_trial.stimulus_event.file_origin) <NEW_LINE> self.log.debug('waiting for peck...') <NEW_LINE> self.panel.center.on() <NEW_LINE> trial_time = None <NEW_LINE...
Prepares stimuli to be presented ADDED: turn on peck ports
625941f1be8e80087fb211e2
def create_options(options, passthru_args=None): <NEW_LINE> <INDENT> class FakeOptions(object): <NEW_LINE> <INDENT> def for_scope(self, scope): <NEW_LINE> <INDENT> scoped_options = options[scope] <NEW_LINE> if isinstance(scoped_options, _FakeOptionValues): <NEW_LINE> <INDENT> return scoped_options <NEW_LINE> <DEDENT> e...
Create a fake Options object for testing. Note that the returned object only provides access to the provided options values. There is no registration mechanism on this object. Code under test shouldn't care about resolving cmd-line flags vs. config vs. env vars etc. etc. :param dict options: A dict of scope -> (dict ...
625941f1be8e80087fb211e3
def make_copy_kernel(new_dim_tags, old_dim_tags=None): <NEW_LINE> <INDENT> from loopy.kernel.array import (parse_array_dim_tags, SeparateArrayArrayDimTag, VectorArrayDimTag) <NEW_LINE> new_dim_tags = parse_array_dim_tags(new_dim_tags) <NEW_LINE> rank = len(new_dim_tags) <NEW_LINE> if old_dim_tags is None: <NEW_LINE> <I...
Returns a :class:`LoopKernel` that changes the data layout of a variable (called "input") to the new layout specified by *new_dim_tags* from the one specified by *old_dim_tags*. *old_dim_tags* defaults to an all-C layout of the same rank as the one given by *new_dim_tags*.
625941f1925a0f43d254a427
def line_string_to_points(line_string): <NEW_LINE> <INDENT> latlngs = [coord.strip().replace('LatLng(', '').replace(')', '') for coord in line_string.replace('[', '').replace(']', '').split(',')] <NEW_LINE> point_strings = [latlngs[i+1] + ' ' + latlngs[i] for i in range(0, len(latlngs), 2)] <NEW_LINE> return [GEOSGeome...
Parse line geometry, represented as a string. return array of GEOS Points
625941f17047854f462a19ad
def ProveOneOfN(ck, cis, el, r, message = ""): <NEW_LINE> <INDENT> n = int(math.ceil(math.log(len(cis)) / math.log(2))) <NEW_LINE> assert Com(ck, 0, r) == cis[el] <NEW_LINE> (G, g, h, o) = ck <NEW_LINE> el = Bn(el) <NEW_LINE> eli = [Bn(int(el.is_bit_set(i))) for i in range(n)] <NEW_LINE> ri = [o.random() for i in rang...
NIZK Proof that Com(0; r) is within Cis. The fact that it is the el'th commitmtnet is not revealed. + Ring signature on "message".
625941f121bff66bcd684ef7
def deleteBucket(self, namespace, bucketName): <NEW_LINE> <INDENT> assert namespace is not None, MESSAGE_NAMESPACE_REQUIRED <NEW_LINE> assert bucketName is not None, MESSAGE_BUCKET_NAME_REQUIRED <NEW_LINE> body = {"namespace": namespace} <NEW_LINE> headers = {'x-sds-auth-token': self.token, 'Accept': 'application/json'...
Deletes the specified bucket. :param namespace:Namespace associated. If it is null, then current user's namespace is used. :param bucketName:Bucket name to be deleted
625941f1851cf427c661aab4
def Put(self, data, url, parser, media_source=None): <NEW_LINE> <INDENT> return gdata.service.GDataService.Put(self, data=data, uri=url, media_source=media_source, converter=parser)
Streamlined version of Put. Requires a parser function which takes the server response's body as the only argument.
625941f15510c4643540f980
def next(self, irc, msg, args): <NEW_LINE> <INDENT> if not self._quorum: <NEW_LINE> <INDENT> irc.error('No quorum, more triagers need to !here to proceed.') <NEW_LINE> return <NEW_LINE> <DEDENT> if self.current_issue is not None: <NEW_LINE> <INDENT> self.seen.add(self.current_issue) <NEW_LINE> self.current_issue = None...
(chair only) Advance to the next triage issue if a quorum is present.
625941f1596a89723608a063
def fBMatRecursion(Bp, Bhat_x, Bhat_t, R0p, r_pi): <NEW_LINE> <INDENT> if len(Bp)==0: <NEW_LINE> <INDENT> n_p = 0 <NEW_LINE> <DEDENT> elif len(Bp.shape)==2: <NEW_LINE> <INDENT> n_p = Bp.shape[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Exception('Bp needs to be empty or a 2d array') <NEW_LINE> <DEDENT> if le...
Recursive formulae for B' and Bhat See discussion after Eq.(12) and (15) from [1]
625941f13d592f4c4ed1d608
def CreateMenuBar(self): <NEW_LINE> <INDENT> self.gMenuBar = wx.MenuBar() <NEW_LINE> self.gMenu_File = self.CreateMenu_File() <NEW_LINE> self.gMenu_Edit = self.CreateMenu_Edit() <NEW_LINE> self.gMenu_View = self.CreateMenu_View() <NEW_LINE> self.gMenu_Tools = self.CreateMenu_Tools() <NEW_LINE> self.gMenu_Draw = self.Cr...
Create the MenuBar for the :class:`EmbroidermodderMainWindow`.
625941f1d10714528d600295
def get_pet_labels(image_dir): <NEW_LINE> <INDENT> in_files = listdir(image_dir) <NEW_LINE> results_dic = dict() <NEW_LINE> for idx in range(0, len(in_files), 1): <NEW_LINE> <INDENT> if in_files[idx][0] != ".": <NEW_LINE> <INDENT> pet_label = "" <NEW_LINE> tempname = in_files[idx].lower().split("_") <NEW_LINE> for word...
Creates a dictionary of pet labels (results_dic) based upon the filenames of the image files. These pet image labels are used to check the accuracy of the labels that are returned by the classifier function, since the filenames of the images contain the true identity of the pet in the image. Be sure to format the pe...
625941f1627d3e7fe0d693fc
def checkEmacs(l_info,ip): <NEW_LINE> <INDENT> if l_info.line.endswith('# PYTHON-MODE'): <NEW_LINE> <INDENT> return ip.handle_emacs <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
Emacs ipython-mode tags certain input lines.
625941f1c4546d3d9de72fe4
def _pretend_write(): <NEW_LINE> <INDENT> device_id = state.get_memory_by_offset(1) <NEW_LINE> dlog("OUT\t\t", device_id) <NEW_LINE> return 2
OUT placeholder for internal use - just writes a log saying an OUT opcode was reached. actual device write should be caught and handled through machine-specific code externally, using the get_write_data function
625941f1ad47b63b2c50a52a
def generate_data(self): <NEW_LINE> <INDENT> leftovers = None <NEW_LINE> for cur_file_name in self.file_names: <NEW_LINE> <INDENT> cur_file_features, cur_file_labels = self.load_data(cur_file_name) <NEW_LINE> if leftovers is not None: <NEW_LINE> <INDENT> cur_file_features = self.concat_data( leftovers[0], cur_file_feat...
Yields batches of training data until none are left.
625941f1f7d966606f6aa5b6
def get_sy(self): <NEW_LINE> <INDENT> return self.get_measurement(out_format='list')[1]
Returns Sy in vector format.
625941f1dd821e528d63b74f
def run_opt(model_fn, parameter_space, max_iter=10000, save_iter=100, load = False, name = 'opt', path = ''): <NEW_LINE> <INDENT> file_name = path + "tpe_trials_{0}.p".format(name) <NEW_LINE> i = 1 <NEW_LINE> max_i = round(max_iter/save_iter) <NEW_LINE> if load and os.path.exists(file_name): <NEW_LINE> <INDENT> with op...
Description runs hyperopt optimization Input: model_fn : model function, should return the value of the metric to be minimized parameter_space : hyperopt parameter space to be optimized max_iter : optmization max iterations save_iter : the results will be saved every save_iter iterations loa...
625941f14428ac0f6e5bada2
def _get_vtn_info(vtn_name): <NEW_LINE> <INDENT> vnets = odl_api_get("/vtn:vtns/") <NEW_LINE> vtn = [d for d in vnets["vtns"]["vtn"] if d["name"] == vtn_name][0] <NEW_LINE> return vtn
Returns the info dictionary of a given VTN containing the virtual topology
625941f163b5f9789fde7691
def test_save_method(self): <NEW_LINE> <INDENT> dummy_instance = Place() <NEW_LINE> dummy_instance.save() <NEW_LINE> self.assertNotEqual( dummy_instance.created_at, dummy_instance.updated_at)
test save method
625941f19b70327d1c4e1383
def test_station_layout_replace(): <NEW_LINE> <INDENT> layout = StationPlotLayout() <NEW_LINE> layout.add_text('E', 'temperature') <NEW_LINE> layout.add_value('E', 'dewpoint') <NEW_LINE> assert 'E' in layout <NEW_LINE> assert layout['E'][0] is StationPlotLayout.PlotTypes.value <NEW_LINE> assert layout['E'][1] == 'dewpo...
Test that layout locations are replaced.
625941f1e1aae11d1e74a268
def init_strings(self): <NEW_LINE> <INDENT> DateParser.init_strings(self) <NEW_LINE> _span_1 = ['自'] <NEW_LINE> _span_2 = ['至'] <NEW_LINE> _range_1 = ['介于'] <NEW_LINE> _range_2 = ['与'] <NEW_LINE> self._span = re.compile("(%s)\s+(?P<start>.+)\s+(%s)\s+(?P<stop>.+)" % ('|'.join(_span_1), '|'.join(_span_2)), re.IGNORECAS...
This method compiles regular expression strings for matching dates.
625941f138b623060ff0b398
def mock_the_extension_manager(driver="fake", namespace="ironic.drivers"): <NEW_LINE> <INDENT> entry_point = None <NEW_LINE> for ep in list(pkg_resources.iter_entry_points(namespace)): <NEW_LINE> <INDENT> s = "%s" % ep <NEW_LINE> if driver == s[:s.index(' =')]: <NEW_LINE> <INDENT> entry_point = ep <NEW_LINE> break <NEW...
Get a fake stevedore NameDispatchExtensionManager instance. :param namespace: A string representing the namespace over which to search for entrypoints. :returns mock_ext_mgr: A DriverFactory instance that has been faked. :returns mock_ext: A real plugin loaded by mock_ext_mgr in the specified ...
625941f126238365f5f0f421
def _sync_domains(self): <NEW_LINE> <INDENT> LOG.debug('Synchronising domains') <NEW_LINE> admin_context = MonikerContext.get_admin_context() <NEW_LINE> domains = central_api.get_domains(admin_context) <NEW_LINE> output_folder = os.path.join(os.path.abspath(cfg.CONF.state_path), 'bind9') <NEW_LINE> if not os.path.exist...
Sync the list of domains this server handles
625941f14428ac0f6e5bada3
def __init__(self, char): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> character_path = "characters/" + char + "/img/" <NEW_LINE> self.character = arcade.AnimatedWalkingSprite() <NEW_LINE> self.all_character_sprites = arcade.SpriteList() <NEW_LINE> self.left_stand = arcade.load_texture(character_path + "default.pn...
Initialize our character variables
625941f13617ad0b5ed684a1
def distance_to(self, u: Any, v: Any) -> int: <NEW_LINE> <INDENT> distances: List[int] = [-1] * len(self.graph) <NEW_LINE> queue: List[Any] = [] <NEW_LINE> distance = 0 <NEW_LINE> distances[u] = distance <NEW_LINE> queue.append(u) <NEW_LINE> while len(queue) > 0: <NEW_LINE> <INDENT> node = queue.pop(0) <NEW_LINE> dista...
Time Complexity: This algorithm takes O(V+E) where E is the number of edges in the connected component of a. The worst case occurs when the graph is complete, which would result in O(N2).
625941f1167d2b6e31219140
def DateRange_from_node(node): <NEW_LINE> <INDENT> if node["datetype"] != None: <NEW_LINE> <INDENT> return DateRange(node["datetype"], node["date1"], node["date2"]) <NEW_LINE> <DEDENT> return DateRange()
Extracts a DateRange value from any db node, if present.
625941f1091ae35668667500
@pytest.fixture <NEW_LINE> def mocked_user_input_first(mocked_user_input): <NEW_LINE> <INDENT> mocked_user_input.return_value = "First one" <NEW_LINE> return mocked_user_input
Mocking user input and return mock value
625941f1187af65679ca56cb
def make_reference(self): <NEW_LINE> <INDENT> self._make_reference_helper()
Takes a snapshot of the current state. Subsequent diagrams will be relative to this reference.
625941f10fa83653e4657562
def make_chunks(ids, n_chunks=None, size=None): <NEW_LINE> <INDENT> if not n_chunks and not size: <NEW_LINE> <INDENT> raise ValueError("n_chunks or size must be passed") <NEW_LINE> <DEDENT> if n_chunks and size: <NEW_LINE> <INDENT> raise ValueError("only n_chunks or size must be passed") <NEW_LINE> <DEDENT> if not size...
Do chunks from ids. We can make chunks either with number of chunks desired or size of every chunk.
625941f17cff6e4e81117f30
def save(self): <NEW_LINE> <INDENT> save_json(self.hass.config.path(PERSISTENCE), self.items)
Save the items.
625941f1b57a9660fec33e38
def swapaxes(a, axis1, axis2): <NEW_LINE> <INDENT> return a.swapaxes(axis1, axis2)
Swaps the two axes. Args: a (cupy.ndarray): Array to swap the axes. axis1 (int): The first axis to swap. axis2 (int): The second axis to swap. Returns: cupy.ndarray: A view of ``a`` that the two axes are swapped. .. seealso:: :func:`numpy.swapaxes`
625941f1460517430c394720
def join_by_date_nested(lesser_dict, on_key, date_key, copy_dict_map, major_dict, date_set=set(), missing=None): <NEW_LINE> <INDENT> logger.info("joining on %s" % on_key) <NEW_LINE> output_dict = copy.deepcopy(major_dict) <NEW_LINE> for row in lesser_dict: <NEW_LINE> <INDENT> date = row[date_key] <NEW_LINE> formatted_d...
Emulates a SQL left join from lesser_dict to major_dict on on_key for dates in field named date_key All fields and values named in copy_dict_map will be copied to new dict, and placed in major_dict[join_val][date] Adds all dates seen to date_set Converts python datetime objects to isoformat, for cross-application ...
625941f115fb5d323cde10c4
def test_touched(self): <NEW_LINE> <INDENT> with test_app.test_request_context( 'path', data={'name': 'new name'}): <NEW_LINE> <INDENT> self.assertTrue(self.handler.touched('name')) <NEW_LINE> self.assertFalse(self.handler.touched('summary'))
We can tell if the user meant to edit a field.
625941f1de87d2750b860344
def edges(self): <NEW_LINE> <INDENT> ed = [] <NEW_LINE> for i in range(0, len(self.graph)): <NEW_LINE> <INDENT> for j in range(0, len(self.graph)): <NEW_LINE> <INDENT> if self.graph[i][j]: <NEW_LINE> <INDENT> ed.append((i+1, j+1)) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return ed
Lista de arestas do grafo. :return: Returna lista com as tuplas que representam as arestas do grafo.
625941f13c8af77a43ae3d53
def dict_invert(d): <NEW_LINE> <INDENT> newDict = {} <NEW_LINE> for x in d.values(): <NEW_LINE> <INDENT> newDict[x] = [] <NEW_LINE> <DEDENT> for v in d.keys(): <NEW_LINE> <INDENT> newDict[d[v]] += [v,] <NEW_LINE> <DEDENT> for x in newDict.keys(): <NEW_LINE> <INDENT> if len(newDict[x]) > 1: <NEW_LINE> <INDENT> newItem =...
inverts a dictionary with immutable values Takes in a dictionary with immutable values and returns the inverse of the dictionary. The inverse of a dictionary d is another dictionary whose keys are the unique dictionary values in d. The value for a key in the inverse dictionary is a sorted list of all keys in d that...
625941f1796e427e537b0b76
def random_train_labels_file(N, size): <NEW_LINE> <INDENT> return data_file('random/train_labels_%d_%s' % (N, '_'.join(list(map(str, size)))), HDF5_EXT)
Random train labels. :return: filepath :rtype: str
625941f13539df3088e2e8f7
def draw(self, g): <NEW_LINE> <INDENT> g.stroke(0, 0, 0, 1) <NEW_LINE> g.strokeWeight(1) <NEW_LINE> g.fill(0, 1, 1, 0.75) <NEW_LINE> g.line(self.origin.x, self.origin.y, self.location.x, self.location.y) <NEW_LINE> g.circle(self.location.x, self.location.y, 20)
draws objects to the screen
625941f10c0af96317bb8792
def get_file_from_request(key): <NEW_LINE> <INDENT> if key in request.files and request.files[key].filename: <NEW_LINE> <INDENT> file = request.files[key] <NEW_LINE> filename = secure_filename(file.filename) <NEW_LINE> input_stream = BytesIO() <NEW_LINE> file.save(input_stream) <NEW_LINE> file_data = input_stream.getva...
Get an uploaded file from the current request as File object.
625941f115baa723493c4525
def EC_tonum(dtype,data,sheet,errlist,downcaster=None, err_str = err_str): <NEW_LINE> <INDENT> data = data.dropna() <NEW_LINE> data = pd.to_numeric(data,errors='coerce',downcast=downcaster) <NEW_LINE> nullct = np.array(data[data.isnull()].index.tolist()) <NEW_LINE> if nullct.shape[0] > 0: <NEW_LINE> <INDENT> print(' e...
catching data that wont work for me, by cleaning the data up and return the dataset ready to go it will remove nans, convert to numeric data and print errors if theres a problem input: dtype - string 'WS' for wandering search, NQ for nested quadrat and QUAD for the abundance measurements data - series input will probab...
625941f18a43f66fc4b5460a
def validate(self): <NEW_LINE> <INDENT> Element.validate(self) <NEW_LINE> source_size = Constants.TYPE_TO_SIZEOF[self.get_source().get_type()] * self.get_source().get_vlen() <NEW_LINE> sink_size = Constants.TYPE_TO_SIZEOF[self.get_sink().get_type()] * self.get_sink().get_vlen() <NEW_LINE> if source_size != sink_size: <...
Validate the connections. The ports must match in io size.
625941f18da39b475bd65527
def inorderTraversal(self, root): <NEW_LINE> <INDENT> def helper(root, prev, result): <NEW_LINE> <INDENT> if not root: return prev <NEW_LINE> prev = helper(root.left, prev, result) <NEW_LINE> result.append(root.val) <NEW_LINE> prev = helper(root.right, root, result) <NEW_LINE> return prev <NEW_LINE> <DEDENT> result = [...
:type root: TreeNode :rtype: List[int]
625941f18e7ae83300e4b57a
def suite(): <NEW_LINE> <INDENT> test_suite = trytond.tests.test_tryton.suite() <NEW_LINE> test_suite.addTests([ unittest.TestLoader().loadTestsFromTestCase(TestTree), ]) <NEW_LINE> return test_suite
Define suite
625941f1a4f1c619b28b05d6
def grid_src_cvis(u, v, wavel, mgrid, gscale, phi=None): <NEW_LINE> <INDENT> if phi is None: <NEW_LINE> <INDENT> phi = grid_precalc_aux_cvis(u, v, wavel, mgrid, gscale) <NEW_LINE> <DEDENT> return np.dot(phi, np.ravel(mgrid))
Calc. complex vis measured by an array for a complex object ---------------------------------------------------------------- - u,v: baseline coordinates (meters) - wavel: wavelength (meters) - mgrid: square grid array describing the object - gscale: scalar defining the "mgrid" pitch size (in mas) - phi: pre-com...
625941f13617ad0b5ed684a2
def __init__(self, links=None, page=None, resources=None): <NEW_LINE> <INDENT> self._links = None <NEW_LINE> self._page = None <NEW_LINE> self._resources = None <NEW_LINE> self.discriminator = None <NEW_LINE> if links is not None: <NEW_LINE> <INDENT> self.links = links <NEW_LINE> <DEDENT> if page is not None: <NEW_LINE...
PageOfAssetPolicyItem - a model defined in Swagger
625941f1236d856c2ad44d8e
def reverse(self): <NEW_LINE> <INDENT> return self.__class__( self.id, self.sequence[::-1], None if self.quality is None else self.quality[::-1])
Reverse a read (note that this is NOT a reverse complement). @return: The reversed sequence as an instance of the current class.
625941f145492302aab5e875
def get_object(self, symbol, lookup_by): <NEW_LINE> <INDENT> log.info("Looking up '{}' using method '{}'".format(symbol, lookup_by)) <NEW_LINE> try: <NEW_LINE> <INDENT> if lookup_by == 'name': <NEW_LINE> <INDENT> name_statement = getattr(self.chado_object, 'name') <NEW_LINE> return self.session.query(self.chado_object)...
Lookup CellLine.
625941f1009cb60464c63958
def is_flash_ready(self): <NEW_LINE> <INDENT> reg = self.debugger.read_word(self.NVM_CTRL_ADDRESS + self.NVM_CTRL_INTFLAG_OFFSET) <NEW_LINE> if reg & (1 << self.NVM_INT_ERROR_BIT): <NEW_LINE> <INDENT> error_cause = self.debugger.read_word(self.NVM_CTRL_ADDRESS + self.NVM_CTRL_STATUS_OFFSET) <NEW_LINE> self.logger.error...
Checks if Flash Controller is ready :return: boolean ready state
625941f160cbc95b062c6aef
def main(): <NEW_LINE> <INDENT> _solution = Solution() <NEW_LINE> inp = [[], [3], [5,2,1]] <NEW_LINE> for i in inp: <NEW_LINE> <INDENT> print(_solution.func(i))
main function
625941f1498bea3a759ba059
def _get_cherry_picked(branch, repodir=None): <NEW_LINE> <INDENT> git = sh.Command('git').bake(_cwd=repodir, _tty_out=False) <NEW_LINE> picked = {} <NEW_LINE> to_ = None <NEW_LINE> from_ = None <NEW_LINE> for line in git.log(branch, _iter=True, _cwd=repodir): <NEW_LINE> <INDENT> line = cook(line) <NEW_LINE> line = line...
Find which commits have been cherry picked. Returns a dictionary; for each entry, the key is the commit sha1 of the commit on the branch, and value is the cherry picked from commit sha1.
625941f196565a6dacc8fc75
def load_rules_from_json_file(self, path): <NEW_LINE> <INDENT> self._logger.info(LOADING_RULES_LOG) <NEW_LINE> rules = self._read_rules_from_file(path) <NEW_LINE> for rule in rules: <NEW_LINE> <INDENT> rule_type = rule[TYPE_KEY] <NEW_LINE> value = rule[VALUE_KEY] <NEW_LINE> if rule[ALLOW_KEY]: <NEW_LINE> <INDENT> self....
Loading the rules to the db from file in path :param path: file path
625941f1b830903b967e9eb0
def getModeBusy(*args): <NEW_LINE> <INDENT> return _ArNetworkingPy.ArServerMode_getModeBusy(*args)
getModeBusy(ArServerClient client, ArNetPacket packet)
625941f1d58c6744b4258209
def create_splicesites_file(gtf_file, align_dir, data): <NEW_LINE> <INDENT> out_file = os.path.join(align_dir, "ref-transcripts-splicesites.txt") <NEW_LINE> if file_exists(out_file): <NEW_LINE> <INDENT> return out_file <NEW_LINE> <DEDENT> safe_makedir(align_dir) <NEW_LINE> hisat2_ss = config_utils.get_program("hisat2_e...
if not pre-created, make a splicesites file to use with hisat2
625941f1a79ad161976cc6f1
def find_selfcal_gain_plots(direction): <NEW_LINE> <INDENT> selfcal_dir = os.path.join(direction.working_dir, 'results', 'facetselfcal', direction.name) <NEW_LINE> facetpeel_dir = os.path.join(direction.working_dir, 'results', 'facetpeel', direction.name) <NEW_LINE> peel_dir = os.path.join(direction.working_dir, 'resul...
Returns the filenames of selfcal Gain plots
625941f1b545ff76a89143c1
def allocate(self, glyphset, screen): <NEW_LINE> <INDENT> raise NotImplementedError()
Create an array suitable for processing the passed dataset into the requested grid size. * glyphset - The points that will be processed (already projected) * screen -- The size of the bin-grid to produce
625941f194891a1f4081c058
def testTeamPointsInRound(self): <NEW_LINE> <INDENT> profile = self.users[0].profile <NEW_LINE> profile.add_points(10, datetime.datetime.today() - datetime.timedelta(minutes=1), "test") <NEW_LINE> profile.save() <NEW_LINE> self.assertEqual(team_mgr.team_points_leader(round_name=self.current_round), profile.team, "The u...
Tests calculating the team points leaders in a round.
625941f17b180e01f3dc4d9c
def setup_command_parser(subparsers): <NEW_LINE> <INDENT> parser_sql = subparsers.add_parser( 'sql', help='command for generating SQL' ) <NEW_LINE> parser_sql.add_argument( 'infile', type=argparse.FileType('r', encoding='utf-8') ) <NEW_LINE> parser_sql.add_argument( '--output-file', '-o', help='write output to file' ) ...
Sets up a new sub parser for the sql command and adds it to the provided subparsers
625941f14e696a04525c99f9
def forward_decoder(self, src, enc, target): <NEW_LINE> <INDENT> mask1 = get_mask(target,target, self.constants.PADDING_IDX, self.constants.DEVICE,avoid_subsequent_info=True) <NEW_LINE> mask2 = get_mask(target,src, self.constants.PADDING_IDX, self.constants.DEVICE) <NEW_LINE> output = self.EmbeddingTgt(target) <NEW_LIN...
Arg: src: tensor(nb_texts, nb_tokens) enc: tensor(nb_texts, nb_tokens, d_model) target: tensor(nb_texts, nb_tokens) Output: tensor(nb_texts, nb_tokens, vocabulary_size_out)
625941f1c4546d3d9de72fe5
def pauli_terms_for_tpdm_ab(spatial_dim, transform=jordan_wigner): <NEW_LINE> <INDENT> bas_ab = {} <NEW_LINE> cnt_ab = 0 <NEW_LINE> for p, q in product(range(spatial_dim), repeat=2): <NEW_LINE> <INDENT> bas_ab[(p, q)] = cnt_ab <NEW_LINE> cnt_ab += 1 <NEW_LINE> <DEDENT> pauli_terms_to_measure = [] <NEW_LINE> pauli_to_rd...
Build the alpha-beta block of the 2-RDM Note: OpenFermion ordering is used. The 2-RDM(alpha-beta) block is spatial_dim**2 linear size. (DOI: 10.1021/acs.jctc.6b00190) :param spatial_dim: rank of spatial orbitals in the basis set. :param transform: type of fermion-to-qubit transformation. :return: list of Pauli...
625941f12ae34c7f2600d6dc
def urdf_xacro_reader(urdf_xacro): <NEW_LINE> <INDENT> robot_urdf = urdf_xacro[:-6] <NEW_LINE> xacro_proc = subprocess.Popen("xacro {0} > {1}".format(urdf_xacro, robot_urdf), stderr=subprocess.STDOUT, shell=True) <NEW_LINE> xacro_proc.wait() <NEW_LINE> assert os.path.exists(robot_urdf) <NEW_LINE> urdf_contents = read_f...
Parse and obtain contents from .urdf.xacro files. This is useful especially in generating the robot description for the robot_state_publisher node. Args: urdf_xacro (str): Absolute path to the .urdf.xacro file. Returns: A string containing the contents of the .urdf.xacro file.
625941f1ec188e330fd5ad3e
def effect_strip_add(frame_start=0, frame_end=0, channel=1, replace_sel=True, overlap=False, type='CROSS', color=(0.0, 0.0, 0.0)): <NEW_LINE> <INDENT> pass
Add an effect to the sequencer, most are applied on top of existing strips :param frame_start: Start Frame, Start frame of the sequence strip :type frame_start: int in [-inf, inf], (optional) :param frame_end: End Frame, End frame for the color strip :type frame_end: int in [-inf, inf], (optional) :param channel: C...
625941f13d592f4c4ed1d609
def grid(): <NEW_LINE> <INDENT> clear() <NEW_LINE> bgcolor('light blue') <NEW_LINE> color('white') <NEW_LINE> for x in range(-150,200,50): <NEW_LINE> <INDENT> line(x,-200,x,200) <NEW_LINE> <DEDENT> for x in range(-175,200,50): <NEW_LINE> <INDENT> for y in range(-175,200,50): <NEW_LINE> <INDENT> up() <NEW_LINE> goto(x,y...
Draw Connect Four grid.
625941f1dc8b845886cb5ae3
def display_hand(self): <NEW_LINE> <INDENT> print(self.__hand)
Display the Player's Hand by calling the __str__ method
625941f1d99f1b3c44c67b2f
def assertExists(self, selector, until=0): <NEW_LINE> <INDENT> if self.exists(selector, until): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.fail("No such element: '{}'".format(selector))
Assert that the given element exists within *until* seconds
625941f1bde94217f3683397
def start(self): <NEW_LINE> <INDENT> self.is_running = True
Override to add logic before the start eg. running condition
625941f156ac1b37e626476f
def toggle_status_visibility(self, action, *args): <NEW_LINE> <INDENT> if self._loading: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> names = { 'pagenumber': constants.STATUS_PAGE, 'resolution': constants.STATUS_RESOLUTION, 'rootpath': constants.STATUS_PATH, 'filename': constants.STATUS_FILENAME, 'filenumber': co...
Called when status entries visibility is to be changed.
625941f1097d151d1a223402
def signals(self): <NEW_LINE> <INDENT> return self.__signal_names
:meth:`.WSignalSourceProto.signals` implementation
625941f16fb2d068a760f653
def encrypt_message(cipher_choice, message): <NEW_LINE> <INDENT> cipher = ALL_CIPHERS[cipher_choice]() <NEW_LINE> encrypted_message = cipher.encrypt(message) <NEW_LINE> return encrypted_message
Determines users choice of cipher Calls the encrypt method and returns the encrypted message
625941f1379a373c97cfb0f3
def test(): <NEW_LINE> <INDENT> import time <NEW_LINE> from pyre.timers.WallTimer import WallTimer <NEW_LINE> t = WallTimer(name="tests.timer") <NEW_LINE> t.start() <NEW_LINE> time.sleep(0.5) <NEW_LINE> t.stop() <NEW_LINE> import journal <NEW_LINE> channel = journal.debug(name="pyre.timers") <NEW_LINE> channel.log(f"el...
Exercise the simple use case with a wall timer
625941f1cc0a2c11143dd43e
def loss_reg(self, y_true, arrs, total): <NEW_LINE> <INDENT> dx = arrs[:, 1] <NEW_LINE> dy = arrs[:, 2] <NEW_LINE> dw = arrs[:, 3] <NEW_LINE> dh = arrs[:, 4] <NEW_LINE> tx = tf.reshape(y_true[:,:, 5], shape=(total,)) <NEW_LINE> ty = tf.reshape(y_true[:,:, 6], shape=(total,)) <NEW_LINE> tw = tf.reshape(y_true[:,:, 7], s...
回归损失 loss_reg = 1/Nreg * ∑(m=1->Nreg)∑(i∈(x,y,w,h)) smootL1(t[m,i] - d[m,i]) t[m,i]:第m个样本的真实t[i]值 d[m,i]:第m个样本的预测d[i]值 @param y_true: tensor(batch_size, num, 9) 1个批次代表1张图,1个num代表一张图的1个proposal [ [分类索引, proposal左上/右下点坐标(相对特征...
625941f1099cdd3c635f1204
def test_solar_elevation(): <NEW_LINE> <INDENT> solar = pypvsim.Solar(lat=0) <NEW_LINE> date = np.datetime64('2013-03-20T12:00Z') <NEW_LINE> assert_almost_equal(solar.elevation(date.astype(object)), sp.radians(90), 1) <NEW_LINE> date = np.datetime64('2013-09-22T12:00Z') <NEW_LINE> assert_almost_equal(solar.elevation(da...
sun should be directly overhead on the equator at noon on the equinox
625941f1baa26c4b54cb16c5
def list(self, request, *args, **kwargs): <NEW_LINE> <INDENT> queryset = self.filter_queryset(self.get_queryset()) <NEW_LINE> serializer = self.get_serializer(queryset, many=True) <NEW_LINE> return Response(serializer.data)
项目列表,不分页
625941f14e696a04525c99fa
def add_training_op(self, loss): <NEW_LINE> <INDENT> optimizer = tf.train.GradientDescentOptimizer(learning_rate=self.config.lr) <NEW_LINE> grads_and_vars = optimizer.compute_gradients(loss) <NEW_LINE> variables = [output[1] for output in grads_and_vars] <NEW_LINE> gradients = [output[0] for output in grads_and_vars] <...
Sets up the training Ops. Creates an optimizer and applies the gradients to all trainable variables. The Op returned by this function is what must be passed to the `sess.run()` call to cause the model to train. See TODO: - Get the gradients for the loss from optimizer using optimizer.compute_gradients. ...
625941f1e1aae11d1e74a269
def initCreate(self , initialconfig): <NEW_LINE> <INDENT> return
inits the process and local vars to process the conversion
625941f1a219f33f34628f0d
@login_required <NEW_LINE> @require_http_methods(["POST"]) <NEW_LINE> def activity_on_course_delete_view(request: HttpRequest, slug: str): <NEW_LINE> <INDENT> course = get_object_or_404(Course, slug=slug) <NEW_LINE> activity_pk_form = ActivityPKForm(request.POST or None) <NEW_LINE> if activity_pk_form.is_valid(): <NEW_...
Delete an activity which is currently attached to a course. The link between the activity and the course will be removed, as well as the activity itself. .. caution:: Changing the activities in a course requires the **change_course** permission. .. important:: The activity to change is given as a POST parameter called...
625941f16aa9bd52df037354
def public_key_auth_supported(self): <NEW_LINE> <INDENT> return False
Return whether or not public key authentication is supported This method should return ``True`` if client public key authentication is supported. Applications wishing to support it must have this method return ``True`` and implement :meth:`validate_public_key` to return whether or not the key provided by the client is...
625941f131939e2706e4d40e
def kfolds_split_list(dataset, folds): <NEW_LINE> <INDENT> result = [] <NEW_LINE> foldsize = 1.0 * len(dataset) / folds <NEW_LINE> rest = 1.0 * len(dataset) % folds <NEW_LINE> for f in range(1, folds + 1): <NEW_LINE> <INDENT> start = (f - 1) * foldsize <NEW_LINE> end = f * foldsize <NEW_LINE> train_size = foldsize * (f...
:param dataset: :param folds: :return: List of tuples.
625941f1236d856c2ad44d8f
def code_name(self): <NEW_LINE> <INDENT> return self._map[FINDSTAT_MAP_CODE_NAME]
Return the name of the function defined by :meth:`code`. OUTPUT: A string. EXAMPLES:: sage: from sage.databases.findstat import FindStatMap # optional -- internet sage: print(FindStatMap(71).code_name()) # optional -- internet descents_composition
625941f11f5feb6acb0c50f5
def is_columns_request(s, col): <NEW_LINE> <INDENT> return not not columns_re.findall(s)
Test what `s` is are string for fetching columns
625941f130c21e258bdfaa50
def visit_ellipsis(self, e: EllipsisExpr) -> Type: <NEW_LINE> <INDENT> if self.chk.pyversion[0] >= 3: <NEW_LINE> <INDENT> return self.named_type('builtins.ellipsis') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.named_type('builtins.object')
Type check '...'.
625941f176d4e153a657f0de
def serveClient(self, client): <NEW_LINE> <INDENT> itrans = self.inputTransportFactory.getTransport(client) <NEW_LINE> iprot = self.inputProtocolFactory.getProtocol(itrans) <NEW_LINE> if isinstance(self.inputProtocolFactory, THeaderProtocolFactory): <NEW_LINE> <INDENT> otrans = None <NEW_LINE> oprot = iprot <NEW_LINE> ...
Process input/output from a client for as long as possible
625941f1d164cc61757832fb
def trim_to_motif(self, motifs, prefix_length=0, suffix_length=0, methyl_index=-1, blank=False): <NEW_LINE> <INDENT> assert type(methyl_index) is int <NEW_LINE> label = read_label(self.label_file, skip_start=0, bases=False) <NEW_LINE> indices = [] <NEW_LINE> for motif in motifs: <NEW_LINE> <INDENT> indices.extend(self....
Trim labels around a motif
625941f144b2445a3393263e
def get_portions(it, slices): <NEW_LINE> <INDENT> if is_slice(slices): <NEW_LINE> <INDENT> slices = [slices] <NEW_LINE> <DEDENT> if len(slices) == 1: <NEW_LINE> <INDENT> s = slices[0] <NEW_LINE> try: <NEW_LINE> <INDENT> yield from itertools.islice(it, s.start, s.stop, s.step) <NEW_LINE> return <NEW_LINE> <DEDENT> excep...
Yield from portions of an iterable. Parameters ---------- it: iterable slices: a slice or a list of slice objects
625941f18e7ae83300e4b57b
def pullup(*ports, **kwargs): <NEW_LINE> <INDENT> for port in ports: <NEW_LINE> <INDENT> portname = get_name(port) <NEW_LINE> _pullup(portname, port) <NEW_LINE> <DEDENT> for name, port in kwargs.items(): <NEW_LINE> <INDENT> _pullup(name, port)
This method takes a subentity *input* or *output* ports, creates equivalent ports in their parent's parent entity and connects them using influences. Use kwargs to assign a specific name. .. note :: This method requires an entity to be initialised aleady. Call this method e.g. from within __init__ and be car...
625941f15fcc89381b1e1c70
def list_all( self, custom_headers=None, raw=False, **operation_config): <NEW_LINE> <INDENT> def internal_paging(next_link=None, raw=False): <NEW_LINE> <INDENT> if not next_link: <NEW_LINE> <INDENT> url = self.list_all.metadata['url'] <NEW_LINE> path_format_arguments = { 'subscriptionId': self._serialize.url("self.conf...
Gets all the express route circuits in a subscription. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides<msrest:optionsforoperations>`. :return: An ite...
625941f1fbf16365ca6f677d
def eraseOverlapIntervals(self, intervals): <NEW_LINE> <INDENT> invs = sorted((x.end, x.start) for x in intervals) <NEW_LINE> ans = 0 <NEW_LINE> end = -0x7fffffff <NEW_LINE> for e, s in invs: <NEW_LINE> <INDENT> if s >= end: <NEW_LINE> <INDENT> end = e <NEW_LINE> ans += 1 <NEW_LINE> <DEDENT> <DEDENT> return len(interva...
:type intervals: List[Interval] :rtype: int
625941f1cc40096d61595efa
def post(self, request, slug, *args, **kwargs): <NEW_LINE> <INDENT> article = get_object_or_404(Article.objects.all(), slug=slug) <NEW_LINE> article_url = FavoriteSerializer().create_article_url(request, slug) <NEW_LINE> user = request.user.id <NEW_LINE> data = { "user": user, "article_url": article_url, "article_title...
PUT /api/v1/articles/<slug>/favorite/
625941f18c3a87329515896e
def test_rule_get_matches_new_line(pcre): <NEW_LINE> <INDENT> rule = chromaterm.Rule(r'hell\Wo', chromaterm.Color('bold'), pcre=pcre) <NEW_LINE> assert not rule.get_matches(b'hell\no')
Attempt to match a new line, which shouldn't be possible as it's considered as a separator (i.e. not passed to be highlighted). New lines are only used to replace data matched by exclusive rules.
625941f155399d3f05588c65
def add_polydata_numeric_field(polydata, field_name, field_data, array_type=VTK_INT): <NEW_LINE> <INDENT> vtk_field_data = numpy_support.numpy_to_vtk(field_data, deep=True, array_type=array_type) <NEW_LINE> vtk_field_data.SetName(field_name) <NEW_LINE> polydata.GetFieldData().AddArray(vtk_field_data) <NEW_LINE> return ...
Add a field to a vtk polydata. Parameters ---------- polydata : vtkPolyData field_name : str field_data : bool, int, float, double, numeric array or ndarray array_type : vtkArrayType
625941f1cdde0d52a9e535e5
def dict( self, *, include: Union["AbstractSetIntStr", "MappingIntStrAny"] = None, exclude: Union["AbstractSetIntStr", "MappingIntStrAny"] = None, by_alias: bool = False, skip_defaults: bool = None, exclude_hidden: bool = True, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, ) -...
Overriding of the respective method from Pydantic Hides fields, marked as "hidden
625941f176e4537e8c351c24
def removeSpaces(message): <NEW_LINE> <INDENT> newMessage = '' <NEW_LINE> for ch in message: <NEW_LINE> <INDENT> if ch != ' ': <NEW_LINE> <INDENT> newMessage += ch <NEW_LINE> <DEDENT> <DEDENT> return newMessage
Takes a string as input and returns the same string with spaces removed.
625941f11f037a2d8b9467a8
def skolemize(formulas): <NEW_LINE> <INDENT> variables = set() <NEW_LINE> for formula in formulas: <NEW_LINE> <INDENT> variables |= formula.variables() <NEW_LINE> <DEDENT> binding = {} <NEW_LINE> for var in variables: <NEW_LINE> <INDENT> binding[var] = compile.Term.create_from_python( uuidutils.generate_uuid()) <NEW_LI...
Instantiate all variables consistently with UUIDs in the formulas.
625941f14e4d5625662d497c
def process_video_to_image(abort, logger, video, folder_path, rfid_code, xvalue, yvalue, width, height): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import cv2 <NEW_LINE> vid_cap = cv2.VideoCapture(folder_path + secure_filename(video.filename)) <NEW_LINE> success, image = vid_cap.read() <NEW_LINE> count = 0 <NEW_LINE>...
Process the video and save the images to the target folder. :param video: video file :param folder_path: :param rfid_code: :param xvalue: initial x coordinates :param yvalue: initial y coordinates :param width: image width :param height: image height :return: True or False, the executed result
625941f1d268445f265b541c
def save_hdf5(X, y, path): <NEW_LINE> <INDENT> with h5py.File(path, 'w') as f: <NEW_LINE> <INDENT> is_sparse = 1 if sparse.issparse(X) else 0 <NEW_LINE> f['issparse'] = is_sparse <NEW_LINE> f['target'] = y <NEW_LINE> if is_sparse: <NEW_LINE> <INDENT> f['shape'] = np.array(X.shape) <NEW_LINE> f['data'] = X.data <NEW_LIN...
Save data as a HDF5 file. Args: X (numpy or scipy sparse matrix): Data matrix y (numpy array): Target vector. path (str): Path to the HDF5 file to save data.
625941f126238365f5f0f422
def __init__(self): <NEW_LINE> <INDENT> self.discriminator = None
Body59 - a model defined in Swagger
625941f1cb5e8a47e48b804d
def modifier(stat): <NEW_LINE> <INDENT> return (stat-10)//2
Fairly accurate to DnD style Returns attribute modifier
625941f138b623060ff0b399
def put(self, key, value): <NEW_LINE> <INDENT> if key in self.mapper: <NEW_LINE> <INDENT> self.deletenode(self.mapper[key]) <NEW_LINE> <DEDENT> self.addnode(QueueNode(key, value))
:type key: int :type value: int :rtype: void
625941f116aa5153ce362a26
def _append_arrs(arrs, use_shared_mem=False, expand=False, batch_axis=0): <NEW_LINE> <INDENT> if isinstance(arrs[0], torch.Tensor): <NEW_LINE> <INDENT> out = arrs <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> out = [torch.from_numpy(x) for x in arrs] <NEW_LINE> <DEDENT> if expand: <NEW_LINE> <INDENT> out = [x.unsqueeze...
Internal impl for returning appened arrays as list.
625941f182261d6c526aba55
def set_default_color_scheme(self, name='Spyder'): <NEW_LINE> <INDENT> color_scheme_name = self.get_option('color_scheme_name', None) <NEW_LINE> if color_scheme_name is None: <NEW_LINE> <INDENT> names = CONF.get("color_schemes", "names") <NEW_LINE> if name not in names: <NEW_LINE> <INDENT> name = names[0] <NEW_LINE> <D...
Set default color scheme (only once)
625941f1b830903b967e9eb1