code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def get_heatmap(self,image,bboxes,threshold=2): <NEW_LINE> <INDENT> heat_map = np.zeros((image.shape[0],image.shape[1])) <NEW_LINE> for bbox in bboxes: <NEW_LINE> <INDENT> heat_map[bbox[0][1]:bbox[1][1], bbox[0][0]:bbox[1][0]]+=1 <NEW_LINE> <DEDENT> if self.old_heatmap is not None: <NEW_LINE> <INDENT> heat_map += 0.99*... | A heatmap of image is created and heat is added in the region
covered by individual bounding box. Threshold is then applied
and outliers are removed | 625941f2c4546d3d9de73014 |
def u_welcome(info, msg): <NEW_LINE> <INDENT> if not admin_check(info): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not msg or not len(msg) in [1,2]: <NEW_LINE> <INDENT> say(info, globals()[sys._getframe().f_code.co_name].__doc__) <NEW_LINE> return <NEW_LINE> <DEDENT> board = get_tc(write=True).get_board(config["... | **!welcome <username> [ircnick] - Add user to organization. Email, username or ID allowed | 625941f20a50d4780f667472 |
def show(self, index): <NEW_LINE> <INDENT> if self.menu and self.menu.parent: <NEW_LINE> <INDENT> self.text = "Return to %s" % self.menu.parent.title <NEW_LINE> if not self.text.strip().lower().endswith("menu"): <NEW_LINE> <INDENT> self.text += " menu" <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.text = ... | This class overrides this method | 625941f24f88993c3716c63b |
def get_name_without_version(self): <NEW_LINE> <INDENT> if self.required_by: <NEW_LINE> <INDENT> return "# {} # Installed as dependency for {}".format( self.name, ", ".join(self.required_by) ) <NEW_LINE> <DEDENT> return self.name | Return the name of the package without a version. | 625941f24c3428357757c8fe |
def setParameterInt64(self, *args, **kwargs): <NEW_LINE> <INDENT> return _engine_internal.Region_setParameterInt64(self, *args, **kwargs) | setParameterInt64(self, name, value) | 625941f23d592f4c4ed1d637 |
def find_element_by_name(self, name): <NEW_LINE> <INDENT> return self.find_element(by=By.NAME, value=name) | Finds an element by name.
:param name: The name of the element to find. | 625941f266656f66f7cbc788 |
def step(self, action): <NEW_LINE> <INDENT> action = self._sanitize_action(action) <NEW_LINE> self._env.set_actions(self.brain_name, action) <NEW_LINE> step_result = self._step() <NEW_LINE> if self._multiagent: <NEW_LINE> <INDENT> return self._multi_step(step_result) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return... | Run one timestep of the environment's dynamics.
Accepts an action and returns a tuple (observation, reward, done, info).
In the case of multi-agent environments, these are lists.
Args:
action (object/list): an action provided by the environment
Returns:
observation (object/list): agent's observation of the cur... | 625941f24e4d5625662d49aa |
def test_auth_user_can_post_new_post(self) -> None: <NEW_LINE> <INDENT> self.user_seeder.create_user() <NEW_LINE> self.login_user(username='john', password='john123') <NEW_LINE> response = self.client.post('/posts', data=dict(body="This is new post form John"), follow_redirects=True) <NEW_LINE> self.assertEqual(respons... | It test that logged in user can post new post | 625941f2cad5886f8bd275b3 |
def countRangeSum(self, nums, lower, upper): <NEW_LINE> <INDENT> root = TreeNode(0) <NEW_LINE> presum = BST() <NEW_LINE> curSum = 0 <NEW_LINE> result = 0 <NEW_LINE> for num in nums: <NEW_LINE> <INDENT> curSum += num <NEW_LINE> upper2 = curSum - lower <NEW_LINE> lower2 = curSum - upper <NEW_LINE> result += presum.queryL... | :type nums: List[int]
:type lower: int
:type upper: int
:rtype: int | 625941f207f4c71912b11a60 |
def restoreClean ( ): <NEW_LINE> <INDENT> for htmlFileName in os.listdir( 'data/raw' ): <NEW_LINE> <INDENT> with open( 'data/raw/' + htmlFileName ) as htmlFile: <NEW_LINE> <INDENT> webPage = htmlFile.read( ) <NEW_LINE> title, tokens = spider.parse( webPage, args.tokenizer ) <NEW_LINE> lowerTokens = spider.lower( toke... | Opens every file in data/raw directory, parsing, lowercasing,
and stemming. Stores results in data/clean directory. | 625941f2d8ef3951e3243b18 |
def read_messages(message_file): <NEW_LINE> <INDENT> message_list = [] <NEW_LINE> for line in message_file: <NEW_LINE> <INDENT> line = line.strip() <NEW_LINE> message_list.append(line) <NEW_LINE> <DEDENT> return message_list | (file open for reading) -> list of str
Read and return the contents of message_file as a list of messages. | 625941f22c8b7c6e89b35d96 |
def t111112_1000(): <NEW_LINE> <INDENT> def ExitPause(): <NEW_LINE> <INDENT> SetEventState(71120418, 1) <NEW_LINE> <DEDENT> assert t111112_x3(text1=11250200, z2=71120428, flag14=0, mode11=1) <NEW_LINE> def WhilePaused(): <NEW_LINE> <INDENT> c1_119(0) <NEW_LINE> c1_120(9, 2, 1, 9, 9, 9, 9, 9, 9) <NEW_LINE> <DEDENT> Quit... | State 0,2 | 625941f2b57a9660fec33e68 |
def dispatch( self, input, handle_stash: Callable[[str, Optional[Tensor]], None], handle_pop: Callable[[str], Optional[Tensor]], ): <NEW_LINE> <INDENT> generator = self.module(input) <NEW_LINE> if not isinstance(generator, Generator): <NEW_LINE> <INDENT> output = generator <NEW_LINE> return output <NEW_LINE> <DEDENT> t... | Dispatches :class:`stash` or :class:`pop` commands generated by the
module's ``forward()``. | 625941f245492302aab5e8a4 |
def process(self, event_manager): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = self._socket.recv(4096) <NEW_LINE> <DEDENT> except socket.error as error: <NEW_LINE> <INDENT> log.error(unicode(error)) <NEW_LINE> self.disconnect('Connection reset by peer') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not data: ... | Processes new data received from the IRC server. | 625941f28e71fb1e9831dd81 |
def add_event(self, event): <NEW_LINE> <INDENT> self.events.append(event) | :type event: nlplingo.text.text_theory.Event | 625941f2d268445f265b544a |
def addStudent(student): <NEW_LINE> <INDENT> pass | Add a student to the advised students list. | 625941f2e8904600ed9f2512 |
def pos(self: S, pos: ElementArg[Tuple[NumAttr, NumAttr]]) -> S: <NEW_LINE> <INDENT> return self.attrs(pos=pos) | Sets the position of the label relative to its parent element.
If the parent is a node, (0,0) will be the node's center. If the parent is an
edge connecting two nodes, (0,0) will be the midpoint between the two nodes. If
the parent is a looping edge connecting one node, (0,0) will be a point on the
node's boundary.
:... | 625941f201c39578d7e75416 |
def owner_access_only(handler_method): <NEW_LINE> <INDENT> handler_signature = signature(handler_method) <NEW_LINE> @wraps(handler_method) <NEW_LINE> def _wrapped_handler(*args, **kwargs): <NEW_LINE> <INDENT> if {'admin', 'system'} & set(g.groups): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ... | Decorator that limit access for user,
that does not connected to the requested model.
Guess model name from handler method arguments.
:param handler_method: decorated handler method | 625941f2377c676e91272781 |
def incident_form(request): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> f = IncidentForm(request.POST) <NEW_LINE> if f.is_valid(): <NEW_LINE> <INDENT> f.save() <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> f = IncidentForm() <NEW_LINE> <DEDENT> return render_to_response('incidents/inci... | Form for users to submit an incident | 625941f2046cf37aa974d31c |
def before_save(self, session, global_step_value): <NEW_LINE> <INDENT> session.graph._unsafe_unfinalize() <NEW_LINE> self.pruning_obj.run_update_step(session, global_step_value) | Before save processing. | 625941f223849d37ff7b3665 |
@set_module('mxnet.symbol.numpy') <NEW_LINE> def ones_like(a, dtype=None, order='C', ctx=None, out=None): <NEW_LINE> <INDENT> if order != 'C': <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> if ctx is None: <NEW_LINE> <INDENT> ctx = current_context() <NEW_LINE> <DEDENT> return _npi.full_like(a, fill_v... | Return an array of ones with the same shape and type as a given array.
Parameters
----------
a : _Symbol
The shape and data-type of `a` define these same attributes of
the returned array.
fill_value : scalar
Fill value.
dtype : data-type, optional
Overrides the data type of the result.
Temporarily ... | 625941f260cbc95b062c6b1f |
def close(self): <NEW_LINE> <INDENT> self.connection.close() | Close connection with DB | 625941f2b830903b967e9edf |
def is_monophyletic(self,taxon_list): <NEW_LINE> <INDENT> if isinstance(taxon_list,str): <NEW_LINE> <INDENT> taxon_set=set([taxon_list]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> taxon_set=set(taxon_list) <NEW_LINE> <DEDENT> node_id=self.root <NEW_LINE> while 1: <NEW_LINE> <INDENT> subclade_taxa=set(self.get_taxa(n... | Return node_id of common ancestor if taxon_list is monophyletic, -1 otherwise.
result = is_monophyletic(self,taxon_list) | 625941f2925a0f43d254a458 |
def __set_header(self, url): <NEW_LINE> <INDENT> self.HEADER['Host'] = url.split('/')[2] <NEW_LINE> self.session.headers.update(self.HEADER) | Set HTTP request header.
:return: None | 625941f2be8e80087fb21213 |
def state_firsthop(f_router, table): <NEW_LINE> <INDENT> routers = [] <NEW_LINE> router_ids = sorted(table.keys()) <NEW_LINE> for router in router_ids: <NEW_LINE> <INDENT> if table[router][0] == f_router: <NEW_LINE> <INDENT> routers.append(router) <NEW_LINE> <DEDENT> <DEDENT> return routers | Function that returns the routers in which the routes in the routing
table use the input f_router as first hop | 625941f2a934411ee3751c70 |
def validate_options(options, args): <NEW_LINE> <INDENT> if options.max_length < options.min_length: <NEW_LINE> <INDENT> sys.stderr.write("The maximum length of a word can not be " "lesser then minimum length.\n" "Check the specified settings.\n") <NEW_LINE> sys.exit(1) <NEW_LINE> <DEDENT> if len(args) > 1: <NEW_LINE> ... | Given a set of command line options, performs various validation checks | 625941f230bbd722463cc3a4 |
def create_string_array(self, key, value): <NEW_LINE> <INDENT> supported_variable_type = 'StringArray' <NEW_LINE> if self.variable_type(key) != supported_variable_type: <NEW_LINE> <INDENT> raise RuntimeError(f'The key provided ({key}) is not a {supported_variable_type} key.') <NEW_LINE> <DEDENT> return self._create_arr... | Create method of CRUD operation for string array data.
Args:
key (str): The variable to write to the DB.
value (any): The data to write to the DB.
Returns:
(str): Result of DB write. | 625941f296565a6dacc8fca4 |
def fetch_and_check(source): <NEW_LINE> <INDENT> sids = fetch_skeletons_pc(source) <NEW_LINE> problemSkels = check_skeleton_list(sids, source) <NEW_LINE> return problemSkels | fetch the skeletons to the computer, and check each skeleton | 625941f263d6d428bbe44acc |
def _get_labels_filename(self): <NEW_LINE> <INDENT> root_labels = os.path.join( self._data_dir, '{}.csv'.format(self._split) ) <NEW_LINE> if tf.gfile.Exists(root_labels): <NEW_LINE> <INDENT> return root_labels <NEW_LINE> <DEDENT> split_labels_generic = os.path.join( self._data_dir, self._split, 'labels.csv' ) <NEW_LINE... | Get the label file.
| 625941f267a9b606de4a8491 |
def fullJustify(self, words, maxWidth): <NEW_LINE> <INDENT> rendered = [] <NEW_LINE> wordBuffer = [] <NEW_LINE> for i in range(len(words)): <NEW_LINE> <INDENT> if wordBuffer != [] and len(" ".join(wordBuffer) + " " + words[i]) >= maxWidth: <NEW_LINE> <INDENT> totalSpace = maxWidth - len("".join(wordBuffer)) <NEW_LINE> ... | :type words: List[str]
:type maxWidth: int
:rtype: List[str] | 625941f2c432627299f05226 |
def _get_required_fields(self, table): <NEW_LINE> <INDENT> required_fields = [] <NEW_LINE> for row in self._get_pragma(table): <NEW_LINE> <INDENT> if row[3] == 1: <NEW_LINE> <INDENT> required_fields.append(str(row[1])) <NEW_LINE> <DEDENT> <DEDENT> return required_fields | Return a list of fields that have NOT NULL set.
Parameters
----------
table: str
Name of table to get required fields for. | 625941f23617ad0b5ed684d1 |
def add_css(self, css): <NEW_LINE> <INDENT> self.__css += css | append CSS to this Screen
@param css: str CSS to be appended | 625941f23cc13d1c6d3c7952 |
def delete_dir_by_url(self, dir_url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> r = request.delete(dir_url) <NEW_LINE> <DEDENT> except request.ConnectionError as e: <NEW_LINE> <INDENT> return (False, 0, str(e)) <NEW_LINE> <DEDENT> msg = get_response_msg(r) <NEW_LINE> if r.status_code == 204: <NEW_LINE> <INDENT> retu... | 删除一个目录
:param dir_url: 目录url
:return: (ok, code, msg)
ok: True or False, 指示请求是否成功
code: 请求返回的状态码
msg: 请求结果描述字符串 | 625941f23c8af77a43ae3d83 |
def fetch_repo(*, feedstock_dir, origin, upstream, branch, base_branch="main"): <NEW_LINE> <INDENT> if not os.path.isdir(feedstock_dir): <NEW_LINE> <INDENT> p = subprocess.run( f"git clone -q {origin} {feedstock_dir}", shell=True, ) <NEW_LINE> if p.returncode != 0: <NEW_LINE> <INDENT> msg = "Could not clone " + origin ... | fetch a repo and make a PR branch
Parameters
----------
feedstock_dir : str
The directory where you want to clone the feedstock.
origin : str
The origin to clone from.
upstream : str
The upstream repo to add as a remote named `upstream`.
branch : str
The branch to make and checkout.
base_branch : str, ... | 625941f297e22403b379d577 |
def get_request(self, deflate=True): <NEW_LINE> <INDENT> if deflate: <NEW_LINE> <INDENT> request = OneLogin_Saml2_Utils.deflate_and_base64_encode(self.__authn_request) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> request = OneLogin_Saml2_Utils.b64encode(self.__authn_request) <NEW_LINE> <DEDENT> return request | Returns unsigned AuthnRequest.
:param deflate: It makes the deflate process optional
:type: bool
:return: AuthnRequest maybe deflated and base64 encoded
:rtype: str object | 625941f215baa723493c4556 |
def _cc(self, color): <NEW_LINE> <INDENT> if color == 'white': <NEW_LINE> <INDENT> return '7' <NEW_LINE> <DEDENT> elif color == 'black': <NEW_LINE> <INDENT> return '0' <NEW_LINE> <DEDENT> elif color == 'default': <NEW_LINE> <INDENT> return '9' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return '8;2;{};{};{}'.format(*... | Return the "SGR" parameter for selecting color.
See https://en.wikipedia.org/wiki/ANSI_escape_code#SGR for an
explanation. We use the basic codes for black/white/default for
maximum compatibility; they are the only colors used when the
mono palette is selected. | 625941f27cff6e4e81117f61 |
def test_generate_matchup_tags(self): <NEW_LINE> <INDENT> key_word = {'text': "NYG@DAL", 'type': 'ORG', 'start_char': 94, 'end_char': 104} <NEW_LINE> desired_tags = [{"type": "team", "value": "DALLAS COWBOYS", 'isPrimary': True}, {"type": "league", "value": "NFL", 'isPrimary': False}, {"type": "sport", "value": "FOOTBA... | Duplicate tags is fine as this is handled in seperate methods | 625941f25510c4643540f9b0 |
def _insert_forward(self, docid, words): <NEW_LINE> <INDENT> idx = self._fwd_index <NEW_LINE> has_key = idx.has_key <NEW_LINE> for word in words: <NEW_LINE> <INDENT> if not has_key(word): <NEW_LINE> <INDENT> idx[word] = IISet() <NEW_LINE> <DEDENT> idx[word].insert(docid) | insert a sequence of words into the forward index | 625941f21d351010ab8560f6 |
def eval(self, stage=Stage.TEST): <NEW_LINE> <INDENT> super().eval() <NEW_LINE> self._set_module_stage(stage) | Override to set stage | 625941f201c39578d7e75417 |
def _prepare_skip_character_set(ModeName, OptionsDb, CounterDb, IncidenceDb, MHI): <NEW_LINE> <INDENT> SkipSetupList = OptionsDb.value_sequence("skip") <NEW_LINE> if SkipSetupList is None or len(SkipSetupList) == 0: <NEW_LINE> <INDENT> return [], [] <NEW_LINE> <DEDENT> iterable = SkipSetupList.__iter__() <NEW... | MHI = Mode hierarchie index. | 625941f2d10714528d6002c6 |
def reservation_delete(request, reservation_id): <NEW_LINE> <INDENT> Reservation.objects.get(id=reservation_id).delete() <NEW_LINE> return HttpResponseRedirect(reverse('reservations:reservations', kwargs={})) | Delete reservation.
Redirect to list of reservations. | 625941f2498bea3a759ba089 |
def get_step_stats_for_run(self, run_id: str, step_keys=None) -> List[RunStepKeyStatsSnapshot]: <NEW_LINE> <INDENT> logs = self.get_logs_for_run(run_id) <NEW_LINE> if step_keys: <NEW_LINE> <INDENT> logs = [ event for event in logs if event.is_dagster_event and event.get_dagster_event().step_key in step_keys ] <NEW_LINE... | Get per-step stats for a pipeline run. | 625941f2e64d504609d74e1b |
def p_modelexpressionlist_modelexpression_list_expression(p): <NEW_LINE> <INDENT> vartype = p[3][1] <NEW_LINE> vartype = MODEL_MAP.get(vartype, 'ScilabDouble') <NEW_LINE> if vartype != '': <NEW_LINE> <INDENT> p[0] = '%s, new %s([%s])' % (p[1], vartype, p[3][0]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = '%s,%... | modelexpressionlist : modelexpressionlist COMMA expression
| modelexpressionlist COMMA listcall | 625941f2566aa707497f4b3c |
def test_code_qa(cookies, context): <NEW_LINE> <INDENT> context['create_virtualenv'] = 'Yes' <NEW_LINE> result = cookies.bake(extra_context=context) <NEW_LINE> base_path = str(result.project) <NEW_LINE> try: <NEW_LINE> <INDENT> sh.flake8('{path}/setup.py {path}/{namespace}'.format( path=base_path, namespace=context['na... | Generated project should pass flake8 and py.test. | 625941f207d97122c4178e75 |
def hogwarts_by_house(filename): <NEW_LINE> <INDENT> dumbledores_army = [] <NEW_LINE> gryffindor = [] <NEW_LINE> hufflepuff = [] <NEW_LINE> ravenclaw = [] <NEW_LINE> slytherin = [] <NEW_LINE> ghosts = [] <NEW_LINE> instructors = [] <NEW_LINE> all_hogwarts = [dumbledores_army, gryffindor, hufflepuff, ravenclaw, slytheri... | TODO: Sort students into lists by house and return all lists in one list.
Iterate over the data to create an alphabeticaly sorted list for each
house, and sorts students into their appropriate houses by last name. Sorts
ghosts into a list called "ghosts" and instructors into a list called
"instructors". Add them, in t... | 625941f28e7ae83300e4b5aa |
def get_accuracy_image(self, fname=None): <NEW_LINE> <INDENT> print('get_accuracy_image') | Returns validation screen image and optinally save it to disk
| 625941f263f4b57ef00016e3 |
def _get_mounts(self): <NEW_LINE> <INDENT> return (dir(m) for m in wrapped(win32file.GetVolumePathNamesForVolumeName, self.name)) | An iterator of the :class:`Dir` objects which mount this volume. NB Windows
restrictions mean that no more than one drive root directory can mount the same
volume simultaneously. But it is possible for a volume to be mounted on, eg,
e:\ and c:\mounts\e at the same time. | 625941f296565a6dacc8fca5 |
def findMaxConsecutiveOnes(self, nums): <NEW_LINE> <INDENT> count = 0 <NEW_LINE> list_of_count = [] <NEW_LINE> for i in range(len(nums)): <NEW_LINE> <INDENT> if nums[i] == 1: <NEW_LINE> <INDENT> count+=1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> list_of_count.append(count) <NEW_LINE> count=0 <NEW_LINE> <DEDENT> <DE... | :type nums: List[int]
:rtype: int | 625941f28a349b6b435e874e |
def _get_image_blob(roidb, scale_inds, is_reshape=True): <NEW_LINE> <INDENT> num_images = len(roidb) <NEW_LINE> processed_ims = [] <NEW_LINE> im_scales = [] <NEW_LINE> for i in range(num_images): <NEW_LINE> <INDENT> imgpath=roidb[i]['image'] <NEW_LINE> im = cv2.imread(imgpath) <NEW_LINE> if roidb[i]['flipped']: <NEW_LI... | Builds an input blob from the images in the roidb at the specified
scales. | 625941f2cdde0d52a9e53614 |
def sum_log(self, user_id): <NEW_LINE> <INDENT> with self.connection: <NEW_LINE> <INDENT> self.cursor.execute("SELECT sum(amount) FROM fridays_transactions " "WHERE user_id=%s", (user_id,)) <NEW_LINE> row = self.cursor.fetchall() <NEW_LINE> print('amount sum: {}'.format(row[0][0])) <NEW_LINE> <DEDENT> return row[0][0] | Sums over all elements in amount with given user_id | 625941f2b545ff76a89143f1 |
def test_udefinded_method_with_primitive_type(self): <NEW_LINE> <INDENT> self.assertRaises( AttributeError, lambda: Conference(self.name).addElement('bar')) | test calling undefined method | 625941f2187af65679ca56fc |
def correct_parent_partner(self, cr, uid, context=None): <NEW_LINE> <INDENT> claim_ids = self.search(cr, uid, [], context=context) <NEW_LINE> for claim in self.browse(cr, uid, claim_ids, context=context): <NEW_LINE> <INDENT> if claim.partner_id and claim.partner_id.parent_id: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT... | Set claim to parent partner not destination
| 625941f2cc0a2c11143dd46d |
def is_bad_version(self, n: int) -> bool: <NEW_LINE> <INDENT> return True | :param n:
:return: | 625941f2adb09d7d5db6cd68 |
def set_setting(name, value, channel="", server=""): <NEW_LINE> <INDENT> if channel: <NEW_LINE> <INDENT> from core import channeltools <NEW_LINE> return channeltools.set_channel_setting(name, value, channel) <NEW_LINE> <DEDENT> elif server: <NEW_LINE> <INDENT> from core import servertools <NEW_LINE> return servertools.... | Fija el valor de configuracion del parametro indicado.
Establece 'value' como el valor del parametro 'name' en la configuracion global o en la configuracion propia del
canal 'channel'.
Devuelve el valor cambiado o None si la asignacion no se ha podido completar.
Si se especifica el nombre del canal busca en la ruta ... | 625941f2d268445f265b544b |
def tick( format_func: Optional[Callable] = format_seconds, print_func: Optional[Callable] = print ) -> None: <NEW_LINE> <INDENT> ident = threading.get_ident() <NEW_LINE> if ident in _ticks_per_thread: <NEW_LINE> <INDENT> _ticks_per_thread[ident].tick() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> _ticks_per_thread[id... | Create a TickTock object for a current thread,
or do a 'tick' for an existing one
Args: look at ion.time.ticktock.TickTock.__init__ | 625941f263d6d428bbe44acd |
def root_with_outgroup(self, outgroup=None): <NEW_LINE> <INDENT> def _connect_subtree(parent, child): <NEW_LINE> <INDENT> for i, branch in enumerate(self.unrooted): <NEW_LINE> <INDENT> if parent in branch[:2] and child in branch[:2]: <NEW_LINE> <INDENT> branch = self.unrooted.pop(i) <NEW_LINE> break <NEW_LINE> <DEDENT>... | Define a tree's root with a reference group outgroup. | 625941f2507cdc57c63072c5 |
def sprint_addr(addr): <NEW_LINE> <INDENT> if not len(addr): <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> return str(ipaddress.ip_address(addr)) | binary ip addr -> string | 625941f2eab8aa0e5d26e136 |
def __init__(self, name): <NEW_LINE> <INDENT> log.msg("Initializing factory for world '%s'..." % name) <NEW_LINE> self.name = name <NEW_LINE> self.config_name = "world %s" % name <NEW_LINE> self.port = configuration.getint(self.config_name, "port") <NEW_LINE> self.interface = configuration.getdefault(self.config_name, ... | Create a factory and world.
``name`` is the string used to look up factory-specific settings from
the configuration.
:param str name: internal name of this factory | 625941f2379a373c97cfb123 |
def evaluation_step(self, batch): <NEW_LINE> <INDENT> pass | Implements an evaluation step that includes:
* Forward a batch through the network(s)
* Compute loss(es) or any other evaluation metrics.
* Return a dictionary with the computed losses the evaluation
metrics for that batch. The key names on the dictionary can be
arbitrary. | 625941f257b8e32f52483a7b |
def GetFinalType(self): <NEW_LINE> <INDENT> return self | Returns the final type of this description, following Typedefs links.
This method should be overridden by Description sub-types that are types,
and represent links to other types (like Typedefs).
Returns:
The final type. | 625941f2097d151d1a223432 |
def transpose(data): <NEW_LINE> <INDENT> if isinstance(data, dict): <NEW_LINE> <INDENT> return [ tuple(data.keys()), tuple(data.values()) ] <NEW_LINE> <DEDENT> if isinstance(data, list): <NEW_LINE> <INDENT> result = [] <NEW_LINE> for field in data[0]._fields: <NEW_LINE> <INDENT> fields = [] <NEW_LINE> for member in dat... | Transpose a data structure
1. dict
data = {'2017-8': 19, '2017-9': 13}
In: transpose(data)
Out: [('2017-8', '2017-9'), (19, 13)]
2. list of (named)tuples
data = [Member(name='Bob', since_days=60, karma_points=60,
bitecoin_earned=56),
Member(name='Julian', since_days=221, karma_points=34,
... | 625941f2004d5f362079a90a |
def require_ajax(func): <NEW_LINE> <INDENT> @wraps(func) <NEW_LINE> def _inner(request, *args, **kwargs): <NEW_LINE> <INDENT> if not request.is_ajax(): <NEW_LINE> <INDENT> return HttpResponseBadRequest() <NEW_LINE> <DEDENT> return func(request, *args, **kwargs) <NEW_LINE> <DEDENT> return _inner | AJAX request required decorator. Use it in your views:
@ajax_required
def my_view(request):
.... | 625941f224f1403a9260113d |
def test_waitforthreads_timeout(self): <NEW_LINE> <INDENT> thread = launch_thread(None, thread_function, True, 0.1) <NEW_LINE> self.assertEqual(list(waitforthreads([thread], timeout=0.01)), []) | Waitforthreads returns empty list if timeout. | 625941f2d58c6744b4258239 |
def onShowStar(self, event): <NEW_LINE> <INDENT> kpoint = self.klist_ctrl.getSelectedKpoint() <NEW_LINE> if kpoint is None: return <NEW_LINE> star = kpoint.compute_star(self.structure.fm_symmops) <NEW_LINE> KpointsFrame(self, self.structure, star, title="Star of point: " + str(star.base_point)).Show() | Show a new `KpointsFrame` with the list of points in the star of the selected k-point. | 625941f2442bda511e8be9eb |
def treatFailedProdWithNoReq(self, jobID): <NEW_LINE> <INDENT> res = self.markJob(jobID, "Failed") <NEW_LINE> if res["OK"]: <NEW_LINE> <INDENT> self.accounting["Production"].append({"JobID": jobID, "JobStatus": "Failed with 'Pending Requests'", "Treatment": ("Job Marked Failed with minor status 'Requests Done' " "and a... | treatment for production jobs in failed status which don't have a request in RMS | 625941f24d74a7450ccd47a1 |
def add_favorite(self, product, substitute): <NEW_LINE> <INDENT> query = "INSERT INTO favorite (id_compared, id_result) VALUES (%s, %s)" <NEW_LINE> cursor = self.connect.create_cursor() <NEW_LINE> cursor.execute(query, (product.id, substitute.id,)) <NEW_LINE> self.connect.commit() | Method for adding favorites in the db | 625941f28c0ade5d55d3ef9c |
def remove(self, name, func): <NEW_LINE> <INDENT> if name not in self.hooks: <NEW_LINE> <INDENT> raise ValueError("Unknown hook name %s" % name) <NEW_LINE> <DEDENT> was_empty = self._empty() <NEW_LINE> self.hooks[name].remove(func) <NEW_LINE> if self.app and not was_empty and self._empty(): self.app.reset() | Remove a callback from a hook. | 625941f226238365f5f0f452 |
def unsubscribe(self): <NEW_LINE> <INDENT> _LOGGER.info("PubNub unsubscribing") <NEW_LINE> for pubnub in self._pubnubs: <NEW_LINE> <INDENT> pubnub.unsubscribe_all() <NEW_LINE> pubnub.stop() <NEW_LINE> pubnub = None <NEW_LINE> <DEDENT> self._pubnubs.clear() | Completly stop all pubnub operations. | 625941f2dd821e528d63b780 |
def listModelObjectClasses(self): <NEW_LINE> <INDENT> return list(self._registered_objects.values()) | returns a list of registered classes | 625941f26e29344779a62bed |
def contract_ABMPS(state, compress_alg='contract first', svd_option=None): <NEW_LINE> <INDENT> horizontal = False <NEW_LINE> while state.ncol > 2 and state.nrow > 2: <NEW_LINE> <INDENT> edge = state[:,:2] if horizontal else state[:2] <NEW_LINE> body = state[:,2:] if horizontal else state[2:] <NEW_LINE> state = contract... | Contract the PEPS by performing alternating vertical and horizontal bondary contractions.
Parameters
----------
mps_mult_mpo: method or None, optional
The method used to apply an MPS to another MPS/MPO.
svd_option: tensorbackends.interface.Option, optional
Parameters for SVD truncations. Will perform SVD if g... | 625941f255399d3f05588c94 |
def __ne__(self, other: 'ProfileLinkLink') -> bool: <NEW_LINE> <INDENT> return not self == other | Return `true` when self and other are not equal, false otherwise. | 625941f26fece00bbac2dd22 |
def appInstall(*args, **kwargs): <NEW_LINE> <INDENT> print("dxpy.appInstall is deprecated; please use app_install instead.", file=sys.stderr) <NEW_LINE> return app_install(*args, **kwargs) | .. deprecated:: 0.42.0
Use :func:`app_install()` instead. | 625941f2004d5f362079a90b |
def get_transactions(self, address): <NEW_LINE> <INDENT> URL = "%s/txs" % self.base_url <NEW_LINE> res = requests.get(URL, params={"address": address}) <NEW_LINE> res.raise_for_status() <NEW_LINE> transactions = [] <NEW_LINE> for transaction in res.json()["txs"]: <NEW_LINE> <INDENT> transactions.append(self._tx_from_js... | Return a list of transaction objects for the given bitcoin address | 625941f2fb3f5b602dac3c76 |
def cast(*args): <NEW_LINE> <INDENT> return _itkInterpolateImageFunctionPython.itkInterpolateImageFunctionIF3F_cast(*args) | cast(itkLightObject obj) -> itkInterpolateImageFunctionIF3F | 625941f2cad5886f8bd275b4 |
def set_current(self, current_percent): <NEW_LINE> <INDENT> self._communicate('SOUR:POW:CURR {}'.format(current_percent)) <NEW_LINE> return self.get_current() | Set laser current setpoint.
@param float current_percent: laser current setpoint | 625941f24527f215b584ca2e |
def __init__(self, opt=None): <NEW_LINE> <INDENT> if opt is None: <NEW_LINE> <INDENT> opt = {} <NEW_LINE> <DEDENT> admm.ADMM.Options.__init__(self, opt) <NEW_LINE> if self['AutoRho', 'RsdlTarget'] is None: <NEW_LINE> <INDENT> self['AutoRho', 'RsdlTarget'] = 1.0 | Parameters
----------
opt : dict or None, optional (default None)
TVL2Denoise algorithm options | 625941f256ac1b37e626479f |
def GetModule(self): <NEW_LINE> <INDENT> return _lldb.SBSymbolContext_GetModule(self) | GetModule(self) -> SBModule | 625941f28a43f66fc4b5463a |
def SEFD(ms, station1, station2, freq): <NEW_LINE> <INDENT> def interp_sefd(freq, antennamode): <NEW_LINE> <INDENT> sefd_pth = pkg_resources.resource_filename('losito', 'data/noise/SEFD_{}.csv'.format(antennamode)) <NEW_LINE> points = np.loadtxt(sefd_pth, dtype=float, delimiter=',') <NEW_LINE> fun = interp1d(points[:, ... | Return the system equivalent flux density (SEFD) for all rows and a
single fequency channel.
The values for the SEFD were derived from van Haarlem
et al. (2013).
Parameters
----------
ms : MS-object
station1 : (n,) ndarray, dtype = int
ANTENNA1 indices.
station2 : (n,) ndarray, dtpe = int
ANTENNA2 indices.
fre... | 625941f24e4d5625662d49ab |
def test_system_number_external(self): <NEW_LINE> <INDENT> self.assertEqual( self.bibfield_json['system_number_external'], self.record['external_system_numbers'][0] ) | Test if system_number_external is created correctly | 625941f266656f66f7cbc789 |
def test_wpa2_ocv_ap_override_eapol_g1(dev, apdev): <NEW_LINE> <INDENT> params = {"channel": "1", "ieee80211w": "2", "ocv": "1", "oci_freq_override_eapol_g1": "2462"} <NEW_LINE> hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params) <NEW_LINE> bssid = hapd.own_addr() <NEW_LINE> dev[0].connect(ssid, psk=passphrase, sca... | OCV on 2.4 GHz and AP override EAPOL-Key group msg 1/2 | 625941f2e76e3b2f99f3adde |
def insert(self, k): <NEW_LINE> <INDENT> self.heapList.append(k) <NEW_LINE> self.currentSize += 1 <NEW_LINE> self.percUp(self.currentSize) | 先加上值後,再檢查階層架構是否被破壞 | 625941f2a8370b7717052e7a |
def set_gpgkey(self): <NEW_LINE> <INDENT> gpgkey_init = entities.GPGKey.__init__ <NEW_LINE> gpgkey = self.config['gpgkey'] <NEW_LINE> def patched_gpgkey_init(this, server_config=None, **kwargs): <NEW_LINE> <INDENT> gpgkey_init(this, server_config, **kwargs) <NEW_LINE> this._fields['content'].default = gpgkey.get('conte... | Set gpgkey | 625941f2711fe17d8254293a |
def test__voyager_counts_match_obs_general(self): <NEW_LINE> <INDENT> obs = (ObsGeneral.objects.values_list('volume_id') .filter(mission_id='VG') .annotate(Count('volume_id')) .order_by('volume_id')) <NEW_LINE> ref = (ObsMissionVoyager.objects.values_list('volume_id') .annotate(Count('volume_id')) .order_by('volume_id'... | [test_local_db_integrity.py] DB Integrity: volumes in obs_general = obs_mission_voyager
Test that the observation count per volume is the same in
obs_general for mission_id='VG' and obs_mission_voyager. | 625941f2eab8aa0e5d26e137 |
def chunks(lst, size): <NEW_LINE> <INDENT> for i in range(0, len(lst), size): <NEW_LINE> <INDENT> yield lst[i: i + size] | Build a (generator) list of chucks of size 'size' from the list
'list'. Example:
>> p = ['spectri', '8', '150', '13', 'BAT', '5', '148', '1', 'Beny', '5', '148', '3']
>>> print(p, list(chunks(p, 4)))
[['spectri', '8', '150', '13'], ['BAT', '5', '148', '1'], ['Beny', '5', '148', '3']] | 625941f25fcc89381b1e1ca1 |
def setup_worker_threads(self): <NEW_LINE> <INDENT> for thread_number in range(0, self.max_workers): <NEW_LINE> <INDENT> worker = DeviceWorker(self, thread_number) <NEW_LINE> self.worker_threads.append(worker) <NEW_LINE> worker.start() | Setup the worker threads | 625941f2656771135c3ebe53 |
def test_icon_png(self): <NEW_LINE> <INDENT> path = ':/plugins/SafeRouting/icon.png' <NEW_LINE> icon = QIcon(path) <NEW_LINE> self.assertFalse(icon.isNull()) | Test we can click OK. | 625941f24a966d76dd5515f2 |
def __repr__(self): <NEW_LINE> <INDENT> temp_node = self.head <NEW_LINE> values = [] <NEW_LINE> if temp_node is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> while temp_node is not None: <NEW_LINE> <INDENT> values.append(temp_node.value) <NEW_LINE> temp_node = temp_node.next_node <NEW_LINE> <DEDENT> return ... | DO NOT EDIT
String representation of a linked list
:return: string of list of values | 625941f2be8e80087fb21214 |
def image_registered(self, image_path: pathlib.Path) -> bool: <NEW_LINE> <INDENT> cursor = self._connection.cursor() <NEW_LINE> cursor.execute("SELECT * FROM images WHERE path = ?", (str(image_path),)) <NEW_LINE> result = cursor.fetchone() <NEW_LINE> cursor.close() <NEW_LINE> return result is not None | Tells whether the given image has already been registered, i.e. if an entry for the path already exists.
:param image_path: Path to the image.
:return: A boolean value indicating whether it is already registered or not. | 625941f23d592f4c4ed1d63a |
def cli_passthrough(cmd=None, interactive=False): <NEW_LINE> <INDENT> masters, slaves = zip(pty.openpty(), pty.openpty()) <NEW_LINE> for fd in chain(masters, slaves): <NEW_LINE> <INDENT> _set_size(fd) <NEW_LINE> <DEDENT> if interactive: <NEW_LINE> <INDENT> cmd = ["/bin/bash", "-i", "-c"] + cmd.split() <NEW_LINE> <DEDEN... | Largely found in https://stackoverflow.com/a/31953436 | 625941f2bf627c535bc137ac |
def write_files(video, timings, output_folder = None): <NEW_LINE> <INDENT> video_name = video.name <NEW_LINE> if video_name.endswith(".mp4"): video_name = video_name.rstrip(".mp4") <NEW_LINE> elif video_name.endswith(".mov"): video_name = video_name.rstrip(".mov") <NEW_LINE> if output_folder is None: <NEW_LINE> <INDE... | Write the videos that are found in the output. | 625941f27b25080760e39a32 |
def get_options(args): <NEW_LINE> <INDENT> args, defaults = preprocess_args( args, default_home_path_filename='validate_bom.yml') <NEW_LINE> parser = argparse.ArgumentParser(prog='validate_bom.sh') <NEW_LINE> add_standard_parser_args(parser, defaults) <NEW_LINE> add_parser_argument(parser, 'log_dir', defaults, './valid... | Resolve all the command-line options. | 625941f2bd1bec0571d90c0c |
def remove(self, attendees): <NEW_LINE> <INDENT> if isinstance(attendees, (list, tuple)): <NEW_LINE> <INDENT> attendees = { attendee.address if isinstance(attendee, Attendee) else attendee for attendee in attendees} <NEW_LINE> <DEDENT> elif isinstance(attendees, str): <NEW_LINE> <INDENT> attendees = {attendees} <NEW_LI... | Remove the provided attendees from the event
:param attendees: list of attendees to add
:type attendees: str or tuple(str, str) or Attendee or list[str] or
list[tuple(str,str)] or list[Attendee] | 625941f2046cf37aa974d31e |
def connect(self): <NEW_LINE> <INDENT> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) <NEW_LINE> if self.timeout is not None: <NEW_LINE> <INDENT> sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO, struct.pack('fL', self.timeout, 0)) <NEW_LINE> <DEDENT> self.sock = OpenSSLConnectionDelegator(self.context, ... | Connect to an SSL port using the OpenSSL library and apply
per-connection parameters. | 625941f215baa723493c4557 |
def booted(self): <NEW_LINE> <INDENT> while self.running: <NEW_LINE> <INDENT> events = self.poll.poll() <NEW_LINE> event_strings = { select.POLLIN: 'fd_%s_readable', select.POLLOUT: 'fd_%s_writable', select.POLLPRI: 'fd_%s_exceptional' } <NEW_LINE> if not events: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> for eve... | Main I/O loop of the application.
Events raised:
* fd_<object>_readable <object> - fd is readable.
* fd_<object>_writable <object> - fd is writable.
* fd_<object>_exceptional <object> - fd is exceptional. | 625941f27d43ff24873a3282 |
def test_user_used_can_reset_password(self): <NEW_LINE> <INDENT> response = self.post_data_reset_password(reset_password_data) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> response_msg = json.loads(response.data.decode("UTF-8")) <NEW_LINE> self.assertIn("Use this token to reset password", response_... | Test API enables user to reset password | 625941f2b830903b967e9ee1 |
def cube(x): <NEW_LINE> <INDENT> return pow(x, 3) | Cube. | 625941f28da39b475bd65559 |
def insert(self, value): <NEW_LINE> <INDENT> self.startTimer() <NEW_LINE> cur = self.getCursor() <NEW_LINE> digest = Binary(md5(value).digest()) <NEW_LINE> bvalue = Binary(value) <NEW_LINE> cur.execute("INSERT INTO `%s`(hash,value) VALUES (?,?)" % self.getName(), (digest,bvalue,)) <NEW_LINE> item = cur.lastrowid <NEW_L... | :param value: bytes
:return: int | 625941f23539df3088e2e928 |
def predict(self, obs_n, act_n, adjacency): <NEW_LINE> <INDENT> concatenated_input = tf.concat([obs_n, act_n], axis=-1) <NEW_LINE> concatenated_input = tf.transpose(concatenated_input, [1, 0, 2]) <NEW_LINE> return self._predict_internal(concatenated_input, adjacency) | Predict the value of the input.
Shapes:
obs_n: (list no_agents, ndarray(batch_size, no_features))
act_n: (list no_agents, EagerTensor: batch_size, no_actions) | 625941f20c0af96317bb87c4 |
@bp_reclamation.route('/<id>', methods=['PUT']) <NEW_LINE> @login_required <NEW_LINE> @use_args(save_args) <NEW_LINE> def update_reclamation(args, id): <NEW_LINE> <INDENT> reclamation = Reclamation.query.get(id) <NEW_LINE> reclamation.update(**args) <NEW_LINE> db.session.add(reclamation) <NEW_LINE> db.session.commit() ... | Private | 625941f221a7993f00bc82d8 |
def find_nearest_frames(self, idx_list, value): <NEW_LINE> <INDENT> global_val = self.data_key[value] <NEW_LINE> list_idx = [global_val in i for i in self.split_idx].index(True) <NEW_LINE> val_list = self.split_idx[list_idx] <NEW_LINE> length_list = len(val_list) <NEW_LINE> pos = np.where(val_list == global_val)[0][0] ... | Find the index of the two entries that 'value' lies between in 'idx_list' and calculate the distance between each of them.
| 625941f263d6d428bbe44ace |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.