code
stringlengths
51
2.34k
sequence
stringlengths
1.16k
13.1k
docstring
stringlengths
11
171
def find_if_expression_as_statement(node): return ( isinstance(node, ast.Expr) and isinstance(node.value, ast.IfExp) )
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'find_if_expression_as_statement'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children':...
Finds an "if" expression as a statement
def clear_selection(self): text_cursor = self._editor.textCursor() text_cursor.clearSelection() self._editor.setTextCursor(text_cursor)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clear_selection'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's...
Clears text cursor selection.
def _hammer_function(self, x,x0,r_x0, s_x0): return norm.logcdf((np.sqrt((np.square(np.atleast_2d(x)[:,None,:]-np.atleast_2d(x0)[None,:,:])).sum(-1))- r_x0)/s_x0)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_hammer_function'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'child...
Creates the function to define the exclusion zones
def _parse_box_list(self, output): boxes = [] name = provider = version = None for timestamp, target, kind, data in self._parse_machine_readable_output(output): if kind == 'box-name': if name is not None: boxes.append(Box(name=name, provider=provid...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_parse_box_list'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Remove Vagrant usage for unit testing
def _init_client_authentication( self, client_certchain_file: Optional[str], client_key_file: Optional[str], client_key_type: OpenSslFileTypeEnum, client_key_password: str, ignore_client_authentication_requests: bool ) -> None: if clien...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '33', '35']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_init_client_authentication'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '13', '21', '25', '29']}; {'id': '4', '...
Setup client authentication using the supplied certificate and key.
def _prt_read_msg(self, prt, fin_txt, exclude_ungrouped): if self.sections_seen or exclude_ungrouped: dat = SummarySec2dHdrGos().summarize_sec2hdrgos(self.section2goids.items()) sys.stdout.write(Grouper.fmtsum.format( GO_DESC='hdr', SECs=len(dat['S']), GOs=len(dat['G']), ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_prt_read_msg'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': []...
Print which file was read and the number of GO IDs found.
def log_debug(func, *args, **kwargs): logging.debug('Starting "%s" in thread %s...', func.__name__, current_thread()) results = func(*args, **kwargs) logging.debug('Successfully finished "%s" in thread %s.', func.__name__, current_thread()) return results
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'log_debug'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Wrap call of provided function with debug log statements.
def _on_client_volume_changed(self, data): self._clients.get(data.get('id')).update_volume(data)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_on_client_volume_changed'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': ...
Handle client volume change.
def flush(self): if self.parent != (): self.parent.flush() if self.hdf5: self.hdf5.flush()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'flush'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'i...
Flush the underlying hdf5 file
def downsample(in_bam, data, target_counts, work_dir=None): index(in_bam, data["config"], check_timestamp=False) ds_pct = get_downsample_pct(in_bam, target_counts, data) if ds_pct: out_file = "%s-downsample%s" % os.path.splitext(in_bam) if work_dir: out_file = os.path.join(work_d...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'downsample'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], ...
Downsample a BAM file to the specified number of target counts.
def uri(self): return self.uri_template.format( host=self.host, port="" if self.port is None else self.port, database=self.database, username=self.username, password="" if self.password is None else self.password, has_password="" if self.pa...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'uri'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id'...
Return sqlalchemy connect string URI.
def sidereal_time(t): theta = earth_rotation_angle(t.ut1) t = (t.tdb - T0) / 36525.0 st = ( 0.014506 + (((( - 0.0000000368 * t - 0.000029956 ) * t - 0.00000044 ) * t + 1.3915817 ) * t + 4612.156534 ) * t) return (...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sidereal_time'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 't'}...
Compute Greenwich sidereal time at the given ``Time``.
def map_constructor(self, loader, node, deep=False): mapping = {} for key_node, value_node in node.value: key = loader.construct_object(key_node, deep=deep) value = loader.construct_object(value_node, deep=deep) if key in mapping: raise ValueError(f"D...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'map_constructor'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children':...
Walk the mapping, recording any duplicate keys.
def register(klass): "Register a class into the agnocomplete registry." logger.info("registering {}".format(klass.__name__)) AGNOCOMPLETE_REGISTRY[klass.slug] = klass
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'klass'};...
Register a class into the agnocomplete registry.
def get(self, key, _else=None): with self._lock: self.expired() try: value = self._dict[key].get() return value except KeyError: return _else except ValueError: return _else
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
The method to get an assets value
def toml(uncertainty): text = uncertainty.text.strip() if not text.startswith('['): text = '[%s]' % text for k, v in uncertainty.attrib.items(): try: v = ast.literal_eval(v) except ValueError: v = repr(v) text += '\n%s = %s' % (k, v) return text
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'toml'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'uncertainty'...
Converts an uncertainty node into a TOML string
def loads(content): lines = _group_lines(line for line in content.split('\n')) lines = [ (i, _parse_envfile_line(line)) for i, line in lines if line.strip() ] errors = [] duplicates = _find_duplicates(((i, line[0]) for i, line in lines)) for i, variable, j in duplicates: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'loads'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'content'}; ...
Loads variable definitions from a string.
def write_config_file(self, params, path): cfgp = ConfigParser() cfgp.add_section(params['name']) for p in params: if p == 'name': continue cfgp.set(params['name'], p, params[p]) f = open(os.path.join(path, 'experiment.cfg'), 'w') cfgp.writ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_config_file'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [],...
write a config file for this single exp in the folder path.
def _parse_queue_message_from_headers(response): headers = _parse_response_for_dict(response) message = QueueMessage() message.pop_receipt = headers.get('x-ms-popreceipt') message.time_next_visible = parser.parse(headers.get('x-ms-time-next-visible')) return message
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_parse_queue_message_from_headers'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children...
Extracts pop receipt and time next visible from headers.
def compile_jobgroups_from_joblist(joblist, jgprefix, sgegroupsize): jobcmds = defaultdict(list) for job in joblist: jobcmds[job.command.split(' ', 1)[0]].append(job.command) jobgroups = [] for cmds in list(jobcmds.items()): sublists = split_seq(cmds[1], sgegroupsize) count = 0 ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compile_jobgroups_from_joblist'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'c...
Return list of jobgroups, rather than list of jobs.
def get(self, block_number: BlockNumber) -> str: if block_number in self.mapping: return self.mapping[block_number] block_hash = self.web3.eth.getBlock(block_number)['hash'] block_hash = block_hash.hex() self.mapping[block_number] = block_hash return block_hash
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Given a block number returns the hex representation of the blockhash
def install_language(language): translator = get_translator(default_domain, default_directory, languages=[get_lang(language)], fallback=True) do_unicode = True translator.install(do_unicode)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'install_language'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Install translation service routines into default namespace.
def input(input_id, name, value_class=NumberValue): def _init(): return value_class( name, input_id=input_id, is_input=True, index=-1 ) def _decorator(cls): setattr(cls, input_id, _init()) ret...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'input'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'i...
Add input to controller
def prt_goids(self, goids=None, prtfmt=None, sortby=True, prt=sys.stdout): if goids is None: goids = self.go_sources nts = self.get_nts(goids, sortby) if prtfmt is None: prtfmt = self.prt_attr['fmta'] for ntgo in nts: key2val = ntgo._asdict() ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '19']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'prt_goids'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children'...
Given GO IDs, print decriptive info about each GO Term.
def serverProperties(self): return ServerProperties(url=self._url + "/properties", securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initiali...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'serverProperties'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
gets the server properties for the site as an object
def _memory_usage(func, gallery_conf): if gallery_conf['show_memory']: from memory_profiler import memory_usage assert callable(func) mem, out = memory_usage(func, max_usage=True, retval=True, multiprocess=True) mem = mem[0] else: out = fun...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_memory_usage'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Get memory usage of a function call.
def output_markdown(markdown_cont, output_file): if output_file: with open(output_file, 'w') as out: out.write(markdown_cont)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'output_markdown'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Writes to an output file if `outfile` is a valid path.
def as_contours(self): contours = dict() for byte_value in self.__byte_values: if byte_value == 0: continue mask = (self.__array == byte_value) * 255 found_contours = find_contours(mask, 254, fully_connected='high') contours[byte_value] = C...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'as_contours'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
A dictionary of lists of contours keyed by byte_value
def do_load(self, filename): try: self.__session.load(filename) except IOError as e: self.logger.error(e.strerror)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'do_load'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self...
Load disk image for analysis
def _render_children(self, contexts, partials): ret = [] for child in self.children: ret.append(child._render(contexts, partials)) return EMPTYSTRING.join(ret)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_render_children'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], ...
Render the children tokens
def setup_html_filter(portal): logger.info("*** Setup HTML Filter ***") adapter = IFilterSchema(portal) style_whitelist = adapter.style_whitelist for style in ALLOWED_STYLES: logger.info("Allow style '{}'".format(style)) if style not in style_whitelist: style_whitelist.append...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setup_html_filter'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
Setup HTML filtering for resultsinterpretations
def age_gender_section_header_element(feature, parent): _ = feature, parent header = age_gender_section_header['string_format'] return header.capitalize()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'age_gender_section_header_element'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'chi...
Retrieve age gender section header string from definitions.
def destroy(self): super(Syndic, self).destroy() if hasattr(self, 'local'): del self.local if hasattr(self, 'forward_events'): self.forward_events.stop()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'destroy'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {...
Tear down the syndic minion
def check_backend() -> bool: try: call('gatttool', stdout=PIPE, stderr=PIPE) return True except OSError as os_err: msg = 'gatttool not found: {}'.format(str(os_err)) _LOGGER.error(msg) return False
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_backend'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'type', 'children': ['5']}; {'id': '5', '...
Check if gatttool is available on the system.
async def get_zones(self) -> List[Zone]: res = await self.services["avContent"]["getCurrentExternalTerminalsStatus"]() zones = [Zone.make(services=self.services, **x) for x in res if 'meta:zone:output' in x['meta']] if not zones: raise SongpalException("Device has no zones") ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_zones'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's...
Return list of available zones.
def adc_to_percentage(value, max_volts, clamp=True): percentage = (100.0 / const.ADC_MAX_VAL) * value return max(min(100, percentage), 0) if clamp else percentage
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'adc_to_percentage'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [],...
Convert the ADC raw value to a percentage.
def _render_str(self, string): if isinstance(string, StrLabel): string = string._render(string.expr) string = str(string) if len(string) == 0: return '' name, supers, subs = split_super_sub(string) return render_latex_sub_super( name, subs, sup...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_render_str'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Returned a texified version of the string
def followingPrefix(prefix): prefixBytes = array('B', prefix) changeIndex = len(prefixBytes) - 1 while (changeIndex >= 0 and prefixBytes[changeIndex] == 0xff ): changeIndex = changeIndex - 1; if(changeIndex < 0): return None newBytes = array('B', prefix[0:...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'followingPrefix'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'p...
Returns a String that sorts just after all Strings beginning with a prefix
def insert(conn, qualified_name: str, column_names, records): query = create_insert_statement(qualified_name, column_names) with conn: with conn.cursor(cursor_factory=NamedTupleCursor) as cursor: for record in records: cursor.execute(query, record)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'insert'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '9', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Insert a collection of namedtuple records.
def diff(self, n, axis=1): new_values = algos.diff(self.values, n, axis=axis) return [self.make_block(values=new_values)]
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'diff'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
return block for the diff of the values
async def handle_agent_message(self, agent_addr, message): message_handlers = { AgentHello: self.handle_agent_hello, AgentJobStarted: self.handle_agent_job_started, AgentJobDone: self.handle_agent_job_done, AgentJobSSHDebug: self.handle_agent_job_ssh_debug, ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'handle_agent_message'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': ...
Dispatch messages received from agents to the right handlers
def _set_watering_time(self, zoneid, value): if value not in MANUAL_WATERING_ALLOWED: raise ValueError( 'Valid options are: {}'.format( ', '.join(map(str, MANUAL_WATERING_ALLOWED))) ) if isinstance(value, int) and value == 0: value ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_set_watering_time'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': []...
Private method to set watering_time per zone.
def valid_header_waiting(self): if len(self.buffer) < 4: self.logger.debug("Buffer does not yet contain full header") result = False else: result = True result = result and self.buffer[0] == velbus.START_BYTE if not result: self...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'valid_header_waiting'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Check if a valid header is waiting in buffer
def to_json(self): sanitized_lut = {} for k, v in self.lut.items(): san_v = list(v) repr_dims = str(v[1]) san_v[1] = repr_dims sanitized_lut[k] = tuple(san_v) return json.dumps(sanitized_lut)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_json'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {...
Returns a json-serialized version of the unit registry
def mk_token(self, load): if not self.authenticate_eauth(load): return {} if self._allow_custom_expire(load): token_expire = load.pop('token_expire', self.opts['token_expire']) else: _ = load.pop('token_expire', None) token_expire = self.opts['toke...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'mk_token'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
Run time_auth and create a token. Return False or the token
def collect_static(static_folder): appbuilder_static_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "static/appbuilder" ) app_static_path = os.path.join(os.getcwd(), static_folder) if not os.path.isdir(app_static_path): click.echo( click.style( ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'collect_static'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'st...
Copies flask-appbuilder static files to your projects static folder
def extract(self, zip_archive, font_files): tmp_container = tempfile.mkdtemp(prefix='icomoon-tmp') self._debug("* Temporary dir for extracted archive: {}", tmp_container) zip_archive.extract(settings.ICOMOON_MANIFEST_FILENAME, tmp_container) for item in font_files: zip_archiv...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'extract'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
Extract files to install
def _mapped_std_streams(lookup_paths, streams=('stdin', 'stdout', 'stderr')): standard_inos = {} for stream in streams: try: stream_stat = os.fstat(getattr(sys, stream).fileno()) key = stream_stat.st_dev, stream_stat.st_ino standard_inos[key] = stream except E...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_mapped_std_streams'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], '...
Get a mapping of standard streams to given paths.
def __get_url(self, endpoint): url = self.url api = "wc-api" if url.endswith("/") is False: url = "%s/" % url if self.wp_api: api = "wp-json" return "%s%s/%s/%s" % (url, api, self.version, endpoint)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__get_url'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Get URL for requests
def write(self, name, data): if isinstance(data, StringIO): self.zf.writestr(name, data.getvalue()) else: self.zf.writestr(name, to_utf8(data))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's...
Write a blob of data to the XPI manager.
def from_json(cls, string): exp_dict = json_to_data(string) version = exp_dict.get('version', 0) if version == 0: return cls.from_dict(exp_dict) elif version == 1: return cls.from_dict(exp_dict) else: raise ValueError("Version %d not supported"...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_json'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cl...
Create a ChemicalEntity from a json string
def data_filler_simple_registration(self, number_of_rows, pipe): try: for i in range(number_of_rows): pipe.hmset('simple_registration:%s' % i, { 'id': rnd_id_generator(self), 'email': self.faker.safe_email(), 'password': sel...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'data_filler_simple_registration'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', '...
creates keys with simple regis. information
def _detect_devices(self) -> None: devices_num = len(self.devices_list) if devices_num == 0: raise DeviceConnectionException( 'No devices are connected. Please connect the device with USB or via WLAN and turn on the USB debugging option.') elif not self.device_sn and ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_detect_devices'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Detect whether devices connected.
async def spawn(self): self._server._pending_set.add(self) await self._server._sem.acquire() self._subprocess = await asyncio.create_subprocess_shell( self._cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) self._began_at = datetime....
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'spawn'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'i...
Spawn the command wrapped in this object as a subprocess.
def getTheta(k, nTrials=100000): theDots = np.zeros(nTrials) w1 = getSparseTensor(k, k, nTrials, fixedRange=1.0/k) for i in range(nTrials): theDots[i] = w1[i].dot(w1[i]) dotMean = theDots.mean() print("k=", k, "min/mean/max diag of w dot products", theDots.min(), dotMean, theDots.max()) theta = ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getTheta'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'k'}...
Estimate a reasonable value of theta for this k.
def write_conf(self): f = open(self.output_filename, 'w') print(self.t.render(prefixes=self.prefixes), file=f) f.close()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_conf'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
Write the config to file
def delete(callback=None, path=None, method=Method.DELETE, tags=None, summary="Delete specified resource.", middleware=None): def inner(c): op = Operation(c, path or PathParam('{key_field}'), method, None, tags, summary, middleware) op.responses.add(Response(HTTPStatus.NO_CONTENT, "{name}...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '24']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '15', '18', '21']}; {'id': '4', 'type': 'default_parameter',...
Decorator to configure an operation that deletes resource.
def _before_after(n_samples): if not isinstance(n_samples, (tuple, list)): before = n_samples // 2 after = n_samples - before else: assert len(n_samples) == 2 before, after = n_samples n_samples = before + after assert before >= 0 assert after >= 0 assert befo...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_before_after'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'n_s...
Get the number of samples before and after.
def _get_responses(link): template = link.response_schema template.update({'description': 'Success'}) res = {200: template} res.update(link.error_status_codes) return res
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_responses'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'li...
Returns an OpenApi-compliant response
def validate(identifier): source = actions.validate_source(identifier) log.info('Source %s (%s) has been validated', source.slug, str(source.id))
{'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': 'identifi...
Validate a source given its identifier
def close(self): if self._socket is not None and self._conn is not None: message_input = UnityMessage() message_input.header.status = 400 self._communicator_send(message_input.SerializeToString()) if self._socket is not None: self._socket.close() ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'close'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'i...
Sends a shutdown signal to the unity environment, and closes the socket connection.
def _jtime(self, timestamp): if isinstance(timestamp, datetime): timestamp = time.mktime(timestamp.timetuple()) return self._sc._jvm.Time(long(timestamp * 1000))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_jtime'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Convert datetime or unix_timestamp into Time
def _delete(self, url, **kwargs): response = retry_request(self)(self._http_delete)(url, **kwargs) if self.raw_mode: return response if response.status_code >= 300: error = get_error(response) if self.raise_errors: raise error retur...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_delete'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
Wrapper for the HTTP DELETE request.
def sqlalch_datetime(dt): if isinstance(dt, str): return datetime.strptime(dt, "%Y-%m-%d %H:%M:%S.%f").replace(tzinfo=UTC) if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) is not None: return dt.astimezone(UTC) return dt.replace(tzinfo=UTC)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sqlalch_datetime'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Convert a SQLAlchemy datetime string to a datetime object.
def cd_previous(self): if self._prev_dir is None or isinstance(self._prev_dir, ROOT.TROOT): return False if isinstance(self._prev_dir, ROOT.TFile): if self._prev_dir.IsOpen() and self._prev_dir.IsWritable(): self._prev_dir.cd() return True ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cd_previous'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
cd to the gDirectory before this file was open.
def _handle_tag_salt_error(self, tag, data): if self.connected: log.debug('Forwarding salt error event tag=%s', tag) self._fire_master(data, tag)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_handle_tag_salt_error'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children'...
Handle a _salt_error event
def principal_direction_extents(neurites, neurite_type=NeuriteType.all, direction=0): def _pde(neurite): points = neurite.points[:, :3] return morphmath.principal_direction_extent(points)[direction] return map(_pde, iter_neurites(neurites, filt=is_type(neurite_type)))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'principal_direction_extents'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '10']}; {'id': '4', 'type': 'identifier', 'ch...
Principal direction extent of neurites in neurons
def unparse_signature(signature) : "converts a signature from parsed form to string form." signature = parse_signature(signature) if not isinstance(signature, (tuple, list)) : signature = [signature] return \ DBUS.Signature("".join(t.signature for t in signature))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'unparse_signature'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
converts a signature from parsed form to string form.
def runSearchVariantAnnotations(self, request): return self.runSearchRequest( request, protocol.SearchVariantAnnotationsRequest, protocol.SearchVariantAnnotationsResponse, self.variantAnnotationsGenerator)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'runSearchVariantAnnotations'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children'...
Runs the specified SearchVariantAnnotationsRequest.
def section_volumes(neurites, neurite_type=NeuriteType.all): return map_sections(sectionfunc.section_volume, neurites, neurite_type=neurite_type)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'section_volumes'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
section volumes in a collection of neurites
def go_up(self): vsb = self.scrollarea.verticalScrollBar() vsb.setValue(int(vsb.value() - vsb.singleStep()))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'go_up'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'i...
Scroll the scrollbar of the scrollarea up by a single step.
def qn_df(df, axis='row', keep_orig=False): df_qn = {} for mat_type in df: inst_df = df[mat_type] if axis == 'row': inst_df = inst_df.transpose() missing_values = inst_df.isnull().values.any() if missing_values: missing_mask = pd.isnull(inst_df) inst_df = inst_df.fillna(value=0) ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'qn_df'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
do quantile normalization of a dataframe dictionary, does not write to net
def _read_datasets(self, dataset_nodes, **kwargs): reader_datasets = {} for node in dataset_nodes: ds_id = node.name if ds_id in self.datasets or not isinstance(node.data, dict): continue reader_name = node.data.get('reader_name') if reader...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_read_datasets'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
Read the given datasets from file.
def _is_postgres(self): if self._is_postgres_engine is None: is_postgres_engine = False try: dialect = self.session.bind.engine.name if 'redshift' in dialect or 'postg' in dialect or 'pg' in \ dialect: is_postgre...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_is_postgres'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self...
Determine if the running engine is postgres
def setbpf(self, bpf): self._bpf = min(bpf, self.BPF) self._rng_n = int((self._bpf + self.RNG_RANGE_BITS - 1) / self.RNG_RANGE_BITS)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setbpf'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Set number of bits per float output
def construct_oauth_url(self): response = self._requester(requests.head, "{0}://{1}/".format(self.protocol, self.client.server), allow_redirects=False ) if response.is_redirect: server = ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'construct_oauth_url'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Constructs verifier OAuth URL
def edit_finished(self): self.hide() if isinstance(self.tab_index, int) and self.tab_index >= 0: tab_text = to_text_string(self.text()) self.main.setTabText(self.tab_index, tab_text) self.main.sig_change_name.emit(tab_text)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'edit_finished'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
On clean exit, update tab name.
def _create_figure(self): if get_option('close_all_figures'): plt.close('all') figure = plt.figure() axs = self.facet.make_axes( figure, self.layout.layout, self.coordinates) figure._themeable = {} self.figure = figure self....
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_create_figure'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Create Matplotlib figure and axes
def attrs(self) -> Mapping: if self._attrs is None: self._attrs = OrderedDict() return self._attrs
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'attrs'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
Dictionary of global attributes on this dataset
def _find_filepath_in_roots(filename): for root in settings.DJANGO_STATIC_MEDIA_ROOTS: filepath = _filename2filepath(filename, root) if os.path.isfile(filepath): return filepath, root if settings.DEBUG: try: from django.contrib.staticfiles import finders ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_find_filepath_in_roots'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Look for filename in all MEDIA_ROOTS, and return the first one found.
def create_instance(self, application, revision=None, environment=None, name=None, parameters=None, submodules=None, destroyInterval=None, manifestVersion=None): from qubell.api.private.instance import Instance return Instance.new(self._router, application, revision, environment,...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '27']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_instance'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21', '24']}; {'id': '4', 'ty...
Launches instance in application and returns Instance object.
def update(self) -> None: for source_old in self: if isinstance(source_old, RemoteSource): repo = git.Repo(source_old.location) origin = repo.remotes.origin origin.pull() sha = repo.head.object.hexsha version = repo.git....
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Ensures that all remote sources are up-to-date.
def tag_value(func): def inner(self): tag, attrib, attrib_type = func(self) tag_obj = self.et.find(tag) if tag_obj is not None: try: return attrib_type(self.et.find(tag).attrib[attrib]) except KeyError: raise AttributeError return i...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tag_value'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'func'};...
Decorator used to declare that the property is attribute of embedded tag
def set(self, dct) : for field, value in dct.items() : if field not in self.collection.arangoPrivates : if isinstance(value, dict) : if field in self.validators and isinstance(self.validators[field], dict): vals = self.validators[field] ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; ...
Set the store using a dictionary
def parse(self, text): token_stream = self.lexer.tokenize(text) return self.expr(token_stream, next(token_stream))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
Parse the given text, return a list of Keywords.
def add_namespaces(metadata, namespaces): for key, value in metadata.items(): if key not in namespaces: namespaces[key] = value elif namespaces[key] != value: raise validate.ValidationException( "Namespace prefix '{}' has conflicting definitions '{}'" ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_namespaces'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Collect the provided namespaces, checking for conflicts.
def wrap_options(self, data, renderer_context): request = renderer_context.get("request", None) method = request and getattr(request, 'method') if method != 'OPTIONS': raise WrapperNotApplicable("Request method must be OPTIONS") wrapper = self.dict_class() wrapper["me...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'wrap_options'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
Wrap OPTIONS data as JSON API meta value
def aggregate(cls, pipeline=None, **kwargs): return list(cls.collection.aggregate(pipeline or [], **kwargs))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'aggregate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Returns the document dicts returned from the Aggregation Pipeline
def getMaxWidth(self, rows): 'Return the maximum length of any cell in column or its header.' w = 0 if len(rows) > 0: w = max(max(len(self.getDisplayValue(r)) for r in rows), len(self.name))+2 return max(w, len(self.name))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getMaxWidth'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Return the maximum length of any cell in column or its header.
def enforce_reversible_on_closed(P): import msmtools.analysis as msmana n = np.shape(P)[0] Prev = P.copy() sets = closed_sets(P) for s in sets: I = np.ix_(s, s) pi_s = msmana.stationary_distribution(P[I]) X_s = pi_s[:, None] * P[I] X_s = 0.5 * (X_s + X_s.T) Pr...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'enforce_reversible_on_closed'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': []...
Enforces transition matrix P to be reversible on its closed sets.
def clear_allow_repeat_items(self): if (self.get_allow_repeat_items_metadata().is_read_only() or self.get_allow_repeat_items_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['allowRepeatItems'] = \ bool(self._allow_repeat_items_metadata...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clear_allow_repeat_items'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
reset allow repeat itmes to default value
def instagram_config(self, id, secret, scope=None, **_): scope = scope if scope else 'basic' token_params = dict(scope=scope) config = dict( access_token_url='/oauth/access_token/', authorize_url='/oauth/authorize/', base_url='https://api.instagram.com/', ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'instagram_config'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'chi...
Get config dictionary for instagram oauth
def getProjectDescriptor(self, dir): for project in glob.glob(os.path.join(dir, '*.uproject')): return os.path.realpath(project) raise UnrealManagerException('could not detect an Unreal project in the current directory')
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getProjectDescriptor'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], '...
Detects the .uproject descriptor file for the Unreal project in the specified directory
def runMkdir(self, _dir, **kwargs): return self.runRemoteCommand('mkdir', {'dir': _dir, 'logEnviron': self.logEnviron, }, **kwargs)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'runMkdir'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
create a directory and its parents
def _apply_columns(self, func): new_data = {col: func(series) for col, series in self.items()} return self._constructor( data=new_data, index=self.index, columns=self.columns, default_fill_value=self.default_fill_value).__finalize__(self)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_apply_columns'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Get new SparseDataFrame applying func to each columns
def _soln2str(self, soln, fancy=False): chars = list() for r in range(1, 10): for c in range(1, 10): if fancy and c in (4, 7): chars.append("|") chars.append(self._get_val(soln, r, c)) if fancy and r != 9: chars....
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_soln2str'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Convert a Sudoku solution point to a string.
def unfolding(tens, i): return reshape(tens.full(), (np.prod(tens.n[0:(i+1)]), -1))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'unfolding'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'te...
Compute the i-th unfolding of a tensor.
def assign_qualification(self, qualification_id, worker_id, score, notify=False): return self._is_ok( self.mturk.associate_qualification_with_worker( QualificationTypeId=qualification_id, WorkerId=worker_id, IntegerValue=score, SendNoti...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'assign_qualification'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', '...
Score a worker for a specific qualification
def clean(ctx, text): text = conversions.to_string(text, ctx) return ''.join([c for c in text if ord(c) >= 32])
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clean'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ctx'};...
Removes all non-printable characters from a text string
def wr_row_mergeall(self, worksheet, txtstr, fmt, row_idx): hdridxval = len(self.hdrs) - 1 worksheet.merge_range(row_idx, 0, row_idx, hdridxval, txtstr, fmt) return row_idx + 1
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'wr_row_mergeall'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'childr...
Merge all columns and place text string in widened cell.