code
stringlengths
51
2.34k
sequence
stringlengths
1.16k
13.1k
docstring
stringlengths
11
171
async def enable_user(self, username): user_facade = client.UserManagerFacade.from_connection( self.connection()) entity = client.Entity(tag.user(username)) return await user_facade.EnableUser([entity])
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'enable_user'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Re-enable a previously disabled user.
def c_struct(self): member = '\n'.join(self.c_member_funcs(True)) if self.opts.windll: return 'struct {{\n{}{} }} {};\n'.format( self._c_dll_base(), member, self.name ) return 'typedef\nstruct {2} {{\n{0}\n{1}}}\n{3};\n'.format( self._c_dll_bas...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'c_struct'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; ...
Get the struct of the module.
def _handle_factory_method(self, service_obj, method_name, args=None, kwargs=None): if args is None: args = [] if kwargs is None: kwargs = {} _check_type('args', args, list) _check_type('kwargs', kwargs, dict) new_args = self...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_handle_factory_method'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier'...
Returns an object returned from a factory method
def _attachChild(self, child): "attach a child database, returning an identifier for it" self._childCounter += 1 databaseName = 'child_db_%d' % (self._childCounter,) self._attachedChildren[databaseName] = child self.executeSQL("ATTACH DATABASE '%s' AS %s" % ( chil...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_attachChild'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
attach a child database, returning an identifier for it
def _to_datalibrary_safe(fname, gi, folder_name, sample_info, config): num_tries = 0 max_tries = 5 while 1: try: _to_datalibrary(fname, gi, folder_name, sample_info, config) break except (simplejson.scanner.JSONDecodeError, bioblend.galaxy.client.ConnectionError) as e...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_to_datalibrary_safe'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'c...
Upload with retries for intermittent JSON failures.
def add(parent, idx, value): if isinstance(parent, dict): if idx in parent: raise JSONPatchError("Item already exists") parent[idx] = value elif isinstance(parent, list): if idx == "" or idx == "~": parent.append(value) else: parent.insert(int(idx), value) else: raise JSONPat...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'par...
Add a value to a dict.
def infra_nodes(info, meta, max_pod_cluster, label, key): nodes = meta.get(label, []) or [] infos = info[info["machine_id"].isin(nodes)] if infos.empty: return return make_response(key, max_pod_cluster=max_pod_cluster, infos=infos, GREEN=Fore.GREEN, RED=Fore.RED, YELLOW=...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'infra_nodes'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children':...
Function used to create the response for all infra node types
def handle_session_cookie(self): if not self.server.settings['jsessionid']: return cookie = self.cookies.get('JSESSIONID') if not cookie: cv = 'dummy' else: cv = cookie.value self.set_cookie('JSESSIONID', cv)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'handle_session_cookie'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
Handle JSESSIONID cookie logic
def main(): conf.init(), db.init(conf.DbPath) inqueue = LineQueue(sys.stdin).queue outqueue = type("", (), {"put": lambda self, x: print("\r%s" % x, end=" ")})() if "--quiet" in sys.argv: outqueue = None if conf.MouseEnabled: inqueue.put("mouse_start") if conf.KeyboardEnabled: inqueue.p...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'main'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '19', '30', '56', '67', '79'...
Entry point for stand-alone execution.
def getcloud(site, feed_id=None): cloudict = fjcache.cache_get(site.id, 'tagclouds') if not cloudict: cloudict = cloudata(site) fjcache.cache_set(site, 'tagclouds', cloudict) if feed_id: feed_id = int(feed_id) if feed_id in cloudict: return cloudict[feed_id] return [] return cloudict[0]
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getcloud'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sit...
Returns the tag cloud for a site or a site's subscriber.
def _dispatch_change_event(self, object, trait_name, old, new, handler): args = self.argument_transform(object, trait_name, old, new) if tnotifier._pre_change_event_tracer is not None: tnotifier._pre_change_event_tracer(object, trait_name, old, new, handler) from automate.common import SystemNotRead...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_dispatch_change_event'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identif...
Prepare and dispatch a trait change event to a listener.
def _compute_mean(self, C, g, mag, hypo_depth, dists, imt): delta = 0.00750 * 10 ** (0.507 * mag) if mag < 6.5: R = np.sqrt(dists.rhypo ** 2 + delta ** 2) else: R = np.sqrt(dists.rrup ** 2 + delta ** 2) mean = ( C['c1'] + C['c2'] * mag + C[...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_compute_mean'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type': 'identifier...
Compute mean according to equation on Table 2, page 2275.
def _margdist_loglr(self, mf_snr, opt_snr): mf_snr_marg = mf_snr/self._dist_array opt_snr_marg = opt_snr/self._dist_array**2 return special.logsumexp(mf_snr_marg - 0.5*opt_snr_marg, b=self._deltad*self.dist_prior)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_margdist_loglr'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '...
Returns the log likelihood ratio marginalized over distance.
def write_type_dumps(self, operations, preserve_order, output_dir): by_type = {SqlType.INDEX: [], SqlType.FUNCTION: [], SqlType.TRIGGER: []} for operation in operations: by_type[operation.sql_type].append(operation) if not preserve_order: for obj_type, ops in by_type.item...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_type_dumps'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children':...
Splits the list of SQL operations by type and dumps these to separate files
async def join(self, ctx, *, channel: discord.VoiceChannel): if ctx.voice_client is not None: return await ctx.voice_client.move_to(channel) await channel.connect()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'join'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Joins a voice channel
def update_selection_self_prior_condition(self, state_row_iter, sm_selected_model_set, selected_model_list): selected_path = self.tree_store.get_path(state_row_iter) tree_model_row = self.tree_store[selected_path] model = tree_model_row[self.MODEL_STORAGE_ID] if model in sm_selected_mode...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_selection_self_prior_condition'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'ide...
Tree view prior update of one model in the state machine selection
def to_flat(coord): if coord is None: return go.N * go.N return go.N * coord[0] + coord[1]
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_flat'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'coord'}; ...
Converts from a Minigo coordinate to a flattened coordinate.
def __get_img(self): with self.fs.open(self.__img_path, 'rb') as fd: img = PIL.Image.open(fd) img.load() return img
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__get_img'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'};...
Returns an image object corresponding to the page
def _filter_seqs(fn): out_file = op.splitext(fn)[0] + "_unique.fa" idx = 0 if not file_exists(out_file): with open(out_file, 'w') as out_handle: with open(fn) as in_handle: for line in in_handle: if line.startswith("@") or line.startswith(">"): ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_filter_seqs'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'fn'}...
Convert names of sequences to unique ids
def getThirdPartyLibCmakeFlags(self, libs): fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] platformDefaults = True if libs[0] == '--nodefaults': platformDefaults = False libs = libs[1:] details = self.getThirdpartyLibs(libs, includeP...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getThirdPartyLibCmakeFlags'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children':...
Retrieves the CMake invocation flags for building against the Unreal-bundled versions of the specified third-party libraries
def course(self): course = self.parent while course.parent: course = course.parent return course
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'course'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'...
Course this node belongs to
def getRecommendedRenderTargetSize(self): fn = self.function_table.getRecommendedRenderTargetSize pnWidth = c_uint32() pnHeight = c_uint32() fn(byref(pnWidth), byref(pnHeight)) return pnWidth.value, pnHeight.value
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getRecommendedRenderTargetSize'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': ...
Suggested size for the intermediate render target that the distortion pulls from.
def resolve_params(self, text): " Parse the parameters into a dict. " params = MultiValueDict() for line in text.split('\n'): pair = line.split(':', 1) if len(pair) == 2: params.appendlist(pair[0].strip(), pair[1].strip()) return params
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'resolve_params'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Parse the parameters into a dict.
def remove(self, filename): output = self.shell('rm', filename) return False if output else True
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Remove file from device
def match(self, p_todo): children = self.todolist.children(p_todo) uncompleted = [todo for todo in children if not todo.is_completed()] return not uncompleted
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'match'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
Returns True when there are no children that are uncompleted yet.
async def update_version(self): get_version = GetVersion(pyvlx=self) await get_version.do_api_call() if not get_version.success: raise PyVLXException("Unable to retrieve version") self.version = get_version.version get_protocol_version = GetProtocolVersion(pyvlx=self)...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_version'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Retrieve version and protocol version from API.
def _initFilesystemInfo(self): self._mapFSpathDev = {} fsinfo = FilesystemInfo() for fs in fsinfo.getFSlist(): devpath = fsinfo.getFSdev(fs) dev = self._getUniqueDev(devpath) if dev is not None: self._mapFSpathDev[fs] = dev
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_initFilesystemInfo'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Initialize filesystem to device mappings.
def update(self, **kwargs): for k in self.prior_params: try: self.params[k] = kwargs[self.alias[k]] except(KeyError): pass
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Update `params` values using alias.
def _get_repo_metadata(self): cache = salt.cache.Cache(self.opts, self.opts['spm_cache_dir']) metadata = {} def _read_metadata(repo, repo_info): if cache.updated('.', repo) is None: log.warning('Updating repo metadata') self._download_repo_metadata({})...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_repo_metadata'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Return cached repo metadata
def from_json_format(conf): if 'fmode' in conf: conf['fmode'] = int(conf['fmode'], 8) if 'dmode' in conf: conf['dmode'] = int(conf['dmode'], 8)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_json_format'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Convert fields of parsed json dictionary to python format
def toggle_input(self): current_index = self.input.currentIndex() if self.input.itemData(current_index, Qt.UserRole) != ( self.radio_button_enabler): self.disable_radio_button() else: self.enable_radio_button()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'toggle_input'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self...
Change behaviour of radio button based on input.
def fire_exception(exc, opts, job=None, node='minion'): if job is None: job = {} event = salt.utils.event.SaltEvent(node, opts=opts, listen=False) event.fire_event(pack_exception(exc), '_salt_error')
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fire_exception'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': ...
Fire raw exception across the event bus
def ecdh(self, identity, pubkey): log.info('please confirm GPG decryption on %s for "%s"...', self.device, identity.to_string()) with self.device: return self.device.ecdh(pubkey=pubkey, identity=identity)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ecdh'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Derive shared secret using ECDH from remote public key.
def html(self, text=TEXT): self.logger.debug("Generating the HTML report{}..." .format(["", " (text only)"][text])) html = [] for piece in self._pieces: if isinstance(piece, string_types): html.append(markdown2.markdown(piece, extras=["tables...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'html'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'};...
Generate an HTML file from the report data.
def _all(self, *args, **kwargs): data = dict() data['software'] = self._software(**kwargs) data['system'] = self._system(**kwargs) data['services'] = self._services(**kwargs) try: data['configuration'] = self._configuration(**kwargs) except InspectorQueryExcep...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_all'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Return all the summary of the particular system.
async def connect(self): request = stun.Message(message_method=stun.Method.ALLOCATE, message_class=stun.Class.REQUEST) request.attributes['LIFETIME'] = self.lifetime request.attributes['REQUESTED-TRANSPORT'] = UDP_TRANSPORT try: response, _ = aw...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'connect'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {...
Create a TURN allocation.
def add_cssfile(self, src: str) -> None: self.head.appendChild(Link(rel='stylesheet', href=src))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_cssfile'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
Add CSS file to load at this document's header.
def sar(computation: BaseComputation) -> None: shift_length, value = computation.stack_pop(num_items=2, type_hint=constants.UINT256) value = unsigned_to_signed(value) if shift_length >= 256: result = 0 if value >= 0 else constants.UINT_255_NEGATIVE_ONE else: result = (value >> shift_leng...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sar'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6']}; {'i...
Arithmetic bitwise right shift
def measure_string(self, text, fontname, fontsize, encoding=0): return _fitz.Tools_measure_string(self, text, fontname, fontsize, encoding)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'measure_string'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'childr...
Measure length of a string for a Base14 font.
def ignore_failed_logs_action(self, request, queryset): count = _ignore_failed_logs(queryset) self.message_user( request, _('{count} failed trigger logs marked as ignored.').format(count=count), )
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ignore_failed_logs_action'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'childr...
Set FAILED trigger logs in queryset to IGNORED.
def require_admin(func): @wraps(func) @require_login def decorated(*args, **kwargs): user = current_user() if user and user.is_admin: return func(*args, **kwargs) else: return Response( 'Forbidden', 403 ) return decorated
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'require_admin'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'fun...
Requires an admin user to access this resource.
def use_plenary_sequence_rule_enabler_rule_view(self): self._object_views['sequence_rule_enabler_rule'] = PLENARY for session in self._get_provider_sessions(): try: session.use_plenary_sequence_rule_enabler_rule_view() except AttributeError: pass
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'use_plenary_sequence_rule_enabler_rule_view'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier',...
Pass through to provider SequenceRuleEnablerRuleLookupSession.use_plenary_sequence_rule_enabler_rule_view
def register_pkg(name, formula_def, conn=None): close = False if conn is None: close = True conn = init() conn.execute('INSERT INTO packages VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', ( name, formula_def['version'], formula_def['release'], datetime.datetime.ut...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register_pkg'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
Register a package in the package database
def remove_files(): logger.info("Removing local track files that were not downloaded...") files = [f for f in os.listdir('.') if os.path.isfile(f)] for f in files: if f not in fileToKeep: os.remove(f)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove_files'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '12', '34']}; {'id':...
Removes any pre-existing tracks that were not just downloaded
def finish_experiment(self, session, exp_id): self.logger.debug('Finishing %s' %exp_id) experiments = session.get('experiments', []) experiments = [x for x in experiments if x != exp_id] session['experiments'] = experiments return experiments
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'finish_experiment'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [],...
remove an experiment from the list after completion.
def load_json_network(json_dict): network = pyphi.Network.from_json(json_dict['network']) state = json_dict['state'] return (network, state)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_json_network'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
Load a network from a json file
def addList(self, source_id, dir_path, is_recurcive=False, timestamp_reception=None, training_metadata=[]): if not path.isdir(dir_path): raise ValueError(dir_path + ' is not a directory') files_to_send = _get_files_from_dir(dir_path, is_recurcive) succeed_upload = {} failed_u...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'addList'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13']}; {'id': '4', 'type': 'identifier', 'childr...
Add all profile from a given directory.
def remote(): logger.info("Fetching latest data from PyPI.") results = defaultdict(list) packages = PackageVersion.objects.exclude(is_editable=True) for pv in packages: pv.update_from_pypi() results[pv.diff_status].append(pv) logger.debug("Updated package from PyPI: %r", pv) ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remote'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '12', '19', '32', '61', '6...
Update package info from PyPI.
def named_entity_texts(self): if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() return self.texts(NAMED_ENTITIES)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'named_entity_texts'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
The texts representing named entities.
def removeHandler(self, event_name): if event_name not in self.handlers: raise ValueError('{} is not a valid event'.format(event_name)) self.handlers[event_name] = None
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'removeHandler'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Remove handler for given event.
def _find_frame(stack, start=0): frame = inspect.getframeinfo(stack[start][0]) if frame.function == '__init__': return _find_frame(stack, start + 1) return frame
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_find_frame'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Find the frame with the caller on the stack.
def _clearContents(self): logger.debug("Clearing inspector contents") self.titleLabel.setText('') self.imageItem.clear() self.imagePlotItem.setLabel('left', '') self.imagePlotItem.setLabel('bottom', '') self.histLutItem.setHistogramRange(0, 100) self.histLutItem.s...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_clearContents'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Clears the contents when no valid data is available
def md5hash(self): digest = hashlib.md5(self.content).digest() return b64_string(digest)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'md5hash'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {...
Return the MD5 hash string of the file content
def gen_input_add(sig_dic): if sig_dic['en'] == 'tag_file_download': html_str = HTML_TPL_DICT['input_add_download'].format( sig_en=sig_dic['en'], sig_zh=sig_dic['zh'], sig_dic=sig_dic['dic'][1], sig_type=sig_dic['type'] ) else: html_str = H...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'gen_input_add'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sig...
Adding for HTML Input control.
async def get_trans_flags(self) -> 'Flags': from bernard.middleware import MiddlewareManager async def make_flags(request: Request) -> 'Flags': return {} mf = MiddlewareManager.instance().get('make_trans_flags', make_flags) return await mf(self)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_trans_flags'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Gives a chance to middlewares to make the translation flags
def args(self): if self._args is None: parser = self._build_parser() self._args = parser.parse_args() return self._args
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'args'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id...
Parsed command-line arguments.
def hourly_dew_point(self): dpt_data = self._humidity_condition.hourly_dew_point_values( self._dry_bulb_condition) return self._get_daily_data_collections( temperature.DewPointTemperature(), 'C', dpt_data)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'hourly_dew_point'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
A data collection containing hourly dew points over they day.
def run_object_query(client, base_object_query, start_record, limit_to, verbose=False): if verbose: print("[start: %d limit: %d]" % (start_record, limit_to)) start = datetime.datetime.now() result = client.execute_object_query( object_query=base_object_query, sta...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run_object_query'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'chil...
inline method to take advantage of retry
def hg_hook(ui, repo, node=None, **kwargs): seen = set() paths = [] if len(repo): for rev in range(repo[node], len(repo)): for file_ in repo[rev].files(): file_ = op.join(repo.root, file_) if file_ in seen or not op.exists(file_): conti...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'hg_hook'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Run pylama after mercurial commit.
def lint_stylesheets(context: Context): args = [ '--config', os.path.join(context.app.common_templates_path, 'mtp_common', 'build_tasks', 'sass-lint.yml'), '--format', 'stylish', '--syntax', 'scss', ] if context.verbosity > 1: args.append('--verbose') args.append(os.path....
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'lint_stylesheets'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6'...
Tests stylesheets for code and style errors
def list(self, list, prefix=None): self.indent += 1 for (i, entry) in enumerate(list.content): for (j, paragraph) in enumerate(entry.content): prefix = "- " if j == 0 else " " handler = self.paragraphDispatch[paragraph.__class__] handler(parag...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'list'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Process a pyth list into the target
async def send(self, hittype, *args, **data): if hittype not in self.valid_hittypes: raise KeyError('Unsupported Universal Analytics Hit Type: {0}'.format(repr(hittype))) self.set_timestamp(data) self.consume_options(data, hittype, args) for item in args: if isins...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Transmit HTTP requests to Google Analytics using the measurement protocol
def merge_results(self, other_processor): if not isinstance(other_processor, self.__class__): raise ValueError("Can only extend with another %s instance." % self.__class__.__name__) self.statements.extend(other_processor.statements) if other_processor.sta...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge_results'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Merge the results of this processor with those of another.
def parse(rmk: str) -> RemarksData: rmkdata = {} for item in rmk.split(' '): if len(item) in [5, 9] and item[0] == 'T' and item[1:].isdigit(): rmkdata['temperature_decimal'] = core.make_number(_tdec(item[1:5], None)) rmkdata['dewpoint_decimal'] = core.make_number(_tdec(item[5:], ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6']}; {...
Finds temperature and dewpoint decimal values from the remarks
def markers_to_events(self, keep_name=False): markers = self.parent.info.markers if markers is None: self.parent.statusBar.showMessage('No markers in dataset.') return if not keep_name: name, ok = self.new_eventtype() if not ok: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'markers_to_events'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
Copy all markers in dataset to event type.
def seek(self, pos): if self.debug: logging.debug('seek: %r' % pos) self.fp.seek(pos) self.bufpos = pos self.buf = b'' self.charpos = 0 self._parse1 = self._parse_main self._curtoken = b'' self._curtokenpos = 0 self._tokens = [] ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'seek'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'};...
Seeks the parser to the given position.
def search(search_text, config=None): storm_ = get_storm_instance(config) try: results = storm_.search_host(search_text) if len(results) == 0: print ('no results found.') if len(results) > 0: message = 'Listing results for {0}:\n'.format(search_text) m...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'search'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'searc...
Searches entries by given search text.
def _is_valid_string(self, inpt, metadata): if not is_string(inpt): return False if metadata.get_minimum_string_length() and len(inpt) < metadata.get_minimum_string_length(): return False elif metadata.get_maximum_string_length() and len(inpt) > metadata.get_maximum_strin...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_is_valid_string'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], ...
Checks if input is a valid string
def load_configs(self, conf_file): with open(conf_file) as stream: lines = itertools.chain(("[global]",), stream) self._config.read_file(lines) return self._config['global']
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_configs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
Assumes that the config file does not have any sections, so throw it all in global
def default(request): protocol = request.is_secure() and 'wss://' or 'ws://' heartbeat_msg = settings.WS4REDIS_HEARTBEAT and '"{0}"'.format(settings.WS4REDIS_HEARTBEAT) or 'null' context = { 'WEBSOCKET_URI': protocol + request.get_host() + settings.WEBSOCKET_URL, 'WS4REDIS_HEARTBEAT': mark_s...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'default'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'request'}...
Adds additional context variables to the default context.
def com_google_fonts_check_font_copyright(ttFont): import re from fontbakery.utils import get_name_entry_strings failed = False for string in get_name_entry_strings(ttFont, NameID.COPYRIGHT_NOTICE): does_match = re.search(r'Copyright [0-9]{4} The .* Project Authors \([^\@]*\)', st...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'com_google_fonts_check_font_copyright'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'chil...
Copyright notices match canonical pattern in fonts
def LogInit(): logging.debug("Initializing client logging subsystem.") logger = logging.getLogger() memory_handlers = [ m for m in logger.handlers if m.__class__.__name__ == "PreLoggingMemoryHandler" ] logger.handlers = list(GetLogHandlers()) SetLogLevels() for handler in memory_handlers: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'LogInit'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '12', '20', '38', '49', '...
Configure the logging subsystem.
def _valid_folder(self, base, name): valid = True fullpath = os.path.join(base, name) if ( not self.recursive or ( self.folder_exclude_check is not None and not self.compare_directory(fullpath[self._base_len:] if self.dir_pathname else name...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_valid_folder'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Return whether a folder can be searched.
def clear_all(self): self.injections.clear_all() for config_file in CONFIG_FILES: self.injections.clear(os.path.join("~", config_file))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clear_all'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'};...
clear all files that were to be injected
def _initFeedFuncs(self): self.setFeedFunc('syn.nodes', self._addSynNodes) self.setFeedFunc('syn.splice', self._addSynSplice) self.setFeedFunc('syn.ingest', self._addSynIngest)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_initFeedFuncs'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Registration for built-in Cortex feed functions.
def ai(x, context=None): return _apply_function_in_current_context( BigFloat, mpfr.mpfr_ai, (BigFloat._implicit_convert(x),), context, )
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ai'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id...
Return the Airy function of x.
def retrieve(self, request, project, pk=None): log = JobLog.objects.get(id=pk) return Response(self._log_as_dict(log))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'retrieve'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
Returns a job_log_url object given its ID
def validate(self, ymldata=None, messages=None): schema_val = self.schema_val(messages) if len(messages) == 0: content_val = self.content_val(ymldata, messages) return schema_val and content_val
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'validate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Validates the Telemetry Dictionary definitions
def enum(cls, options, values): names, real = zip(*options) del names def factory(i, name): return cls(i, name, (len(real),), lambda a: real[a[0]], values) return factory
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'enum'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cl...
Create an ArgumentType where you choose one of a set of known values.
def handle_translocation_illegal(self, line: str, position: int, tokens: ParseResults) -> None: raise MalformedTranslocationWarning(self.get_line_number(), line, position, tokens)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17', '19']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'handle_translocation_illegal'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '9', '13']}; {'id': '4', 'type': 'iden...
Handle a malformed translocation.
def from_string(source, args=None): if _has_jinja: logger.info('Precompiling model with arguments: {}'.format(args)) return _jenv.from_string(source).render(args or {}) if args: raise RuntimeError(_except_text) return source
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_string'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Renders a template string
def parse_metadata(self): all_models = defaultdict(list) with open(self.metadata_index_json) as f: loaded = json.load(f) for m in loaded['index']: all_models[m['uniprot_ac']].append(m) self.all_models = dict(all_models)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_metadata'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Parse the INDEX_JSON file and reorganize it as a dictionary of lists.
def rule_expand(component, text): global rline_mpstate if component[0] == '<' and component[-1] == '>': return component[1:-1].split('|') if component in rline_mpstate.completion_functions: return rline_mpstate.completion_functions[component](text) return [component]
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rule_expand'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
expand one rule component
def translate(self, instr): try: translator = self._instr_translators[instr.mnemonic] return translator(*instr.operands) except Exception: logger.error("Failed to translate instruction: %s", instr, exc_info=True) raise
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'translate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Return the SMT representation of a REIL instruction.
def raise_for_response(self, responses): exception_messages = [self.client.format_exception_message(response) for response in responses] if len(exception_messages) == 1: message = exception_messages[0] else: message = "[%s]" % ", ".join(exception_messages) raise P...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'raise_for_response'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Constructs appropriate exception from list of responses and raises it.
def run(self, tasks=None, timeout=None): timeout = self._timeout if timeout is None else timeout if self.async_running or self.loop.is_running(): return self.wait_all_tasks_done(timeout) else: tasks = tasks or self.todo_tasks return self.loop.run_until_complet...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Block, run loop until all tasks completed.
def lipid_box(self): if self._lipid_box: return self._lipid_box else: self._lipid_box = self.lipid_components.boundingbox self._lipid_box.mins -= np.array([0.5*np.sqrt(self.apl), 0.5*np.sqrt(self.apl), ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'lipid_box'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'};...
The box containing all of the lipids.
def does_external_program_run(prog, verbose): try: with open('/dev/null') as null: subprocess.call([prog, '-h'], stdout=null, stderr=null) result = True except OSError: if verbose > 1: print("couldn't run {}".format(prog)) result = False return result
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'does_external_program_run'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': ...
Test to see if the external programs can be run.
def conf_files(self): for attr in dir(self): field = getattr(self, attr) if isinstance(field, ConfFile): yield field
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'conf_files'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
List of configuration files for this module
def lex(self, text): for match in self.regex.finditer(text): name = match.lastgroup yield (name, match.group(name))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'lex'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; ...
Iterator that tokenizes `text` and yields up tokens as they are found
def send(self, message, callback=None): assert isinstance(message, velbus.Message) self._write_queue.put_nowait((message, callback))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Add message to write queue.
def spi_write(self, data): data_out = array.array('B', data) data_in = array.array('B', (0,) * len(data_out)) ret = api.py_aa_spi_write(self.handle, len(data_out), data_out, len(data_in), data_in) _raise_error_if_negative(ret) return bytes(data_in)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'spi_write'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Write a stream of bytes to a SPI device.
def cli(env, identifier, enabled, port, weight, healthcheck_type, ip_address): mgr = SoftLayer.LoadBalancerManager(env.client) loadbal_id, service_id = loadbal.parse_id(identifier) if ((not any([ip_address, weight, port, healthcheck_type])) and enabled is None): raise exceptions.CLIAbort...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cli'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type': 'identifier', 'childr...
Edit the properties of a service group.
def printNetwork(network): print "The network has",len(network.regions.values()),"regions" for p in range(network.getMaxPhase()): print "=== Phase",p for region in network.regions.values(): if network.getPhases(region.name)[0] == p: print " ",region.name
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'printNetwork'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'netw...
Given a network, print out regions sorted by phase
def write_output(self, data, filename=None, args=None): if args: if not args.linejson: return 0 if not filename: filename = args.linejson entrylist = [] for entry in data['entries']: entrystring = json.dumps(entry, sort_keys=True) entry...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_output'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': []...
Write log data to a file with one JSON object per line
def ref_context_from_geoloc(geoloc): text = geoloc.get('text') geoid = geoloc.get('geoID') rc = RefContext(name=text, db_refs={'GEOID': geoid}) return rc
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ref_context_from_geoloc'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Return a RefContext object given a geoloc entry.
def ms_zoom(self, viewer, event, data_x, data_y, msg=True): if not self.canzoom: return True msg = self.settings.get('msg_zoom', msg) x, y = self.get_win_xy(viewer) if event.state == 'move': self._zoom_xy(viewer, x, y) elif event.state == 'down': ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ms_zoom'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'children...
Zoom the image by dragging the cursor left or right.
def deserialize_upload(value, url): result = {'name': None, 'storage': None} try: result = signing.loads(value, salt=url) except signing.BadSignature: pass else: try: result['storage'] = get_storage_class(result['storage']) except (ImproperlyConfigured, Import...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'deserialize_upload'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Restore file and name and storage from serialized value and the upload url.
def add_ppas_from_file(file_name, update=True): for ppa in _read_lines_from_file(file_name): add_ppa(ppa, update=False) if update: update_apt_sources()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_ppas_from_file'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Add personal package archive from a file list.
def validate(self): validator = Draft4Validator(self.SCHEMA) if not validator.is_valid(self.config): for err in validator.iter_errors(self.config): LOGGER.error(str(err.message)) validator.validate(self.config)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'validate'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; ...
Validate the configuration file.