function_name stringlengths 1 57 | function_code stringlengths 20 4.99k | documentation stringlengths 50 2k | language stringclasses 5
values | file_path stringlengths 8 166 | line_number int32 4 16.7k | parameters listlengths 0 20 | return_type stringlengths 0 131 | has_type_hints bool 2
classes | complexity int32 1 51 | quality_score float32 6 9.68 | repo_name stringclasses 34
values | repo_stars int32 2.9k 242k | docstring_style stringclasses 7
values | is_async bool 2
classes |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wrap | public final TypeToken<T> wrap() {
if (isPrimitive()) {
@SuppressWarnings("unchecked") // this is a primitive class
Class<T> type = (Class<T>) runtimeType;
return of(Primitives.wrap(type));
}
return this;
} | Returns the corresponding wrapper type if this is a primitive type; otherwise returns {@code
this} itself. Idempotent.
@since 15.0 | java | android/guava/src/com/google/common/reflect/TypeToken.java | 553 | [] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
getmask | def getmask(a):
"""
Return the mask of a masked array, or nomask.
Return the mask of `a` as an ndarray if `a` is a `MaskedArray` and the
mask is not `nomask`, else return `nomask`. To guarantee a full array
of booleans of the same shape as a, use `getmaskarray`.
Parameters
----------
a... | Return the mask of a masked array, or nomask.
Return the mask of `a` as an ndarray if `a` is a `MaskedArray` and the
mask is not `nomask`, else return `nomask`. To guarantee a full array
of booleans of the same shape as a, use `getmaskarray`.
Parameters
----------
a : array_like
Input `MaskedArray` for which the ... | python | numpy/ma/core.py | 1,400 | [
"a"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
value | public JSONStringer value(Object value) throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
if (value instanceof JSONArray) {
((JSONArray) value).writeTo(this);
return this;
}
else if (value instanceof JSONObject) {
((JSONObject) value).writeTo(this);
... | Encodes {@code value}.
@param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer,
Long, Double or null. May not be {@link Double#isNaN() NaNs} or
{@link Double#isInfinite() infinities}.
@return this stringer.
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONStringer.java | 236 | [
"value"
] | JSONStringer | true | 8 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
expandtabs | def expandtabs(a, tabsize=8):
"""
Return a copy of each string element where all tab characters are
replaced by one or more spaces.
Calls :meth:`str.expandtabs` element-wise.
Return a copy of each string element where all tab characters are
replaced by one or more spaces, depending on the curr... | Return a copy of each string element where all tab characters are
replaced by one or more spaces.
Calls :meth:`str.expandtabs` element-wise.
Return a copy of each string element where all tab characters are
replaced by one or more spaces, depending on the current column
and the given `tabsize`. The column number is r... | python | numpy/_core/strings.py | 636 | [
"a",
"tabsize"
] | false | 2 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
get | public static List<String> get(BeanFactory beanFactory) {
try {
return beanFactory.getBean(BEAN, BasePackages.class).get();
}
catch (NoSuchBeanDefinitionException ex) {
throw new IllegalStateException("Unable to retrieve @EnableAutoConfiguration base packages");
}
} | Return the auto-configuration base packages for the given bean factory.
@param beanFactory the source bean factory
@return a list of auto-configuration packages
@throws IllegalStateException if auto-configuration is not enabled | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java | 75 | [
"beanFactory"
] | true | 2 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false | |
_is_level_reference | def _is_level_reference(self, key: Level, axis: Axis = 0) -> bool:
"""
Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column labe... | Test whether a key is a level reference for a given axis.
To be considered a level reference, `key` must be a string that:
- (axis=0): Matches the name of an index level and does NOT match
a column label.
- (axis=1): Matches the name of a column level and does NOT match
an index label.
Parameters
--------... | python | pandas/core/generic.py | 1,609 | [
"self",
"key",
"axis"
] | bool | true | 4 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
full | def full(shape, fill_value, dtype=None, order='C', *, device=None, like=None):
"""
Return a new array of given shape and type, filled with `fill_value`.
Parameters
----------
shape : int or sequence of ints
Shape of the new array, e.g., ``(2, 3)`` or ``2``.
fill_value : scalar or array_... | Return a new array of given shape and type, filled with `fill_value`.
Parameters
----------
shape : int or sequence of ints
Shape of the new array, e.g., ``(2, 3)`` or ``2``.
fill_value : scalar or array_like
Fill value.
dtype : data-type, optional
The desired data-type for the array The default, None, me... | python | numpy/_core/numeric.py | 325 | [
"shape",
"fill_value",
"dtype",
"order",
"device",
"like"
] | false | 3 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
fit | def fit(self, X, y, sample_weight=None):
"""Build a boosted classifier/regressor from the training set (X, y).
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The training input samples. Sparse matrix can be CSC, CSR, COO,
D... | Build a boosted classifier/regressor from the training set (X, y).
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The training input samples. Sparse matrix can be CSC, CSR, COO,
DOK, or LIL. COO, DOK, and LIL are converted to CSR.
y : array-like of shape (n_samples,)
... | python | sklearn/ensemble/_weight_boosting.py | 108 | [
"self",
"X",
"y",
"sample_weight"
] | false | 7 | 6.16 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
from_key_val_list | def from_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('strin... | Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('string')
Traceback (most recent call last):
...
ValueE... | python | src/requests/utils.py | 308 | [
"value"
] | false | 3 | 7.2 | psf/requests | 53,586 | unknown | false | |
poll | public void poll(RequestFuture<?> future) {
while (!future.isDone())
poll(time.timer(Long.MAX_VALUE), future);
} | Block indefinitely until the given request future has finished.
@param future The request future to await.
@throws WakeupException if {@link #wakeup()} is called from another thread
@throws InterruptException if the calling thread is interrupted | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java | 202 | [
"future"
] | void | true | 2 | 6 | apache/kafka | 31,560 | javadoc | false |
lookup | protected abstract @Nullable Object lookup(Object key); | Perform an actual lookup in the underlying store.
@param key the key whose associated value is to be returned
@return the raw store value for the key, or {@code null} if none | java | spring-context/src/main/java/org/springframework/cache/support/AbstractValueAdaptingCache.java | 77 | [
"key"
] | Object | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false |
getValueAsText | @Override
public Text getValueAsText() throws IOException {
// _tokenIncomplete is true when UTF8StreamJsonParser has already processed this value.
if (_currToken == JsonToken.VALUE_STRING && _tokenIncomplete) {
if (lastOptimisedValue != null) {
return new Text(new XConte... | Method that will try to get underlying UTF-8 encoded bytes of the current string token.
This is only a best-effort attempt; if there is some reason the bytes cannot be retrieved, this method will return null. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParser.java | 60 | [] | Text | true | 5 | 7.2 | elastic/elasticsearch | 75,680 | javadoc | false |
parse | @Override
public Duration parse(String text, Locale locale) throws ParseException {
if (this.defaultUnit == null) {
//delegate to the style
return DurationFormatterUtils.parse(text, this.style);
}
return DurationFormatterUtils.parse(text, this.style, this.defaultUnit);
} | Create a {@code DurationFormatter} in a specific {@link DurationFormat.Style} with an
optional {@code DurationFormat.Unit}.
<p>If a {@code defaultUnit} is specified, it may be used in parsing cases when no
unit is present in the string (provided the style allows for such a case). It will
also be used as the representat... | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatter.java | 78 | [
"text",
"locale"
] | Duration | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
build_all | def build_all() -> None:
"""
Build mkdocs site for en, and then build each language inside, end result is located
at directory ./site/ with each language inside.
"""
update_languages()
shutil.rmtree(site_path, ignore_errors=True)
langs = [
lang.name
for lang in get_lang_paths... | Build mkdocs site for en, and then build each language inside, end result is located
at directory ./site/ with each language inside. | python | scripts/docs.py | 259 | [] | None | true | 3 | 7.04 | tiangolo/fastapi | 93,264 | unknown | false |
registerShutdownHook | @Override
public void registerShutdownHook() {
if (this.shutdownHook == null) {
// No shutdown hook registered yet.
this.shutdownHook = new Thread(SHUTDOWN_HOOK_THREAD_NAME) {
@Override
public void run() {
if (isStartupShutdownThreadStuck()) {
active.set(false);
return;
}
sta... | Register a shutdown hook {@linkplain Thread#getName() named}
{@code SpringContextShutdownHook} with the JVM runtime, closing this
context on JVM shutdown unless it has already been closed at that time.
<p>Delegates to {@code doClose()} for the actual closing procedure.
@see Runtime#addShutdownHook
@see ConfigurableAppl... | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 1,066 | [] | void | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
applyNonNull | public static <T, R> R applyNonNull(final T value, final Function<? super T, ? extends R> mapper) {
return value != null ? Objects.requireNonNull(mapper, "mapper").apply(value) : null;
} | Applies a value to a function if the value isn't {@code null}, otherwise the method returns {@code null}. If the value isn't {@code null} then return the
result of the applying function.
<pre>{@code
Functions.applyNonNull("a", String::toUpperCase) = "A"
Functions.applyNonNull(null, String::toUpperCase) = null
Function... | java | src/main/java/org/apache/commons/lang3/function/Functions.java | 68 | [
"value",
"mapper"
] | R | true | 2 | 7.84 | apache/commons-lang | 2,896 | javadoc | false |
removeMetric | public synchronized KafkaMetric removeMetric(MetricName metricName) {
KafkaMetric metric = this.metrics.remove(metricName);
if (metric != null) {
for (MetricsReporter reporter : reporters) {
try {
reporter.metricRemoval(metric);
} catch (Ex... | Remove a metric if it exists and return it. Return null otherwise. If a metric is removed, `metricRemoval`
will be invoked for each reporter.
@param metricName The name of the metric
@return the removed `KafkaMetric` or null if no such metric exists | java | clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java | 549 | [
"metricName"
] | KafkaMetric | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false |
sort | public static int[] sort(final int[] array) {
if (array != null) {
Arrays.sort(array);
}
return array;
} | Sorts the given array into ascending order and returns it.
@param array the array to sort (may be null).
@return the given array.
@see Arrays#sort(int[]) | java | src/main/java/org/apache/commons/lang3/ArraySorter.java | 93 | [
"array"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
rename_fields | def rename_fields(base, namemapper):
"""
Rename the fields from a flexible-datatype ndarray or recarray.
Nested fields are supported.
Parameters
----------
base : ndarray
Input array whose fields must be modified.
namemapper : dictionary
Dictionary mapping old field names t... | Rename the fields from a flexible-datatype ndarray or recarray.
Nested fields are supported.
Parameters
----------
base : ndarray
Input array whose fields must be modified.
namemapper : dictionary
Dictionary mapping old field names to their new version.
Examples
--------
>>> import numpy as np
>>> from numpy... | python | numpy/lib/recfunctions.py | 608 | [
"base",
"namemapper"
] | false | 4 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
create_training_job | def create_training_job(
self,
config: dict,
wait_for_completion: bool = True,
print_log: bool = True,
check_interval: int = 30,
max_ingestion_time: int | None = None,
):
"""
Start a model training job.
After training completes, Amazon SageMak... | Start a model training job.
After training completes, Amazon SageMaker saves the resulting model
artifacts to an Amazon S3 location that you specify.
:param config: the config for training
:param wait_for_completion: if the program should keep running until job finishes
:param check_interval: the time interval in sec... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 289 | [
"self",
"config",
"wait_for_completion",
"print_log",
"check_interval",
"max_ingestion_time"
] | true | 3 | 7.92 | apache/airflow | 43,597 | sphinx | false | |
length | @Override
public int length() {
return size;
} | Gets the length of the string builder.
@return the length | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,435 | [] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
pollResponseReceivedDuringReauthentication | public Optional<NetworkReceive> pollResponseReceivedDuringReauthentication() {
return authenticator.pollResponseReceivedDuringReauthentication();
} | Return the (always non-null but possibly empty) client-side
{@link NetworkReceive} response that arrived during re-authentication but
is unrelated to re-authentication. This corresponds to a request sent
prior to the beginning of re-authentication; the request was made when the
channel was successfully authenticated, a... | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 658 | [] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
getKeyAlgorithmIdentifier | private static String getKeyAlgorithmIdentifier(byte[] keyBytes) throws IOException, GeneralSecurityException {
DerParser parser = new DerParser(keyBytes);
DerParser.Asn1Object sequence = parser.readAsn1Object();
parser = sequence.getParser();
parser.readAsn1Object().getInteger(); // ver... | Parses a DER encoded private key and reads its algorithm identifier Object OID.
@param keyBytes the private key raw bytes
@return A string identifier for the key algorithm (RSA, DSA, or EC)
@throws GeneralSecurityException if the algorithm oid that is parsed from ASN.1 is unknown
@throws IOException if the DER encoded ... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | 667 | [
"keyBytes"
] | String | true | 1 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
chunks | def chunks(it, n):
"""Split an iterator into chunks with `n` elements each.
Warning:
``it`` must be an actual iterator, if you pass this a
concrete sequence will get you repeating elements.
So ``chunks(iter(range(1000)), 10)`` is fine, but
``chunks(range(1000), 10)`` is not.
... | Split an iterator into chunks with `n` elements each.
Warning:
``it`` must be an actual iterator, if you pass this a
concrete sequence will get you repeating elements.
So ``chunks(iter(range(1000)), 10)`` is fine, but
``chunks(range(1000), 10)`` is not.
Example:
# n == 2
>>> x = chunks(iter([... | python | celery/utils/functional.py | 112 | [
"it",
"n"
] | false | 2 | 6.64 | celery/celery | 27,741 | unknown | false | |
toString | @Override
public String toString() {
final StringBuilder sb = new StringBuilder(getClass().getSimpleName());
sb.append('{');
String path = keystorePath;
if (path != null) {
sb.append("path=").append(path).append(", ");
}
sb.append("type=").append(type);
... | Verifies that the keystore contains at least 1 private key entry. | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/StoreKeyConfig.java | 209 | [] | String | true | 5 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
topicIdValues | public Map<Uuid, KafkaFuture<TopicDescription>> topicIdValues() {
return topicIdFutures;
} | Use when {@link Admin#describeTopics(TopicCollection, DescribeTopicsOptions)} used a TopicIdCollection
@return a map from topic IDs to futures which can be used to check the status of
individual topics if the request used topic IDs, otherwise return null. | java | clients/src/main/java/org/apache/kafka/clients/admin/DescribeTopicsResult.java | 60 | [] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
should_skip_the_package | def should_skip_the_package(provider_id: str, version_suffix: str) -> tuple[bool, str]:
"""Return True, version if the package should be skipped and False, good version suffix if not.
For RC and official releases we check if the "officially released" version exists
and skip the released if it was. This all... | Return True, version if the package should be skipped and False, good version suffix if not.
For RC and official releases we check if the "officially released" version exists
and skip the released if it was. This allows to skip packages that have not been
marked for release in this wave. For "dev" suffixes, we always ... | python | dev/breeze/src/airflow_breeze/prepare_providers/provider_distributions.py | 51 | [
"provider_id",
"version_suffix"
] | tuple[bool, str] | true | 10 | 6 | apache/airflow | 43,597 | unknown | false |
messageWithFallback | public String messageWithFallback() {
if (message == null)
return error.message();
return message;
} | If `message` is defined, return it. Otherwise fallback to the default error message associated with the error
code. | java | clients/src/main/java/org/apache/kafka/common/requests/ApiError.java | 89 | [] | String | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
field | public XContentBuilder field(String name, Double value) throws IOException {
return (value == null) ? nullField(name) : field(name, value.doubleValue());
} | @return the value of the "human readable" flag. When the value is equal to true,
some types of values are written in a format easier to read for a human. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 468 | [
"name",
"value"
] | XContentBuilder | true | 2 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
cardinality | public int cardinality() {
return bitSet.cardinality();
} | Returns the number of bits set to {@code true} in this {@link BitSet}.
@return the number of bits set to {@code true} in this {@link BitSet}. | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 129 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
repeat | def repeat(self, repeats: int | Sequence[int], axis: None = None) -> Series:
"""
Repeat elements of a Series.
Returns a new Series where each element of the current Series
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or ... | Repeat elements of a Series.
Returns a new Series where each element of the current Series
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or array of ints
The number of repetitions for each element. This should be a
non-negative integer. Repeating 0 times will return an... | python | pandas/core/series.py | 1,204 | [
"self",
"repeats",
"axis"
] | Series | true | 1 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
createHttpClient | private CloseableHttpAsyncClient createHttpClient() {
// default timeouts are all infinite
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom()
.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS)
.setSocketTimeout(DEFAULT_SOCKET_TIMEOUT_MILLIS);
if (requestC... | Similar to {@code org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.DefaultThreadFactory} but with better thread names. | java | client/rest/src/main/java/org/elasticsearch/client/RestClientBuilder.java | 324 | [] | CloseableHttpAsyncClient | true | 4 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
setup | def setup(app):
"""
Sets the plugin up and returns configuration of the plugin.
:param app: application.
:return json description of the configuration that is needed by the plugin.
"""
directives.register_directive("exampleinclude", ExampleInclude)
app.connect("doctree-read", doctree_read)
... | Sets the plugin up and returns configuration of the plugin.
:param app: application.
:return json description of the configuration that is needed by the plugin. | python | devel-common/src/sphinx_exts/exampleinclude.py | 263 | [
"app"
] | false | 2 | 6.4 | apache/airflow | 43,597 | sphinx | false | |
comparator | public static Comparator<Class<?>> comparator() {
return COMPARATOR;
} | Gets the class comparator, comparing by class name.
@return the class comparator.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 190 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
abortTransaction | default AbortTransactionResult abortTransaction(AbortTransactionSpec spec) {
return abortTransaction(spec, new AbortTransactionOptions());
} | Forcefully abort a transaction which is open on a topic partition. See
{@link #abortTransaction(AbortTransactionSpec, AbortTransactionOptions)} for more details.
@param spec The transaction specification including topic partition and producer details
@return The result | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,718 | [
"spec"
] | AbortTransactionResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
markAsProcessed | private void markAsProcessed(Element element) {
if (element instanceof TypeElement) {
this.processedSourceTypes.add(this.typeHelper.getType(element));
}
} | Create a new {@code MetadataProcessor} instance.
@param processingEnvironment the processing environment of the build
@param previousMetadata any previous metadata or {@code null} | java | spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataCollector.java | 68 | [
"element"
] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
castIfNecessary | private CodeBlock castIfNecessary(boolean castNecessary, Class<?> castType, CodeBlock valueCode) {
return (castNecessary ? CodeBlock.of("($T) $L", castType, valueCode) : valueCode);
} | Cast the specified {@code valueCode} to the specified {@code castType} if the
{@code castNecessary} is {@code true}. Otherwise, return the valueCode as-is.
@param castNecessary whether a cast is necessary
@param castType the type to cast to
@param valueCode the code for the value
@return the existing value or a form of... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGenerator.java | 414 | [
"castNecessary",
"castType",
"valueCode"
] | CodeBlock | true | 2 | 7.68 | spring-projects/spring-framework | 59,386 | javadoc | false |
writeLineSeparatorsAndIndentBefore | function writeLineSeparatorsAndIndentBefore(node: Node, parent: Node): boolean {
const leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, node, ListFormat.None);
if (leadingNewlines) {
writeLinesAndIndent(leadingNewlines, /*writeSpaceIfNotIndenting*/ false);... | Emits a list without brackets or raising events.
NOTE: You probably don't want to call this directly and should be using `emitList` or `emitExpressionList` instead. | typescript | src/compiler/emitter.ts | 5,151 | [
"node",
"parent"
] | true | 3 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
applyNonNull | public static <T, U, R> R applyNonNull(final T value1, final Function<? super T, ? extends U> mapper1, final Function<? super U, ? extends R> mapper2) {
return applyNonNull(applyNonNull(value1, mapper1), mapper2);
} | Applies values to a chain of functions, where a {@code null} can short-circuit each step. A function is only applied if the previous value is not
{@code null}, otherwise this method returns {@code null}.
<pre>{@code
Functions.applyNonNull(" a ", String::toUpperCase, String::trim) = "A"
Functions.applyNonNull(null, Stri... | java | src/main/java/org/apache/commons/lang3/function/Functions.java | 98 | [
"value1",
"mapper1",
"mapper2"
] | R | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
getExportsForCircularRequire | function getExportsForCircularRequire(module) {
const requiredESM = module[kRequiredModuleSymbol];
if (requiredESM && requiredESM.getStatus() !== kEvaluated) {
let message = `Cannot require() ES Module ${module.id} in a cycle.`;
const parent = module[kLastModuleParent];
if (parent) {
message += ` ... | Returns the exports object for a module that has a circular `require`.
If the exports object is a plain object, it is wrapped in a proxy that warns
about circular dependencies.
@param {Module} module The module instance
@returns {object} | javascript | lib/internal/modules/cjs/loader.js | 1,004 | [
"module"
] | false | 8 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
runUninterruptiblyWithTimeout | @Override
public void runUninterruptiblyWithTimeout(
Runnable runnable, long timeoutDuration, TimeUnit timeoutUnit) throws TimeoutException {
checkNotNull(runnable);
checkNotNull(timeoutUnit);
checkPositiveTimeout(timeoutDuration);
Future<?> future = executor.submit(runnable);
try {
... | Creates a TimeLimiter instance using the given executor service to execute method calls.
<p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
up, any time callers spend waiting for a thread may count toward their time limit, and in this
case the call may even time out before th... | java | android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java | 201 | [
"runnable",
"timeoutDuration",
"timeoutUnit"
] | void | true | 3 | 6.72 | google/guava | 51,352 | javadoc | false |
i0 | def i0(x):
"""
Modified Bessel function of the first kind, order 0.
Usually denoted :math:`I_0`.
Parameters
----------
x : array_like of float
Argument of the Bessel function.
Returns
-------
out : ndarray, shape = x.shape, dtype = float
The modified Bessel functio... | Modified Bessel function of the first kind, order 0.
Usually denoted :math:`I_0`.
Parameters
----------
x : array_like of float
Argument of the Bessel function.
Returns
-------
out : ndarray, shape = x.shape, dtype = float
The modified Bessel function evaluated at each of the elements of `x`.
See Also
-----... | python | numpy/lib/_function_base_impl.py | 3,533 | [
"x"
] | false | 3 | 7.04 | numpy/numpy | 31,054 | numpy | false | |
toCharArray | public char[] toCharArray() {
if (size == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
return ArrayUtils.arraycopy(buffer, 0, 0, size, char[]::new);
} | Copies the builder's character array into a new character array.
@return a new array that represents the contents of the builder | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,936 | [] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
setAgentSetting | @SuppressForbidden(reason = "Need to be able to manipulate APM agent-related properties to set them dynamically")
public void setAgentSetting(String key, String value) {
if (key.startsWith("global_labels.")) {
// Invalid agent setting, leftover from flattening global labels in APMJVMOptions
... | Copies a setting to the APM agent's system properties under <code>elastic.apm</code>, either
by setting the property if {@code value} has a value, or by deleting the property if it doesn't.
All permitted agent properties must be covered by the <code>write_system_properties</code> entitlement,
see the entitlement policy... | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/APMAgentSettings.java | 87 | [
"key",
"value"
] | void | true | 4 | 7.2 | elastic/elasticsearch | 75,680 | javadoc | false |
toCall | public void toCall(Runnable runnable) {
Assert.notNull(runnable, "'runnable' must not be null");
T value = getValue();
if (value != null && test(value)) {
runnable.run();
}
} | Complete the mapping by calling the specified method when the value has not
been filtered.
@param runnable the method to call if the value has not been filtered | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 338 | [
"runnable"
] | void | true | 3 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
addMessage | public void addMessage(String code, Locale locale, String msg) {
Assert.notNull(code, "Code must not be null");
Assert.notNull(locale, "Locale must not be null");
Assert.notNull(msg, "Message must not be null");
this.messageMap.computeIfAbsent(code, key -> new HashMap<>(4)).put(locale, new MessageHolder(msg, lo... | Associate the given message with the given code.
@param code the lookup code
@param locale the locale that the message should be found within
@param msg the message associated with this lookup code | java | spring-context/src/main/java/org/springframework/context/support/StaticMessageSource.java | 75 | [
"code",
"locale",
"msg"
] | void | true | 2 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
createSslContext | default SSLContext createSslContext(String protocol) {
try {
SSLContext sslContext = SSLContext.getInstance(protocol);
sslContext.init(getKeyManagers(), getTrustManagers(), null);
return sslContext;
}
catch (Exception ex) {
throw new IllegalStateException("Could not load SSL context: " + ex.getMessage... | Factory method to create a new {@link SSLContext} for the {@link #getKeyManagers()
key managers} and {@link #getTrustManagers() trust managers} managed by this
instance.
@param protocol the standard name of the SSL protocol. See
{@link SSLContext#getInstance(String)}
@return a new {@link SSLContext} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java | 83 | [
"protocol"
] | SSLContext | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
representative_combos | def representative_combos(list_1: list[str], list_2: list[str]) -> list[tuple[str, str]]:
"""
Include only representative combos from the matrix of the two lists - making sure that each of the
elements contributing is present at least once.
:param list_1: first list
:param list_2: second list
:r... | Include only representative combos from the matrix of the two lists - making sure that each of the
elements contributing is present at least once.
:param list_1: first list
:param list_2: second list
:return: list of combinations with guaranteed at least one element from each of the list | python | dev/breeze/src/airflow_breeze/utils/exclude_from_matrix.py | 22 | [
"list_1",
"list_2"
] | list[tuple[str, str]] | true | 2 | 8.08 | apache/airflow | 43,597 | sphinx | false |
maybeSendShareAcknowledgementEvent | private void maybeSendShareAcknowledgementEvent(Map<TopicIdPartition, Acknowledgements> acknowledgementsMap,
boolean checkForRenewAcknowledgements,
Optional<Integer> acquisitionLockTimeoutMs) {
if (isAcknowle... | Process acknowledgeRequestStates and prepares a list of acknowledgements to be sent in the poll().
@param currentTimeMs the current time in ms.
@return the PollResult containing zero or more acknowledgements. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 411 | [
"acknowledgementsMap",
"checkForRenewAcknowledgements",
"acquisitionLockTimeoutMs"
] | void | true | 3 | 7.6 | apache/kafka | 31,560 | javadoc | false |
from_product | def from_product(
cls,
iterables: Sequence[Iterable[Hashable]],
sortorder: int | None = None,
names: Sequence[Hashable] | Hashable | lib.NoDefault = lib.no_default,
) -> MultiIndex:
"""
Make a MultiIndex from the cartesian product of multiple iterables.
Param... | Make a MultiIndex from the cartesian product of multiple iterables.
Parameters
----------
iterables : list / sequence of iterables
Each iterable has unique labels for each level of the index.
sortorder : int or None
Level of sortedness (must be lexicographically sorted by that
level).
names : list / sequen... | python | pandas/core/indexes/multi.py | 597 | [
"cls",
"iterables",
"sortorder",
"names"
] | MultiIndex | true | 4 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
_justify | def _justify(
head: list[Sequence[str]], tail: list[Sequence[str]]
) -> tuple[list[tuple[str, ...]], list[tuple[str, ...]]]:
"""
Justify items in head and tail, so they are right-aligned when stacked.
Parameters
----------
head : list-like of list-likes of strings
tail : list-like of list-l... | Justify items in head and tail, so they are right-aligned when stacked.
Parameters
----------
head : list-like of list-likes of strings
tail : list-like of list-likes of strings
Returns
-------
tuple of list of tuples of strings
Same as head and tail, but items are right aligned when stacked
vertically.
Exam... | python | pandas/io/formats/printing.py | 471 | [
"head",
"tail"
] | tuple[list[tuple[str, ...]], list[tuple[str, ...]]] | true | 2 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
closeAll | @SuppressWarnings("CatchingUnchecked") // sneaky checked exception
private static void closeAll(BaseStream<?, ?>[] toClose) {
// If one of the streams throws an exception, continue closing the others, then throw the
// exception later. If more than one stream throws an exception, the later ones are added to t... | If a value is present in {@code optional}, returns a stream containing only that element,
otherwise returns an empty stream.
<p><b>Java 9 users:</b> use {@code optional.stream()} instead. | java | android/guava/src/com/google/common/collect/Streams.java | 157 | [
"toClose"
] | void | true | 4 | 6 | google/guava | 51,352 | javadoc | false |
isLibraryFileOrClassesDirectory | protected boolean isLibraryFileOrClassesDirectory(Archive.Entry entry) {
String name = entry.name();
if (entry.isDirectory()) {
return name.equals("BOOT-INF/classes/");
}
return name.startsWith("BOOT-INF/lib/");
} | Determine if the specified entry is a nested item that should be added to the
classpath.
@param entry the entry to check
@return {@code true} if the entry is a nested item (jar or directory) | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/Launcher.java | 183 | [
"entry"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
T | def T(self):
"""
Returns the transpose of the matrix.
Does *not* conjugate! For the complex conjugate transpose, use ``.H``.
Parameters
----------
None
Returns
-------
ret : matrix object
The (non-conjugated) transpose of the matrix... | Returns the transpose of the matrix.
Does *not* conjugate! For the complex conjugate transpose, use ``.H``.
Parameters
----------
None
Returns
-------
ret : matrix object
The (non-conjugated) transpose of the matrix.
See Also
--------
transpose, getH
Examples
--------
>>> m = np.matrix('[1, 2; 3, 4]')
>>> m
m... | python | numpy/matrixlib/defmatrix.py | 943 | [
"self"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
write | @Override
public int write(ByteBuffer src) throws IOException {
return socketChannel.write(src);
} | Writes a sequence of bytes to this channel from the given buffer.
@param src The buffer from which bytes are to be retrieved
@return The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream
@throws IOException If some other I/O error occurs | java | clients/src/main/java/org/apache/kafka/common/network/PlaintextTransportLayer.java | 137 | [
"src"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
lookup | @Override
public String lookup(final String key) {
if (map == null) {
return null;
}
return Objects.toString(map.get(key), null);
} | Looks up a String key to a String value using the map.
<p>
If the map is null, then null is returned.
The map result object is converted to a string using toString().
</p>
@param key the key to be looked up, may be null.
@return the matching value, null if no match. | java | src/main/java/org/apache/commons/lang3/text/StrLookup.java | 78 | [
"key"
] | String | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
wrapperCommit | function wrapperCommit() {
return new LodashWrapper(this.value(), this.__chain__);
} | Executes the chain sequence and returns the wrapped result.
@name commit
@memberOf _
@since 3.2.0
@category Seq
@returns {Object} Returns the new `lodash` wrapper instance.
@example
var array = [1, 2];
var wrapped = _(array).push(3);
console.log(array);
// => [1, 2]
wrapped = wrapped.commit();
console.log(array);
// =>... | javascript | lodash.js | 8,998 | [] | false | 1 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
_find_path_from_directory | def _find_path_from_directory(
base_dir_path: str | os.PathLike[str],
ignore_file_name: str,
ignore_rule_type: type[_IgnoreRule],
) -> Generator[str, None, None]:
"""
Recursively search the base path and return the list of file paths that should not be ignored.
:param base_dir_path: the base pa... | Recursively search the base path and return the list of file paths that should not be ignored.
:param base_dir_path: the base path to be searched
:param ignore_file_name: the file name containing regular expressions for files that should be ignored.
:param ignore_rule_type: the concrete class for ignore rules, which i... | python | airflow-core/src/airflow/utils/file.py | 167 | [
"base_dir_path",
"ignore_file_name",
"ignore_rule_type"
] | Generator[str, None, None] | true | 8 | 8.24 | apache/airflow | 43,597 | sphinx | false |
lazyStackTraceIsLazy | @Deprecated
@J2ktIncompatible
@GwtIncompatible // getStackTraceElementMethod
public static boolean lazyStackTraceIsLazy() {
return getStackTraceElementMethod != null && getStackTraceDepthMethod != null;
} | Returns whether {@link #lazyStackTrace} will use the special implementation described in its
documentation.
@since 19.0
@deprecated This method always returns false on JDK versions past JDK 8 and on all Android
versions. | java | android/guava/src/com/google/common/base/Throwables.java | 394 | [] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
indexOf | public static int indexOf(boolean[] array, boolean target) {
return indexOf(array, target, 0, array.length);
} | Returns the index of the first appearance of the value {@code target} in {@code array}.
<p><b>Note:</b> consider representing the array as a {@link java.util.BitSet} instead, and
using {@link java.util.BitSet#nextSetBit(int)} or {@link java.util.BitSet#nextClearBit(int)}.
@param array an array of {@code boolean} values... | java | android/guava/src/com/google/common/primitives/Booleans.java | 161 | [
"array",
"target"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
removeElements | @SafeVarargs
public static <T> T[] removeElements(final T[] array, final T... values) {
if (isEmpty(array) || isEmpty(values)) {
return clone(array);
}
final HashMap<T, MutableInt> occurrences = new HashMap<>(values.length);
for (final T v : values) {
incremen... | Removes occurrences of specified elements, in specified quantities,
from the specified array. All subsequent elements are shifted left.
For any element-to-be-removed specified in greater quantities than
contained in the original array, no change occurs beyond the
removal of the existing matching items.
<p>
This method ... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,308 | [
"array"
] | true | 6 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
appendln | public StrBuilder appendln(final StrBuilder str) {
return append(str).appendNewLine();
} | Appends another string builder followed by a new line to this string builder.
Appending null will call {@link #appendNull()}.
@param str the string builder to append
@return {@code this} instance.
@since 2.3 | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,039 | [
"str"
] | StrBuilder | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
alterReplicaLogDirs | default AlterReplicaLogDirsResult alterReplicaLogDirs(Map<TopicPartitionReplica, String> replicaAssignment) {
return alterReplicaLogDirs(replicaAssignment, new AlterReplicaLogDirsOptions());
} | Change the log directory for the specified replicas. If the replica does not exist on the broker, the result
shows REPLICA_NOT_AVAILABLE for the given replica and the replica will be created in the given log directory on the
broker when it is created later. If the replica already exists on the broker, the replica will ... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 549 | [
"replicaAssignment"
] | AlterReplicaLogDirsResult | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
manageMapIfNecessary | private Object manageMapIfNecessary(Map<?, ?> map) {
boolean containsRuntimeRefs = false;
for (Object element : map.values()) {
if (element instanceof RuntimeBeanReference) {
containsRuntimeRefs = true;
break;
}
}
if (containsRuntimeRefs) {
Map<Object, Object> managedMap = new ManagedMap<>();
... | Checks whether there are any {@link RuntimeBeanReference RuntimeBeanReferences}
inside the {@link Map} and converts it to a {@link ManagedMap} if necessary.
@param map the original Map
@return either the original map or a managed copy of it | java | spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java | 567 | [
"map"
] | Object | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
registerBeanDefinitions | public int registerBeanDefinitions(ResourceBundle rb, @Nullable String prefix) throws BeanDefinitionStoreException {
// Simply create a map and call overloaded method.
Map<String, Object> map = new HashMap<>();
Enumeration<String> keys = rb.getKeys();
while (keys.hasMoreElements()) {
String key = keys.nextEl... | Register bean definitions contained in a ResourceBundle.
<p>Similar syntax as for a Map. This method is useful to enable
standard Java internationalization support.
@param rb the ResourceBundle to load from
@param prefix a filter within the keys in the map: for example, 'beans.'
(can be empty or {@code null})
@return t... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java | 301 | [
"rb",
"prefix"
] | true | 2 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toInteger | public static int toInteger(final boolean bool, final int trueValue, final int falseValue) {
return bool ? trueValue : falseValue;
} | Converts a boolean to an int specifying the conversion values.
<pre>
BooleanUtils.toInteger(true, 1, 0) = 1
BooleanUtils.toInteger(false, 1, 0) = 0
</pre>
@param bool the to convert
@param trueValue the value to return if {@code true}
@param falseValue the value to return if {@code false}
@return the appropriat... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 903 | [
"bool",
"trueValue",
"falseValue"
] | true | 2 | 7.84 | apache/commons-lang | 2,896 | javadoc | false | |
make_gaussian_quantiles | def make_gaussian_quantiles(
*,
mean=None,
cov=1.0,
n_samples=100,
n_features=2,
n_classes=3,
shuffle=True,
random_state=None,
):
r"""Generate isotropic Gaussian and label samples by quantile.
This classification dataset is constructed by taking a multi-dimensional
standard ... | r"""Generate isotropic Gaussian and label samples by quantile.
This classification dataset is constructed by taking a multi-dimensional
standard normal distribution and defining classes separated by nested
concentric multi-dimensional spheres such that roughly equal numbers of
samples are in each class (quantiles of t... | python | sklearn/datasets/_samples_generator.py | 2,005 | [
"mean",
"cov",
"n_samples",
"n_features",
"n_classes",
"shuffle",
"random_state"
] | false | 5 | 7.28 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_find_valid_index | def _find_valid_index(self, *, how: str) -> Hashable:
"""
Retrieves the index of the first valid value.
Parameters
----------
how : {'first', 'last'}
Use this parameter to change between the first or last valid index.
Returns
-------
idx_firs... | Retrieves the index of the first valid value.
Parameters
----------
how : {'first', 'last'}
Use this parameter to change between the first or last valid index.
Returns
-------
idx_first_valid : type of index | python | pandas/core/generic.py | 11,581 | [
"self",
"how"
] | Hashable | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
stubTrue | function stubTrue() {
return true;
} | This method returns `true`.
@static
@memberOf _
@since 4.13.0
@category Util
@returns {boolean} Returns `true`.
@example
_.times(2, _.stubTrue);
// => [true, true] | javascript | lodash.js | 16,224 | [] | false | 1 | 7.12 | lodash/lodash | 61,490 | jsdoc | false | |
max | public static double max(final double... array) {
// Validates input
validateArray(array);
// Finds and returns max
double max = array[0];
for (int j = 1; j < array.length; j++) {
if (Double.isNaN(array[j])) {
return Double.NaN;
}
... | Returns the maximum value in an array.
@param array an array, must not be null or empty.
@return the maximum value in the array.
@throws NullPointerException if {@code array} is {@code null}.
@throws IllegalArgumentException if {@code array} is empty.
@see IEEE754rUtils#max(double[]) IEEE754rUtils for a version of ... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 863 | [] | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
toFullyQualifiedName | public static String toFullyQualifiedName(final Class<?> context, final String resourceName) {
Objects.requireNonNull(context, "context");
Objects.requireNonNull(resourceName, "resourceName");
return toFullyQualifiedName(context.getPackage(), resourceName);
} | Returns the fully qualified name for the resource with name {@code resourceName} relative to the given context.
<p>
Note that this method does not check whether the resource actually exists. It only constructs the name. Null inputs are not allowed.
</p>
<pre>
ClassPathUtils.toFullyQualifiedName(StringUtils.class, "Stri... | java | src/main/java/org/apache/commons/lang3/ClassPathUtils.java | 73 | [
"context",
"resourceName"
] | String | true | 1 | 6.4 | apache/commons-lang | 2,896 | javadoc | false |
get_instance | def get_instance(
self,
*,
instance_id: str,
project: str | None = None,
endpoint: str | None = None,
) -> Instance:
"""
Get a MaxCompute task instance.
.. seealso:: https://pyodps.readthedocs.io/en/latest/base-instances.html#instances
:param... | Get a MaxCompute task instance.
.. seealso:: https://pyodps.readthedocs.io/en/latest/base-instances.html#instances
:param instance_id: The ID of the instance to get.
:param project: The project ID to use.
:param endpoint: The endpoint to use.
:return: The MaxCompute task instance.
:raises ValueError: If the instance ... | python | providers/alibaba/src/airflow/providers/alibaba/cloud/hooks/maxcompute.py | 201 | [
"self",
"instance_id",
"project",
"endpoint"
] | Instance | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
resolveAutowiringValue | public static Object resolveAutowiringValue(Object autowiringValue, Class<?> requiredType) {
if (autowiringValue instanceof ObjectFactory<?> factory && !requiredType.isInstance(autowiringValue)) {
if (autowiringValue instanceof Serializable && requiredType.isInterface()) {
autowiringValue = Proxy.newProxyInsta... | Resolve the given autowiring value against the given required type,
for example, an {@link ObjectFactory} value to its actual object result.
@param autowiringValue the value to resolve
@param requiredType the type to assign the result to
@return the resolved value | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java | 134 | [
"autowiringValue",
"requiredType"
] | Object | true | 5 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
analyze | protected abstract @Nullable FailureAnalysis analyze(Throwable rootFailure, T cause); | Returns an analysis of the given {@code rootFailure}, or {@code null} if no
analysis was possible.
@param rootFailure the root failure passed to the analyzer
@param cause the actual found cause
@return the analysis or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/diagnostics/AbstractFailureAnalyzer.java | 47 | [
"rootFailure",
"cause"
] | FailureAnalysis | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
handle_url_build_error | def handle_url_build_error(
self, error: BuildError, endpoint: str, values: dict[str, t.Any]
) -> str:
"""Called by :meth:`.url_for` if a
:exc:`~werkzeug.routing.BuildError` was raised. If this returns
a value, it will be returned by ``url_for``, otherwise the error
will be r... | Called by :meth:`.url_for` if a
:exc:`~werkzeug.routing.BuildError` was raised. If this returns
a value, it will be returned by ``url_for``, otherwise the error
will be re-raised.
Each function in :attr:`url_build_error_handlers` is called with
``error``, ``endpoint`` and ``values``. If a function returns
``None`` or ... | python | src/flask/sansio/app.py | 974 | [
"self",
"error",
"endpoint",
"values"
] | str | true | 5 | 6.72 | pallets/flask | 70,946 | sphinx | false |
set_dag_run_state_to_success | def set_dag_run_state_to_success(
*,
dag: SerializedDAG,
run_id: str | None = None,
commit: bool = False,
session: SASession = NEW_SESSION,
) -> list[TaskInstance]:
"""
Set the dag run's state to success.
Set for a specific logical date and its task instances to success.
:param dag... | Set the dag run's state to success.
Set for a specific logical date and its task instances to success.
:param dag: the DAG of which to alter state
:param run_id: the run_id to start looking from
:param commit: commit DAG and tasks to be altered to the database
:param session: database session
:return: If commit is tr... | python | airflow-core/src/airflow/api/common/mark_tasks.py | 208 | [
"dag",
"run_id",
"commit",
"session"
] | list[TaskInstance] | true | 6 | 7.92 | apache/airflow | 43,597 | sphinx | false |
async_get_partitions | async def async_get_partitions(
self,
client: Any,
database_name: str,
table_name: str,
expression: str = "",
page_size: int | None = None,
max_items: int | None = 1,
) -> set[tuple]:
"""
Asynchronously retrieves the partition values for a tabl... | Asynchronously retrieves the partition values for a table.
:param database_name: The name of the catalog database where the partitions reside.
:param table_name: The name of the partitions' table.
:param expression: An expression filtering the partitions to be returned.
Please see official AWS documentation for fu... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue_catalog.py | 48 | [
"self",
"client",
"database_name",
"table_name",
"expression",
"page_size",
"max_items"
] | set[tuple] | true | 3 | 7.44 | apache/airflow | 43,597 | sphinx | false |
toString | @Override
public String toString() {
return "ClientQuotaFilter(components=" + components + ", strict=" + strict + ")";
} | @return whether the filter is strict, i.e. only includes specified components | java | clients/src/main/java/org/apache/kafka/common/quota/ClientQuotaFilter.java | 97 | [] | String | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
getUsingClassName | @SuppressWarnings("unchecked")
private @Nullable StructuredLogFormatter<E> getUsingClassName(String className) {
Object formatter = this.instantiator.instantiate(className);
if (formatter != null) {
Assert.state(formatter instanceof StructuredLogFormatter,
() -> "'%s' is not a StructuredLogFormatter".forma... | Get a new {@link StructuredLogFormatter} instance for the specified format.
@param format the format requested (either a {@link CommonStructuredLogFormat} ID
or a fully-qualified class name)
@return a new {@link StructuredLogFormatter} instance
@throws IllegalArgumentException if the format is unknown | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLogFormatterFactory.java | 134 | [
"className"
] | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
withReplacement | ConfigDataEnvironmentContributor withReplacement(ConfigDataEnvironmentContributor existing,
ConfigDataEnvironmentContributor replacement) {
if (this == existing) {
return replacement;
}
Map<ImportPhase, List<ConfigDataEnvironmentContributor>> updatedChildren = new LinkedHashMap<>(
this.children.size());... | Create a new {@link ConfigDataEnvironmentContributor} instance where an existing
child is replaced.
@param existing the existing node that should be replaced
@param replacement the replacement node that should be used instead
@return a new {@link ConfigDataEnvironmentContributor} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java | 340 | [
"existing",
"replacement"
] | ConfigDataEnvironmentContributor | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
toString | @Override
public String toString() {
if (StringUtils.hasLength(this.file)) {
return this.file;
}
return new File(this.path, "spring.log").getPath();
} | Apply log file details to {@code LOG_PATH} and {@code LOG_FILE} map entries.
@param properties the properties to apply to | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java | 101 | [] | String | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
createEntrySet | private ImmutableSet<Entry<E>> createEntrySet() {
return isEmpty() ? ImmutableSet.of() : new EntrySet();
} | @since 21.0 (present with return type {@code Set} since 2.0) | java | android/guava/src/com/google/common/collect/ImmutableMultiset.java | 358 | [] | true | 2 | 6.32 | google/guava | 51,352 | javadoc | false | |
isInterfaceProxied | @Override
public boolean isInterfaceProxied(Class<?> ifc) {
for (Class<?> proxyIntf : this.interfaces) {
if (ifc.isAssignableFrom(proxyIntf)) {
return true;
}
}
return false;
} | Remove a proxied interface.
<p>Does nothing if the given interface isn't proxied.
@param ifc the interface to remove from the proxy
@return {@code true} if the interface was removed; {@code false}
if the interface was not found and hence could not be removed | java | spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java | 258 | [
"ifc"
] | true | 2 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
cumsum | def cumsum(self, numeric_only: bool = False, *args, **kwargs) -> NDFrameT:
"""
Cumulative sum for each group.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
*args : tuple
Positional arguments to ... | Cumulative sum for each group.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
*args : tuple
Positional arguments to be passed to `func`.
**kwargs : dict
Additional/specific keyword arguments to be passed to the function,
such as `numeric_only` and `sk... | python | pandas/core/groupby/groupby.py | 4,914 | [
"self",
"numeric_only"
] | NDFrameT | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
_values_for_factorize | def _values_for_factorize(self) -> tuple[np.ndarray, Any]:
"""
Return an array and missing value suitable for factorization.
Returns
-------
values : ndarray
An array suitable for factorization. This should maintain order
and be a supported dtype (Float64... | Return an array and missing value suitable for factorization.
Returns
-------
values : ndarray
An array suitable for factorization. This should maintain order
and be a supported dtype (Float64, Int64, UInt64, String, Object).
By default, the extension array is cast to object dtype.
na_value : object
Th... | python | pandas/core/arrays/base.py | 1,605 | [
"self"
] | tuple[np.ndarray, Any] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | unknown | false |
on_post_execution | def on_post_execution(**kwargs):
"""
Call callbacks after execution.
As it's being called after execution, it can capture status of execution,
duration, etc. Note that any exception from callback will be logged but
won't be propagated.
:param kwargs:
:return: None
"""
logger.debug(... | Call callbacks after execution.
As it's being called after execution, it can capture status of execution,
duration, etc. Note that any exception from callback will be logged but
won't be propagated.
:param kwargs:
:return: None | python | airflow-core/src/airflow/utils/cli_action_loggers.py | 87 | [] | false | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false | |
getLoggerConfigurations | @Override
public List<LoggerConfiguration> getLoggerConfigurations() {
List<LoggerConfiguration> result = new ArrayList<>();
getAllLoggers().forEach((name, loggerConfig) -> result.add(convertLoggerConfig(name, loggerConfig)));
result.sort(CONFIGURATION_COMPARATOR);
return result;
} | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 390 | [] | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
query_task | def query_task(self, *ids):
"""Return detail of tasks currently executed by workers.
Arguments:
*ids (str): IDs of tasks to be queried.
Returns:
Dict: Dictionary ``{HOSTNAME: {TASK_ID: [STATE, TASK_INFO]}}``.
Here is the list of ``TASK_INFO`` fields:
... | Return detail of tasks currently executed by workers.
Arguments:
*ids (str): IDs of tasks to be queried.
Returns:
Dict: Dictionary ``{HOSTNAME: {TASK_ID: [STATE, TASK_INFO]}}``.
Here is the list of ``TASK_INFO`` fields:
* ``id`` - ID of the task
* ``name`` - Name of the task
* ``args`` - Positina... | python | celery/app/control.py | 340 | [
"self"
] | false | 3 | 7.28 | celery/celery | 27,741 | google | false | |
whenNot | public Source<T> whenNot(Predicate<T> predicate) {
Assert.notNull(predicate, "'predicate' must not be null");
return when(predicate.negate());
} | Return a filtered version of the source that won't map values that match the
given predicate.
@param predicate the predicate used to filter values
@return a new filtered source instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 266 | [
"predicate"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
putmask | def putmask(self, mask, value: MultiIndex) -> MultiIndex:
"""
Return a new MultiIndex of the values set with the mask.
Parameters
----------
mask : array like
value : MultiIndex
Must either be the same length as self or length one
Returns
---... | Return a new MultiIndex of the values set with the mask.
Parameters
----------
mask : array like
value : MultiIndex
Must either be the same length as self or length one
Returns
-------
MultiIndex | python | pandas/core/indexes/multi.py | 4,188 | [
"self",
"mask",
"value"
] | MultiIndex | true | 5 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
asof_locs | def asof_locs(
self, where: Index, mask: npt.NDArray[np.bool_]
) -> npt.NDArray[np.intp]:
"""
Return the locations (indices) of labels in the index.
As in the :meth:`pandas.Index.asof`, if the label (a particular entry in
``where``) is not in the index, the latest index labe... | Return the locations (indices) of labels in the index.
As in the :meth:`pandas.Index.asof`, if the label (a particular entry in
``where``) is not in the index, the latest index label up to the
passed label is chosen and its index returned.
If all of the labels in the index are later than a label in ``where``,
-1 is r... | python | pandas/core/indexes/base.py | 5,714 | [
"self",
"where",
"mask"
] | npt.NDArray[np.intp] | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
ordered | def ordered(self) -> Ordered:
"""
Whether the categories have an ordered relationship.
See Also
--------
set_ordered : Set the ordered attribute.
as_ordered : Set the Categorical to be ordered.
as_unordered : Set the Categorical to be unordered.
Examples... | Whether the categories have an ordered relationship.
See Also
--------
set_ordered : Set the ordered attribute.
as_ordered : Set the Categorical to be ordered.
as_unordered : Set the Categorical to be unordered.
Examples
--------
For :class:`pandas.Series`:
>>> ser = pd.Series(["a", "b", "c", "a"], dtype="category")... | python | pandas/core/arrays/categorical.py | 851 | [
"self"
] | Ordered | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | unknown | false |
appendSeparator | public StrBuilder appendSeparator(final String separator) {
return appendSeparator(separator, null);
} | Appends a separator if the builder is currently non-empty.
Appending a null separator will have no effect.
The separator is appended using {@link #append(String)}.
<p>
This method is useful for adding a separator each time around the
loop except the first.
</p>
<pre>
for (Iterator it = list.iterator(); it.hasNext(); ) ... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,298 | [
"separator"
] | StrBuilder | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
newProxy | @Override
public <T> T newProxy(
T target, Class<T> interfaceType, long timeoutDuration, TimeUnit timeoutUnit) {
checkNotNull(target);
checkNotNull(interfaceType);
checkNotNull(timeoutUnit);
checkPositiveTimeout(timeoutDuration);
checkArgument(interfaceType.isInterface(), "interfaceType must... | Creates a TimeLimiter instance using the given executor service to execute method calls.
<p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
up, any time callers spend waiting for a thread may count toward their time limit, and in this
case the call may even time out before th... | java | android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java | 75 | [
"target",
"interfaceType",
"timeoutDuration",
"timeoutUnit"
] | T | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
defaultProperties | public Set<Property> defaultProperties() {
return defaultProperties;
} | @return a set representing the default properties for this database | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/Database.java | 221 | [] | true | 1 | 6.16 | elastic/elasticsearch | 75,680 | javadoc | false | |
fetchOffsets | public CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> fetchOffsets(
final Set<TopicPartition> partitions,
final long deadlineMs) {
if (partitions.isEmpty()) {
return CompletableFuture.completedFuture(Collections.emptyMap());
}
CompletableFuture<Map<TopicPar... | Enqueue a request to fetch committed offsets, that will be sent on the next call to {@link #poll(long)}.
@param partitions Partitions to fetch offsets for.
@param deadlineMs Time until which the request should be retried if it fails
with expected retriable errors.
@return Future that... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 513 | [
"partitions",
"deadlineMs"
] | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
getEnterpriseGeoIpTaskState | @Nullable
static EnterpriseGeoIpTaskState getEnterpriseGeoIpTaskState(ProjectMetadata projectMetadata) {
PersistentTasksCustomMetadata.PersistentTask<?> task = getTaskWithId(
projectMetadata,
EnterpriseGeoIpTask.ENTERPRISE_GEOIP_DOWNLOADER
);
return (task == null) ? n... | Retrieves the geoip downloader's task state from the cluster state. This may return null in some circumstances,
for example if the geoip downloader task hasn't been created yet (which it wouldn't be if it's disabled).
@param projectMetadata the project metatdata to read the task state from
@return the geoip downloader'... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpTaskState.java | 147 | [
"projectMetadata"
] | EnterpriseGeoIpTaskState | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
getObject | @Override
public final @Nullable Properties getObject() throws IOException {
if (this.singleton) {
return this.singletonInstance;
}
else {
return createProperties();
}
} | Set whether a shared 'singleton' Properties instance should be
created, or rather a new Properties instance on each request.
<p>Default is "true" (a shared singleton). | java | spring-beans/src/main/java/org/springframework/beans/factory/config/PropertiesFactoryBean.java | 77 | [] | Properties | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
_safe_assign | def _safe_assign(X, values, *, row_indexer=None, column_indexer=None):
"""Safe assignment to a numpy array, sparse matrix, or pandas dataframe.
Parameters
----------
X : {ndarray, sparse-matrix, dataframe}
Array to be modified. It is expected to be 2-dimensional.
values : ndarray
T... | Safe assignment to a numpy array, sparse matrix, or pandas dataframe.
Parameters
----------
X : {ndarray, sparse-matrix, dataframe}
Array to be modified. It is expected to be 2-dimensional.
values : ndarray
The values to be assigned to `X`.
row_indexer : array-like, dtype={int, bool}, default=None
A 1-di... | python | sklearn/utils/_indexing.py | 380 | [
"X",
"values",
"row_indexer",
"column_indexer"
] | false | 5 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
create_location | def create_location(self, location_uri: str, **create_location_kwargs) -> str:
"""
Create a new location.
.. seealso::
- :external+boto3:py:meth:`DataSync.Client.create_location_s3`
- :external+boto3:py:meth:`DataSync.Client.create_location_smb`
- :external+b... | Create a new location.
.. seealso::
- :external+boto3:py:meth:`DataSync.Client.create_location_s3`
- :external+boto3:py:meth:`DataSync.Client.create_location_smb`
- :external+boto3:py:meth:`DataSync.Client.create_location_nfs`
- :external+boto3:py:meth:`DataSync.Client.create_location_efs`
:param loca... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/datasync.py | 67 | [
"self",
"location_uri"
] | str | true | 6 | 7.28 | apache/airflow | 43,597 | sphinx | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.