code
stringlengths
51
2.34k
sequence
stringlengths
186
3.94k
docstring
stringlengths
11
171
def pop_callback(obj): callbacks = obj._callbacks if not callbacks: return if isinstance(callbacks, Node): node = callbacks obj._callbacks = None else: node = callbacks.first callbacks.remove(node) if not callbacks: obj._callbacks = None return node.data, node.extra
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier if_statement not_operator identifier block return_statement if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier identifier expression_statement assignment attribute identifier identifier none else_clause block expression_statement assignment identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier if_statement not_operator identifier block expression_statement assignment attribute identifier identifier none return_statement expression_list attribute identifier identifier attribute identifier identifier
Pop a single callback.
def overwrite_file_check(args, filename): if not args['overwrite'] and os.path.exists(filename): if args['no_overwrite']: overwrite = False else: try: overwrite = confirm_input(input('Overwrite {0}? (yes/no): ' .format(filename))) except (KeyboardInterrupt, EOFError): sys.exit() if not overwrite: new_filename = modify_filename_id(filename) while os.path.exists(new_filename): new_filename = modify_filename_id(new_filename) return new_filename return filename
module function_definition identifier parameters identifier identifier block if_statement boolean_operator not_operator subscript identifier string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list identifier block if_statement subscript identifier string string_start string_content string_end block expression_statement assignment identifier false else_clause block try_statement block expression_statement assignment identifier call identifier argument_list call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier except_clause tuple identifier identifier block expression_statement call attribute identifier identifier argument_list if_statement not_operator identifier block expression_statement assignment identifier call identifier argument_list identifier while_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement assignment identifier call identifier argument_list identifier return_statement identifier return_statement identifier
If filename exists, overwrite or modify it to be unique.
def add_scan_host_detail(self, scan_id, host='', name='', value=''): self.scan_collection.add_result(scan_id, ResultType.HOST_DETAIL, host, name, value)
module function_definition identifier parameters identifier identifier default_parameter identifier string string_start string_end default_parameter identifier string string_start string_end default_parameter identifier string string_start string_end block expression_statement call attribute attribute identifier identifier identifier argument_list identifier attribute identifier identifier identifier identifier identifier
Adds a host detail result to scan_id scan.
def iter_previewers(self, previewers=None): if self.entry_point_group is not None: self.load_entry_point_group(self.entry_point_group) self.entry_point_group = None previewers = previewers or \ self.app.config.get('PREVIEWER_PREFERENCE', []) for item in previewers: if item in self.previewers: yield self.previewers[item]
module function_definition identifier parameters identifier default_parameter identifier none block if_statement comparison_operator attribute identifier identifier none block expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment attribute identifier identifier none expression_statement assignment identifier boolean_operator identifier line_continuation call attribute attribute attribute identifier identifier identifier identifier argument_list string string_start string_content string_end list for_statement identifier identifier block if_statement comparison_operator identifier attribute identifier identifier block expression_statement yield subscript attribute identifier identifier identifier
Get previewers ordered by PREVIEWER_PREVIEWERS_ORDER.
def unary_operator(op): valid_ops = {'~'} if op not in valid_ops: raise ValueError("Invalid unary operator %s." % op) def unary_operator(self): if isinstance(self, NumericalExpression): return NumExprFilter.create( "{op}({expr})".format(op=op, expr=self._expr), self.inputs, ) else: return NumExprFilter.create("{op}x_0".format(op=op), (self,)) unary_operator.__doc__ = "Unary Operator: '%s'" % op return unary_operator
module function_definition identifier parameters identifier block expression_statement assignment identifier set string string_start string_content string_end if_statement comparison_operator identifier identifier block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier function_definition identifier parameters identifier block if_statement call identifier argument_list identifier identifier block return_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier attribute identifier identifier else_clause block return_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier identifier tuple identifier expression_statement assignment attribute identifier identifier binary_operator string string_start string_content string_end identifier return_statement identifier
Factory function for making unary operator methods for Filters.
def next_header_class(self): if self._next_header_class_key == '': return None key = getattr(self, self._next_header_class_key) rv = self._next_header_map.get(key, None) if rv is None: log_warn("No class exists to handle next header value {}".format(key)) return rv
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier string string_start string_end block return_statement none expression_statement assignment identifier call identifier argument_list identifier attribute identifier identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier none if_statement comparison_operator identifier none block expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier return_statement identifier
Return class of next header, if known.
def __get_connection_info(): conn_info = {} try: conn_info['hostname'] = __opts__['mysql_auth']['hostname'] conn_info['username'] = __opts__['mysql_auth']['username'] conn_info['password'] = __opts__['mysql_auth']['password'] conn_info['database'] = __opts__['mysql_auth']['database'] conn_info['auth_sql'] = __opts__['mysql_auth']['auth_sql'] except KeyError as e: log.error('%s does not exist', e) return None return conn_info
module function_definition identifier parameters block expression_statement assignment identifier dictionary try_statement block expression_statement assignment subscript identifier string string_start string_content string_end subscript subscript identifier string string_start string_content string_end string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end subscript subscript identifier string string_start string_content string_end string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end subscript subscript identifier string string_start string_content string_end string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end subscript subscript identifier string string_start string_content string_end string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end subscript subscript identifier string string_start string_content string_end string string_start string_content string_end except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier return_statement none return_statement identifier
Grab MySQL Connection Details
def write_byte(self, cmd, value): self.bus.write_byte_data(self.address, cmd, value) self.log.debug( "write_byte: Wrote 0x%02X to command register 0x%02X" % ( value, cmd ) )
module function_definition identifier parameters identifier identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list binary_operator string string_start string_content string_end tuple identifier identifier
Writes an 8-bit byte to the specified command register
def reset(self): self._episode_steps = 0 if self._episode_count: self._restart() self._episode_count += 1 logging.info("Starting episode: %s", self._episode_count) self._metrics.increment_episode() self._last_score = [0] * self._num_agents self._state = environment.StepType.FIRST if self._realtime: self._last_step_time = time.time() self._target_step = 0 return self._observe()
module function_definition identifier parameters identifier block expression_statement assignment attribute identifier identifier integer if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list expression_statement augmented_assignment attribute identifier identifier integer expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement assignment attribute identifier identifier binary_operator list integer attribute identifier identifier expression_statement assignment attribute identifier identifier attribute attribute identifier identifier identifier if_statement attribute identifier identifier block expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier integer return_statement call attribute identifier identifier argument_list
Start a new episode.
def _process_response(self, reply): self._advance_cluster_time(reply.get('$clusterTime')) self._advance_operation_time(reply.get('operationTime')) if self._in_transaction and self._transaction.sharded: recovery_token = reply.get('recoveryToken') if recovery_token: self._transaction.recovery_token = recovery_token
module function_definition identifier parameters identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end if_statement boolean_operator attribute identifier identifier attribute attribute identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end if_statement identifier block expression_statement assignment attribute attribute identifier identifier identifier identifier
Process a response to a command that was run with this session.
def _ValidateReturnValue(return_value, type_check_dict): return_check = type_check_dict.get("returns", None) if not return_check: return [] messages = [] if not _ValidateValue(return_value, return_check): message = ("Invalid return value '%s'. Expected %s" % (return_value, _FormatTypeCheck(return_check))) messages.append(message) return messages
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end none if_statement not_operator identifier block return_statement list expression_statement assignment identifier list if_statement not_operator call identifier argument_list identifier identifier block expression_statement assignment identifier parenthesized_expression binary_operator string string_start string_content string_end tuple identifier call identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier return_statement identifier
Validate return value and return list of errors messages.
def validate_sort_fields(self): sort_fields = ','.join(self.options.sort_fields) if sort_fields == '*': sort_fields = self.get_output_fields() return formatting.validate_sort_fields(sort_fields or config.sort_fields)
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list attribute attribute identifier identifier identifier if_statement comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier call attribute identifier identifier argument_list return_statement call attribute identifier identifier argument_list boolean_operator identifier attribute identifier identifier
Take care of sorting.
def update_task_redundancy(config, task_id, redundancy): if task_id is None: msg = ("Are you sure you want to update all the tasks redundancy?") if click.confirm(msg): res = _update_tasks_redundancy(config, task_id, redundancy) click.echo(res) else: click.echo("Aborting.") else: res = _update_tasks_redundancy(config, task_id, redundancy) click.echo(res)
module function_definition identifier parameters identifier identifier identifier block if_statement comparison_operator identifier none block expression_statement assignment identifier parenthesized_expression string string_start string_content string_end if_statement call attribute identifier identifier argument_list identifier block expression_statement assignment identifier call identifier argument_list identifier identifier identifier expression_statement call attribute identifier identifier argument_list identifier else_clause block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end else_clause block expression_statement assignment identifier call identifier argument_list identifier identifier identifier expression_statement call attribute identifier identifier argument_list identifier
Update task redudancy for a project.
def GetWsdlMethod(ns, wsdlName): with _lazyLock: method = _wsdlMethodMap[(ns, wsdlName)] if isinstance(method, ManagedMethod): return method elif method: LoadManagedType(*method) return _wsdlMethodMap[(ns, wsdlName)] else: raise KeyError("{0} {1}".format(ns, name))
module function_definition identifier parameters identifier identifier block with_statement with_clause with_item identifier block expression_statement assignment identifier subscript identifier tuple identifier identifier if_statement call identifier argument_list identifier identifier block return_statement identifier elif_clause identifier block expression_statement call identifier argument_list list_splat identifier return_statement subscript identifier tuple identifier identifier else_clause block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier identifier
Get wsdl method from ns, wsdlName
def setup_logger(logging_level, logging_format): logger = logging.getLogger("ray") if type(logging_level) is str: logging_level = logging.getLevelName(logging_level.upper()) logger.setLevel(logging_level) global _default_handler if _default_handler is None: _default_handler = logging.StreamHandler() logger.addHandler(_default_handler) _default_handler.setFormatter(logging.Formatter(logging_format)) logger.propagate = False
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator call identifier argument_list identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier global_statement identifier if_statement comparison_operator identifier none block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier expression_statement assignment attribute identifier identifier false
Setup default logging for ray.
def _setChoiceDict(self): self.choiceDict = minmatch.MinMatchDict() for c in self.choice: self.choiceDict.add(c, c)
module function_definition identifier parameters identifier block expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list for_statement identifier attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier identifier
Create min-match dictionary for choice list
def _extract_node_text(node): texts = map( six.text_type.strip, map(six.text_type, map(unescape, node.xpath(".//text()"))) ) return " ".join(text for text in texts if text)
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list attribute attribute identifier identifier identifier call identifier argument_list attribute identifier identifier call identifier argument_list identifier call attribute identifier identifier argument_list string string_start string_content string_end return_statement call attribute string string_start string_content string_end identifier generator_expression identifier for_in_clause identifier identifier if_clause identifier
Extract text from a given lxml node.
def mode_new_collection(): print globals()['mode_new_collection'].__doc__ collection_name = raw_input("Collection name: ") item_attr_list = [] collection_node_id = None if collection_name: collection_node_id = insert_node(name=collection_name, value=None) insert_query(name='select_link_node_from_node.sql', node_id=collection_node_id) item_attr = True while item_attr: item_attr = raw_input("Add a collection item attribute name: ") if item_attr: item_attr_list.append(item_attr) selection = collection_name while selection: selection = select([ 'Add item', ]) if selection == 'Add item': add_item_with_attributes_to_collection( collection_name=collection_name, collection_node_id=collection_node_id, item_attr_list=item_attr_list) if collection_node_id: print "Added collection name '{0}' with node id: {1}".format(collection_name, collection_node_id)
module function_definition identifier parameters block print_statement attribute subscript call identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier call identifier argument_list string string_start string_content string_end expression_statement assignment identifier list expression_statement assignment identifier none if_statement identifier block expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier keyword_argument identifier none expression_statement call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier expression_statement assignment identifier true while_statement identifier block expression_statement assignment identifier call identifier argument_list string string_start string_content string_end if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier identifier while_statement identifier block expression_statement assignment identifier call identifier argument_list list string string_start string_content string_end if_statement comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier if_statement identifier block print_statement call attribute string string_start string_content string_end identifier argument_list identifier identifier
Create a new collection of items with common attributes.
def _get_username_for_key(self): response = self.client.get_access_key_last_used( AccessKeyId=self.compromised_resource['access_key_id'] ) username = response['UserName'] return username
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list keyword_argument identifier subscript attribute identifier identifier string string_start string_content string_end expression_statement assignment identifier subscript identifier string string_start string_content string_end return_statement identifier
Find the user for a given access key
def compute_laplacian_matrix(affinity_matrix, method='auto', **kwargs): if method == 'auto': method = 'geometric' return Laplacian.init(method, **kwargs).laplacian_matrix(affinity_matrix)
module function_definition identifier parameters identifier default_parameter identifier string string_start string_content string_end dictionary_splat_pattern identifier block if_statement comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier string string_start string_content string_end return_statement call attribute call attribute identifier identifier argument_list identifier dictionary_splat identifier identifier argument_list identifier
Compute the laplacian matrix with the given method
def _format_data(self, name=None): is_justify = not (self.inferred_type in ('string', 'unicode') or (self.inferred_type == 'categorical' and is_object_dtype(self.categories))) return format_object_summary(self, self._formatter_func, is_justify=is_justify, name=name)
module function_definition identifier parameters identifier default_parameter identifier none block expression_statement assignment identifier not_operator parenthesized_expression boolean_operator comparison_operator attribute identifier identifier tuple string string_start string_content string_end string string_start string_content string_end parenthesized_expression boolean_operator comparison_operator attribute identifier identifier string string_start string_content string_end call identifier argument_list attribute identifier identifier return_statement call identifier argument_list identifier attribute identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier
Return the formatted data as a unicode string.
def function_body(self): if self.shared.function_vars > 0: const = self.symtab.insert_constant("0{}".format(self.shared.function_vars * 4), SharedData.TYPES.UNSIGNED) self.arithmetic("-", "%15", const, "%15") self.newline_label(self.shared.function_name + "_body", True, True)
module function_definition identifier parameters identifier block if_statement comparison_operator attribute attribute identifier identifier identifier integer block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list binary_operator attribute attribute identifier identifier identifier integer attribute attribute identifier identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list binary_operator attribute attribute identifier identifier identifier string string_start string_content string_end true true
Inserts a local variable initialization and body label
def treble(self, treble): treble = int(treble) treble = max(-10, min(treble, 10)) self.renderingControl.SetTreble([ ('InstanceID', 0), ('DesiredTreble', treble) ])
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list unary_operator integer call identifier argument_list identifier integer expression_statement call attribute attribute identifier identifier identifier argument_list list tuple string string_start string_content string_end integer tuple string string_start string_content string_end identifier
Set the speaker's treble.
def push_source(self, newstream, newfile=None): "Push an input source onto the lexer's input source stack." if isinstance(newstream, basestring): newstream = StringIO(newstream) self.filestack.appendleft((self.infile, self.instream, self.lineno)) self.infile = newfile self.instream = newstream self.lineno = 1
module function_definition identifier parameters identifier identifier default_parameter identifier none block expression_statement string string_start string_content string_end if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list tuple attribute identifier identifier attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier identifier expression_statement assignment attribute identifier identifier identifier expression_statement assignment attribute identifier identifier integer
Push an input source onto the lexer's input source stack.
def invocation(): cmdargs = [sys.executable] + sys.argv[:] invocation = " ".join(shlex.quote(s) for s in cmdargs) return invocation
module function_definition identifier parameters block expression_statement assignment identifier binary_operator list attribute identifier identifier subscript attribute identifier identifier slice expression_statement assignment identifier call attribute string string_start string_content string_end identifier generator_expression call attribute identifier identifier argument_list identifier for_in_clause identifier identifier return_statement identifier
reconstructs the invocation for this python program
def checkin(self): self._query_instance.checkin(self.place_id, self._query_instance.sensor)
module function_definition identifier parameters identifier block expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier attribute attribute identifier identifier identifier
Checks in an anonymous user in.
def savepoint(self): if self._last_image: self._savepoints.append(self._last_image) self._last_image = None
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier expression_statement assignment attribute identifier identifier none
Copies the last displayed image.
def utc_dt_to_local_dt(dtm): utc_zone = mktz("UTC") if dtm.tzinfo is not None and dtm.tzinfo != utc_zone: raise ValueError( "Expected dtm without tzinfo or with UTC, not %r" % ( dtm.tzinfo ) ) if dtm.tzinfo is None: dtm = dtm.replace(tzinfo=utc_zone) return dtm.astimezone(mktz())
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list string string_start string_content string_end if_statement boolean_operator comparison_operator attribute identifier identifier none comparison_operator attribute identifier identifier identifier block raise_statement call identifier argument_list binary_operator string string_start string_content string_end parenthesized_expression attribute identifier identifier if_statement comparison_operator attribute identifier identifier none block expression_statement assignment identifier call attribute identifier identifier argument_list keyword_argument identifier identifier return_statement call attribute identifier identifier argument_list call identifier argument_list
Convert a UTC datetime to datetime in local timezone
def tostr(self): element = _transform.SVGFigure(self.width, self.height) element.append(self) svgstr = element.to_str() return svgstr
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list return_statement identifier
Export SVG as a string
def mkdir(dir, enter): if not os.path.exists(dir): os.makedirs(dir)
module function_definition identifier parameters identifier identifier block if_statement not_operator call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier
Create directory with template for topic of the current environment
def patch(self, urls=None, **overrides): if urls is not None: overrides['urls'] = urls return self.where(accept='PATCH', **overrides)
module function_definition identifier parameters identifier default_parameter identifier none dictionary_splat_pattern identifier block if_statement comparison_operator identifier none block expression_statement assignment subscript identifier string string_start string_content string_end identifier return_statement call attribute identifier identifier argument_list keyword_argument identifier string string_start string_content string_end dictionary_splat identifier
Sets the acceptable HTTP method to PATCH
def _batchify(self, batch_data, batch_label, start=0): i = start batch_size = self.batch_size try: while i < batch_size: label, s = self.next_sample() data = self.imdecode(s) try: self.check_valid_image([data]) label = self._parse_label(label) data, label = self.augmentation_transform(data, label) self._check_valid_label(label) except RuntimeError as e: logging.debug('Invalid image, skipping: %s', str(e)) continue for datum in [data]: assert i < batch_size, 'Batch size must be multiples of augmenter output length' batch_data[i] = self.postprocess_data(datum) num_object = label.shape[0] batch_label[i][0:num_object] = nd.array(label) if num_object < batch_label[i].shape[0]: batch_label[i][num_object:] = -1 i += 1 except StopIteration: if not i: raise StopIteration return i
module function_definition identifier parameters identifier identifier identifier default_parameter identifier integer block expression_statement assignment identifier identifier expression_statement assignment identifier attribute identifier identifier try_statement block while_statement comparison_operator identifier identifier block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list identifier try_statement block expression_statement call attribute identifier identifier argument_list list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list identifier except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call identifier argument_list identifier continue_statement for_statement identifier list identifier block assert_statement comparison_operator identifier identifier string string_start string_content string_end expression_statement assignment subscript identifier identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier subscript attribute identifier identifier integer expression_statement assignment subscript subscript identifier identifier slice integer identifier call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier subscript attribute subscript identifier identifier identifier integer block expression_statement assignment subscript subscript identifier identifier slice identifier unary_operator integer expression_statement augmented_assignment identifier integer except_clause identifier block if_statement not_operator identifier block raise_statement identifier return_statement identifier
Override the helper function for batchifying data
def apply_deprecations(cls, path): "Convert any potentially deprecated paths and issue appropriate warnings" split = path.split('.') msg = 'Element {old} deprecated. Use {new} instead.' for old, new in cls.deprecations: if split[0] == old: parsewarning.warning(msg.format(old=old, new=new)) return '.'.join([new] + split[1:]) return path
module function_definition identifier parameters identifier identifier block expression_statement string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier string string_start string_content string_end for_statement pattern_list identifier identifier attribute identifier identifier block if_statement comparison_operator subscript identifier integer identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier return_statement call attribute string string_start string_content string_end identifier argument_list binary_operator list identifier subscript identifier slice integer return_statement identifier
Convert any potentially deprecated paths and issue appropriate warnings
def cache_invalidate_by_tags(tags, cache=None): if isinstance(tags, basestring): tags = [tags] tag_keys = [CACHE_TAG_KEY % tag for tag in tags if tag] if not tag_keys: raise ValueError('Attr tags invalid') if cache is None: cache = default_cache tag_keys_for_delete = [] if cache.__class__.__name__ == 'RedisCache': from django_redis.exceptions import ConnectionInterrupted try: redis_client = cache.client.get_client() for tag_key in tag_keys: keys = redis_client.smembers(tag_key) if keys: cache.delete_many(keys) tag_keys_for_delete.append(tag_key) except ConnectionInterrupted: pass else: for tag_key in tag_keys: keys = cache.get(tag_key) if keys: cache.delete_many(keys) tag_keys_for_delete.append(tag_key) if tag_keys_for_delete: cache.delete_many(tag_keys_for_delete)
module function_definition identifier parameters identifier default_parameter identifier none block if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier list identifier expression_statement assignment identifier list_comprehension binary_operator identifier identifier for_in_clause identifier identifier if_clause identifier if_statement not_operator identifier block raise_statement call identifier argument_list string string_start string_content string_end if_statement comparison_operator identifier none block expression_statement assignment identifier identifier expression_statement assignment identifier list if_statement comparison_operator attribute attribute identifier identifier identifier string string_start string_content string_end block import_from_statement dotted_name identifier identifier dotted_name identifier try_statement block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier except_clause identifier block pass_statement else_clause block for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier
Clear cache by tags.
def part_lister(mpupload, part_number_marker=None): more_results = True part = None while more_results: parts = mpupload.get_all_parts(None, part_number_marker) for part in parts: yield part part_number_marker = mpupload.next_part_number_marker more_results= mpupload.is_truncated
module function_definition identifier parameters identifier default_parameter identifier none block expression_statement assignment identifier true expression_statement assignment identifier none while_statement identifier block expression_statement assignment identifier call attribute identifier identifier argument_list none identifier for_statement identifier identifier block expression_statement yield identifier expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier attribute identifier identifier
A generator function for listing parts of a multipart upload.
def compress(self): for ast_token in self.ast_tokens: if type(ast_token) in self.dispatcher: self.dispatcher[type(ast_token)](ast_token) else: self.dispatcher['default'](ast_token)
module function_definition identifier parameters identifier block for_statement identifier attribute identifier identifier block if_statement comparison_operator call identifier argument_list identifier attribute identifier identifier block expression_statement call subscript attribute identifier identifier call identifier argument_list identifier argument_list identifier else_clause block expression_statement call subscript attribute identifier identifier string string_start string_content string_end argument_list identifier
Main function of compression.
def session(self, create=True): if hasattr(self.local, 'session'): return self.local.session else: if create: s = Session(self.name) self.local.session = s return s
module function_definition identifier parameters identifier default_parameter identifier true block if_statement call identifier argument_list attribute identifier identifier string string_start string_content string_end block return_statement attribute attribute identifier identifier identifier else_clause block if_statement identifier block expression_statement assignment identifier call identifier argument_list attribute identifier identifier expression_statement assignment attribute attribute identifier identifier identifier identifier return_statement identifier
Used to created default session
def sign(ctx, filename): if filename: tx = filename.read() else: tx = sys.stdin.read() tx = TransactionBuilder(eval(tx), bitshares_instance=ctx.bitshares) tx.appendMissingSignatures() tx.sign() print_tx(tx.json())
module function_definition identifier parameters identifier identifier block if_statement identifier block expression_statement assignment identifier call attribute identifier identifier argument_list else_clause block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier call identifier argument_list call identifier argument_list identifier keyword_argument identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list expression_statement call identifier argument_list call attribute identifier identifier argument_list
Sign a json-formatted transaction
def new(cls, arg): content = None if arg.kind == 'file': if os.path.exists(arg.value): with open(arg.value, 'r') as f: content = f.read() else: raise Exception('File does not exist: {}'.format(arg.value)) elif arg.kind == 'cli': content = arg.value for source_cls in cls.sources: if source_cls.supports_source(arg): return source_cls(content) msg = 'Unsupported Parameter Source "{}"' raise Execption(msg.format(arg.value))
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier none if_statement comparison_operator attribute identifier identifier string string_start string_content string_end block if_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier block with_statement with_clause with_item as_pattern call identifier argument_list attribute identifier identifier string string_start string_content string_end as_pattern_target identifier block expression_statement assignment identifier call attribute identifier identifier argument_list else_clause block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier elif_clause comparison_operator attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier attribute identifier identifier for_statement identifier attribute identifier identifier block if_statement call attribute identifier identifier argument_list identifier block return_statement call identifier argument_list identifier expression_statement assignment identifier string string_start string_content string_end raise_statement call identifier argument_list call attribute identifier identifier argument_list attribute identifier identifier
Creates a new Parameter object from the given ParameterArgument.
def clear_layout(layout: QLayout) -> None: if layout is not None: while layout.count(): item = layout.takeAt(0) widget = item.widget() if widget is not None: widget.deleteLater() else: clear_layout(item.layout())
module function_definition identifier parameters typed_parameter identifier type identifier type none block if_statement comparison_operator identifier none block while_statement call attribute identifier identifier argument_list block expression_statement assignment identifier call attribute identifier identifier argument_list integer expression_statement assignment identifier call attribute identifier identifier argument_list if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list else_clause block expression_statement call identifier argument_list call attribute identifier identifier argument_list
Clear the layout off all its components
def visit_Yield(self, node): self.generic_visit(node) self.combine(self.current, node.value)
module function_definition identifier parameters identifier identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier
Compute yield type and merges it with others yield type.
def check_create_folder(filename): os.makedirs(os.path.dirname(filename), exist_ok=True)
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier keyword_argument identifier true
Check if the folder exisits. If not, create the folder
def visit_SetComp(self, node: AST, dfltChaining: bool = True) -> str: return f"{{{self.visit(node.elt)} " \ f"{' '.join(self.visit(gen) for gen in node.generators)}}}"
module function_definition identifier parameters identifier typed_parameter identifier type identifier typed_default_parameter identifier type identifier true type identifier block return_statement concatenated_string string string_start string_content escape_interpolation interpolation call attribute identifier identifier argument_list attribute identifier identifier string_content string_end string string_start interpolation call attribute string string_start string_content string_end identifier generator_expression call attribute identifier identifier argument_list identifier for_in_clause identifier attribute identifier identifier string_content escape_interpolation string_end
Return `node`s representation as set comprehension.
def view_num_units(token, dstore): taxo = dstore['assetcol/tagcol/taxonomy'].value counts = collections.Counter() for asset in dstore['assetcol']: counts[taxo[asset['taxonomy']]] += asset['number'] data = sorted(counts.items()) data.append(('*ALL*', sum(d[1] for d in data))) return rst_table(data, header=['taxonomy', 'num_units'])
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute subscript identifier string string_start string_content string_end identifier expression_statement assignment identifier call attribute identifier identifier argument_list for_statement identifier subscript identifier string string_start string_content string_end block expression_statement augmented_assignment subscript identifier subscript identifier subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list tuple string string_start string_content string_end call identifier generator_expression subscript identifier integer for_in_clause identifier identifier return_statement call identifier argument_list identifier keyword_argument identifier list string string_start string_content string_end string string_start string_content string_end
Display the number of units by taxonomy
def _get_connection(self, x, y): if (self._width is None or self._height is None or self._root_chip is None): return self.connections[None] else: eth_chip = spinn5_local_eth_coord(x, y, self._width, self._height, *self._root_chip) conn = self.connections.get(eth_chip) if conn is not None: return conn else: return self.connections[None]
module function_definition identifier parameters identifier identifier identifier block if_statement parenthesized_expression boolean_operator boolean_operator comparison_operator attribute identifier identifier none comparison_operator attribute identifier identifier none comparison_operator attribute identifier identifier none block return_statement subscript attribute identifier identifier none else_clause block expression_statement assignment identifier call identifier argument_list identifier identifier attribute identifier identifier attribute identifier identifier list_splat attribute identifier identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier if_statement comparison_operator identifier none block return_statement identifier else_clause block return_statement subscript attribute identifier identifier none
Get the appropriate connection for a chip.
def add(self, *tasks): nodes = [x.node for x in tasks] self.node.add(*nodes) return self
module function_definition identifier parameters identifier list_splat_pattern identifier block expression_statement assignment identifier list_comprehension attribute identifier identifier for_in_clause identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list list_splat identifier return_statement identifier
Interfaces the GraphNode `add` method
def load(self, url, offset=0, length=-1): file_only = url.startswith(('/', '.')) filename = from_file_url(url) if filename != url: file_only = True url = filename try: afile = open(url, 'rb') except IOError: if file_only: raise return super(LocalFileLoader, self).load(url, offset, length) if offset > 0: afile.seek(offset) if length >= 0: return LimitReader(afile, length) else: return afile
module function_definition identifier parameters identifier identifier default_parameter identifier integer default_parameter identifier unary_operator integer block expression_statement assignment identifier call attribute identifier identifier argument_list tuple string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier if_statement comparison_operator identifier identifier block expression_statement assignment identifier true expression_statement assignment identifier identifier try_statement block expression_statement assignment identifier call identifier argument_list identifier string string_start string_content string_end except_clause identifier block if_statement identifier block raise_statement return_statement call attribute call identifier argument_list identifier identifier identifier argument_list identifier identifier identifier if_statement comparison_operator identifier integer block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier integer block return_statement call identifier argument_list identifier identifier else_clause block return_statement identifier
Load a file-like reader from the local file system
def _disconnect(self): if not self.protocol or not self.protocol.transport: self.protocol = None return _LOGGER.info('Disconnecting from gateway') self.protocol.transport.close() self.protocol = None
module function_definition identifier parameters identifier block if_statement boolean_operator not_operator attribute identifier identifier not_operator attribute attribute identifier identifier identifier block expression_statement assignment attribute identifier identifier none return_statement expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list expression_statement assignment attribute identifier identifier none
Disconnect from the transport.
def _get_tables(self, ods): childnodes = ods.spreadsheet.childNodes qname_childnodes = [(s.qname[1], s) for s in childnodes] return [node for name, node in qname_childnodes if name == u"table"]
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment identifier list_comprehension tuple subscript attribute identifier identifier integer identifier for_in_clause identifier identifier return_statement list_comprehension identifier for_in_clause pattern_list identifier identifier identifier if_clause comparison_operator identifier string string_start string_content string_end
Returns list of table nodes from ods object
def parse_command_line(self): result = _Distribution.parse_command_line(self) if self.features: self._finalize_features() return result
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list return_statement identifier
Process features after parsing command line options
def _from_dict(cls, _dict): args = {} if 'classifier_id' in _dict: args['classifier_id'] = _dict.get('classifier_id') if 'url' in _dict: args['url'] = _dict.get('url') if 'text' in _dict: args['text'] = _dict.get('text') if 'top_class' in _dict: args['top_class'] = _dict.get('top_class') if 'classes' in _dict: args['classes'] = [ ClassifiedClass._from_dict(x) for x in (_dict.get('classes')) ] return cls(**args)
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier dictionary if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end list_comprehension call attribute identifier identifier argument_list identifier for_in_clause identifier parenthesized_expression call attribute identifier identifier argument_list string string_start string_content string_end return_statement call identifier argument_list dictionary_splat identifier
Initialize a Classification object from a json dictionary.
def validate(self, value): value = super(Boolean, self).validate(value) if value is not None: value = bool(value) return value
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute call identifier argument_list identifier identifier identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement assignment identifier call identifier argument_list identifier return_statement identifier
Always returns a Python boolean.
def clear_cache_root(): logger.debug("Clearing root cache") if os.path.isdir(_root_songcache_dir): for filename in os.listdir(_root_songcache_dir): file_path = os.path.join(_root_songcache_dir, filename) try: if os.path.isfile(file_path): os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) except PermissionError: pass except Exception as e: logger.exception(e) logger.debug("Root cache cleared")
module function_definition identifier parameters block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block for_statement identifier call attribute identifier identifier argument_list identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier identifier try_statement block if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier elif_clause call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier except_clause identifier block pass_statement except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end
Clears everything in the song cache
def _is_excluded(self, path, dir_only): return self.npatterns and self._match_excluded(path, self.npatterns)
module function_definition identifier parameters identifier identifier identifier block return_statement boolean_operator attribute identifier identifier call attribute identifier identifier argument_list identifier attribute identifier identifier
Check if file is excluded.
def _clear(self): (colour, attr, bg) = self.palette["background"] self._canvas.clear_buffer(colour, attr, bg)
module function_definition identifier parameters identifier block expression_statement assignment tuple_pattern identifier identifier identifier subscript attribute identifier identifier string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list identifier identifier identifier
Clear the current canvas.
def add_option(self, K=None, price=None, St=None, kind="call", pos="long"): kinds = { "call": Call, "Call": Call, "c": Call, "C": Call, "put": Put, "Put": Put, "p": Put, "P": Put, } St = self.St if St is None else St option = kinds[kind](St=St, K=K, price=price, pos=pos) self.options.append(option)
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier string string_start string_content string_end default_parameter identifier string string_start string_content string_end block expression_statement assignment identifier dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier expression_statement assignment identifier conditional_expression attribute identifier identifier comparison_operator identifier none identifier expression_statement assignment identifier call subscript identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier
Add an option to the object's `options` container.
def rpm_eval(macro): try: value = subprocess.Popen( ['rpm', '--eval', macro], stdout=subprocess.PIPE).communicate()[0].strip() except OSError: logger.error('Failed to get value of {0} rpm macro'.format( macro), exc_info=True) value = b'' return console_to_str(value)
module function_definition identifier parameters identifier block try_statement block expression_statement assignment identifier call attribute subscript call attribute call attribute identifier identifier argument_list list string string_start string_content string_end string string_start string_content string_end identifier keyword_argument identifier attribute identifier identifier identifier argument_list integer identifier argument_list except_clause identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier keyword_argument identifier true expression_statement assignment identifier string string_start string_end return_statement call identifier argument_list identifier
Get value of given macro using rpm tool
def _log_task_info(headers, extra_task_info=None): ran_at = time.time() task_eta = float(headers.get('X-Appengine-Tasketa', 0.0)) task_info = { 'retry_count': headers.get('X-Appengine-Taskretrycount', ''), 'execution_count': headers.get('X-Appengine-Taskexecutioncount', ''), 'task_eta': task_eta, 'ran': ran_at, 'gae_latency_seconds': ran_at - task_eta } if extra_task_info: task_info['extra'] = extra_task_info logging.debug('TASK-INFO: %s', json.dumps(task_info))
module function_definition identifier parameters identifier default_parameter identifier none block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end float expression_statement assignment identifier dictionary pair string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end pair string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end binary_operator identifier identifier if_statement identifier block expression_statement assignment subscript identifier string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list identifier
Processes the header from task requests to log analytical data.
def serialize(self): res = '<?xml version="1.0" encoding="UTF-8"?>' for ns in self.namespaces: self.top_grammar.attr["xmlns:" + self.namespaces[ns]] = ns res += self.top_grammar.start_tag() for ch in self.top_grammar.children: res += ch.serialize() res += self.tree.serialize() for d in self.global_defs: res += self.global_defs[d].serialize() for i in self.identities: res += self.identities[i].serialize() return res + self.top_grammar.end_tag()
module function_definition identifier parameters identifier block expression_statement assignment identifier string string_start string_content string_end for_statement identifier attribute identifier identifier block expression_statement assignment subscript attribute attribute identifier identifier identifier binary_operator string string_start string_content string_end subscript attribute identifier identifier identifier identifier expression_statement augmented_assignment identifier call attribute attribute identifier identifier identifier argument_list for_statement identifier attribute attribute identifier identifier identifier block expression_statement augmented_assignment identifier call attribute identifier identifier argument_list expression_statement augmented_assignment identifier call attribute attribute identifier identifier identifier argument_list for_statement identifier attribute identifier identifier block expression_statement augmented_assignment identifier call attribute subscript attribute identifier identifier identifier identifier argument_list for_statement identifier attribute identifier identifier block expression_statement augmented_assignment identifier call attribute subscript attribute identifier identifier identifier identifier argument_list return_statement binary_operator identifier call attribute attribute identifier identifier identifier argument_list
Return the string representation of the receiver.
def getCoeffStr(self): txt = '' for key, val in self.coeffs.items(): txt += '%s = %s\n' % (key, val) return txt
module function_definition identifier parameters identifier block expression_statement assignment identifier string string_start string_end for_statement pattern_list identifier identifier call attribute attribute identifier identifier identifier argument_list block expression_statement augmented_assignment identifier binary_operator string string_start string_content escape_sequence string_end tuple identifier identifier return_statement identifier
get the distortion coeffs in a formated string
def escape_header(val): if val is None: return None try: return quote(val, encoding="ascii", safe="/ ") except ValueError: return "utf-8''" + quote(val, encoding="utf-8", safe="/ ")
module function_definition identifier parameters identifier block if_statement comparison_operator identifier none block return_statement none try_statement block return_statement call identifier argument_list identifier keyword_argument identifier string string_start string_content string_end keyword_argument identifier string string_start string_content string_end except_clause identifier block return_statement binary_operator string string_start string_content string_end call identifier argument_list identifier keyword_argument identifier string string_start string_content string_end keyword_argument identifier string string_start string_content string_end
Escapes a value so that it can be used in a mime header
def discover_settings(conf_base=None): settings = { 'zmq_prefix': '', 'libzmq_extension': False, 'no_libzmq_extension': False, 'skip_check_zmq': False, 'build_ext': {}, 'bdist_egg': {}, } if sys.platform.startswith('win'): settings['have_sys_un_h'] = False if conf_base: merge(settings, load_config('config', conf_base)) merge(settings, get_cfg_args()) merge(settings, get_eargs()) return settings
module function_definition identifier parameters default_parameter identifier none block expression_statement assignment identifier dictionary pair string string_start string_content string_end string string_start string_end pair string string_start string_content string_end false pair string string_start string_content string_end false pair string string_start string_content string_end false pair string string_start string_content string_end dictionary pair string string_start string_content string_end dictionary if_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end block expression_statement assignment subscript identifier string string_start string_content string_end false if_statement identifier block expression_statement call identifier argument_list identifier call identifier argument_list string string_start string_content string_end identifier expression_statement call identifier argument_list identifier call identifier argument_list expression_statement call identifier argument_list identifier call identifier argument_list return_statement identifier
Discover custom settings for ZMQ path
def _perm_dict_from_pyxb(self, access_pyxb): subj_dict = self._subj_dict_from_pyxb(access_pyxb) return self._perm_dict_from_subj_dict(subj_dict)
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement call attribute identifier identifier argument_list identifier
Return dict representation of AccessPolicy PyXB obj.
def RunOnce(self): global WEBAUTH_MANAGER WEBAUTH_MANAGER = BaseWebAuthManager.GetPlugin( config.CONFIG["AdminUI.webauth_manager"])() logging.info("Using webauth manager %s", WEBAUTH_MANAGER)
module function_definition identifier parameters identifier block global_statement identifier expression_statement assignment identifier call call attribute identifier identifier argument_list subscript attribute identifier identifier string string_start string_content string_end argument_list expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier
Run this once on init.
def predict(self, X): return self.__cost(self.__unroll(self.__thetas), 0, np.matrix(X))
module function_definition identifier parameters identifier identifier block return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list attribute identifier identifier integer call attribute identifier identifier argument_list identifier
Returns predictions of input test cases.
def _generate_time_steps(self, trajectory_list): for time_step in env_problem.EnvProblem._generate_time_steps( self, trajectory_list): frame_np = np.array(time_step.pop(env_problem.OBSERVATION_FIELD)) frame_np = frame_np.reshape( [self.frame_height, self.frame_width, self.num_channels]) frame = png.from_array(frame_np, "RGB", info={"bitdepth": 8}) frame_buffer = six.BytesIO() frame.save(frame_buffer) time_step[_IMAGE_ENCODED_FIELD] = [frame_buffer.getvalue()] time_step[_IMAGE_FORMAT_FIELD] = [_FORMAT] time_step[_IMAGE_HEIGHT_FIELD] = [self.frame_height] time_step[_IMAGE_WIDTH_FIELD] = [self.frame_width] time_step[_FRAME_NUMBER_FIELD] = time_step[env_problem.TIMESTEP_FIELD] yield time_step
module function_definition identifier parameters identifier identifier block for_statement identifier call attribute attribute identifier identifier identifier argument_list identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list list attribute identifier identifier attribute identifier identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier string string_start string_content string_end keyword_argument identifier dictionary pair string string_start string_content string_end integer expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment subscript identifier identifier list call attribute identifier identifier argument_list expression_statement assignment subscript identifier identifier list identifier expression_statement assignment subscript identifier identifier list attribute identifier identifier expression_statement assignment subscript identifier identifier list attribute identifier identifier expression_statement assignment subscript identifier identifier subscript identifier attribute identifier identifier expression_statement yield identifier
Transforms time step observations to frames of a video.
def pdebug(*args, **kwargs): if should_msg(kwargs.get("groups", ["debug"])): global colorama_init if not colorama_init: colorama_init = True colorama.init() args = indent_text(*args, **kwargs) sys.stderr.write(colorama.Fore.CYAN) sys.stderr.write("".join(args)) sys.stderr.write(colorama.Fore.RESET) sys.stderr.write("\n")
module function_definition identifier parameters list_splat_pattern identifier dictionary_splat_pattern identifier block if_statement call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end list string string_start string_content string_end block global_statement identifier if_statement not_operator identifier block expression_statement assignment identifier true expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier call identifier argument_list list_splat identifier dictionary_splat identifier expression_statement call attribute attribute identifier identifier identifier argument_list attribute attribute identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list call attribute string string_start string_end identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list attribute attribute identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content escape_sequence string_end
print formatted output to stdout with indentation control
def changes(self, adding=None, deleting=None): if deleting is not None: for deleted in deleting: self.root_node.remove(deleted) if adding is not None: for added in adding: self.root_node.add(added) added = list() removed = list() for csn in self._get_conflict_set_nodes(): c_added, c_removed = csn.get_activations() added.extend(c_added) removed.extend(c_removed) return (added, removed)
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none block if_statement comparison_operator identifier none block for_statement identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier if_statement comparison_operator identifier none block for_statement identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier call identifier argument_list for_statement identifier call attribute identifier identifier argument_list block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier return_statement tuple identifier identifier
Pass the given changes to the root_node.
def _raw(s): if isinstance(s, list): s = "\n".join(_raw(item) for item in s) if s == EOF: return "EOF" s = repr(s) s = s[1:-1] if len(s) > 15: s = s[:15] + "..." return s
module function_definition identifier parameters identifier block if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier call attribute string string_start string_content escape_sequence string_end identifier generator_expression call identifier argument_list identifier for_in_clause identifier identifier if_statement comparison_operator identifier identifier block return_statement string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier subscript identifier slice integer unary_operator integer if_statement comparison_operator call identifier argument_list identifier integer block expression_statement assignment identifier binary_operator subscript identifier slice integer string string_start string_content string_end return_statement identifier
Get raw representation of s, truncating if too long.
def output_to_graphviz(file, namer=_graphviz_default_namer, block=None): print(block_to_graphviz_string(block, namer), file=file)
module function_definition identifier parameters identifier default_parameter identifier identifier default_parameter identifier none block expression_statement call identifier argument_list call identifier argument_list identifier identifier keyword_argument identifier identifier
Walk the block and output it in graphviz format to the open file.
def create_shared_noise(count): seed = 123 noise = np.random.RandomState(seed).randn(count).astype(np.float32) return noise
module function_definition identifier parameters identifier block expression_statement assignment identifier integer expression_statement assignment identifier call attribute call attribute call attribute attribute identifier identifier identifier argument_list identifier identifier argument_list identifier identifier argument_list attribute identifier identifier return_statement identifier
Create a large array of noise to be shared by all workers.
def addContinuousSearchOptions(parser): addContinuousSetIdArgument(parser) addContinuousReferenceNameArgument(parser) addStartArgument(parser) addEndArgument(parser)
module function_definition identifier parameters identifier block expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier
Adds common options to a continuous search command line parser.
def list_product_versions_for_build_configuration(id=None, name=None, page_size=200, page_index=0, sort="", q=""): data = list_product_versions_for_build_configuration_raw(id, name, page_size, page_index, sort, q) if data: return utils.format_json_list(data)
module function_definition identifier parameters default_parameter identifier none default_parameter identifier none default_parameter identifier integer default_parameter identifier integer default_parameter identifier string string_start string_end default_parameter identifier string string_start string_end block expression_statement assignment identifier call identifier argument_list identifier identifier identifier identifier identifier identifier if_statement identifier block return_statement call attribute identifier identifier argument_list identifier
List all ProductVersions associated with a BuildConfiguration
def _purge_expired(self): time_horizon = time.time() - self._keep_time new_cache = {} for (k, v) in self._cache.items(): if v.timestamp > time_horizon: new_cache[k] = v self._cache = new_cache
module function_definition identifier parameters identifier block expression_statement assignment identifier binary_operator call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier dictionary for_statement tuple_pattern identifier identifier call attribute attribute identifier identifier identifier argument_list block if_statement comparison_operator attribute identifier identifier identifier block expression_statement assignment subscript identifier identifier identifier expression_statement assignment attribute identifier identifier identifier
Remove all expired entries from the cache.
def finalize(self, sched): super(AddCoro, self).finalize(sched) return self.result
module function_definition identifier parameters identifier identifier block expression_statement call attribute call identifier argument_list identifier identifier identifier argument_list identifier return_statement attribute identifier identifier
Return a reference to the instance of the newly added coroutine.
def _is_suffix(self, t): return t not in NOT_SUFFIX and (t.replace('.', '') in SUFFIXES or t.replace('.', '') in SUFFIXES_LOWER)
module function_definition identifier parameters identifier identifier block return_statement boolean_operator comparison_operator identifier identifier parenthesized_expression boolean_operator comparison_operator call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end identifier comparison_operator call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end identifier
Return true if t is a suffix.
def _filter_data(self, pattern): removed = [] filtered = [] for param in self.data: if not param[0].startswith(pattern): filtered.append(param) else: removed.append(param) self.data = filtered return removed
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list expression_statement assignment identifier list for_statement identifier attribute identifier identifier block if_statement not_operator call attribute subscript identifier integer identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier else_clause block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment attribute identifier identifier identifier return_statement identifier
Removes parameters which match the pattern from the config data
def Betainc(a, b, x): return sp.special.betainc(a, b, x),
module function_definition identifier parameters identifier identifier identifier block return_statement expression_list call attribute attribute identifier identifier identifier argument_list identifier identifier identifier
Complemented, incomplete gamma op.
def genslices_ndim(ndim, shape): iterables = [genslices(shape[n]) for n in range(ndim)] yield from product(*iterables)
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list_comprehension call identifier argument_list subscript identifier identifier for_in_clause identifier call identifier argument_list identifier expression_statement yield call identifier argument_list list_splat identifier
Generate all possible slice tuples for 'shape'.
def _add_filter_node(root, filter_, value): filter_el = ElementTree.SubElement(root, 'Filter') filter_el.set('name', filter_.name) if filter_.type == 'boolean': if value is True or value.lower() in {'included', 'only'}: filter_el.set('excluded', '0') elif value is False or value.lower() == 'excluded': filter_el.set('excluded', '1') else: raise ValueError('Invalid value for boolean filter ({})' .format(value)) elif isinstance(value, list) or isinstance(value, tuple): filter_el.set('value', ','.join(map(str, value))) else: filter_el.set('value', str(value))
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier if_statement comparison_operator attribute identifier identifier string string_start string_content string_end block if_statement boolean_operator comparison_operator identifier true comparison_operator call attribute identifier identifier argument_list set string string_start string_content string_end string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end elif_clause boolean_operator comparison_operator identifier false comparison_operator call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end else_clause block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier elif_clause boolean_operator call identifier argument_list identifier identifier call identifier argument_list identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call attribute string string_start string_content string_end identifier argument_list call identifier argument_list identifier identifier else_clause block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call identifier argument_list identifier
Adds filter xml node to root.
def refresh(self): if self.exists: self.delete() self.populate() self.open()
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
Refresh the cache by deleting the old one and creating a new one.
def _send_rpc(self, device_info, control_info, address, rpc_id, payload, poll_interval, timeout): write_address, write_data = control_info.format_rpc(address, rpc_id, payload) self._jlink.memory_write32(write_address, write_data) self._trigger_rpc(device_info) start = monotonic() now = start poll_address, poll_mask = control_info.poll_info() while (now - start) < timeout: time.sleep(poll_interval) value, = self._jlink.memory_read8(poll_address, 1) if value & poll_mask: break now = monotonic() if (now - start) >= timeout: raise HardwareError("Timeout waiting for RPC response", timeout=timeout, poll_interval=poll_interval) read_address, read_length = control_info.response_info() read_data = self._read_memory(read_address, read_length, join=True) return control_info.format_response(read_data)
module function_definition identifier parameters identifier identifier identifier identifier identifier identifier identifier identifier block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list while_statement comparison_operator parenthesized_expression binary_operator identifier identifier identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment pattern_list identifier call attribute attribute identifier identifier identifier argument_list identifier integer if_statement binary_operator identifier identifier block break_statement expression_statement assignment identifier call identifier argument_list if_statement comparison_operator parenthesized_expression binary_operator identifier identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier keyword_argument identifier true return_statement call attribute identifier identifier argument_list identifier
Write and trigger an RPC.
def tob(data, enc='utf8'): return data.encode(enc) if isinstance(data, six.text_type) else bytes(data)
module function_definition identifier parameters identifier default_parameter identifier string string_start string_content string_end block return_statement conditional_expression call attribute identifier identifier argument_list identifier call identifier argument_list identifier attribute identifier identifier call identifier argument_list identifier
Convert anything to bytes
def remove_nullchars(block): data = block.lstrip(b'\00') padding = b'\00' * ((len(block) - len(data)) % 8) return padding + data
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content escape_sequence string_end expression_statement assignment identifier binary_operator string string_start string_content escape_sequence string_end parenthesized_expression binary_operator parenthesized_expression binary_operator call identifier argument_list identifier call identifier argument_list identifier integer return_statement binary_operator identifier identifier
Strips NULL chars taking care of bytes alignment.
def _get_program(self): return ansible_mitogen.target.get_small_file( context=self.service_context, path=self.path, )
module function_definition identifier parameters identifier block return_statement call attribute attribute identifier identifier identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier
Fetch the module binary from the master if necessary.
def _rules_from_env(self, val): val = val.split(':') if 'DEFAULT_RULES' in val: val = const.DEFAULT_RULES + [rule for rule in val if rule != 'DEFAULT_RULES'] return val
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment identifier binary_operator attribute identifier identifier list_comprehension identifier for_in_clause identifier identifier if_clause comparison_operator identifier string string_start string_content string_end return_statement identifier
Transforms rules list from env-string to python.
def log_once(log_func, msg, *args, **kwargs): if msg not in _LOG_ONCE_SEEN: log_func(msg, *args, **kwargs) _LOG_ONCE_SEEN.add(msg)
module function_definition identifier parameters identifier identifier list_splat_pattern identifier dictionary_splat_pattern identifier block if_statement comparison_operator identifier identifier block expression_statement call identifier argument_list identifier list_splat identifier dictionary_splat identifier expression_statement call attribute identifier identifier argument_list identifier
Logs a message only once.
def reset_password(self, token=None, login_user=None): pwcol = self.options['password_column'] if not token: if "token" in request.view_args: token = request.view_args["token"] elif "token" in request.values: token = request.values["token"] else: raise OptionMissingError(("Missing 'token' option or 'token' view arg " "or 'token' GET paramater in 'reset_password' action")) user = self.find_by_token(token, salt="password-reset", max_age=self.options["reset_password_ttl"]) if user is None: if self.options["reset_password_error_message"]: flash(self.options["reset_password_error_message"], "error") current_context.exit(trigger_action_group="reset_password_failed") self.update_password_from_form(user) self.reset_password_signal.send(self, user=user) if (login_user is None and self.options["login_user_on_reset_password"]) or login_user: flask_login.login_user(user) return user
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end if_statement not_operator identifier block if_statement comparison_operator string string_start string_content string_end attribute identifier identifier block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end elif_clause comparison_operator string string_start string_content string_end attribute identifier identifier block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end else_clause block raise_statement call identifier argument_list parenthesized_expression concatenated_string string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier string string_start string_content string_end keyword_argument identifier subscript attribute identifier identifier string string_start string_content string_end if_statement comparison_operator identifier none block if_statement subscript attribute identifier identifier string string_start string_content string_end block expression_statement call identifier argument_list subscript attribute identifier identifier string string_start string_content string_end string string_start string_content string_end expression_statement call attribute identifier identifier argument_list keyword_argument identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier keyword_argument identifier identifier if_statement boolean_operator parenthesized_expression boolean_operator comparison_operator identifier none subscript attribute identifier identifier string string_start string_content string_end identifier block expression_statement call attribute identifier identifier argument_list identifier return_statement identifier
Resets the password of the user identified by the token
def publish_message_to_centrifugo(sender, instance, created, **kwargs): if created is True: client = Client("{0}api/".format(getattr(settings, "CENTRIFUGE_ADDRESS")), getattr(settings, "CENTRIFUGE_SECRET")) active_participants = [participation.participant.id for participation in Participation.objects.filter(thread=instance.thread, date_left__isnull=True).select_related('participant')] client.publish( build_channel(settings.CENTRIFUGO_MESSAGE_NAMESPACE, instance.thread.id, active_participants), { "id": instance.id, "body": instance.body, "sender": instance.sender.id, "thread": instance.thread.id, "sent_at": str(instance.sent_at), "is_notification": True, } )
module function_definition identifier parameters identifier identifier identifier dictionary_splat_pattern identifier block if_statement comparison_operator identifier true block expression_statement assignment identifier call identifier argument_list call attribute string string_start string_content string_end identifier argument_list call identifier argument_list identifier string string_start string_content string_end call identifier argument_list identifier string string_start string_content string_end expression_statement assignment identifier list_comprehension attribute attribute identifier identifier identifier for_in_clause identifier call attribute call attribute attribute identifier identifier identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier true identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list call identifier argument_list attribute identifier identifier attribute attribute identifier identifier identifier identifier dictionary pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute attribute identifier identifier identifier pair string string_start string_content string_end attribute attribute identifier identifier identifier pair string string_start string_content string_end call identifier argument_list attribute identifier identifier pair string string_start string_content string_end true
Publishes each saved message to Centrifugo.
def master_tops(self): log.debug( 'The _ext_nodes master function has been renamed to _master_tops. ' 'To ensure compatibility when using older Salt masters we will ' 'continue to invoke the function as _ext_nodes until the ' 'Magnesium release.' ) load = {'cmd': '_ext_nodes', 'id': self.opts['id'], 'opts': self.opts} if self.auth: load['tok'] = self.auth.gen_token(b'salt') return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \ else self.channel.send(load)
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list concatenated_string string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier dictionary pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end pair string string_start string_content string_end attribute identifier identifier if_statement attribute identifier identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end return_statement conditional_expression call attribute attribute attribute identifier identifier identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier attribute identifier identifier line_continuation call attribute attribute identifier identifier identifier argument_list identifier
Return the metadata derived from the master_tops system
def bank_account_query(self, number, date, account_type, bank_id): return self.authenticated_query( self._bareq(number, date, account_type, bank_id) )
module function_definition identifier parameters identifier identifier identifier identifier identifier block return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier identifier identifier identifier
Bank account statement request
def remove_partition(self, partition): if partition in self._partitions: self._partitions.remove(partition) partition.replicas.remove(self) else: raise ValueError( 'Partition: {topic_id}:{partition_id} not found in broker ' '{broker_id}'.format( topic_id=partition.topic.id, partition_id=partition.partition_id, broker_id=self._id, ) )
module function_definition identifier parameters identifier identifier block if_statement comparison_operator identifier attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier else_clause block raise_statement call identifier argument_list call attribute concatenated_string string string_start string_content string_end string string_start string_content string_end identifier argument_list keyword_argument identifier attribute attribute identifier identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier
Remove partition from partition list.
def json_data(self): return { "info_in_id": self.info_in_id, "info_out_id": self.info_out_id, "node_id": self.node_id, "network_id": self.network_id, }
module function_definition identifier parameters identifier block return_statement dictionary pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier
The json representation of a transformation.
def write_device_config(self, device_config): if not self.capabilities.have_usb_mode(device_config._mode): raise yubikey_base.YubiKeyVersionError("USB mode: %02x not supported for %s" % (device_config._mode, self)) return self._device._write_config(device_config, SLOT.DEVICE_CONFIG)
module function_definition identifier parameters identifier identifier block if_statement not_operator call attribute attribute identifier identifier identifier argument_list attribute identifier identifier block raise_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end tuple attribute identifier identifier identifier return_statement call attribute attribute identifier identifier identifier argument_list identifier attribute identifier identifier
Write a DEVICE_CONFIG to the YubiKey NEO.
def _add_plots_to_output(out, data): out["plot"] = {} diagram_plot = _add_diagram_plot(out, data) if diagram_plot: out["plot"]["diagram"] = diagram_plot scatter = _add_scatter_plot(out, data) if scatter: out["plot"]["scatter"] = scatter scatter_global = _add_global_scatter_plot(out, data) if scatter_global: out["plot"]["scatter_global"] = scatter_global return out
module function_definition identifier parameters identifier identifier block expression_statement assignment subscript identifier string string_start string_content string_end dictionary expression_statement assignment identifier call identifier argument_list identifier identifier if_statement identifier block expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier expression_statement assignment identifier call identifier argument_list identifier identifier if_statement identifier block expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier expression_statement assignment identifier call identifier argument_list identifier identifier if_statement identifier block expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier return_statement identifier
Add CNVkit plots summarizing called copy number values.
def _adjust_font(self): fnames = [k for k in Widget_fontdict.keys()] fl = list(map(str.lower, fnames)) if (not self.text_font) or self.text_font.lower() not in fl: self.text_font = "helv" i = fl.index(self.text_font.lower()) self.text_font = fnames[i] return
module function_definition identifier parameters identifier block expression_statement assignment identifier list_comprehension identifier for_in_clause identifier call attribute identifier identifier argument_list expression_statement assignment identifier call identifier argument_list call identifier argument_list attribute identifier identifier identifier if_statement boolean_operator parenthesized_expression not_operator attribute identifier identifier comparison_operator call attribute attribute identifier identifier identifier argument_list identifier block expression_statement assignment attribute identifier identifier string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list expression_statement assignment attribute identifier identifier subscript identifier identifier return_statement
Ensure the font name is from our list and correctly spelled.
def check(self): for (path, handler) in self.handlers.items(): current_signature = self.signatures[path] new_signature = self.get_path_signature(path) if new_signature != current_signature: self.signatures[path] = new_signature handler.on_change(Event(path))
module function_definition identifier parameters identifier block for_statement tuple_pattern identifier identifier call attribute attribute identifier identifier identifier argument_list block expression_statement assignment identifier subscript attribute identifier identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier identifier block expression_statement assignment subscript attribute identifier identifier identifier identifier expression_statement call attribute identifier identifier argument_list call identifier argument_list identifier
Check if a file is changed
def link_href(self, rel): link = self.link(rel) if (link is not None): link = link['href'] return(link)
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement parenthesized_expression comparison_operator identifier none block expression_statement assignment identifier subscript identifier string string_start string_content string_end return_statement parenthesized_expression identifier
Look for link with specified rel, return href from it or None.
def default(self) -> Optional[ScalarValue]: if self.mandatory: return None if self._default is not None: return self._default return (None if self.type.default is None else ArrayValue([self.type.default]))
module function_definition identifier parameters identifier type generic_type identifier type_parameter type identifier block if_statement attribute identifier identifier block return_statement none if_statement comparison_operator attribute identifier identifier none block return_statement attribute identifier identifier return_statement parenthesized_expression conditional_expression none comparison_operator attribute attribute identifier identifier identifier none call identifier argument_list list attribute attribute identifier identifier identifier
Default value of the receiver, if any.
def chi_eff(mass1, mass2, spin1z, spin2z): return (spin1z * mass1 + spin2z * mass2) / (mass1 + mass2)
module function_definition identifier parameters identifier identifier identifier identifier block return_statement binary_operator parenthesized_expression binary_operator binary_operator identifier identifier binary_operator identifier identifier parenthesized_expression binary_operator identifier identifier
Returns the effective spin from mass1, mass2, spin1z, and spin2z.