text
stringlengths
78
104k
score
float64
0
0.18
async def get_updates(self, offset: typing.Union[base.Integer, None] = None, limit: typing.Union[base.Integer, None] = None, timeout: typing.Union[base.Integer, None] = None, allowed_updates: typing.Union[typing.List...
0.006154
def validate_params_match(method, parameters): """Validates that the given parameters are exactly the method's declared parameters. :param method: The method to be called :type method: function :param parameters: The parameters to use in the call :type parameters: dict[str, object] | list[object] ...
0.004205
def type(self, type): # pylint: disable=redefined-builtin """Setter method; for a description see the getter method.""" type = _ensure_unicode(type) # We perform this check after the initialization to avoid errors # in test tools that show the object with repr(). if typ...
0.005859
def _displayattrs(attrib, expandattrs): """ Helper function to display the attributes of a Node object in lexicographic order. :param attrib: dictionary with the attributes :param expandattrs: if True also displays the value of the attributes """ if not attrib: return '' if expa...
0.002119
def _update_segmentation_mask(segmentation_mask, onset_fronts, offset_fronts, onset_front_id, offset_front_id_most_overlap): """ Returns an updated segmentation mask such that the input `segmentation_mask` has been updated by segmenting between `onset_front_id` and `offset_front_id`, as found in `onset_fron...
0.005455
def register_range_type(pgrange, pyrange, conn): """ Register a new range type as a PostgreSQL range. >>> register_range_type("int4range", intrange, conn) The above will make sure intrange is regarded as an int4range for queries and that int4ranges will be cast into intrange when fetching rows...
0.003641
def find_command(self, argv): """Given an argument list, find a command and return the processor and any remaining arguments. """ search_args = argv[:] name = '' while search_args: if search_args[0].startswith('-'): name = '%s %s' % (name, sear...
0.001634
def _requiredSize(shape, dtype): """ Determines the number of bytes required to store a NumPy array with the specified shape and datatype. """ return math.floor(np.prod(np.asarray(shape, dtype=np.uint64)) * np.dtype(dtype).itemsize)
0.029536
def count_pingbacks_handler(sender, **kwargs): """ Update Entry.pingback_count when a pingback was posted. """ entry = kwargs['entry'] entry.pingback_count = F('pingback_count') + 1 entry.save(update_fields=['pingback_count'])
0.004
def get_image(dataset): """Convert the NumPy array to two nested lists with r,g,b tuples.""" dim, nrow, ncol = dataset.shape uint8_dataset = dataset.astype('uint8') if not (uint8_dataset == dataset).all(): message = ( "\nYour image was cast to a `uint8` (`<img>.astype(uint8)`), " ...
0.001294
def __CreateVoidResponseType(self, method_description): """Create an empty response type.""" schema = {} method_name = self.__names.ClassName( method_description['id'], separator='.') schema['id'] = self.__names.ClassName('%sResponse' % method_name) schema['type'] = '...
0.003976
def get_package_version_provenance(self, feed_id, package_id, package_version_id, project=None): """GetPackageVersionProvenance. [Preview API] Gets provenance for a package version. :param str feed_id: Name or Id of the feed. :param str package_id: Id of the package (GUID Id, not name). ...
0.00694
def _get_selected_items(self): """ Return an Item (e.g. StateView) for each model (e.g. StateModel) in the current selection """ return set(self.canvas.get_view_for_model(model) for model in self._selection)
0.017937
def put_on_top(self, request, queryset): """ Put the selected entries on top at the current date. """ queryset.update(publication_date=timezone.now()) self.ping_directories(request, queryset, messages=False) self.message_user(request, _( 'The selected entries ...
0.005634
def get(self, cfg): """ Reads single document or list of documents from MongoDB collection :param cfg: { AccessParams.KEY_COLLECTION: <Collection to read data from>, AccessParams.KEY_MATCH_PARAMS: <A query that matches the documents to select>, ...
0.005803
def connect(self, their_unl, events, force_master=1, hairpin=1, nonce="0" * 64): """ A new thread is spawned because many of the connection techniques rely on sleep to determine connection outcome or to synchronise hole punching techniques. If the sleep is in its own...
0.005329
def translate_to_stackdriver(self, trace): """Translate the spans json to Stackdriver format. See: https://cloud.google.com/trace/docs/reference/v2/rest/v2/ projects.traces/batchWrite :type trace: dict :param trace: Trace dictionary :rtype: dict :returns: ...
0.001289
def ListDescendentPathInfos(self, client_id, path_type, components, timestamp=None, max_depth=None): """Lists path info records that correspond to children of given p...
0.011392
def import_l2c_db(): """ Static import helper function. Checks if the log2code.pickle exists first, otherwise raises ImportError. """ data_path = os.path.join(os.path.dirname(mtools.__file__), 'data') if os.path.exists(os.path.join(data_path, 'log2code.pickle')): av, lv, lbw, lcl = cPic...
0.001656
def add_positional_embedding(x, max_length, name=None, positions=None): """Adds positional embedding. Args: x: Tensor with shape [batch, length, depth]. max_length: int representing static maximum size of any dimension. name: str representing name of the embedding tf.Variable. positions: Tensor wit...
0.007527
def _tags_present(name, tags, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' helper function to validate tags are correct ''' ret = {'result': True, 'comment': '', 'changes': {}} if tags: sg = __salt__['boto_secgroup.get_config'](name=name...
0.003638
def send_events(self, events): """Adds multiple events to the queued message :returns: None - nothing has been sent to the Riemann server yet """ for event in events: self.queue.events.add().MergeFrom(event) return None
0.007353
def array(a, context=None, axis=(0,), dtype=None, npartitions=None): """ Create a spark bolt array from a local array. Parameters ---------- a : array-like An array, any object exposing the array interface, an object whose __array__ method returns an arra...
0.001923
def _bind_exit_key(self, key): u"""setup the mapping from key to call the function.""" keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() self.exit_dispatch[keyinfo] = None
0.009662
def search(self, query, index='default', **kwargs): """ kwargs supported are the parameters listed at: http://www.elasticsearch.org/guide/reference/api/search/request-body/ Namely: timeout, from, size and search_type. IMPORTANT: prepend ALL keys with "es_" as pyelasticsearch ...
0.002545
def modify(self, sp=None, ip_port=None, ip_address=None, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Modifies a replication interface. :param sp: same as the one in `create` method. :param ip_port: same as the one in `create` method. :par...
0.002962
def retry(default=None): """Retry functions after failures""" def decorator(func): """Retry decorator""" @functools.wraps(func) def _wrapper(*args, **kw): for pos in range(1, MAX_RETRIES): try: return func(*args, **kw) exc...
0.001473
def _set_field_on_message(msg, key, value): """Set helper for protobuf Messages.""" # Attempt to set the value on the types of objects we know how to deal # with. if isinstance(value, (collections_abc.MutableSequence, tuple)): # Clear the existing repeated protobuf message of any elements ...
0.000892
def download(self, output_dir, url, overwrite): """ Dowload file to /tmp """ tmp = self.url2tmp(output_dir, url) if os.path.isfile(tmp) and not overwrite: logging.info("File {0} already exists. Skipping download.".format(tmp)) return tmp f = open(tmp, 'wb') ...
0.005135
def get_key_value_pairs(self, subsystem, filename): """ Read the lines of the given file from the given subsystem and split the lines into key-value pairs. Do not include the subsystem name in the option name. Only call this method if the given subsystem is available. """...
0.006479
def read_env(path=None, environ=None, recurse=True): """Reads a .env file into ``environ`` (which defaults to ``os.environ``). If .env is not found in the directory from which this function is called, recurse up the directory tree until a .env file is found. """ environ = environ if environ is not N...
0.001507
def load_healthchecks(self): """ Loads healthchecks. """ self.load_default_healthchecks() if getattr(settings, 'AUTODISCOVER_HEALTHCHECKS', True): self.autodiscover_healthchecks() self._registry_loaded = True
0.007463
def __set_date(self, value): ''' Sets the invoice date. @param value:datetime ''' value = date_to_datetime(value) if value > datetime.now() + timedelta(hours=14, minutes=1): #More or less 14 hours from now in case the submitted date was local raise ValueError(...
0.009634
def create_presentation(self): """ Create the presentation. The audio track is mixed with the slides. The resulting file is saved as self.output DownloadError is raised if some resources cannot be fetched. ConversionError is raised if the final video cannot be created. """ ...
0.005441
def demunge(s: str) -> str: """Replace munged string components with their original representation.""" def demunge_replacer(match: Match) -> str: full_match = match.group(0) replacement = _DEMUNGE_REPLACEMENTS.get(full_match, None) if replacement: return replacement ...
0.002398
def intersect(self, other): """ self와 other 키가 동일한 아이템의 dictobj :type other: dict :rtype: dictobj: """ return ODict((k, self[k]) for k in self if k in other)
0.009756
def list_known_codes(s, unique=True, rgb_mode=False): """ Find and print all known escape codes in a string, using get_known_codes. """ total = 0 for codedesc in get_known_codes(s, unique=unique, rgb_mode=rgb_mode): total += 1 print(codedesc) plural = 'code' if total == 1 els...
0.00211
def copy_abs(self): """ Return a copy of self with the sign bit unset. Unlike abs(self), this does not make use of the context: the result has the same precision as the original. """ result = mpfr.Mpfr_t.__new__(BigFloat) mpfr.mpfr_init2(result, self.precision) ...
0.005
def set_centralized_assembled_values(self, a): """Set assembled matrix values on processor 0.""" if self.myid != 0: return assert a.size == self.id.nz self._refs.update(a=a) self.id.a = self.cast_array(a)
0.007813
def extract_translations(self, string): """Extract messages from Django template string.""" trans = [] for t in Lexer(string.decode("utf-8"), None).tokenize(): if t.token_type == TOKEN_BLOCK: if not t.contents.startswith( (self.tranz_tag, self...
0.002506
def _proc_ctype_header(self, request, result): """ Process the Content-Type header rules for the request. Only the desired API version can be determined from those rules. :param request: The Request object provided by WebOb. :param result: The Result object to store the results...
0.001455
def _onMethodTimeout(self, serial, d): """ Called when a remote method invocation timeout occurs """ del self._pendingCalls[serial] d.errback(error.TimeOut('Method call timed out'))
0.00905
def _extract_gaussian_gradient_magnitude(image, mask = slice(None), sigma = 1, voxelspacing = None): """ Internal, single-image version of `gaussian_gradient_magnitude`. """ # set voxel spacing if voxelspacing is None: voxelspacing = [1.] * image.ndim # determine gaussian kernel...
0.022312
def WriteFlowProcessingRequests(self, requests): """Writes a list of flow processing requests to the database.""" # If we don't have a handler thread running, we might be able to process the # requests inline. If we are not, we start the handler thread for real and # queue the requests normally. if ...
0.010588
def _get_fs(thin_pathname): """ Returns the file system type (xfs, ext4) of a given device """ cmd = ['lsblk', '-o', 'FSTYPE', '-n', thin_pathname] fs_return = util.subp(cmd) return fs_return.stdout.strip()
0.007874
def keyPressEvent( self, event ): """ Overloads the key press event to listen for escape calls to cancel the parts editing. :param event | <QKeyPressEvent> """ if ( self.scrollWidget().isHidden() ): if ( event.key() == Qt.Key_Escape ): ...
0.023677
def set_option(self, option, value): """ Set a plugin option in configuration file. Note: Use sig_option_changed to call it from widgets of the same or another plugin. """ CONF.set(self.CONF_SECTION, str(option), value)
0.007299
def _db_upgrade(self, db_name): """ Upgrade nipap database schema """ current_db_version = self._get_db_version() self._execute(db_schema.functions) for i in range(current_db_version, nipap.__db_version__): self._logger.info("Upgrading DB schema:", i, "to", i+1) ...
0.006316
def focusOutEvent(self, ev): """Redefine focusOut events to stop editing""" Kittens.widgets.ClickableTreeWidget.focusOutEvent(self, ev) # if focus is going to a child of ours, do nothing wid = QApplication.focusWidget() while wid: if wid is self: retur...
0.004484
def rotated(self, rotation_center, angle): """Returns a RotatedBox that is obtained by rotating this box around a given center by a given angle. >>> assert RotatedBox([2, 2], 2, 1, 0.1).rotated([1, 1], np.pi/2).approx_equal([0, 2], 2, 1, np.pi/2+0.1) """ rot = np.array([[np.cos(angle), ...
0.01085
def Bern_to_Fierz_lep(C,ddll): """From semileptonic Bern basis to Fierz semileptonic basis for Class V. C should be the corresponding leptonic Fierz basis and `ddll` should be of the form 'sbl_enu_tau', 'dbl_munu_e' etc.""" ind = ddll.replace('l_','').replace('nu_','') return {'F' + ind + '9': C['1'...
0.006198
def get_all_keys(self, headers=None, **params): """ This method returns the single key around which this anonymous Bucket was instantiated. :rtype: SimpleResultSet :return: The result from file system listing the keys requested """ key = Key(self.name, self.cont...
0.005435
def on_epoch_end(self, epoch, **kwargs:Any)->None: "Compare the value monitored to its best and maybe reduce lr." current = self.get_monitor_value() if current is None: return if self.operator(current - self.min_delta, self.best): self.best,self.wait = current,0 else: ...
0.017308
def create(name, **params): '''Create a check on a given URL. Additional parameters can be used and are passed to API (for example interval, maxTime, etc). See the documentation https://github.com/fzaninotto/uptime for a full list of the parameters. CLI Example: .. code-block:: bash ...
0.001056
def popitem (self): """Remove and return an item.""" key, value = super(LFUCache, self).popitem() return (key, value[1])
0.020833
def _default_call_in_place(op, x, out, **kwargs): """Default in-place evaluation using ``Operator._call()``. Parameters ---------- op : `Operator` Operator to call x : ``op.domain`` element Point in which to call the operator. out : ``op.range`` element An object in the ...
0.001887
def dumps(obj): """ Dumps a serializable object to JSON. This API maps to the Python built-in json dumps method, with a few differences: * The return value is always valid JSON according to RFC 7159. * The input can be any of the following types: - SFrame - SArray - SGraph ...
0.001229
def _set_keychain(self, v, load=False): """ Setter method for keychain, mapped from YANG variable /keychain (list) If this variable is read-only (config: false) in the source YANG file, then _set_keychain is considered as a private method. Backends looking to populate this variable should do so ...
0.003768
def shareItem(self, sharedItem, shareID=None, interfaces=ALL_IMPLEMENTED): """ Share an item with this role. This provides a way to expose items to users for later retrieval with L{Role.getShare}. @param sharedItem: an item to be shared. @param shareID: a unicode string. If p...
0.004224
def _eintr_retry(func, *args): """restart a system call interrupted by EINTR""" while True: try: return func(*args) except (OSError, select.error) as e: if e.args[0] != errno.EINTR: raise
0.003984
def split_sentences_spacy(text, language_model='en'): r""" You must download a spacy language model with python -m download 'en' The default English language model for spacy tends to be a lot more agressive than NLTK's punkt: >>> split_sentences_nltk("Hi Ms. Lovelace.\nI'm a wanna-\nbe human @ I.B.M. ;) -...
0.005435
def import_from_ding0(self, file, **kwargs): """Import grid data from DINGO file For details see :func:`edisgo.data.import_data.import_from_ding0` """ import_from_ding0(file=file, network=self.network)
0.00823
def get_num_batches(self, instances: Iterable[Instance]) -> int: """ Returns the number of batches that ``dataset`` will be split into; if you want to track progress through the batch with the generator produced by ``__call__``, this could be useful. """ if is_lazy(instan...
0.005548
def getScreenshotPropertyFilename(self, screenshotHandle, filenameType, pchFilename, cchFilename): """ Get the filename for the preview or vr image (see vr::EScreenshotPropertyFilenames). The return value is the size of the string. """ fn = self.function_table.getScre...
0.007952
def get_attention(config: AttentionConfig, max_seq_len: int, prefix: str = C.ATTENTION_PREFIX) -> 'Attention': """ Returns an Attention instance based on attention_type. :param config: Attention configuration. :param max_seq_len: Maximum length of source sequences. :param prefix: Name prefix. :...
0.003407
def remove_from_user(self, name, *args): """Remove attributes from a user. """ user = self.get_user(name=name) attrs_ = user['user'] for a in args: del attrs_[a]
0.00939
def get_func_argument_types(self, hsh: bytes): """Returns the tuple type signature for the arguments of the function associated with the selector ``hsh``. If no normal contract function has the specified selector, the empty tuple type signature ``'()'`` is returned. """ if not i...
0.007156
def _message_queryset(self, include_read=False): """ Return a queryset of messages for the request user """ expire = timezone.now() qs = PersistentMessage.objects.\ filter(user=self.get_user()).\ filter(Q(expires=None) | Q(expires__gt=expire)) if not inc...
0.01292
def _fast_cross_3d(x, y): """Compute cross product between list of 3D vectors Much faster than np.cross() when the number of cross products becomes large (>500). This is because np.cross() methods become less memory efficient at this stage. Parameters ---------- x : array Input arr...
0.000998
def get_assessments(self): """Gets all ``Assessments``. In plenary mode, the returned list contains all known assessments or an error results. Otherwise, the returned list may contain only those assessments that are accessible through this session. return: (osid.assessm...
0.002705
def shot_chart_jointgrid(x, y, data=None, joint_type="scatter", title="", joint_color="b", cmap=None, xlim=(-250, 250), ylim=(422.5, -47.5), court_color="gray", court_lw=1, outer_lines=False, flip_court=False, joint_kde...
0.000411
def before(point): """ True if point datetime specification is before now """ if not point: return True if isinstance(point, str): point = str_to_time(point) elif isinstance(point, int): point = time.gmtime(point) return time.gmtime() < point
0.003472
def rnaseqc_general_stats (self): """ Add alignment rate to the general stats table """ headers = OrderedDict() headers['Expression Profiling Efficiency'] = { 'title': '% Expression Efficiency', 'description': 'Expression Profiling Efficiency: Ratio of exo...
0.004382
def poisson(data): """ Creates a segment cost function for a time series with a poisson distribution with changing mean Args: data (:obj:`list` of float): 1D time series data Returns: function: Function with signature (int, int) -> float where the first arg i...
0.001057
def OnReaderComboBox(self, event): """Called when the user activates a reader in the toolbar combo box.""" cb = event.GetEventObject() reader = cb.GetClientData(cb.GetSelection()) if isinstance(reader, smartcard.reader.Reader.Reader): self.treeuserpanel.dialogpanel.OnActivate...
0.005988
def create_dbsecurity_group(self, name, description=None): """ Create a new security group for your account. This will create the security group within the region you are currently connected to. :type name: string :param name: The name of the new security group ...
0.003413
def to_bytes(self): ''' Create bytes from properties ''' # Verify that properties make sense self.sanitize() # Start with the type bitstream = BitArray('uint:4=%d' % self.message_type) # Add the flags bitstream += BitArray('bool=%d' % self.proxy_...
0.001197
def build_config(config : Dict[str, Any]) -> Dict[str, str]: """Will build the actual config for Jinja2, based on SDK config. """ result = config.copy() # Manage the classifier stable/beta is_stable = result.pop("is_stable", False) if is_stable: result["classifier"] = "Development Status...
0.002421
def diags2(symmat): """ Diagonalize a symmetric 2x2 matrix. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/diags2_c.html :param symmat: A symmetric 2x2 matrix. :type symmat: 2x2-Element Array of floats :return: A diagonal matrix similar to symmat, A rotation us...
0.001558
def get(self, tag=None, **kwargs): ''' Recursively searches children for tags of a certain type with matching attributes. ''' # Stupid workaround since we can not use dom_tag in the method declaration if tag is None: tag = dom_tag attrs = [(dom_tag.clean_attribute(attr), value) for ...
0.010204
def show(*args, **kwargs): r"""Show created figures, alias to ``plt.show()``. By default, showing plots does not block the prompt. Calling this function will block execution. """ _, plt, _ = _import_plt() plt.show(*args, **kwargs)
0.003922
def get_float(self, key, is_list=False, is_optional=False, is_secret=False, is_local=False, default=None, options=None): """ Get a the value corresponding to the key and converts...
0.005975
def get_files(dir_name): """Simple directory walker""" return [(os.path.join('.', d), [os.path.join(d, f) for f in files]) for d, _, files in os.walk(dir_name)]
0.011765
def clear_pictures(self): """Delete all pictures from the file.""" blocks = [b for b in self.metadata_blocks if b.code != Picture.code] self.metadata_blocks = blocks
0.010526
def _utf8_encode(self, d): """ Ensures all values are encoded in UTF-8 and converts them to lowercase """ for k, v in d.items(): if isinstance(v, str): d[k] = v.encode('utf8').lower() if isinstance(v, list): for index,item ...
0.009381
async def run_action(self, action_name, **params): """Run an action on this unit. :param str action_name: Name of action to run :param **params: Action parameters :returns: A :class:`juju.action.Action` instance. Note that this only enqueues the action. You will need to call ...
0.001391
def register_with_google(full_name, email, oauth2_token, lang=None, timezone=None): """Register a new Todoist account by linking a Google account. :param full_name: The user's full name. :type full_name: str :param email: The user's email address. :type email: str :para...
0.000801
def parse_observation_response(json): """Decode AQICN observation response JSON into python object.""" logging.debug(json) iaqi = json['iaqi'] result = { 'idx': json['idx'], 'city': json.get('city', ''), 'aqi': json['aqi'], 'dominentpol': json.get("dominentpol", ''), ...
0.002247
def set_best_hit_values_for_proteins(self, OrganismDB): ''' Iterate through all proteins in the DB, drop duplicates in the hit_dataframe, then store the maximum hit information as protein attributes. ''' for org in OrganismDB.organisms: print 'setting best h...
0.007918
def CALLDATALOAD(self, offset): """Get input data of current environment""" if issymbolic(offset): if solver.can_be_true(self._constraints, offset == self._used_calldata_size): self.constraints.add(offset == self._used_calldata_size) raise ConcretizeArgument(1, p...
0.005298
def cmd_arp_ping(ip, iface, verbose): """ Send ARP packets to check if a host it's alive in the local network. Example: \b # habu.arp.ping 192.168.0.1 Ether / ARP is at a4:08:f5:19:17:a4 says 192.168.0.1 / Padding """ if verbose: logging.basicConfig(level=logging.INFO, format=...
0.001672
def merge_particle_emission(SS): """Returns a sim object summing the emissions and particles in SS (list). """ # Merge all the particles P = reduce(lambda x, y: x + y, [Si.particles for Si in SS]) s = SS[0] S = ParticlesSimulation(t_step=s.t_step, t_max=s.t_max, parti...
0.002212
def df2sd(self, df: 'pd.DataFrame', table: str = '_df', libref: str = '', results: str = '', keep_outer_quotes: bool = False) -> 'SASdata': """ This is an alias for 'dataframe2sasdata'. Why type all that? :param df: :class:`pandas.DataFrame` Pandas Data Frame to import to a SAS Da...
0.009249
def add_adjust(self, data, prehashed=False): """Add a new leaf, and adjust the tree, without rebuilding the whole thing. """ subtrees = self._get_whole_subtrees() new_node = Node(data, prehashed=prehashed) self.leaves.append(new_node) for node in reversed(subtrees): ...
0.004658
def _find_relation_factory(module): """ Attempt to find a RelationFactory subclass in the module. Note: RelationFactory and RelationBase are ignored so they may be imported to be used as base classes without fear. """ if not module: return None # All the RelationFactory subclasses ...
0.000772
def write_backreferences(seen_backrefs, gallery_conf, target_dir, fname, snippet): """Writes down back reference files, which include a thumbnail list of examples using a certain module""" if gallery_conf['backreferences_dir'] is None: return example_file = os.path.join...
0.000855
def create(cls, statement_format, date_start, date_end, monetary_account_id=None, regional_format=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int :param statement_format: The format type of statement. Allowed values: ...
0.004171
def _concat_rangeindex_same_dtype(indexes): """ Concatenates multiple RangeIndex instances. All members of "indexes" must be of type RangeIndex; result will be RangeIndex if possible, Int64Index otherwise. E.g.: indexes = [RangeIndex(3), RangeIndex(3, 6)] -> RangeIndex(6) indexes = [RangeIndex(3...
0.000596
def review_metadata_csv(filedir, input_filepath): """ Check validity of metadata fields. :param filedir: This field is the filepath of the directory whose csv has to be made. :param outputfilepath: This field is the file path of the output csv. :param max_bytes: This field is the maximum fi...
0.000954
def _build_cm(self, cm): """Convert the passed CM to the proper format, or construct the unitary CM if none was provided. """ if cm is None: # Assume all are connected. cm = np.ones((self.size, self.size)) else: cm = np.array(cm) utils...
0.005305