language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
java | public static byte[] decode( byte[] source ){
byte[] decoded = null;
try {
decoded = decode( source, 0, source.length, Base64.NO_OPTIONS );
} catch( java.io.IOException ex ) {
assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage();
... |
java | @Override
public final void setCorrelationIdAsBytes(byte[] value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setCorrelationIdAsBytes", value);
if (value != null) {
/* Set the binary variant to the given value */
byte[... |
python | def make_key(self, value):
""" Make camelCase variant of value. """
if value:
parts = [self.key_filter.sub('', x)
for x in self.key_split.split(value.lower())]
key = parts[0] + ''.join(map(str.capitalize, parts[1:]))
else:
key = ''
... |
java | public ServiceFuture<List<ResourceMetricInner>> listMultiRoleMetricsAsync(final String resourceGroupName, final String name, final ListOperationCallback<ResourceMetricInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listMultiRoleMetricsSinglePageAsync(resourceGroupName, name),
... |
python | def play(self):
"""
Sends a "play" command to the player.
"""
msg = cr.Message()
msg.type = cr.PLAY
self.send_message(msg) |
java | public void onApplicationEvent(ApplicationEvent event)
{
if ((event instanceof LoginEvent)
&& (event.getSource() != LoginEvent.NO_AUTHENTICATION))
handleLoginEvent((LoginEvent) event);
else if ((event instanceof LogoutEvent))
handleLogoutEvent((LogoutEvent) ev... |
java | @Override
public void serialize(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeStartObject();
// Crs or bbox-information must be placed on the toplevel object, but may not be repeated in contained objects!
if (!parent.insideGeometryCollection())
... |
python | def _validate_frequency(cls, index, freq, **kwargs):
"""
Validate that a frequency is compatible with the values of a given
Datetime Array/Index or Timedelta Array/Index
Parameters
----------
index : DatetimeIndex or TimedeltaIndex
The index on which to deter... |
python | def _parse_key(key):
'''
split the hive from the key
'''
splt = key.split("\\")
hive = splt.pop(0)
key = '\\'.join(splt)
return hive, key |
java | public static CommercePriceListAccountRel fetchByUuid_C_Last(String uuid,
long companyId,
OrderByComparator<CommercePriceListAccountRel> orderByComparator) {
return getPersistence()
.fetchByUuid_C_Last(uuid, companyId, orderByComparator);
} |
java | public void clear() {
for (int i = cells.size() - 1; i >= 0; i--) {
Cell<C, T> cell = cells.get(i);
if (cell.widget != null)
toolkit.removeChild(table, cell.widget);
toolkit.freeCell(cell);
}
cells.clear();
rows = 0;
co... |
python | def get_log_format_default(self):
"""Returns default log message format.
.. note:: Some params may be missing.
"""
vars = self.logging.vars
format_default = (
'[pid: %s|app: %s|req: %s/%s] %s (%s) {%s vars in %s bytes} [%s] %s %s => '
'generated %s byte... |
java | private JsonNode fetchConnectionList(String baseUri, PagingParameters pagedListParameters) {
URIBuilder uriBuilder = URIBuilder.fromUri(baseUri);
uriBuilder = appendPagedListParameters(pagedListParameters, uriBuilder);
uriBuilder.queryParam("fields", StringUtils.arrayToCommaDelimitedString(ALL_POST_FIELDS));
UR... |
python | def get_container_update_kwargs(self, action, container_name, update_values, kwargs=None):
"""
Generates keyword arguments for the Docker client to update the HostConfig of an existing container.
:param action: Action configuration.
:type action: ActionConfig
:param container_na... |
python | def adaptive_rejection_sampling(logpdf: callable,
a: float, b: float,
domain: Tuple[float, float],
n_samples: int,
random_stream=None):
"""
Adaptive rejection sampling samples exactly ... |
python | def create_and_validate_dir(data_dir):
'''Creates/Validates dir
'''
if data_dir != "":
if not os.path.exists(data_dir):
try:
logging.info('create directory %s', data_dir)
os.makedirs(data_dir)
except OSError as exc:
if exc.errno... |
python | def __get_factory_with_context(self, factory_name):
# type: (str) -> Tuple[type, FactoryContext]
"""
Retrieves the factory registered with the given and its factory context
:param factory_name: The name of the factory
:return: A (factory, context) tuple
:raise TypeError:... |
java | public Expression evaluateFunction(FunctionCall call) {
try {
return (Expression) Functions.class.getDeclaredMethod(call.getName()
.toLowerCase()
.replaceAll("[... |
python | def filter_filenames(filenames):
"""
Skip files with extentions in `FILE_EXCLUDE_EXTENTIONS` and filenames that
contain `FILE_SKIP_PATTENRS`.
"""
filenames_cleaned = []
for filename in filenames:
keep = True
for pattern in FILE_EXCLUDE_EXTENTIONS:
if filename.endswith... |
java | public void run(String[] args) throws Exception {
if (args.length == 0) {
usage();
System.exit(1);
}
argOptions.parseOptions(args);
int numArgs = argOptions.numPositionalArgs();
if (numArgs < 2) {
throw new IllegalArgumentException("mu... |
python | def delete(uid):
'''
Delete by uid
'''
q_u1 = TabPostHist.delete().where(TabPostHist.post_id == uid)
q_u1.execute()
q_u2 = TabRel.delete().where(TabRel.post_f_id == uid or TabRel.post_t_id == uid)
q_u2.execute()
q_u3 = TabCollect.delete().where(TabCollect... |
java | public void updated(Dictionary<String, ?> properties) throws ConfigurationException {
if (properties != null) {
setApplicationName((String) properties.get(APPLICATION_NAME));
}
synchronized (this) {
serviceRegistration.setProperties(properties);
}
} |
java | public void set_protocol(String protocol) throws nitro_exception
{
if (protocol == null || !(protocol.equalsIgnoreCase("http") ||protocol.equalsIgnoreCase("https"))) {
throw new nitro_exception("error: protocol value " + protocol + " is not supported");
}
this.protocol = protocol;
} |
python | def reset_parameter(**kwargs):
"""Create a callback that resets the parameter after the first iteration.
Note
----
The initial parameter will still take in-effect on first iteration.
Parameters
----------
**kwargs : value should be list or function
List of parameters for each boost... |
python | def _send_status_0x01_request(self):
"""Sent status request to device."""
status_command = StandardSend(self._address,
COMMAND_LIGHT_STATUS_REQUEST_0X19_0X01)
self._send_method(status_command, self._status_message_0x01_received) |
python | def _list_keys(user=None, gnupghome=None, secret=False):
'''
Helper function for Listing keys
'''
gpg = _create_gpg(user, gnupghome)
_keys = gpg.list_keys(secret)
return _keys |
python | def probe_check(name, status, device_type):
"""if the status is "ok" in the PROBE_STATE dict, return ok + string
if the status is not "ok", return critical + string"""
status_string = PROBE_STATE.get(int(status), "unknown")
if status_string == "ok":
return ok, "{} '{}': {}".format(device_type, ... |
java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
bridge_stats[] resources = new bridge_stats[1];
bridge_response result = (bridge_response) service.get_payload_formatter().string_to_resource(bridge_response.class, response);
if(result.errorcode != 0) {
if ... |
java | public UpdateIdentityPoolRequest withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) {
setIdentityPoolTags(identityPoolTags);
return this;
} |
java | public static af_config_info delete(nitro_service client, af_config_info resource) throws Exception
{
resource.validate("delete");
return ((af_config_info[]) resource.delete_resource(client))[0];
} |
java | public String generateQuery(String filter,
Collection<String> attributes, String attributeValue) {
// Build LDAP query for objects having at least one attribute and with
// the given search filter
StringBuilder ldapQuery = new StringBuilder();
ldapQuery.append("(&");
... |
java | public Node getEntry(final String cn, final String owner) {
// TODO implement me!
Node entry = new LdapEntry(cn, owner);
return entry;
} |
python | def update_package(self, package_version_details, feed_id, package_name, package_version):
"""UpdatePackage.
[Preview API]
:param :class:`<PackageVersionDetails> <azure.devops.v5_0.npm.models.PackageVersionDetails>` package_version_details:
:param str feed_id:
:param str package_... |
java | private Table summarize(TableSliceGroup group) {
List<Table> results = new ArrayList<>();
ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap = getAggregateFunctionMultimap();
for (String name : reductionMultimap.keys()) {
List<AggregateFunction<?, ?>> reductions =... |
java | protected static void sendSystem (DObject speakObj, String bundle, String message, byte level)
{
sendMessage(speakObj, new SystemMessage(message, bundle, level));
} |
java | protected final void firePropertyParentChanged(N oldParent, N newParent) {
firePropertyParentChanged(new TreeNodeParentChangedEvent(toN(), oldParent, newParent));
} |
python | def write_quota(outbytes: int, outfn: Path) -> Union[None, int]:
"""
aborts writing if not enough space on drive to write
"""
if not outfn:
return None
anch = Path(outfn).resolve().anchor
freeout = shutil.disk_usage(anch).free
if freeout < 10 * outbytes:
raise IOError(f'out... |
java | public void processDocument(BufferedReader document, Wordsi wordsi) {
Queue<String> prevWords = new ArrayDeque<String>();
Queue<String> nextWords = new ArrayDeque<String>();
Iterator<String> it = IteratorFactory.tokenizeOrdered(document);
// Skip empty documents.
if (!it.hasNex... |
java | public static String getFileExtension(final String fileName) {
if (fileName == null) return null;
final int lastPeriodIndex = fileName.lastIndexOf(".");
// make sure there is an extension, and that the filename doesn't end with a period
if (lastPeriodIndex != -1 && lastPeriodIndex ... |
python | def poll_event(self):
"""Wait for an event and return it.
Returns a tuple: (type, unicode character, key, mod, width, height,
mousex, mousey).
"""
"""
cdef tb_event e
with self._poll_lock:
with nogil:
result = tb_poll_event(&e)
... |
python | def store(self, filename=None, label=None, desc=None, date=None):
"""Store object to mat-file. TODO: determine format specification
"""
date = datetime.now() if date is None else date
filename = filename if filename else date.replace(microsecond=0).isoformat() + '.mat'
def store... |
java | public static <T> LazyIterable<T> reject(Iterable<T> iterable, Predicate<? super T> predicate)
{
return new RejectIterable<T>(iterable, predicate);
} |
python | def spa_compression(htilde, fmin, fmax, min_seglen=0.02,
sample_frequencies=None):
"""Returns the frequencies needed to compress the given frequency domain
waveform. This is done by estimating t(f) of the waveform using the
stationary phase approximation.
Parameters
----------
htilde : ... |
python | def zonearea(idf, zonename, debug=False):
"""zone area"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
floors = [s for s in zone_surfs if s.Surface_Type.upper() == 'FLOOR']
if debug:
... |
python | def GET(self, mid=None):
'''
A convenience URL for getting lists of minions or getting minion
details
.. http:get:: /minions/(mid)
:reqheader X-Auth-Token: |req_token|
:reqheader Accept: |req_accept|
:status 200: |200|
:status 401: |401|... |
python | def add_ignore(self, depend):
"""Adds dependencies to ignore."""
try:
self._add_child(self.ignore, self.ignore_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s... |
python | def get_dev_at_mountpoint(mntpoint):
"""
Retrieves the device mounted at mntpoint, or raises
MountError if none.
"""
results = util.subp(['findmnt', '-o', 'SOURCE', mntpoint])
if results.return_code != 0:
raise MountError('No device mounted at %s' % mntpoint)
... |
python | def request(method, url, headers=None, data=None, session=None):
"""
:type session requests.session
:param method:
:param url:
:param headers:
:param data:
:param session:
:return:
"""
base_headers = {
'User-Agent': random_agent()
}
if headers is None:
hea... |
python | def _receive_poll(self, command_id, response_streams):
"""
Recieves data
:param command_id:
:param streams:
:return:
"""
logging.info('receive command: ' + command_id)
resource = ResourceLocator(CommandShell.ShellResource)
resource.add_selector('Sh... |
python | def _merge_cluster(old, new):
"""merge one cluster to another"""
logger.debug("_merge_cluster: %s to %s" % (old.id, new.id))
logger.debug("_merge_cluster: add idls %s" % old.loci2seq.keys())
for idl in old.loci2seq:
# if idl in new.loci2seq:
# new.loci2seq[idl] = list(set(new.loci2seq... |
python | def create_diamond_db(self):
'''Create a diamond database from the unaligned sequences in this package.
Returns
-------
path to the created diamond db e.g. 'my_sequences.dmnd'
'''
base = self.unaligned_sequence_database_path()
cmd = "diamond makedb --in '%s' -d '... |
java | public void delete(String resourceGroupName, String automationAccountName, UUID jobScheduleId) {
deleteWithServiceResponseAsync(resourceGroupName, automationAccountName, jobScheduleId).toBlocking().single().body();
} |
java | public Observable<ServiceResponse<Page<AppServicePlanInner>>> listAppServicePlansWithServiceResponseAsync(final String resourceGroupName, final String name) {
return listAppServicePlansSinglePageAsync(resourceGroupName, name)
.concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observabl... |
java | public static int readCompressedInt(InputStream in) throws IOException {
int b1=in.read();
if(b1==-1) throw new EOFException();
if((b1&0x80)!=0) {
// 31 bit
int b2=in.read();
if(b2==-1) throw new EOFException();
int b3=in.read();
if(b3==-1) throw new EOFException();
int b4=in.read();
if(b4==-... |
java | public boolean containsTotalBytesOnTiers(
java.lang.String key) {
if (key == null) { throw new java.lang.NullPointerException(); }
return internalGetTotalBytesOnTiers().getMap().containsKey(key);
} |
java | protected void maybeSignalForMoreConnections(ConnectionPartition connectionPartition) {
if (!connectionPartition.isUnableToCreateMoreTransactions()
&& !this.poolShuttingDown &&
connectionPartition.getAvailableConnections()*100/connectionPartition.getMaxConnections() <= this.poolAvailabilityThreshold){
... |
java | public void map(final User user, final Role role)
{
this.getRoleMappings().add(new RoleMapping(user, role));
} |
python | def _read_para_transport_format_list(self, code, cbit, clen, *, desc, length, version):
"""Read HIP TRANSPORT_FORMAT_LIST parameter.
Structure of HIP TRANSPORT_FORMAT_LIST parameter [RFC 7401]:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0... |
java | public <T> EntityResponse<List<T>> getWithListResult(Class<T> entityClass, String path, Map<String, String> params, Map<String, String> headers) throws IOException, RESTException {
HttpGet httpGet = buildHttpGet(path, params);
return parseListEntityResponse(entityClass, getHttpResponse(httpGet, headers)... |
java | private void checkStringIsValidName(final String s) throws PackageNameException {
final boolean packageContainsJavaKeyword = javaKeywords.stream().anyMatch(s::equals);
if (packageContainsJavaKeyword || s.matches("\\d.*")) {
throw new PackageNameException("string is not valid");
}
... |
java | public synchronized long getByteLimit(final String metric) {
if (metric == null || metric.isEmpty()) {
return default_byte_limit;
}
for (final QueryLimitOverrideItem item : overrides.values()) {
if (item.matches(metric)) {
return item.getByteLimit();
}
}
return default_byte... |
python | def from_iso_long_date(self, date_str: str) -> datetime:
""" Parse ISO date string (YYYY-MM-DDTHH:mm:ss) """
assert isinstance(date_str, str)
assert len(date_str) == 19
self.value = datetime.strptime(date_str, ISO_LONG_FORMAT)
return self.value |
python | def cmd_link_ports(self):
'''show available ports'''
ports = mavutil.auto_detect_serial(preferred_list=['*FTDI*',"*Arduino_Mega_2560*", "*3D_Robotics*", "*USB_to_UART*", '*PX4*', '*FMU*'])
for p in ports:
print("%s : %s : %s" % (p.device, p.description, p.hwid)) |
java | @Override
public void close() throws IOException {
debug(String.format("close jar provider loader for: %s", pluginJar));
synchronized (this) {
closed = true;
}
if (null != cachedJar) {
cachedJar.close();
classCache.clear();
cachedJar = ... |
java | public List<Runner> getAllRunners(Runner.RunnerStatus scope) throws GitLabApiException {
return (getAllRunners(scope, getDefaultPerPage()).all());
} |
java | @Override
public JobExecutionResult executeJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException {
checkNotNull(job, "job is null");
final CompletableFuture<JobSubmissionResult> submissionFuture = submitJob(job);
final CompletableFuture<JobResult> jobResultFuture = submissionFuture.thenC... |
python | def Import(context, request):
""" Read Shimadzu GCMS-TQ8030 GC/MS/MS analysis results
"""
form = request.form
# TODO form['file'] sometimes returns a list
infile = form['instrument_results_file'][0] if \
isinstance(form['instrument_results_file'], list) \
else form['instrument_result... |
python | def get_json_request(self):
"""
friendly method to parse a proper json request (i.e.: **application/json** or **text/json**)
:returns: a dict with the parsed data, unless the request data does not contain a valid json string or the content-type do not portray a json request.
"""
... |
python | def _get_normal_name(orig_enc):
"""Imitates get_normal_name in tokenizer.c."""
# Only care about the first 12 characters.
enc = orig_enc[:12].lower().replace("_", "-")
if enc == "utf-8" or enc.startswith("utf-8-"):
return "utf-8"
if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \
... |
python | def fit_feedback_params(calibration, max_resistor_readings):
'''
Fit model of control board high-voltage feedback resistor and
parasitic capacitance values based on measured voltage readings.
'''
R1 = 10e6
# Get transfer function to compute the amplitude of the high-voltage input
# to the c... |
java | public void marshall(CopyBackupToRegionRequest copyBackupToRegionRequest, ProtocolMarshaller protocolMarshaller) {
if (copyBackupToRegionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(copy... |
python | def area_top_orifice(self):
"""Estimate the orifice area corresponding to the top row of orifices.
Another solution method is to use integration to solve this problem.
Here we use the width of the stout weir in the center of the top row
to estimate the area of the top orifice
"""... |
python | def p_instance_or(self, p):
'instance : SENS_OR parameterlist instance_bodylist SEMICOLON'
instancelist = []
for instance_name, instance_ports, instance_array in p[3]:
instancelist.append(Instance(p[1], instance_name, instance_ports,
p[2], ins... |
java | protected void onMissingTypeVisit(Table table, IndexField<?> field) {
if (!Introspector.isModelClass(field.getType())) {
return;
}
Field idField = Introspector.getOpenEngSBModelIdField(field.getType());
if (idField == null) {
LOG.warn("@Model class {} does not h... |
python | def read_route_line(route):
"""
read route line in gaussian input/output and return functional basis_set
and a dictionary of other route parameters
Args:
route (str) : the route line
return
functional (str) : the method (HF, PBE ...)
basis_set (str) : the basis set
... |
java | public static <A, B, C, D, E> Choice5<A, B, C, D, E> d(D d) {
return new _D<>(d);
} |
java | @BetaApi
public final AggregatedListInstanceGroupManagersPagedResponse aggregatedListInstanceGroupManagers(
String project) {
AggregatedListInstanceGroupManagersHttpRequest request =
AggregatedListInstanceGroupManagersHttpRequest.newBuilder().setProject(project).build();
return aggregatedListIns... |
java | public static Expression path(Object... pathComponents) {
if (pathComponents == null || pathComponents.length == 0) {
return EMPTY_INSTANCE;
}
StringBuilder path = new StringBuilder();
for (Object p : pathComponents) {
path.append('.');
if (p instanceo... |
python | def getImages(self, body, getFingerprint=None, imageScalar=2, plotShape="circle", sparsity=1.0):
"""Bulk get images for expressions
Args:
body, ExpressionOperation: The JSON encoded expression to be evaluated (required)
getFingerprint, bool: Configure if the fingerprint should be... |
python | def validate_query(self, query):
"""Validate a query.
Determines whether `query` is well-formed. This includes checking for all
required parameters, as well as checking parameters for valid values.
Parameters
----------
query : NCSSQuery
The query to validat... |
java | public static Number readNumericStoredAsText(DataInputStream dataInput, int length) throws IOException {
try {
byte t_float[] = new byte[length];
int readed = dataInput.read(t_float);
if (readed != length) {
throw new EOFException("failed to read:" + length + " bytes");
}
t_float = DBFUtils.removeS... |
java | public void move(Path srcDirFilePath, Path dstDirFilePath) {
String id = ids.getIfPresent(srcDirFilePath);
if (id != null) {
ids.put(dstDirFilePath, id);
ids.invalidate(srcDirFilePath);
}
} |
java | public static com.liferay.commerce.notification.model.CommerceNotificationAttachment getCommerceNotificationAttachmentByUuidAndGroupId(
String uuid, long groupId)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getCommerceNotificationAttachmentByUuidAndGroupId(uuid,
gro... |
java | public static <T> HttpMethod retrieveMethod(Request<T> request) {
if (request == null) {
return null;
}
Class<?> clazz = request.getClass();
Method method = clazz.getAnnotation(Method.class);
HttpMethod httpMethod = method.value();
return httpMethod;
} |
python | def heading2table(soup, table, row):
"""add heading row to table"""
tr = Tag(soup, name="tr")
table.append(tr)
for attr in row:
th = Tag(soup, name="th")
tr.append(th)
th.append(attr) |
java | public static String encodeLine(String string, boolean bResourceListBundle)
{
if (string == null)
return string;
for (int i = 0; i < string.length(); i++)
{
if (((string.charAt(i) == '\"') || (string.charAt(i) == '\\'))
|| ((!bResourceListBundle) && (stri... |
python | def create(self, path, visibility):
"""
Create a new FunctionVersionInstance
:param unicode path: The path
:param FunctionVersionInstance.Visibility visibility: The visibility
:returns: Newly created FunctionVersionInstance
:rtype: twilio.rest.serverless.v1.service.func... |
python | def config(self, body):
"""Configure the email provider.
Args:
body (dict): Please see: https://auth0.com/docs/api/v2#!/Emails/post_provider
"""
return self.client.post(self._url(), data=body) |
python | def get_potential(self, config_nr):
"""Return potential data for a given measurement configuration.
Parameters
----------
config_nr: int
Number of the configurations. Starts at 0
Returns
-------
pot_data: list with two numpy.ndarrays
Firs... |
python | def integer_entry(self, prompt, message=None, min=None, max=None, rofi_args=None, **kwargs):
"""Prompt the user to enter an integer.
Parameters
----------
prompt: string
Prompt to display to the user.
message: string, optional
Message to display under the... |
java | public ListAssociationsResult withAssociations(Association... associations) {
if (this.associations == null) {
setAssociations(new com.amazonaws.internal.SdkInternalList<Association>(associations.length));
}
for (Association ele : associations) {
this.associations.add(ele... |
python | def run_experiment(self):
"""Sign up, run the ``participate`` method, then sign off and close
the driver."""
try:
self.sign_up()
self.participate()
if self.sign_off():
self.complete_experiment("worker_complete")
else:
... |
java | public static void setInputColumns(Configuration conf, String columns)
{
if (columns == null || columns.isEmpty())
return;
conf.set(INPUT_CQL_COLUMNS_CONFIG, columns);
} |
python | def p2wsh_input_and_witness(outpoint, stack, witness_script, sequence=None):
'''
Outpoint, str, str, int -> (TxIn, InputWitness)
Create a signed witness TxIn and InputWitness from a p2wsh prevout
'''
if sequence is None:
sequence = guess_sequence(witness_script)
stack = list(map(
... |
python | def assign_to_topic_partition(self, topic_partition=None):
"""Assign a list of TopicPartitions to this consumer.
- ``partitions`` (list of `TopicPartition`): Assignment for this instance.
"""
if isinstance(topic_partition, TopicPartition):
topic_partition = [topic_p... |
python | def check_docstring_sections(self, definition, docstring):
"""D21{4,5}, D4{05,06,07,08,09,10}: Docstring sections checks.
Check the general format of a sectioned docstring:
'''This is my one-liner.
Short Summary
-------------
This is my summary.
... |
python | def checkstring(somestr, interchange = ALL):
"""
Checks that some string is palindrome. Checking performs case-insensitive
:param str somestr:
It is some string that will be checked for palindrome as string.
The string is any string that you want. The string also can be multiline.
If t... |
python | def zero_pixels(self):
""" Return an array of the zero pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the zero pixels
"""
zero_px = np.where(np.sum(self.raw_data, axis=2) == 0)
zero_px = np.c_[zero_px[0], zero_px[1]]
return zero_px |
python | def get_vm_ports(port_id=None):
"""Returns filtered list of vms that may be relevant on CVX"""
return get_ports(device_owners=[n_const.DEVICE_OWNER_COMPUTE_PREFIX,
t_const.TRUNK_SUBPORT_OWNER],
vnic_type=portbindings.VNIC_NORMAL, port_id=port_id) |
python | def gene_names(self, contig=None, strand=None):
"""
Return all genes in the database,
optionally restrict to a chromosome and/or strand.
"""
return self._all_feature_values(
column="gene_name",
feature="gene",
contig=contig,
strand=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.