language stringclasses 2
values | func_code_string stringlengths 63 466k |
|---|---|
python | def memoize(func):
"""Simple caching decorator."""
cache = {}
@functools.wraps(func)
def wrapper(*args, **kwargs):
"""Caching wrapper."""
key = (args, tuple(sorted(kwargs.items())))
if key in cache:
return cache[key]
else:
result = func(*args, **k... |
python | def count_courses(self):
"""Return the average number of courses per string."""
c = 0
for x in self.tuning:
if type(x) == list:
c += len(x)
else:
c += 1
return float(c) / len(self.tuning) |
python | def get_url(cls, world, category=Category.EXPERIENCE, vocation=VocationFilter.ALL, page=1):
"""Gets the Tibia.com URL of the highscores for the given parameters.
Parameters
----------
world: :class:`str`
The game world of the desired highscores.
category: :class:`Cat... |
python | def verify(self, store=None, chain=None, key=None):
"""
Verify self. Supports verification on both X509 store object
or just public issuer key
@param store X509Store object.
@param chain - list of X509 objects to add into verification
context.These objects are untrust... |
python | def delete(self, docids):
"""Delete documents (specified by their ids) from the index."""
logger.debug("deleting %i documents from %s" % (len(docids), self))
deleted = 0
for docid in docids:
try:
del self.id2pos[docid]
deleted += 1
... |
python | def is_selected_by_selector(self, selector):
"""Assert the option matching the CSS selector is selected."""
elem = find_element_by_jquery(world.browser, selector)
if not elem.is_selected():
raise AssertionError("Element expected to be selected.") |
python | def _make_inputnode(self, frequency):
"""
Generates an input node for the given frequency. It also adds implicit
file format conversion nodes to the pipeline.
Parameters
----------
frequency : str
The frequency (i.e. 'per_session', 'per_visit', 'per_subject' ... |
java | private <T> Collection<Integer> transformSource(SourceTransformation<T> source) {
String slotSharingGroup = determineSlotSharingGroup(source.getSlotSharingGroup(), Collections.emptyList());
streamGraph.addSource(source.getId(),
slotSharingGroup,
source.getCoLocationGroupKey(),
source.getOperator(),
... |
java | boolean isCodeInCCLength(int encLength, int code) {
boolean found;
if (encLength > 1 || code >= BitSet.SINGLE_BYTE_SIZE) {
if (mbuf == null) {
found = false;
} else {
found = CodeRange.isInCodeRange(mbuf.getCodeRange(), code);
}
... |
java | public void disable(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions) {
disableWithServiceResponseAsync(jobId, disableTasks, jobDisableOptions).toBlocking().single().body();
} |
java | public double computeCosineSimilarity(String analogy, Matrix m) {
double cosineVals = 0.0;
int totalVals = 0;
if (!isAnalogyFormat(analogy, true)) {
System.err.println("Analogy: \"" + analogy + "\" not in proper format");
return 0.0;
}
String pairs[] = an... |
python | def split_by_count(items, count, filler=None):
"""Split the items into tuples of count items each
>>> split_by_count([0,1,2,3], 2)
[(0, 1), (2, 3)]
If there are a mutiple of count items then filler makes no difference
>>> split_by_count([0,1,2,7,8,9], 3, 0) == split_by_count([0,1,2,7,8,9], 3)
... |
python | def get(key, default='', delimiter=':'):
'''
Retrieve master config options, with optional nesting via the delimiter
argument.
**Arguments**
default
If the key is not found, the default will be returned instead
delimiter
Override the delimiter used to separate nested levels ... |
python | def read_from_config(cp, **kwargs):
"""Initializes a model from the given config file.
The section must have a ``name`` argument. The name argument corresponds to
the name of the class to initialize.
Parameters
----------
cp : WorkflowConfigParser
Config file parser to read.
\**kwa... |
java | public void setAsynchConsumerCallback(int requestNumber,
int maxActiveMessages,
long messageLockExpiry,
int batchsize,
OrderingContext orderContext, ... |
python | def v_init_extension(ctx, stmt):
"""find the modulename of the prefix, and set `stmt.keyword`"""
(prefix, identifier) = stmt.raw_keyword
(modname, revision) = \
prefix_to_modulename_and_revision(stmt.i_module, prefix,
stmt.pos, ctx.errors)
stmt.keyword =... |
python | def align_to_mmap(num, round_up):
"""
Align the given integer number to the closest page offset, which usually is 4096 bytes.
:param round_up: if True, the next higher multiple of page size is used, otherwise
the lower page_size will be used (i.e. if True, 1 becomes 4096, otherwise it becomes 0)
... |
python | def release(self):
"""Create a release
1. Perform Sanity checks on work file.
2. Copy work file to releasefile location.
3. Perform cleanup actions on releasefile.
:returns: True if successfull, False if not.
:rtype: bool
:raises: None
"""
log.in... |
java | public final Future<InetAddress> resolve(String inetHost, Iterable<DnsRecord> additionals) {
return resolve(inetHost, additionals, executor().<InetAddress>newPromise());
} |
python | def clear(self):
"""Clear the data, and thus, force it to be created on the next fetch. This is
done by removing the attribute from ``owner``, deleting it from globals
and removing the file from the disk.
"""
vname = self.varname
if self.path.exists():
logge... |
python | def main():
"""Create a new Cheroot instance with arguments from the command line."""
parser = argparse.ArgumentParser(
description='Start an instance of the Cheroot WSGI/HTTP server.',
)
for arg, spec in _arg_spec.items():
parser.add_argument(arg, **spec)
raw_args = parser.parse_arg... |
java | private void processTag(boolean start) {
if (start) {
nested++;
doc.startElement(tag,attributes);
}
else {
nested--;
doc.endElement(tag);
}
} |
python | def vote(self, identifier, weight=100.0):
''' Waits 5 seconds as that is the required amount
of time between votes.
'''
for num_of_retries in range(default.max_retry):
try:
self.steem_instance().vote(identifier,
weight, self.mainaccount)
... |
python | def clean_password2(self):
"""
Check wether password 1 and password 2 are equivalent
While ideally this would be done in clean, there is a chance a
superclass could declare clean and forget to call super. We
therefore opt to run this password mismatch check in password2
... |
python | def dates(self, field_name, kind, order='ASC'):
"""
Returns a list of datetime objects representing all available dates for
the given field_name, scoped to 'kind'.
"""
assert kind in ("month", "year", "day", "week", "hour", "minute"), \
"'kind' must be one of 'year',... |
python | def vartype_argument(*arg_names):
"""Ensures the wrapped function receives valid vartype argument(s). One
or more argument names can be specified (as a list of string arguments).
Args:
*arg_names (list[str], argument names, optional, default='vartype'):
The names of the constrained argu... |
python | def inplace(method_name):
"""
Returns a type instance method that will call the given method
name, used for inplace operators such as __iadd__ and __imul__.
"""
def method(self, other):
getattr(self, method_name)(value_left(self, other))
return self
return method |
python | def _to_output_code(self):
"""Return a unicode object with the Gremlin/MATCH representation of this Literal."""
# All supported Literal objects serialize to identical strings both in Gremlin and MATCH.
self.validate()
if self.value is None:
return u'null'
elif self.va... |
java | @Nonnull
@ReturnsMutableCopy
public ICommonsList <ICommonsList <String>> readAll () throws IOException
{
final ICommonsList <ICommonsList <String>> ret = new CommonsArrayList <> ();
while (m_bHasNext)
{
final ICommonsList <String> aNextLineAsTokens = readNext ();
if (aNextLineAsTokens != n... |
java | @Override
public void cleanup() throws IOException {
this.client.close();
ExecutorsUtils.shutdownExecutorService(this.singleThreadPool, Optional.of(log));
} |
java | public void onReceiveStatus(CmsWorkflowResponse brokenResources) {
if (brokenResources.isSuccess()) {
succeed();
hide();
CmsNotification.get().send(
CmsNotification.Type.NORMAL,
org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.... |
python | def xmoe_tr_2d():
"""Mixture of experts (16 experts).
623M Params, einsum=1.09e13
Returns:
a hparams
"""
hparams = xmoe_tr_dense_2k()
hparams.mesh_shape = "b0:2;b1:4"
hparams.outer_batch_size = 4
hparams.layout = "outer_batch:b0;inner_batch:b1,expert_x:b1,expert_y:b0"
hparams.encoder_layers = ["... |
python | def get_helper(name=None, quiet=True, **kwargs):
'''
get the correct helper depending on the environment variable
HELPME_CLIENT
quiet: if True, suppress most output about the client (e.g. speak)
'''
# Second priority, from environment
from helpme.defaults import HELPME_CLIENT
... |
python | def _cal_color(self, value, color_index):
"""Blend between two colors based on input value."""
range_min_p = self._domain[color_index]
range_p = self._domain[color_index + 1] - range_min_p
try:
factor = (value - range_min_p) / range_p
except ZeroDivisionError:
... |
java | protected void notifyChangeListeners() {
ChangeEvent e = new ChangeEvent(this);
for (ChangeListener l : changeListeners) {
l.stateChanged(e);
}
} |
java | public CmsUser readUser(CmsDbContext dbc, String username) throws CmsDataAccessException {
CmsUser user = m_monitor.getCachedUser(username);
if (user == null) {
user = getUserDriver(dbc).readUser(dbc, username);
m_monitor.cacheUser(user);
}
// important: do not r... |
java | public void marshall(RestApi restApi, ProtocolMarshaller protocolMarshaller) {
if (restApi == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(restApi.getId(), ID_BINDING);
protocolMarshall... |
java | public static Float getQuality(String value)
{
if (value==null)
return __zero;
int qe=value.indexOf(";");
if (qe++<0 || qe==value.length())
return __one;
if (value.charAt(qe++)=='q')
{
qe++;
Map.Entry entry=__q... |
python | def list(self, instance=None, limit=20, marker=0):
"""
Return a paginated list of backups, or just for a particular
instance.
"""
if instance is None:
return super(CloudDatabaseBackupManager, self).list()
return self.api._manager._list_backups_for_instance(ins... |
python | def getOutEdges(self, label=None):
"""Gets all the outgoing edges of the node. If label
parameter is provided, it only returns the edges of
the given label
@params label: Optional parameter to filter the edges
@returns A generator function with the outgoing edges"""
if l... |
python | def show(self):
"""
Reimplements the :meth:`QWidget.show` method.
"""
selected_text = self.__container.get_current_editor().get_selected_text()
selected_text and SearchAndReplace.insert_pattern(selected_text, self.__search_patterns_model)
self.Search_comboBox.line_edit()... |
python | def lxqstr(string, qchar, first):
"""
Lex (scan) a quoted string.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lxqstr_c.html
:param string: String to be scanned.
:type string: str
:param qchar: Quote delimiter character.
:type qchar: char (string of one char)
:param first: C... |
python | def dump_with_fn(dump_fn, data, stream, **options):
"""
Dump 'data' to a string if 'stream' is None, or dump 'data' to a file or
file-like object 'stream'.
:param dump_fn: Callable to dump data
:param data: Data to dump
:param stream: File or file like object or None
:param options: option... |
python | def get(self, singleSnapshot=False):
"""
*geneate the pyephem positions*
**Key Arguments:**
- ``singleSnapshot`` -- just extract positions for a single pyephem snapshot (used for unit testing)
**Return:**
- ``None``
"""
self.log.info('starting t... |
python | def fill(self, key, mor_dict):
"""
Set a dict mapping (resouce_type --> objects[]) for a given key
"""
with self._objects_queue_lock:
self._objects_queue[key] = mor_dict |
python | def set_interrupt(self, method=None, **kwargs):
"""
Decorator that turns a function or controller method into an action interrupt.
"""
def action_wrap(f):
action_id = kwargs.get("action_id", f.__name__)
name = kwargs.get("name", action_id)
... |
python | def _send_request(self, request, headers=None, content=None, **operation_config):
"""Prepare and send request object according to configuration.
:param ClientRequest request: The request object to be sent.
:param dict headers: Any headers to add to the request.
:param content: Any body d... |
java | public ManagedEntity findChild(ManagedEntity parent, String name) throws RuntimeFault, RemoteException {
if (parent == null) {
throw new IllegalArgumentException("parent entity must not be null.");
}
ManagedObjectReference mor = getVimService().findChild(getMOR(), parent.getMOR()... |
java | public void addData(final char[] data, final int off, final int size) {
if(size<1){
return;
}
final String str = new String(data, off, size);
if (str.contains("\n")) {
final String[] lines = str.split("\\r?\\n", -1);
for (int i = 0 ; i < lines.length -... |
python | def _symbol_token_end(c, ctx, is_field_name, value=None):
"""Returns a transition which ends the current symbol token."""
if value is None:
value = ctx.value
if is_field_name or c in _SYMBOL_TOKEN_TERMINATORS or ctx.quoted_text:
# This might be an annotation or a field name. Mark it as self-... |
java | public LongConsumer mask(ThrowingLongConsumer<? extends X> consumer) {
Objects.requireNonNull(consumer);
return l -> maskException(() -> consumer.accept(l));
} |
java | public static boolean containsOnly (@Nullable final CharSequence aCS, @Nullable final ICharPredicate aFilter)
{
final int nLen = getLength (aCS);
if (nLen == 0)
return false;
if (aFilter == null)
return true;
for (int i = 0; i < nLen; ++i)
if (!aFilter.test (aCS.charAt (i)))
... |
java | public ItemCollectionMetrics withSizeEstimateRangeGB(Double... sizeEstimateRangeGB) {
if (this.sizeEstimateRangeGB == null) {
setSizeEstimateRangeGB(new java.util.ArrayList<Double>(sizeEstimateRangeGB.length));
}
for (Double ele : sizeEstimateRangeGB) {
this.sizeEstimateR... |
java | @Override
public void init(final FilterConfig filterConfig) throws ServletException {
// verify there are no init parameters configured that are not recognized
// since an unrecognized init param might be the adopter trying to configure this filter in
// an important way
// and acci... |
java | @BetaApi
public final License getLicense(String license) {
GetLicenseHttpRequest request = GetLicenseHttpRequest.newBuilder().setLicense(license).build();
return getLicense(request);
} |
java | @Restricted(NoExternalUse.class)
public static String normalize(@Nonnull String path) {
StringBuilder buf = new StringBuilder();
// Check for prefix designating absolute path
Matcher m = ABSOLUTE_PREFIX_PATTERN.matcher(path);
if (m.find()) {
buf.append(m.group(1));
... |
python | def get_version():
"""Obtain the version number"""
import imp
import os
mod = imp.load_source(
'version', os.path.join('skdata', '__init__.py')
)
return mod.__version__ |
java | private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) {
final WebAppErrorPage errorPage = new WebAppErrorPage();
if (errorPageType.getErrorCode() != null) {
errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString());
}
if (errorPageType.getExceptionT... |
python | def get_find_executions_string(desc, has_children, single_result=False, show_outputs=True,
is_cached_result=False):
'''
:param desc: hash of execution's describe output
:param has_children: whether the execution has children to be printed
:param single_result: whether the ... |
python | def scale_atoms(fac):
'''Scale the currently selected atoms atoms by a certain factor
*fac*.
Use the value *fac=1.0* to reset the scale.
'''
rep = current_representation()
atms = selected_atoms()
rep.scale_factors[atms] = fac
rep.update_scale_factors(rep.scale_factors)
viewer.... |
java | @Nullable
public static final <T extends AbstractSingleton> T getSingletonIfInstantiated (@Nullable final IScope aScope,
@Nonnull final Class <T> aClass)
{
ValueEnforcer.notNull (aClass, "Class");
if (aScope != null)
{
... |
java | public static void decodeTo(byte[] data, int offset, int length, MultiMap map, String charset)
{
if (data == null || length == 0)
return;
if (charset==null)
charset=StringUtil.__ISO_8859_1;
synchronized(map)
{
try
{
... |
python | def snapshot(self, wiki=False, streamed=False, action=None,
chunk_size=1024, **kwargs):
"""Return a snapshot of the repository.
Args:
wiki (bool): If True return the wiki repository
streamed (bool): If True the data will be processed by chunks of
... |
python | def transformer_nat_small():
"""Set of hyperparameters."""
hparams = transformer.transformer_small()
hparams.batch_size = 2048
hparams.learning_rate = 0.2
hparams.learning_rate_warmup_steps = 4000
hparams.num_hidden_layers = 3
hparams.hidden_size = 384
hparams.filter_size = 2048
hparams.label_smoothin... |
python | def ffPDC(self):
"""Full frequency partial directed coherence.
.. math:: \mathrm{ffPDC}_{ij}(f) =
\\frac{A_{ij}(f)}{\sqrt{\sum_f A_{:j}'(f) A_{:j}(f)}}
"""
A = self.A()
return np.abs(A * self.nfft / np.sqrt(np.sum(A.conj() * A, axis=(0, 2),
... |
java | static private void doLookup(SoftTFIDFDictionary dict,double d,String s,boolean compare,double[] stats)
{
System.out.println("lookup: "+s);
long start1 = System.currentTimeMillis();
int n1 = dict.lookup(d,s);
double elapsedSec1 = (System.currentTimeMillis()-start1) / 1000.0;
... |
java | public static void printRawLines(PrintWriter writer, String msg) {
int nl;
while ((nl = msg.indexOf('\n')) != -1) {
writer.println(msg.substring(0, nl));
msg = msg.substring(nl+1);
}
if (msg.length() != 0) writer.println(msg);
} |
python | def read(self):
'''
Read in the specified map and return the map structure
'''
map_ = None
if self.opts.get('map', None) is None:
if self.opts.get('map_data', None) is None:
if self.opts.get('map_pillar', None) is None:
pass
... |
python | def get_subassistants(self):
"""Return list of instantiated subassistants.
Usually, this needs not be overriden in subclasses, you should just override
get_subassistant_classes
Returns:
list of instantiated subassistants
"""
if not hasattr(self, '_subassista... |
java | public double[] getDts(int from, int to) {
double[] ret = new double[to-from];
for (int i = from; i < to; i++) {
ret[i-from] = this.dts[i];
}
return ret;
} |
java | public void write(JsonGenerator jsonGenerator) throws IOException {
jsonGenerator.writeStartObject();
// clusterNodeInfo begins
jsonGenerator.writeFieldName("clusterNodeInfo");
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("name", clusterNodeInfo.name);
jsonGenerator.writeObj... |
java | public Map<URI, URI> getConflicTable() {
for (final Map.Entry<URI, URI> e : conflictTable.entrySet()) {
assert e.getKey().isAbsolute();
assert e.getValue().isAbsolute();
}
return conflictTable;
} |
java | boolean shouldDrainBuffers(boolean delayable) {
if (executor.isShutdown()) {
DrainStatus status = drainStatus.get();
return (status != PROCESSING) && (!delayable || (status == REQUIRED));
}
return false;
} |
java | @Override
public AssociateDeviceWithPlacementResult associateDeviceWithPlacement(AssociateDeviceWithPlacementRequest request) {
request = beforeClientExecution(request);
return executeAssociateDeviceWithPlacement(request);
} |
java | public ServiceFuture<DatabaseInner> updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback<DatabaseInner> serviceCallback) {
return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, param... |
java | private void resize(final int ns) {
final int size = BDDPrime.primeGTE(ns);
this.table = new BDDCacheEntry[size];
for (int n = 0; n < size; n++)
this.table[n] = new BDDCacheEntry();
} |
python | def _elem_set_attrs(obj, parent, to_str):
"""
:param obj: Container instance gives attributes of XML Element
:param parent: XML ElementTree parent node object
:param to_str: Callable to convert value to string or None
:param options: Keyword options, see :func:`container_to_etree`
:return: None... |
java | public static int readAll(InputStream stream, byte[] target, int startOffset, int maxLength) throws IOException {
Preconditions.checkNotNull(stream, "stream");
Preconditions.checkNotNull(stream, "target");
Preconditions.checkElementIndex(startOffset, target.length, "startOffset");
Except... |
java | private static MemoryPoolMXBean findTenuredGenPool() {
// I don't know whether this approach is better, or whether
// we should rather check for the pool name "Tenured Gen"?
for (final MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans())
if (pool.getType() == MemoryType.... |
java | boolean storeMessage(
MessageItem msg,
TransactionCommon transaction,
InputHandlerStore inputHandlerStore,
boolean storedByIH)
throws SIResourceException
{
if (TraceComponent.isAnyTracingE... |
java | @Deprecated
public static int matchAfter(CharSequence a, CharSequence b, int aIndex, int bIndex) {
int i = aIndex, j = bIndex;
int alen = a.length();
int blen = b.length();
for (; i < alen && j < blen; ++i, ++j) {
char ca = a.charAt(i);
char cb = b.charAt(j);
... |
python | def clean(ctx, dry_run=False):
"""Cleanup generated document artifacts."""
basedir = ctx.sphinx.destdir or "build/docs"
cleanup_dirs([basedir], dry_run=dry_run) |
java | public static String[] split(String str, String separator, boolean trim) {
if (str == null) {
return null;
}
char sep = separator.charAt(0);
ArrayList<String> strList = new ArrayList<String>();
StringBuilder split = new StringBuilder();
int index = 0;
... |
java | public void setAcList(StringArray v) {
if (DBInfo_Type.featOkTst && ((DBInfo_Type)jcasType).casFeat_acList == null)
jcasType.jcas.throwFeatMissing("acList", "de.julielab.jules.types.DBInfo");
jcasType.ll_cas.ll_setRefValue(addr, ((DBInfo_Type)jcasType).casFeatCode_acList, jcasType.ll_cas.ll_getFSRef(v));} |
python | def dumps(data, **kwargs):
"""Create a string CCSDS representation of the object
Same arguments and behaviour as :py:func:`dump`
"""
if isinstance(data, Ephem) or (isinstance(data, Iterable) and all(isinstance(x, Ephem) for x in data)):
content = _dump_oem(data, **kwargs)
elif isinstance(da... |
java | protected StringConcatenationClient generateStandardCommentFunctions(boolean forInterface, boolean forAppender,
String elementAccessor) {
return new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append(generateCommentFunction(forInterface, forAppender,... |
java | public void close() {
logger.info("Closing all sync producers");
if (sync) {
for (SyncProducer p : syncProducers.values()) {
p.close();
}
} else {
for (AsyncProducer<V> p : asyncProducers.values()) {
p.close();
}
... |
java | private void checkObjectFactoryAttributes(ResourceInjectionBinding resourceBinding,
ObjectFactoryInfo extensionFactory) // d675976
throws InjectionConfigurationException
{
Resource resourceAnnotation = resourceBinding.getAnnotation();
if (!extension... |
python | def tohexstring(self):
"""
Returns a hexadecimal string
"""
val = self.tostring()
st = "{0:0x}".format(int(val, 2))
return st.zfill(len(self.bitmap)*2) |
python | def smooth(self, smoothing_factor):
"""
return a new time series which is a exponential smoothed version of the original data series.
soomth forward once, backward once, and then take the average.
:param float smoothing_factor: smoothing factor
:return: :class:`TimeSeries` objec... |
python | def _init_entry_points(self, entry_points):
"""
Default initialization loop.
"""
logger.debug(
"registering %d entry points for registry '%s'",
len(entry_points), self.registry_name,
)
for entry_point in entry_points:
try:
... |
java | private static void parseMessageTextNode(Builder builder, Node node)
throws MalformedException {
String value = extractStringFromStringExprNode(node);
while (true) {
int phBegin = value.indexOf(PH_JS_PREFIX);
if (phBegin < 0) {
// Just a string literal
builder.appendStringPart... |
python | def __parse_email_to_employer_stream(self, stream):
"""Parse email to employer stream.
The stream contains a list of email addresses and their employers.
Each line has an email address and a organization name separated by
tabs. Optionally, the date when the identity withdrew from the
... |
java | public static ProfilingTimer createLoggingSubtasks(final Log log, final String processName, final Object... args) {
return create(log, false, null, processName, args);
} |
python | def logspace_bins(self,bins=None,units=None,conversion_function=convert_time,resolution=None):
"""Generates bin edges for a logspace tiling: there is one edge more than bins and each bin is between two edges"""
bins = self.logspace(bins=bins,units=units,conversion_function=conversion_function,resolution... |
java | @Override
public void cacheResult(CommerceSubscriptionEntry commerceSubscriptionEntry) {
entityCache.putResult(CommerceSubscriptionEntryModelImpl.ENTITY_CACHE_ENABLED,
CommerceSubscriptionEntryImpl.class,
commerceSubscriptionEntry.getPrimaryKey(), commerceSubscriptionEntry);
finderCache.putResult(FINDER_PAT... |
java | public void setNodes(final @Nonnull Collection<? extends Node> nodes) throws IOException {
Queue.withLock(new Runnable() {
@Override
public void run() {
Set<String> toRemove = new HashSet<>(Nodes.this.nodes.keySet());
for (Node n : nodes) {
... |
java | public static DynamicMessage parseFrom(final Descriptor type, final ByteString data,
final ExtensionRegistry extensionRegistry) throws InvalidProtocolBufferException {
return wrap(com.google.protobuf.DynamicMessage.parseFrom(type, data, extensionRegistry));
} |
python | def get_user_groups(self, user):
"""
Get user's group memberships.
Args:
user (string): User name.
Returns:
(list): User's groups.
Raises:
requests.HTTPError on failure.
"""
self.project_service.set_auth(self._token_project)
... |
java | @GET
public Response getInstanceInfo() {
InstanceInfo appInfo = registry
.getInstanceByAppAndId(app.getName(), id);
if (appInfo != null) {
logger.debug("Found: {} - {}", app.getName(), id);
return Response.ok(appInfo).build();
} else {
logg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.