code
stringlengths
51
2.34k
sequence
stringlengths
1.16k
13.1k
docstring
stringlengths
11
171
def create_report(self): data = self.create_data() try: json_string = json.dumps(data) except UnicodeDecodeError as e: log.error('ERROR: While preparing JSON:', exc_info=e) self.debug_bad_encoding(data) raise log_string = re.sub(r'"repo_tok...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_report'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
Generate json dumped report for coveralls api.
def open(self, user=None, repo=None): webbrowser.open(self.format_path(repo, namespace=user, rw=False))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'open'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's...
Open the URL of a repository in the user's browser
async def put(self, key, value, *args): self._db[key] = value await self.save()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'put'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Edits a data entry.
def step(h1: Histogram1D, ax: Axes, **kwargs): show_stats = kwargs.pop("show_stats", False) show_values = kwargs.pop("show_values", False) density = kwargs.pop("density", False) cumulative = kwargs.pop("cumulative", False) value_format = kwargs.pop("value_format", None) text_kwargs = pop_kwargs_...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'step'}; {'id': '3', 'type': 'parameters', 'children': ['4', '8', '12']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6'...
Step line-plot of 1D histogram.
def _repr_html_(self): nbreset = f'<style>{css_nbreset}</style>' resources = ''.join(map(str, self.resources)) return f'<div>{nbreset}{resources}<div class="hrepr">{self}</div></div>'
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_repr_html_'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Jupyter Notebook hook to print this element as HTML.
def valid_substitution(strlen, index): values = index[0] return all([strlen > i for i in values])
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'valid_substitution'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
skip performing substitutions that are outside the bounds of the string
def admin_url(model, url, object_id=None): opts = model._meta url = "admin:%s_%s_%s" % (opts.app_label, opts.object_name.lower(), url) args = () if object_id is not None: args = (object_id,) return reverse(url, args=args)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'admin_url'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Returns the URL for the given model and admin url name.
def addImg(self, img): self.img = imread(img, 'gray', 'uint8') didFindCorners, corners = self.method() self.opts['foundPattern'].append(didFindCorners) if didFindCorners: self.findCount += 1 self.objpoints.append(self.objp) self.opts['imgPoints'...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'addImg'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
add one chessboard image for detection lens distortion
def wkhtmltopdf_args_mapping(data): mapping = { 'cookies': 'cookie', 'custom-headers': 'custom-header', 'run-scripts': 'run-script' } return {mapping.get(k, k): v for k, v in data.items()}
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'wkhtmltopdf_args_mapping'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
fix our names to wkhtmltopdf's args
def _css_background(self, **kwargs): img_1x, img_2x, _ = self._get_renditions(kwargs) tmpl = 'background-image: url("{s1x}");' if img_1x != img_2x: image_set = 'image-set(url("{s1x}") 1x, url("{s2x}") 2x)' tmpl += 'background-image: {ss};background-image: -webkit-{ss};'.f...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_css_background'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Get the CSS specifiers for this as a hidpi-capable background image
def authentication_url(self): params = { 'client_id': self.client_id, 'response_type': self.type, 'redirect_uri': self.callback_url } return AUTHENTICATION_URL + "?" + urlencode(params)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'authentication_url'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Redirect your users to here to authenticate them.
def album_to_ref(album): name = '' for artist in album.artists: if len(name) > 0: name += ', ' name += artist.name if (len(name)) > 0: name += ' - ' if album.name: name += album.name else: name += 'Unknown Album' return Ref.directory(uri=album....
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'album_to_ref'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'albu...
Convert a mopidy album to a mopidy ref.
def pulse(self): new_b_value = self.gpio_b.is_active new_a_value = self.gpio_a.is_active value = self.table_values.value(new_b_value, new_a_value, self.old_b_value, self.old_a_value) self.old_b_value = new_b_value self.old_a_value = new_a_value if value != 0: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pulse'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'i...
Calls when_rotated callback if detected changes
def cio_open(cinfo, src=None): argtypes = [ctypes.POINTER(CommonStructType), ctypes.c_char_p, ctypes.c_int] OPENJPEG.opj_cio_open.argtypes = argtypes OPENJPEG.opj_cio_open.restype = ctypes.POINTER(CioType) if src is None: length = 0 else: length = len(src) cio = O...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cio_open'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cin...
Wrapper for openjpeg library function opj_cio_open.
def handle_read(repo, **kwargs): log.info('read: %s %s' %(repo, kwargs)) if type(repo) in [unicode, str]: return {'name': 'Repo', 'desc': 'Welcome to Grit', 'comment': ''} else: return repo.serialize()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'handle_read'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
handles reading repo information
def expand_families(self, stmts): new_stmts = [] for stmt in stmts: families_list = [] for ag in stmt.agent_list(): ag_children = self.get_children(ag) if len(ag_children) == 0: families_list.append([ag]) else: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'expand_families'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Generate statements by expanding members of families and complexes.
def com(self): if self._com is None: self._com = np.mean(self.pmts.pos, axis=0) return self._com
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'com'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id'...
Center of mass, calculated from the mean of the PMT positions
def sitemap_index(request): sitemaps = [] with db_connect() as db_connection: with db_connection.cursor() as cursor: cursor.execute( ) for author, revised in cursor.fetchall(): sitemaps.append(Sitemap(url=request.route_url( 'sitemap', from_id=a...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sitemap_index'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'req...
Return a sitemap index xml file for search engines.
def makeSer(segID, N, CA, C, O, geo): CA_CB_length=geo.CA_CB_length C_CA_CB_angle=geo.C_CA_CB_angle N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle CB_OG_length=geo.CB_OG_length CA_CB_OG_angle=geo.CA_CB_OG_angle N_CA_CB_OG_diangle=geo.N_CA_CB_OG_diangle carbon_b= calculateCoordinates(N, C, CA, CA_CB...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'makeSer'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'children...
Creates a Serine residue
def make_skiplist(*args, use_fallback=False): sl = fallback.Skiplist if use_fallback else Skiplist return sl(*args)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_skiplist'}; {'id': '3', 'type': 'parameters', 'children': ['4', '6']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5'...
Create a new skiplist
def read_inquiry_mode(sock): old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) flt = bluez.hci_filter_new() opcode = bluez.cmd_opcode_pack(bluez.OGF_HOST_CTL, bluez.OCF_READ_INQUIRY_MODE) bluez.hci_filter_set_ptype(flt, bluez.HCI_EVENT_PKT) bluez.hci_filter_set_event(fl...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'read_inquiry_mode'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
returns the current mode, or -1 on failure
def args(self): arglist = [] for k, v in six.iteritems(self.requires_hadoop()): arglist.append('--' + k) arglist.extend([t.output().path for t in flatten(v)]) arglist.extend(['--output', self.output()]) arglist.extend(self.job_args()) return arglist
{'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...
Returns an array of args to pass to the job.
def create_file(self): src = self.get_current_path() name, status = QtWidgets.QInputDialog.getText( self.tree_view, _('Create new file'), _('File name:'), QtWidgets.QLineEdit.Normal, '') if status: fatal_names = ['.', '..', os.sep] for i in fatal_n...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_file'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Creates a file under the current directory.
def locate(self, path): return Zconfig(lib.zconfig_locate(self._as_parameter_, path), False)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'locate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Find a config item along a path; leading slash is optional and ignored.
def multiply(self, number): return self.from_list([x * number for x in self.to_list()])
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'multiply'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
Return a Vector as the product of the vector and a real number.
def _make_scatter_logfile_name(cls, key, linkname, job_config): logfile = job_config.get('logfile', "%s_%s_%s.log" % (cls.default_prefix_logfile, linkname, key)) job_config['logfile'] = logfile
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_make_scatter_logfile_name'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', '...
Hook to inster the name of a logfile into the input config
def _organize_variants(samples, batch_id): caller_names = [x["variantcaller"] for x in samples[0]["variants"]] calls = collections.defaultdict(list) for data in samples: for vrn in data["variants"]: calls[vrn["variantcaller"]].append(vrn["vrn_file"]) data = samples[0] vrn_files =...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_organize_variants'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Retrieve variant calls for all samples, merging batched samples into single VCF.
def watch_dir(path: str) -> None: _compile_exclude_patterns() if config.autoreload or config.debug: p = pathlib.Path(path) p.resolve() _add_watch_path(p)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'watch_dir'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6']...
Add ``path`` to watch for autoreload.
def _permute_aux_specs(self): calc_aux_mapping = self._NAMES_SUITE_TO_CALC.copy() calc_aux_mapping[_OBJ_LIB_STR] = None [calc_aux_mapping.pop(core) for core in self._CORE_SPEC_NAMES] specs = self._get_aux_specs() for suite_name, calc_name in calc_aux_mapping.items(): ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_permute_aux_specs'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Generate all permutations of the non-core specifications.
def read_dates_by_service_ids( path: str ) -> Dict[FrozenSet[str], FrozenSet[datetime.date]]: feed = load_raw_feed(path) return _dates_by_service_ids(feed)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8', '26']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'read_dates_by_service_ids'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'child...
Find dates with identical service
def patch_sys_version(): if '|' in sys.version: sys_version = sys.version.split('|') sys.version = ' '.join([sys_version[0].strip(), sys_version[-1].strip()])
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'patch_sys_version'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5']}; {'id': '5', '...
Remove Continuum copyright statement to avoid parsing errors in IDLE
def _convert_hex_str_to_int(val): if val is None: return None hex_num = int(val, 16) if hex_num > 0x7FFFFFFFFFFFFFFF: hex_num -= 0x10000000000000000 assert -9223372036854775808 <= hex_num <= 9223372036854775807 return hex_num
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_convert_hex_str_to_int'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Convert hexadecimal formatted ids to signed int64
def yum_search(packages): output = {} cmd = ['yum', 'search'] if isinstance(packages, six.string_types): cmd.append(packages) else: cmd.extend(packages) log("Searching for {}".format(packages)) result = subprocess.check_output(cmd) for package in list(packages): outpu...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'yum_search'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'packag...
Search for a package.
def threadProfileCode(func, *args, **kwargs): 'Toplevel thread profile wrapper.' with ThreadProfiler(threading.current_thread()) as prof: try: prof.thread.status = threadProfileCode.__wrapped__(func, *args, **kwargs) except EscapeException as e: prof.thread.status = e
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'threadProfileCode'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [],...
Toplevel thread profile wrapper.
def _dasd_reverse_conversion(cls, val, **kwargs): if val is not None: if val.upper() == 'ADMINISTRATORS': return '0' elif val.upper() == 'ADMINISTRATORS AND POWER USERS': return '1' elif val.upper() == 'ADMINISTRATORS AND INTERACTIVE USERS': ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_dasd_reverse_conversion'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'childre...
converts DASD String values to the reg_sz value
def _sanity_check_coerce_type_outside_of_fold(ir_blocks): is_in_fold = False for first_block, second_block in pairwise(ir_blocks): if isinstance(first_block, Fold): is_in_fold = True if not is_in_fold and isinstance(first_block, CoerceType): if not isinstance(second_block...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_sanity_check_coerce_type_outside_of_fold'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', '...
Ensure that CoerceType not in a @fold are followed by a MarkLocation or Filter block.
def functionFactory(in_code, name, defaults, globals_, imports): def generatedFunction(): pass generatedFunction.__code__ = marshal.loads(in_code) generatedFunction.__name__ = name generatedFunction.__defaults = defaults generatedFunction.__globals__.update(pickle.loads(globals_)) for ke...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'functionFactory'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'childr...
Creates a function at runtime using binary compiled inCode
def forward_state(self, sequence, state=None): if state is None: state = self.zero_state(sequence.size(0)) data = self.input_block(sequence) state_outputs = [] for idx in range(len(self.recurrent_layers)): layer_length = self.recurrent_layers[idx].state_dim ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'forward_state'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Forward propagate a sequence through the network accounting for the state
def _is_at_qry_end(self, nucmer_hit): hit_coords = nucmer_hit.qry_coords() return hit_coords.end >= nucmer_hit.qry_length - self.qry_end_tolerance
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_is_at_qry_end'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Returns True iff the hit is "close enough" to the end of the query sequence
def collect_metrics(local_evaluator=None, remote_evaluators=[], timeout_seconds=180): episodes, num_dropped = collect_episodes( local_evaluator, remote_evaluators, timeout_seconds=timeout_seconds) metrics = summarize_episodes(episodes, episodes, num_dropped) r...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'collect_metrics'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10']}; {'id': '4', 'type': 'default_parameter', 'childre...
Gathers episode metrics from PolicyEvaluator instances.
def request_headers(self, request): headers = {} allow_origin = self.allow_origin(request) if allow_origin: headers = dict_filter({ 'Access-Control-Allow-Origin': allow_origin, 'Access-Control-Allow-Credentials': {True: 'true', False: 'false'}.get(self...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'request_headers'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Generate standard request headers
def generate_checks(fact): yield TypeCheck(type(fact)) fact_captured = False for key, value in fact.items(): if (isinstance(key, str) and key.startswith('__') and key.endswith('__')): if key == '__bind__': yield FactCapture(value) ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'generate_checks'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'f...
Given a fact, generate a list of Check objects for checking it.
def target_to_ipv4_short(target): splitted = target.split('-') if len(splitted) != 2: return None try: start_packed = inet_pton(socket.AF_INET, splitted[0]) end_value = int(splitted[1]) except (socket.error, ValueError): return None start_value = int(binascii.hexlify(...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'target_to_ipv4_short'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Attempt to return a IPv4 short range list from a target string.
def format_rst(self): res = '' num_cols = len(self.header) col_width = 25 for _ in range(num_cols): res += ''.join(['=' for _ in range(col_width - 1)]) + ' ' res += '\n' for c in self.header: res += c.ljust(col_width) res += '\n' ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'format_rst'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
return table in RST format
def delete_network_subname(self, sub_name): try: body = {} net_list = self.neutronclient.list_networks(body=body) for net in net_list: if net.get('name').find(sub_name) != -1: self.delete_network_all_subnets(net.get('net_id')) excep...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete_network_subname'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [],...
Delete the network by part of its name, use with caution.
def uniform(self, key, min_value=0., max_value=1.): return min_value + self._random(key) * (max_value - min_value)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'uniform'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
Returns a random number between min_value and max_value
def _calc_strain(self, loc_input, loc_layer, motion, *args): strain_max = self._calc_strain_max(loc_input, loc_layer, motion, *args) return self.strain_ratio * strain_max
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_calc_strain'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children...
Compute the strain used for iterations of material properties.
def functions(self): return [v for v in self.globals.values() if isinstance(v, values.Function)]
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'functions'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'};...
A list of functions declared or defined in this module.
def add_tenant_to_flavor(request, flavor, tenant): return _nova.novaclient(request).flavor_access.add_tenant_access( flavor=flavor, tenant=tenant)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_tenant_to_flavor'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': ...
Add a tenant to the given flavor access list.
def paramsarraybounds(self): bounds = [] for (i, param) in self._index_to_param.items(): if isinstance(param, str): bounds.append(self.model.PARAMLIMITS[param]) elif isinstance(param, tuple): bounds.append(self.model.PARAMLIMITS[param[0]]) ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'paramsarraybounds'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
Bounds for parameters in `paramsarray`.
def _append_pairs(new_pairs): desired_pairs = restore_pairs() or [] desired_pairs += new_pairs print("Adding {} new pairs, queue has {} pairs".format(len(new_pairs), len(desired_pairs))) save_pairs(desired_pairs)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_append_pairs'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'new...
Load the pairlist, add new stuff, save it out
def _add_minimization_vars(self): self._z = self._prob.namespace(self._model.reactions, lower=0) v = self._v.set(self._model.reactions) z = self._z.set(self._model.reactions) self._prob.add_linear_constraints(z >= v, v >= -z)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_add_minimization_vars'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
Add variables and constraints for L1 norm minimization.
def _find_usage_subnets(self): subnet_to_az = {} subnets = defaultdict(int) for subnet in self.conn.describe_subnets()['Subnets']: subnets[subnet['VpcId']] += 1 subnet_to_az[subnet['SubnetId']] = subnet['AvailabilityZone'] for vpc_id in subnets: self.l...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_find_usage_subnets'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
find usage for Subnets; return dict of SubnetId to AZ
async def jsk_vc_pause(self, ctx: commands.Context): voice = ctx.guild.voice_client if voice.is_paused(): return await ctx.send("Audio is already paused.") voice.pause() await ctx.send(f"Paused audio in {voice.channel.name}.")
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'jsk_vc_pause'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Pauses a running audio source, if there is one.
def _queue_processor(self)->None: "Processes queued up write requests asynchronously to Tensorboard." while not self.stop_request.isSet(): while not self.queue.empty(): if self.stop_request.isSet(): return request = self.queue.get() request.wri...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_queue_processor'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
Processes queued up write requests asynchronously to Tensorboard.
def _get_token(): username = __opts__.get('rallydev', {}).get('username', None) password = __opts__.get('rallydev', {}).get('password', None) path = 'https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize' result = salt.utils.http.query( path, decode=True, decode_type...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_token'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '21', '37', '41', '81'...
Get an auth token
def _cached_request(self, base_url, client_id, client_secret, parameters, **kwargs): key = (base_url, client_id, tuple(parameters.items())) cached = self._cache.get(key, {}) if not cached.get('access_token') or self._expired(cached): cached = yield self._reque...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_cached_request'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', '...
Cache the token request and use cached responses if available
def generate_token(self): response = self._make_request() self.auth = response self.token = response['token']
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'generate_token'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se...
Make request in API to generate a token.
def ext_pillar(minion_id, pillar, conf, nesting_key=None): comps = conf.split() paths = [comp for comp in comps if comp.startswith('path=')] if not paths: log.error('"%s" is not a valid Vault ext_pillar config', conf) return {} vault_pillar = ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ext_pillar'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], ...
Get pillar data from Vault for the configuration ``conf``.
def pre_init_process(self): db.connections.close_all() BackgroundProcess.objects.filter(pk=self.process_id).update( pid=self.pid, last_update=now(), running_since=now(), done=False, failed=False, message='init process..', ) ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pre_init_process'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
will be executed after process fork
async def _wait_execute(self, address, command, args, kw): conn = await self.acquire(command, args) try: return (await conn.execute(command, *args, **kw)) finally: self.release(conn)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_wait_execute'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children...
Acquire connection and execute command.
def _attr_display(value, html_element): if value == 'block': html_element.display = Display.block elif value == 'none': html_element.display = Display.none else: html_element.display = Display.inline
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_attr_display'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Set the display value
def write_file(self, target_path, html): logger.debug("Building to {}{}".format(self.fs_name, target_path)) with self.fs.open(smart_text(target_path), 'wb') as outfile: outfile.write(six.binary_type(html)) outfile.close()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_file'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
Writes out the provided HTML to the provided path.
def getApplications(self): res = [] for f in self.features: if isinstance(f, Feature) and f.prop == "disk.0.applications": res.append(FeaturesApp(f.value.features)) return res
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getApplications'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's...
Return a list of Application with the specified apps in this system.
def byPromissor(self, ID): res = [] for direction in self.table: if ID in direction[1]: res.append(direction) return res
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'byPromissor'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Returns all directions to a promissor.
def OnExitSelectionMode(self, event): self.grid.sel_mode_cursor = None self.grid.EnableDragGridSize(True) self.grid.EnableEditing(True)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'OnExitSelectionMode'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
Event handler for leaving selection mode, enables cell edits
def render_as_text(self, limit=None): lines = traceback.format_exception(self.exc_type, self.exc_value, self.frames[0], limit=limit) return ''.join(lines).rstrip()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'render_as_text'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Return a string with the traceback.
async def on_shutdown(self): await self._unregister_subscriptions() self._accepting = False for (ws, _) in self._subscribers: await ws.close(code=aiohttp.WSCloseCode.GOING_AWAY, message='Server shutdown')
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'on_shutdown'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Cleans up any outstanding subscriptions.
def __doQuery(self, query, format, convert): self.__getFormat(format) self.sparql.setQuery(query) if convert: results = self.sparql.query().convert() else: results = self.sparql.query() return results
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__doQuery'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
Inner method that does the actual query
def gnupg_home(): if 'GNUPGHOME' in os.environ: gnupghome = os.environ['GNUPGHOME'] if not os.path.isdir(gnupghome): raise CryptoritoError("Invalid GNUPGHOME directory") return ["--homedir", gnupghome] else: return []
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'gnupg_home'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5']}; {'id': '5', 'type': ...
Returns appropriate arguments if GNUPGHOME is set
def parse_devices(self): devices = [] for device in self._channel_dict["devices"]: devices.append(Device(device, self._is_sixteen_bit, self._ignore_list)) return devices
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_devices'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
Creates an array of Device objects from the channel
def defadj(self, singular, plural): self.checkpat(singular) self.checkpatplural(plural) self.pl_adj_user_defined.extend((singular, plural)) return 1
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'defadj'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Set the adjective plural of singular to plural.
def pycbc_compile_function(code,arg_names,local_dict,global_dict, module_dir, compiler='', verbose=1, support_code=None, headers=None, customize=None, type_converters=None, ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '32']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pycbc_compile_function'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '12', '15', '18', '21', '24', ...
Dummy wrapper around scipy weave compile to implement file locking
def compute_gas_limit_bounds(parent: BlockHeader) -> Tuple[int, int]: boundary_range = parent.gas_limit // GAS_LIMIT_ADJUSTMENT_FACTOR upper_bound = parent.gas_limit + boundary_range lower_bound = max(GAS_LIMIT_MINIMUM, parent.gas_limit - boundary_range) return lower_bound, upper_bound
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compute_gas_limit_bounds'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'childr...
Compute the boundaries for the block gas limit based on the parent block.
def delete(self, tweet_id): c = self.connection.cursor() try: tweet = c.execute("SELECT id, message, previous_tweet, next_tweet from tweets WHERE id=?", (tweet_id,)).next() except StopIteration: raise ValueError("No tweets were found with that ID") c.execute("UPDA...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
Deletes a tweet from the list with the given id
def print_step_table(self, dataset_number=None): dataset_number = self._validate_dataset_number(dataset_number) if dataset_number is None: self._report_empty_dataset() return st = self.datasets[dataset_number].step_table print(st)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'print_step_table'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
Print the step table.
def recommend_for_record(self, record_id, depth=4, num_reco=10): data = calc_scores_for_node(self._graph, record_id, depth, num_reco) return data.Node.tolist(), data.Score.tolist()
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'recommend_for_record'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'child...
Calculate recommendations for record.
def _create_user(ctx): username, passhash = _get_credentials(ctx.obj['username'], ctx.obj['password'], ctx.obj['db']) if ctx.obj['db'].objectmodels['user'].count({'name': username}) > 0: raise KeyError() new_user = c...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_create_user'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ctx'...
Internal method to create a normal user
def _q(self, number, precision='.00001'): if np.isinf(number): return np.nan else: return D(D(number).quantize(D(precision)))
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_q'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self...
quantiztion of BSSEval values
def default_freq(**indexer): freq = 'AS-JAN' if indexer: if 'DJF' in indexer.values(): freq = 'AS-DEC' if 'month' in indexer and sorted(indexer.values()) != indexer.values(): raise (NotImplementedError) return freq
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'default_freq'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'dictionary_splat_pattern', 'children': ['5'...
Return the default frequency.
def build_from_bases(bases, classdict, attr, attr_dict): output = OrderedDict() output_keys = set() all_bases = [] for base in reversed(bases): if base is not object and isinstance(base, PropertyMetaclass): output_keys = output_keys.union(getattr(base, attr)) for item in reve...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_from_bases'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children':...
Helper function to build private HasProperties attributes
def _remove_network(network): ret = {'name': network['Name'], 'changes': {}, 'result': False, 'comment': ''} errors = [] for cid in network['Containers']: try: cinfo = __salt__['docker.inspect_container'](cid) except CommandExecutionError: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_remove_network'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'n...
Remove network, including all connected containers
def run(self): self.print_message("\nBeginning database replacement process.\n") if self.args.source_settings: settings = self.parse_db_settings(self.args.source_settings) self.initialize_db_args(settings, 'source') if self.args.settings: settings = self.parse...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id'...
Replace a database with the data from the specified source.
def ProcessRequest(self, method_config, request): if self.log_request: logging.info( 'Calling method %s with %s: %s', method_config.method_id, method_config.request_type_name, request) return request
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ProcessRequest'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
Hook for pre-processing of requests.
def delete(self): super().delete() self.character.place.send(self.character.place, key=self.name, val=None)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'...
Remove myself from the world model immediately.
def loads(string): d = _loads(string) for k, v in d.items(): FILTERS[dr.get_component(k) or k] = set(v)
{'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': 'string'}; {...
Loads the filters dictionary given a string.
def _setbin_safe(self, binstring): binstring = tidy_input_string(binstring) binstring = binstring.replace('0b', '') self._setbin_unsafe(binstring)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_setbin_safe'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
Reset the bitstring to the value given in binstring.
def traverse_until_fixpoint(predicate, tree): old_tree = None tree = simplify(tree) while tree and old_tree != tree: old_tree = tree tree = tree.traverse(predicate) if not tree: return None tree = simplify(tree) return tree
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'traverse_until_fixpoint'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': []...
Traverses the tree again and again until it is not modified.
def same_content(ref_source, test_source, allow_removed_final_blank_line): if ref_source == test_source: return True if not allow_removed_final_blank_line: return False ref_source = ref_source.splitlines() test_source = test_source.splitlines() if not ref_source: return False...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'same_content'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
Is the content of two cells the same, except for an optional final blank line?
def search_meta_tag(html_doc, prefix, code): regex = '<meta\s+(?:name=([\'\"]){0}\\1\s+content=([\'\"]){1}\\2|content=([\'\"]){1}\\3\s+name=([\'\"]){0}\\4)\s*/?>'.format(prefix, code) meta = re.compile(regex, flags=re.MULTILINE | re.IGNORECASE) m = meta.search(html_doc) if m: head = re.search(r'...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'search_meta_tag'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '...
Checks whether the html_doc contains a meta matching the prefix & code
def comments(case_id): text = request.form['text'] variant_id = request.form.get('variant_id') username = request.form.get('username') case_obj = app.db.case(case_id) app.db.add_comment(case_obj, text, variant_id=variant_id, username=username) return redirect(request.referrer)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'comments'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'case_id'...
Upload a new comment.
def open(cls, **kwargs): handle_iter = cls.iter_open(**kwargs) try: handle = six.next(handle_iter) except StopIteration: raise usb_exceptions.DeviceNotFoundError( 'Open failed with args: %s', kwargs) try: multiple_handle = six.next(handle_iter) except StopIteration: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'open'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; ...
See iter_open, but raises if multiple or no matches found.
def send(self, message): if not message or not self.protocol or not self.protocol.transport: return if not self.can_log: _LOGGER.debug('Sending %s', message.strip()) try: self.protocol.transport.write(message.encode()) except OSError as exc: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'};...
Write a message to the gateway.
def _draw_error_underline(self, ptx, pango_layout, start, stop): self.context.save() self.context.set_source_rgb(1.0, 0.0, 0.0) pit = pango_layout.get_iter() for i in xrange(start): pit.next_char() extents_list = [] for char_no in xrange(start, stop): ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_draw_error_underline'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', '...
Draws an error underline
def getstr_data(self, name, vals): fld2val = self.get_fld2val(name, vals) return self.fmt.format(**fld2val)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getstr_data'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
Return stats data string in markdown style.
def _get_argument(self, argument_node): argument = FritzActionArgument() argument.name = argument_node.find(self.nodename('name')).text argument.direction = argument_node.find(self.nodename('direction')).text rsv = argument_node.find(self.nodename('relatedStateVariable')).text ar...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_argument'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
Returns a FritzActionArgument instance for the given argument_node.
def kwargs_as_assignments(call_node, parent): if not isinstance(call_node, ast.Call): raise TypeError('node must be an ast.Call') if len(call_node.args) > 0: raise ValueError('positional args not allowed') for keyword in call_node.keywords: dst_name = keyword.arg if dst_name....
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'kwargs_as_assignments'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], ...
Yield NoDeclAssign nodes from kwargs in a Call node.
def getResetsIndices(networkDataFile): try: with open(networkDataFile) as f: reader = csv.reader(f) next(reader, None) next(reader, None) resetIdx = next(reader).index("R") resets = [] for i, line in enumerate(reader): if int(line[resetIdx]) == 1: ...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getResetsIndices'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
Returns the indices at which the data sequences reset.
def push(self, metric_name=None, metric_value=None, volume=None): graphite_path = self.path_prefix graphite_path += '.' + self.device + '.' + 'volume' graphite_path += '.' + volume + '.' + metric_name metric = Metric(graphite_path, metric_value, precision=4, host=...
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'push'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
Ship that shit off to graphite broski
def bySignificator(self, ID): res = [] for direction in self.table: if ID in direction[2]: res.append(direction) return res
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'bySignificator'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
Returns all directions to a significator.