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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
applyAsInt | int applyAsInt(long value) throws E; | Applies this function to the given argument.
@param value the function argument
@return the function result
@throws E Thrown when the function fails. | java | src/main/java/org/apache/commons/lang3/function/FailableLongToIntFunction.java | 53 | [
"value"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
getPropertyAccessorForPropertyPath | protected AbstractNestablePropertyAccessor getPropertyAccessorForPropertyPath(String propertyPath) {
int pos = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(propertyPath);
// Handle nested properties recursively.
if (pos > -1) {
String nestedProperty = propertyPath.substring(0, pos);
String nes... | Recursively navigate to return a property accessor for the nested property path.
@param propertyPath property path, which may be nested
@return a property accessor for the target bean | java | spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java | 816 | [
"propertyPath"
] | AbstractNestablePropertyAccessor | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
toProxyConfigString | String toProxyConfigString(); | As {@code toString()} will normally be delegated to the target,
this returns the equivalent for the AOP proxy.
@return a string description of the proxy configuration | java | spring-aop/src/main/java/org/springframework/aop/framework/Advised.java | 233 | [] | String | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
initializeReportSignalHandlers | function initializeReportSignalHandlers() {
if (getOptionValue('--report-on-signal')) {
const { addSignalHandler } = require('internal/process/report');
addSignalHandler();
}
} | Patch the process object with legacy properties and normalizations.
Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.
Replace `process.argv[1]` with the resolved absolute file path of the entry point, if found.
@param {boolean} expandArgv1 - Whether to replac... | javascript | lib/internal/process/pre_execution.js | 452 | [] | false | 2 | 6.8 | nodejs/node | 114,839 | jsdoc | false | |
get | @Override
public final T get() throws ConcurrentException {
T result;
while ((result = reference.get()) == getNoInit()) {
if (factory.compareAndSet(null, this)) {
try {
reference.set(initialize());
} catch (final Throwable t) {
... | Gets (and initialize, if not initialized yet) the required object.
@return lazily initialized object.
@throws ConcurrentException if the initialization of the object causes an exception. | java | src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java | 126 | [] | T | true | 5 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
hashCode | @Override
public int hashCode() {
int hashCode = 1;
int n = size();
for (int i = 0; i < n; i++) {
hashCode = 31 * hashCode + get(i).hashCode();
hashCode = ~~hashCode;
// needed to deal with GWT integer overflow
}
return hashCode;
} | Returns a view of this immutable list in reverse order. For example, {@code ImmutableList.of(1,
2, 3).reverse()} is equivalent to {@code ImmutableList.of(3, 2, 1)}.
@return a view of this immutable list in reverse order
@since 7.0 | java | android/guava/src/com/google/common/collect/ImmutableList.java | 677 | [] | true | 2 | 8.24 | google/guava | 51,352 | javadoc | false | |
compareTo | @Override
public int compareTo(TimeValue timeValue) {
double thisValue = ((double) duration) * timeUnit.toNanos(1);
double otherValue = ((double) timeValue.duration) * timeValue.timeUnit.toNanos(1);
return Double.compare(thisValue, otherValue);
} | @param sValue Value to parse, which may be {@code null}.
@param defaultValue Value to return if {@code sValue} is {@code null}.
@param settingName Name of the parameter or setting. On invalid input, this value is included in the exception message. Otherwise,
this parameter is unused.
@return ... | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 452 | [
"timeValue"
] | true | 1 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false | |
andThen | default FailableByteConsumer<E> andThen(final FailableByteConsumer<E> after) {
Objects.requireNonNull(after);
return (final byte t) -> {
accept(t);
after.accept(t);
};
} | Returns a composed {@link FailableByteConsumer} like {@link IntConsumer#andThen(IntConsumer)}.
@param after the operation to perform after this one.
@return a composed {@link FailableByteConsumer} like {@link IntConsumer#andThen(IntConsumer)}.
@throws NullPointerException if {@code after} is null | java | src/main/java/org/apache/commons/lang3/function/FailableByteConsumer.java | 62 | [
"after"
] | true | 1 | 6.24 | apache/commons-lang | 2,896 | javadoc | false | |
get_instances | def get_instances(self, filters: list | None = None, instance_ids: list | None = None) -> list:
"""
Get list of instance details, optionally applying filters and selective instance ids.
:param instance_ids: List of ids to get instances for
:param filters: List of filters to specify inst... | Get list of instance details, optionally applying filters and selective instance ids.
:param instance_ids: List of ids to get instances for
:param filters: List of filters to specify instances to get
:return: List of instances | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/ec2.py | 151 | [
"self",
"filters",
"instance_ids"
] | list | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
createConcurrentMapCache | protected Cache createConcurrentMapCache(String name) {
SerializationDelegate actualSerialization = (isStoreByValue() ? this.serialization : null);
return new ConcurrentMapCache(name, new ConcurrentHashMap<>(256), isAllowNullValues(), actualSerialization);
} | Create a new ConcurrentMapCache instance for the specified cache name.
@param name the name of the cache
@return the ConcurrentMapCache (or a decorator thereof) | java | spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCacheManager.java | 215 | [
"name"
] | Cache | true | 2 | 7.68 | spring-projects/spring-framework | 59,386 | javadoc | false |
toClass | public static Class<?>[] toClass(final Object... array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return ArrayUtils.EMPTY_CLASS_ARRAY;
}
return ArrayUtils.setAll(new Class[array.length], i -> array[i] == null ? null : array[i].getClass... | Converts an array of {@link Object} in to an array of {@link Class} objects. If any of these objects is null, a null element will be inserted into the
array.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array an {@link Object} array.
@return a {@link Class} array, {@code null} if nul... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 1,566 | [] | true | 4 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
enhanceStackTrace | function enhanceStackTrace(err, own) {
let ctorInfo = '';
try {
const { name } = this.constructor;
if (name !== 'EventEmitter')
ctorInfo = ` on ${name} instance`;
} catch {
// Continue regardless of error.
}
const sep = `\nEmitted 'error' event${ctorInfo} at:\n`;
const errStack = ArrayPro... | Returns the current max listener value for the event emitter.
@returns {number} | javascript | lib/events.js | 423 | [
"err",
"own"
] | false | 4 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
getTarget | public Object getTarget() {
if (this.cacheKeyGenerator != null) {
return this.cacheKeyGenerator;
}
Assert.state(this.keyGenerator != null, "No key generator");
return this.keyGenerator;
} | Return the target key generator to use in the form of either a {@link KeyGenerator}
or a {@link CacheKeyGenerator}. | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/KeyGeneratorAdapter.java | 78 | [] | Object | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
handle_removed_files | def handle_removed_files(self, known_files: dict[str, set[DagFileInfo]]):
"""
Remove from data structures the files that are missing.
Also, terminate processes that may be running on those removed files.
:param known_files: structure containing known files per-bundle
:return: N... | Remove from data structures the files that are missing.
Also, terminate processes that may be running on those removed files.
:param known_files: structure containing known files per-bundle
:return: None | python | airflow-core/src/airflow/dag_processing/manager.py | 786 | [
"self",
"known_files"
] | true | 2 | 7.76 | apache/airflow | 43,597 | sphinx | false | |
_safe_split | def _safe_split(estimator, X, y, indices, train_indices=None):
"""Create subset of dataset and properly handle kernels.
Slice X, y according to indices for cross-validation, but take care of
precomputed kernel-matrices or pairwise affinities / distances.
If ``estimator._pairwise is True``, X needs to ... | Create subset of dataset and properly handle kernels.
Slice X, y according to indices for cross-validation, but take care of
precomputed kernel-matrices or pairwise affinities / distances.
If ``estimator._pairwise is True``, X needs to be square and
we slice rows and columns. If ``train_indices`` is not None,
we slic... | python | sklearn/utils/metaestimators.py | 112 | [
"estimator",
"X",
"y",
"indices",
"train_indices"
] | false | 9 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
defineLabel | function defineLabel(): Label {
if (!labelOffsets) {
labelOffsets = [];
}
const label = nextLabelId;
nextLabelId++;
labelOffsets[label] = -1;
return label;
} | Defines a label, uses as the target of a Break operation. | typescript | src/compiler/transformers/generators.ts | 2,109 | [] | true | 2 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
_get_leaf_sorter | def _get_leaf_sorter(labels: list[np.ndarray]) -> npt.NDArray[np.intp]:
"""
Returns sorter for the inner most level while preserving the
order of higher levels.
Parameters
----------
labels : list[np.ndarray]
Each ndarray has signe... | Returns sorter for the inner most level while preserving the
order of higher levels.
Parameters
----------
labels : list[np.ndarray]
Each ndarray has signed integer dtype, not necessarily identical.
Returns
-------
np.ndarray[np.intp] | python | pandas/core/indexes/base.py | 4,721 | [
"labels"
] | npt.NDArray[np.intp] | true | 4 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
from | public static <V> CacheLoader<Object, V> from(Supplier<V> supplier) {
return new SupplierToCacheLoader<>(supplier);
} | Returns a cache loader based on an <i>existing</i> supplier instance. Note that there's no need
to create a <i>new</i> supplier just to pass it in here; just subclass {@code CacheLoader} and
implement {@link #load load} instead.
<p>The returned object is serializable if {@code supplier} is serializable.
@param supplier... | java | android/guava/src/com/google/common/cache/CacheLoader.java | 156 | [
"supplier"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
generate_custom_op_choices | def generate_custom_op_choices(
self,
name: str,
decompositions: list[Callable[..., Any]],
input_nodes: list[Buffer],
non_tensor_args: list[dict[str, Any]],
default_impl: Callable[..., Any] | None = None,
input_gen_fns: dict[int, Callable[[Any], torch.Tensor]] | N... | Generate multiple SubgraphChoiceCaller instances for custom op autotuning.
This method extends SubgraphTemplate to support custom op decompositions,
allowing multiple implementations to compete in autotuning.
Args:
name: Base name for the choices
decompositions: List of decomposition functions to compete in a... | python | torch/_inductor/codegen/subgraph.py | 282 | [
"self",
"name",
"decompositions",
"input_nodes",
"non_tensor_args",
"default_impl",
"input_gen_fns"
] | list[SubgraphChoiceCaller] | true | 3 | 7.52 | pytorch/pytorch | 96,034 | google | false |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return this.compareTo(((TimeValue) o)) == 0;
} | @param sValue Value to parse, which may be {@code null}.
@param defaultValue Value to return if {@code sValue} is {@code null}.
@param settingName Name of the parameter or setting. On invalid input, this value is included in the exception message. Otherwise,
this parameter is unused.
@return ... | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 435 | [
"o"
] | true | 4 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
holder | private Holder holder() {
if (holder == null) {
synchronized (data) {
if (holder == null)
holder = new Holder(data);
}
}
return holder;
} | Returns a 32-bit bitfield to represent authorized operations for this cluster. | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java | 215 | [] | Holder | true | 3 | 6.4 | apache/kafka | 31,560 | javadoc | false |
baseIndexOf | function baseIndexOf(array, value, fromIndex) {
return value === value
? strictIndexOf(array, value, fromIndex)
: baseFindIndex(array, baseIsNaN, fromIndex);
} | The base implementation of `_.indexOf` without `fromIndex` bounds checks.
@private
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} fromIndex The index to search from.
@returns {number} Returns the index of the matched value, else `-1`. | javascript | lodash.js | 832 | [
"array",
"value",
"fromIndex"
] | false | 2 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
compose | default FailableIntUnaryOperator<E> compose(final FailableIntUnaryOperator<E> before) {
Objects.requireNonNull(before);
return (final int v) -> applyAsInt(before.applyAsInt(v));
} | Returns a composed {@link FailableIntUnaryOperator} like {@link IntUnaryOperator#compose(IntUnaryOperator)}.
@param before the operator to apply before this one.
@return a composed {@link FailableIntUnaryOperator} like {@link IntUnaryOperator#compose(IntUnaryOperator)}.
@throws NullPointerException if before is null.
@... | java | src/main/java/org/apache/commons/lang3/function/FailableIntUnaryOperator.java | 86 | [
"before"
] | true | 1 | 6 | apache/commons-lang | 2,896 | javadoc | false | |
readUTF | @CanIgnoreReturnValue // to skip a field
@Override
public String readUTF() throws IOException {
return new DataInputStream(in).readUTF();
} | Reads a {@code double} as specified by {@link DataInputStream#readDouble()}, except using
little-endian byte order.
@return the next eight bytes of the input stream, interpreted as a {@code double} in
little-endian byte order
@throws IOException if an I/O error occurs | java | android/guava/src/com/google/common/io/LittleEndianDataInputStream.java | 176 | [] | String | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false |
toLong | public static long toLong(final String str, final long defaultValue) {
try {
return Long.parseLong(str);
} catch (final RuntimeException e) {
return defaultValue;
}
} | Converts a {@link String} to a {@code long}, returning a default value if the conversion fails.
<p>
If the string is {@code null}, the default value is returned.
</p>
<pre>
NumberUtils.toLong(null, 1L) = 1L
NumberUtils.toLong("", 1L) = 1L
NumberUtils.toLong("1", 0L) = 1L
</pre>
@param str the string t... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,609 | [
"str",
"defaultValue"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
construct_strides | def construct_strides(
sizes: Sequence[_IntLike],
fill_order: Sequence[int],
) -> Sequence[_IntLike]:
"""From a list of sizes and a fill order, construct the strides of the permuted tensor."""
# Initialize strides
assert len(sizes) == len(fill_order), (
"Length of sizes must match the length... | From a list of sizes and a fill order, construct the strides of the permuted tensor. | python | torch/_inductor/kernel/flex/common.py | 220 | [
"sizes",
"fill_order"
] | Sequence[_IntLike] | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
withHashes | public StandardStackTracePrinter withHashes() {
return withHashes(true);
} | Return a new {@link StandardStackTracePrinter} from this one that generates and
prints hashes for each stacktrace.
@return a new {@link StandardStackTracePrinter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 262 | [] | StandardStackTracePrinter | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
takeWhile | function takeWhile(array, predicate) {
return (array && array.length)
? baseWhile(array, getIteratee(predicate, 3))
: [];
} | Creates a slice of `array` with elements taken from the beginning. Elements
are taken until `predicate` returns falsey. The predicate is invoked with
three arguments: (value, index, array).
@static
@memberOf _
@since 3.0.0
@category Array
@param {Array} array The array to query.
@param {Function} [predicate=_.identity]... | javascript | lodash.js | 8,391 | [
"array",
"predicate"
] | false | 3 | 7.2 | lodash/lodash | 61,490 | jsdoc | false | |
commitOffsetsSync | public boolean commitOffsetsSync(Map<TopicPartition, OffsetAndMetadata> offsets, Timer timer) {
invokeCompletedOffsetCommitCallbacks();
if (offsets.isEmpty()) {
// We guarantee that the callbacks for all commitAsync() will be invoked when
// commitSync() completes, even if the u... | Commit offsets synchronously. This method will retry until the commit completes successfully
or an unrecoverable error is encountered.
@param offsets The offsets to be committed
@throws org.apache.kafka.common.errors.AuthorizationException if the consumer is not authorized to the group
or to any of the spec... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 1,142 | [
"offsets",
"timer"
] | true | 7 | 7.6 | apache/kafka | 31,560 | javadoc | false | |
to_dict | def to_dict(cls, var: Any) -> dict:
"""Stringifies DAGs and operators contained by var and returns a dict of var."""
# Clear any cached client_defaults to ensure fresh generation for this DAG
# Clear lru_cache for client defaults
SerializedBaseOperator.generate_client_defaults.cache_clea... | Stringifies DAGs and operators contained by var and returns a dict of var. | python | airflow-core/src/airflow/serialization/serialized_objects.py | 2,593 | [
"cls",
"var"
] | dict | true | 2 | 6 | apache/airflow | 43,597 | unknown | false |
__setitem__ | def __setitem__(self, key, value) -> None:
"""
Set one or more values inplace.
This method is not required to satisfy the pandas extension array
interface.
Parameters
----------
key : int, ndarray, or slice
When called from, e.g. ``Series.__setitem__... | Set one or more values inplace.
This method is not required to satisfy the pandas extension array
interface.
Parameters
----------
key : int, ndarray, or slice
When called from, e.g. ``Series.__setitem__``, ``key`` will be
one of
* scalar int
* ndarray of integers.
* boolean ndarray
* slice o... | python | pandas/core/arrays/base.py | 493 | [
"self",
"key",
"value"
] | None | true | 2 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
coordinator | public Optional<Node> coordinator() {
return Optional.ofNullable(this.coordinator);
} | Returns the current coordinator node.
@return the current coordinator node. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CoordinatorRequestManager.java | 252 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
fetchRecords | <K, V> ShareInFlightBatch<K, V> fetchRecords(final Deserializers<K, V> deserializers,
final int maxRecords,
final boolean checkCrcs) {
// Creating an empty ShareInFlightBatch
ShareInFlightBatch<K, V> inFlig... | The {@link RecordBatch batch} of {@link Record records} is converted to a {@link List list} of
{@link ConsumerRecord consumer records} and returned. {@link BufferSupplier Decompression} and
{@link Deserializer deserialization} of the {@link Record record's} key and value are performed in
this step.
@param deserializers... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareCompletedFetch.java | 175 | [
"deserializers",
"maxRecords",
"checkCrcs"
] | true | 15 | 7.68 | apache/kafka | 31,560 | javadoc | false | |
writeStartObject | @Override
public void writeStartObject() throws IOException {
if (inRoot()) {
// Use the low level generator to write the startObject so that the root
// start object is always written even if a filtered generator is used
getLowLevelGenerator().writeStartObject();
... | Reference to filtering generator because
writing an empty object '{}' when everything is filtered
out needs a specific treatment | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentGenerator.java | 141 | [] | void | true | 2 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
getOptionsDiagnosticsOfConfigFile | function getOptionsDiagnosticsOfConfigFile() {
if (!options.configFile) return emptyArray;
let diagnostics = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(options.configFile.fileName);
forEachResolvedProjectReference(resolvedRef => {
diagnostics = concatenate(... | @returns The line index marked as preceding the diagnostic, or -1 if none was. | typescript | src/compiler/program.ts | 3,269 | [] | false | 2 | 7.44 | microsoft/TypeScript | 107,154 | jsdoc | false | |
none | private <T, V> BiConsumer<T, BiConsumer<String, V>> none() {
return (item, pairs) -> {
};
} | Add pairs using nested naming (for example as used in ECS).
@param <T> the item type
@param pairs callback to add all the pairs
@return a {@link BiConsumer} for use with the {@link JsonWriter} | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java | 84 | [] | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false | |
import_optional_dependency | def import_optional_dependency(
name: str,
extra: str = "",
min_version: str | None = None,
*,
errors: Literal["raise", "warn", "ignore"] = "raise",
) -> types.ModuleType | None:
"""
Import an optional dependency.
By default, if a dependency is missing an ImportError with a nice
mes... | Import an optional dependency.
By default, if a dependency is missing an ImportError with a nice
message will be raised. If a dependency is present, but too old,
we raise.
Parameters
----------
name : str
The module name.
extra : str
Additional text to include in the ImportError message.
errors : str {'raise'... | python | pandas/compat/_optional.py | 107 | [
"name",
"extra",
"min_version",
"errors"
] | types.ModuleType | None | true | 12 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
__array__ | def __array__(
self, dtype: NpDtype | None = None, copy: bool | None = None
) -> np.ndarray:
"""
The numpy array interface.
Users should not call this directly. Rather, it is invoked by
:func:`numpy.array` and :func:`numpy.asarray`.
Parameters
----------
... | The numpy array interface.
Users should not call this directly. Rather, it is invoked by
:func:`numpy.array` and :func:`numpy.asarray`.
Parameters
----------
dtype : np.dtype or None
Specifies the dtype for the array.
copy : bool or None, optional
See :func:`numpy.asarray`.
Returns
-------
numpy.array
A... | python | pandas/core/arrays/categorical.py | 1,703 | [
"self",
"dtype",
"copy"
] | np.ndarray | true | 2 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
resolveArguments | AutowiredArguments resolveArguments(RegisteredBean registeredBean) {
Assert.notNull(registeredBean, "'registeredBean' must not be null");
return resolveArguments(registeredBean, this.lookup.get(registeredBean));
} | Resolve arguments for the specified registered bean.
@param registeredBean the registered bean
@return the resolved constructor or factory method arguments | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 239 | [
"registeredBean"
] | AutowiredArguments | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
should_cache | def should_cache(
arg: ArrayConvertible, unique_share: float = 0.7, check_count: int | None = None
) -> bool:
"""
Decides whether to do caching.
If the percent of unique elements among `check_count` elements less
than `unique_share * 100` then we can do caching.
Parameters
----------
a... | Decides whether to do caching.
If the percent of unique elements among `check_count` elements less
than `unique_share * 100` then we can do caching.
Parameters
----------
arg: listlike, tuple, 1-d array, Series
unique_share: float, default=0.7, optional
0 < unique_share < 1
check_count: int, optional
0 <= che... | python | pandas/core/tools/datetimes.py | 156 | [
"arg",
"unique_share",
"check_count"
] | bool | true | 8 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
asBindTarget | public Bindable<?> asBindTarget() {
return this.bindTarget;
} | Return a {@link Bindable} instance suitable that can be used as a target for the
{@link Binder}.
@return a bind target for use with the {@link Binder} | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java | 125 | [] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
__init__ | def __init__(
self,
input_nodes: list[Any],
scalars: Optional[dict[str, Union[float, int]]] = None,
out_dtype: Optional[torch.dtype] = None,
):
"""
Initialize with a tuple of input nodes.
Args:
input_nodes: A tuple of input nodes to store
... | Initialize with a tuple of input nodes.
Args:
input_nodes: A tuple of input nodes to store
out_dtype: Optional output dtype to store | python | torch/_inductor/kernel_inputs.py | 27 | [
"self",
"input_nodes",
"scalars",
"out_dtype"
] | true | 2 | 6.56 | pytorch/pytorch | 96,034 | google | false | |
print | public static String print(Duration value, DurationFormat.Style style, DurationFormat.@Nullable Unit unit) {
return switch (style) {
case ISO8601 -> value.toString();
case SIMPLE -> printSimple(value, unit);
case COMPOSITE -> printComposite(value);
};
} | Print the specified duration in the specified style using the given unit.
@param value the value to print
@param style the style to print in
@param unit the unit to use for printing, if relevant ({@code null} will default
to ms)
@return the printed result | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatterUtils.java | 70 | [
"value",
"style",
"unit"
] | String | true | 1 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
__init__ | def __init__(self, *, xcoms: dict[str, JsonValue] | None = None, **kwargs) -> None:
"""
Initialize the class with the specified parameters.
:param xcoms: A dictionary of XComs or None.
:param kwargs: Additional keyword arguments.
"""
if "payload" in kwargs:
r... | Initialize the class with the specified parameters.
:param xcoms: A dictionary of XComs or None.
:param kwargs: Additional keyword arguments. | python | airflow-core/src/airflow/triggers/base.py | 184 | [
"self",
"xcoms"
] | None | true | 2 | 6.88 | apache/airflow | 43,597 | sphinx | false |
visitImportCallExpression | function visitImportCallExpression(node: ImportCall, rewriteOrShim: boolean): Expression {
if (moduleKind === ModuleKind.None && languageVersion >= ScriptTarget.ES2020) {
return visitEachChild(node, visitor, context);
}
const externalModuleName = getExternalModuleNameLiteral(fact... | Visits the body of a Block to hoist declarations.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 1,208 | [
"node",
"rewriteOrShim"
] | true | 10 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
from_breaks | def from_breaks(
cls,
breaks,
closed: IntervalClosedType | None = "right",
copy: bool = False,
dtype: Dtype | None = None,
) -> Self:
"""
Construct an IntervalArray from an array of splits.
Parameters
----------
breaks : array-like (1-... | Construct an IntervalArray from an array of splits.
Parameters
----------
breaks : array-like (1-dimensional)
Left and right bounds for each interval.
closed : {'left', 'right', 'both', 'neither'}, default 'right'
Whether the intervals are closed on the left-side, right-side, both
or neither.
copy : bool, ... | python | pandas/core/arrays/interval.py | 486 | [
"cls",
"breaks",
"closed",
"copy",
"dtype"
] | Self | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
fromregex | def fromregex(file, regexp, dtype, encoding=None):
r"""
Construct an array from a text file, using regular expression parsing.
The returned array is always a structured array, and is constructed from
all matches of the regular expression in the file. Groups in the regular
expression are converted t... | r"""
Construct an array from a text file, using regular expression parsing.
The returned array is always a structured array, and is constructed from
all matches of the regular expression in the file. Groups in the regular
expression are converted to fields of the structured array.
Parameters
----------
file : file, s... | python | numpy/lib/_npyio_impl.py | 1,631 | [
"file",
"regexp",
"dtype",
"encoding"
] | false | 11 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
_construct_strides | def _construct_strides(
sizes: Sequence[int],
fill_order: Sequence[int],
) -> Sequence[int]:
"""From a list of sizes and a fill order, construct the strides of the permuted tensor."""
# Initialize strides
assert len(sizes) == len(fill_order), (
"Length of sizes must match the length of the f... | From a list of sizes and a fill order, construct the strides of the permuted tensor. | python | torch/_higher_order_ops/flex_attention.py | 35 | [
"sizes",
"fill_order"
] | Sequence[int] | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
toOffsetDateTime | public static OffsetDateTime toOffsetDateTime(final Calendar calendar) {
return OffsetDateTime.ofInstant(calendar.toInstant(), toZoneId(calendar));
} | Converts a Calendar to a OffsetDateTime.
@param calendar the Calendar to convert.
@return a OffsetDateTime.
@since 3.17.0 | java | src/main/java/org/apache/commons/lang3/time/CalendarUtils.java | 85 | [
"calendar"
] | OffsetDateTime | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
computeIndentation | function computeIndentation(
node: TextRangeWithKind,
startLine: number,
inheritedIndentation: number,
parent: Node,
parentDynamicIndentation: DynamicIndentation,
effectiveParentStartLine: number,
): { indentation: number; delta: number; } {
const delt... | Tries to compute the indentation for a list element.
If list element is not in range then
function will pick its actual indentation
so it can be pushed downstream as inherited indentation.
If list element is in the range - its indentation will be equal
to inherited indentation from its predecessors. | typescript | src/services/formatting/formatting.ts | 616 | [
"node",
"startLine",
"inheritedIndentation",
"parent",
"parentDynamicIndentation",
"effectiveParentStartLine"
] | true | 14 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
compareConstructorFit | static int compareConstructorFit(final Constructor<?> left, final Constructor<?> right, final Class<?>[] actual) {
return compareParameterTypes(Executable.of(left), Executable.of(right), actual);
} | Compares the relative fitness of two Constructors in terms of how well they match a set of runtime parameter types, such that a list ordered by the
results of the comparison would return the best match first (least).
@param left the "left" Constructor.
@param right the "right" Constructor.
@param actual the runtime ... | java | src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java | 96 | [
"left",
"right",
"actual"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
topicNameValues | public Map<String, KafkaFuture<TopicDescription>> topicNameValues() {
return nameFutures;
} | Use when {@link Admin#describeTopics(TopicCollection, DescribeTopicsOptions)} used a TopicNameCollection
@return a map from topic names to futures which can be used to check the status of
individual topics if the request used topic names, otherwise return null. | java | clients/src/main/java/org/apache/kafka/clients/admin/DescribeTopicsResult.java | 70 | [] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
initialize_flask_plugins | def initialize_flask_plugins():
"""Collect flask extension points for WEB UI (legacy)."""
global flask_blueprints
global flask_appbuilder_views
global flask_appbuilder_menu_links
if (
flask_blueprints is not None
and flask_appbuilder_views is not None
and flask_appbuilder_me... | Collect flask extension points for WEB UI (legacy). | python | airflow-core/src/airflow/plugins_manager.py | 448 | [] | false | 10 | 6.24 | apache/airflow | 43,597 | unknown | false | |
delete | def delete(
self, loc: int | np.integer | list[int] | npt.NDArray[np.integer]
) -> Self:
"""
Make new Index with passed location(-s) deleted.
Parameters
----------
loc : int or list of int
Location of item(-s) which will be deleted.
Use a list... | Make new Index with passed location(-s) deleted.
Parameters
----------
loc : int or list of int
Location of item(-s) which will be deleted.
Use a list of locations to delete more than one value at the same time.
Returns
-------
Index
Will be same type as self, except for RangeIndex.
See Also
--------
num... | python | pandas/core/indexes/base.py | 7,009 | [
"self",
"loc"
] | Self | true | 3 | 8.64 | pandas-dev/pandas | 47,362 | numpy | false |
_json_to_gemm_operation | def _json_to_gemm_operation(cls, json_dict: dict[str, Any]) -> "GemmOperation": # type: ignore[name-defined] # noqa: F821
"""Convert JSON dict to GemmOperation object.
Args:
json_dict: Dictionary representation
Returns:
GemmOperation: Reconstructed object
"""
... | Convert JSON dict to GemmOperation object.
Args:
json_dict: Dictionary representation
Returns:
GemmOperation: Reconstructed object | python | torch/_inductor/codegen/cuda/serialization.py | 122 | [
"cls",
"json_dict"
] | "GemmOperation" | true | 4 | 7.2 | pytorch/pytorch | 96,034 | google | false |
of | public static CorrelationIdFormatter of(String @Nullable [] spec) {
return of((spec != null) ? List.of(spec) : Collections.emptyList());
} | Create a new {@link CorrelationIdFormatter} instance from the given specification.
@param spec a pre-separated specification
@return a new {@link CorrelationIdFormatter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/CorrelationIdFormatter.java | 147 | [
"spec"
] | CorrelationIdFormatter | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
parse | @Override
boolean parse(final FastDateParser parser, final Calendar calendar, final String source, final ParsePosition pos, final int maxWidth) {
int idx = pos.getIndex();
int last = source.length();
if (maxWidth == 0) {
// if no maxWidth, strip leading white... | Make any modifications to parsed integer
@param parser The parser
@param iValue The parsed integer
@return The modified value | java | src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 277 | [
"parser",
"calendar",
"source",
"pos",
"maxWidth"
] | true | 8 | 7.28 | apache/commons-lang | 2,896 | javadoc | false | |
copy_object | def copy_object(
self,
source_bucket_key: str,
dest_bucket_key: str,
source_bucket_name: str | None = None,
dest_bucket_name: str | None = None,
source_version_id: str | None = None,
acl_policy: str | None = None,
meta_data_directive: str | None = None,
... | Create a copy of an object that is already stored in S3.
.. seealso::
- :external+boto3:py:meth:`S3.Client.copy_object`
Note: the S3 connection used here needs to have access to both
source and destination bucket/key.
:param source_bucket_key: The key of the source object.
It can be either full s3:// style ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 1,379 | [
"self",
"source_bucket_key",
"dest_bucket_key",
"source_bucket_name",
"dest_bucket_name",
"source_version_id",
"acl_policy",
"meta_data_directive"
] | None | true | 5 | 6.8 | apache/airflow | 43,597 | sphinx | false |
withBindMethod | public Bindable<T> withBindMethod(@Nullable BindMethod bindMethod) {
Assert.state(bindMethod != BindMethod.VALUE_OBJECT || this.value == null,
() -> "Value object binding cannot be used with an existing or supplied value");
return new Bindable<>(this.type, this.boxedType, this.value, this.annotations, this.bind... | Create an updated {@link Bindable} instance with a specific bind method. To use
{@link BindMethod#VALUE_OBJECT value object binding}, the current instance must not
have an existing or supplied value.
@param bindMethod the method to use to bind the bindable
@return an updated {@link Bindable}
@since 3.0.8 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | 240 | [
"bindMethod"
] | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
execute | def execute(self, context: Context) -> str:
"""
Execute AWS Glue Crawler from Airflow.
:return: the name of the current glue crawler.
"""
crawler_name = self.config["Name"]
if self.hook.has_crawler(crawler_name):
self.hook.update_crawler(**self.config)
... | Execute AWS Glue Crawler from Airflow.
:return: the name of the current glue crawler. | python | providers/amazon/src/airflow/providers/amazon/aws/operators/glue_crawler.py | 87 | [
"self",
"context"
] | str | true | 5 | 6.88 | apache/airflow | 43,597 | unknown | false |
get_na_values | def get_na_values(col, na_values, na_fvalues, keep_default_na: bool):
"""
Get the NaN values for a given column.
Parameters
----------
col : str
The name of the column.
na_values : array-like, dict
The object listing the NaN values as strings.
na_fvalues : array-like, dict
... | Get the NaN values for a given column.
Parameters
----------
col : str
The name of the column.
na_values : array-like, dict
The object listing the NaN values as strings.
na_fvalues : array-like, dict
The object listing the NaN values as floats.
keep_default_na : bool
If `na_values` is a dict, and the c... | python | pandas/io/parsers/base_parser.py | 836 | [
"col",
"na_values",
"na_fvalues",
"keep_default_na"
] | true | 6 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false | |
onSuccess | default @Nullable Object onSuccess(ConfigurationPropertyName name, Bindable<?> target, BindContext context,
Object result) {
return result;
} | Called when binding of an element ends with a successful result. Implementations
may change the ultimately returned result or perform addition validation.
@param name the name of the element being bound
@param target the item being bound
@param context the bind context
@param result the bound result (never {@code null}... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindHandler.java | 61 | [
"name",
"target",
"context",
"result"
] | Object | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
getStackTrace | public static String getStackTrace(final Throwable throwable) {
if (throwable == null) {
return StringUtils.EMPTY;
}
final StringWriter sw = new StringWriter();
throwable.printStackTrace(new PrintWriter(sw, true));
return sw.toString();
} | Gets the stack trace from a Throwable as a String, including suppressed and cause exceptions.
<p>
The result of this method vary by JDK version as this method
uses {@link Throwable#printStackTrace(java.io.PrintWriter)}.
</p>
@param throwable the {@link Throwable} to be examined, may be null.
@return the stack trace as... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 465 | [
"throwable"
] | String | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
stat | function stat(path, options = { bigint: false }, callback) {
if (typeof options === 'function') {
callback = options;
options = kEmptyObject;
}
callback = makeStatsCallback(callback);
const req = new FSReqCallback(options.bigint);
req.oncomplete = callback;
binding.stat(getValidatedPath(path), opti... | Asynchronously gets the stats of a file.
@param {string | Buffer | URL} path
@param {{ bigint?: boolean; }} [options]
@param {(
err?: Error,
stats?: Stats
) => any} callback
@returns {void} | javascript | lib/fs.js | 1,617 | [
"path",
"callback"
] | false | 2 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
get_db_cluster_snapshot_state | def get_db_cluster_snapshot_state(self, snapshot_id: str) -> str:
"""
Get the current state of a DB cluster snapshot.
.. seealso::
- :external+boto3:py:meth:`RDS.Client.describe_db_cluster_snapshots`
:param snapshot_id: The ID of the target DB cluster.
:return: Retu... | Get the current state of a DB cluster snapshot.
.. seealso::
- :external+boto3:py:meth:`RDS.Client.describe_db_cluster_snapshots`
:param snapshot_id: The ID of the target DB cluster.
:return: Returns the status of the DB cluster snapshot as a string (eg. "available")
:raises AirflowNotFoundException: If the DB cl... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/rds.py | 99 | [
"self",
"snapshot_id"
] | str | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
handleError | protected void handleError(Throwable ex, Method method, @Nullable Object... params) throws Exception {
if (Future.class.isAssignableFrom(method.getReturnType())) {
ReflectionUtils.rethrowException(ex);
}
else {
// Could not transmit the exception to the caller with default executor
try {
this.excepti... | Handles a fatal error thrown while asynchronously invoking the specified
{@link Method}.
<p>If the return type of the method is a {@link Future} object, the original
exception can be propagated by just throwing it at the higher level. However,
for all other cases, the exception will not be transmitted back to the clien... | java | spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java | 307 | [
"ex",
"method"
] | void | true | 3 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
finalizeSplitBatches | private void finalizeSplitBatches(Deque<ProducerBatch> batches) {
// Chain all split batch ProduceRequestResults to the original batch's produceFuture
// Ensures the original batch's future doesn't complete until all split batches complete
for (ProducerBatch splitBatch : batches) {
p... | Finalize the state of a batch. Final state, once set, is immutable. This function may be called
once or twice on a batch. It may be called twice if
1. An inflight batch expires before a response from the broker is received. The batch's final
state is set to FAILED. But it could succeed on the broker and second time aro... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java | 379 | [
"batches"
] | void | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
electLeaders | default ElectLeadersResult electLeaders(ElectionType electionType, Set<TopicPartition> partitions) {
return electLeaders(electionType, partitions, new ElectLeadersOptions());
} | Elect a replica as leader for topic partitions.
<p>
This is a convenience method for {@link #electLeaders(ElectionType, Set, ElectLeadersOptions)}
with default options.
@param electionType The type of election to conduct.
@param partitions The topics and partitions for which to conduct elections.
@return The ElectLea... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,092 | [
"electionType",
"partitions"
] | ElectLeadersResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
contains | public boolean contains(final char ch) {
synchronized (set) {
return set.stream().anyMatch(range -> range.contains(ch));
}
} | Does the {@link CharSet} contain the specified
character {@code ch}.
@param ch the character to check for
@return {@code true} if the set contains the characters | java | src/main/java/org/apache/commons/lang3/CharSet.java | 220 | [
"ch"
] | true | 1 | 6.72 | apache/commons-lang | 2,896 | javadoc | false | |
paired_euclidean_distances | def paired_euclidean_distances(X, Y):
"""Compute the paired euclidean distances between X and Y.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Input array/matrix X.
Y : {array-like, sparse matrix} o... | Compute the paired euclidean distances between X and Y.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Input array/matrix X.
Y : {array-like, sparse matrix} of shape (n_samples, n_features)
Input array/matrix Y.
Returns
--... | python | sklearn/metrics/pairwise.py | 1,187 | [
"X",
"Y"
] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
parameterize | public static final ParameterizedType parameterize(final Class<?> rawClass, final Map<TypeVariable<?>, Type> typeVariableMap) {
Objects.requireNonNull(rawClass, "rawClass");
Objects.requireNonNull(typeVariableMap, "typeVariableMap");
return parameterizeWithOwner(null, rawClass, extractTypeArgume... | Creates a parameterized type instance.
@param rawClass the raw class to create a parameterized type instance for.
@param typeVariableMap the map used for parameterization.
@return {@link ParameterizedType}.
@throws NullPointerException if either {@code rawClass} or {@code typeVariableMap} is {@code null}.
@since... | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,388 | [
"rawClass",
"typeVariableMap"
] | ParameterizedType | true | 1 | 6.4 | apache/commons-lang | 2,896 | javadoc | false |
estimatedSizeInBytes | public int estimatedSizeInBytes() {
return builtRecords != null ? builtRecords.sizeInBytes() : estimatedBytesWritten();
} | Get an estimate of the number of bytes written to the underlying buffer. The returned value
is exactly correct if the record set is not compressed or if the builder has been closed. | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java | 899 | [] | true | 2 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
to_clipboard | def to_clipboard(
obj, excel: bool | None = True, sep: str | None = None, **kwargs
) -> None: # pragma: no cover
"""
Attempt to write text representation of object to the system clipboard
The clipboard can be then pasted into Excel for example.
Parameters
----------
obj : the object to wri... | Attempt to write text representation of object to the system clipboard
The clipboard can be then pasted into Excel for example.
Parameters
----------
obj : the object to write to the clipboard
excel : bool, defaults to True
if True, use the provided separator, writing in a csv
format for allowing easy ... | python | pandas/io/clipboards.py | 135 | [
"obj",
"excel",
"sep"
] | None | true | 9 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
getBeansWithAnnotation | @Override
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) {
String[] beanNames = getBeanNamesForAnnotation(annotationType);
Map<String, Object> result = CollectionUtils.newLinkedHashMap(beanNames.length);
for (String beanName : beanNames) {
Object beanInstance = g... | Check whether the specified bean would need to be eagerly initialized
in order to determine its type.
@param factoryBeanName a factory-bean reference that the bean definition
defines a factory method for
@return whether eager initialization is necessary | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 786 | [
"annotationType"
] | true | 2 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
validate_indices | def validate_indices(indices: np.ndarray, n: int) -> None:
"""
Perform bounds-checking for an indexer.
-1 is allowed for indicating missing values.
Parameters
----------
indices : ndarray
n : int
Length of the array being indexed.
Raises
------
ValueError
Examples... | Perform bounds-checking for an indexer.
-1 is allowed for indicating missing values.
Parameters
----------
indices : ndarray
n : int
Length of the array being indexed.
Raises
------
ValueError
Examples
--------
>>> validate_indices(np.array([1, 2]), 3) # OK
>>> validate_indices(np.array([1, -2]), 3)
Traceback... | python | pandas/core/indexers/utils.py | 189 | [
"indices",
"n"
] | None | true | 4 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false |
arccos | def arccos(x):
"""
Compute the inverse cosine of x.
Return the "principal value" (for a description of this, see
`numpy.arccos`) of the inverse cosine of `x`. For real `x` such that
`abs(x) <= 1`, this is a real number in the closed interval
:math:`[0, \\pi]`. Otherwise, the complex principle ... | Compute the inverse cosine of x.
Return the "principal value" (for a description of this, see
`numpy.arccos`) of the inverse cosine of `x`. For real `x` such that
`abs(x) <= 1`, this is a real number in the closed interval
:math:`[0, \\pi]`. Otherwise, the complex principle value is returned.
Parameters
----------
x... | python | numpy/lib/_scimath_impl.py | 496 | [
"x"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
flatnotmasked_edges | def flatnotmasked_edges(a):
"""
Find the indices of the first and last unmasked values.
Expects a 1-D `MaskedArray`, returns None if all values are masked.
Parameters
----------
a : array_like
Input 1-D `MaskedArray`
Returns
-------
edges : ndarray or None
The indi... | Find the indices of the first and last unmasked values.
Expects a 1-D `MaskedArray`, returns None if all values are masked.
Parameters
----------
a : array_like
Input 1-D `MaskedArray`
Returns
-------
edges : ndarray or None
The indices of first and last non-masked value in the array.
Returns None if all... | python | numpy/ma/extras.py | 1,869 | [
"a"
] | false | 5 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
getMetadata | public CandidateComponentsMetadata getMetadata() {
CandidateComponentsMetadata metadata = new CandidateComponentsMetadata();
for (ItemMetadata item : this.metadataItems) {
metadata.add(item);
}
if (this.previousMetadata != null) {
List<ItemMetadata> items = this.previousMetadata.getItems();
for (ItemMe... | 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 | 78 | [] | CandidateComponentsMetadata | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
of | @Contract("null, _ -> null; !null, _ -> !null")
public static @Nullable OriginTrackedValue of(@Nullable Object value, @Nullable Origin origin) {
if (value == null) {
return null;
}
if (value instanceof CharSequence charSequence) {
return new OriginTrackedCharSequence(charSequence, origin);
}
return new... | Create an {@link OriginTrackedValue} containing the specified {@code value} and
{@code origin}. If the source value implements {@link CharSequence} then so will
the resulting {@link OriginTrackedValue}.
@param value the source value
@param origin the origin
@return an {@link OriginTrackedValue} or {@code null} if the s... | java | core/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java | 89 | [
"value",
"origin"
] | OriginTrackedValue | true | 3 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
ensureValid | public void ensureValid() {
if (sizeInBytes() < RECORD_OVERHEAD_V0)
throw new CorruptRecordException("Record is corrupt (crc could not be retrieved as the record is too "
+ "small, size = " + sizeInBytes() + ")");
if (!isValid())
throw new CorruptRecordExcept... | Throw an CorruptRecordException if isValid is false for this record | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 129 | [] | void | true | 3 | 6.24 | apache/kafka | 31,560 | javadoc | false |
getListByRange | function getListByRange(start: number, end: number, node: Node, sourceFile: SourceFile): NodeArray<Node> | undefined {
switch (node.kind) {
case SyntaxKind.TypeReference:
return getList((node as TypeReferenceNode).typeArguments);
case SyntaxKind.ObjectLiteralExpressio... | @param assumeNewLineBeforeCloseBrace
`false` when called on text from a real source file.
`true` when we need to assume `position` is on a newline.
This is useful for codefixes. Consider
```
function f() {
|}
```
with `position` at `|`.
When inserting some text after an open brace, we would like to get inden... | typescript | src/services/formatting/smartIndenter.ts | 489 | [
"start",
"end",
"node",
"sourceFile"
] | true | 5 | 8.32 | microsoft/TypeScript | 107,154 | jsdoc | false | |
readObject | private JSONObject readObject() throws JSONException {
JSONObject result = new JSONObject();
/* Peek to see if this is the empty object. */
int first = nextCleanInternal();
if (first == '}') {
return result;
}
else if (first != -1) {
this.pos--;
}
while (true) {
Object name = nextValue();
... | Reads a sequence of key/value pairs and the trailing closing brace '}' of an
object. The opening brace '{' should have already been read.
@return an object
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 354 | [] | JSONObject | true | 10 | 8.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
init_gradient_and_hessian | def init_gradient_and_hessian(self, n_samples, dtype=np.float64, order="F"):
"""Initialize arrays for gradients and hessians.
Unless hessians are constant, arrays are initialized with undefined values.
Parameters
----------
n_samples : int
The number of samples, usu... | Initialize arrays for gradients and hessians.
Unless hessians are constant, arrays are initialized with undefined values.
Parameters
----------
n_samples : int
The number of samples, usually passed to `fit()`.
dtype : {np.float64, np.float32}, default=np.float64
The dtype of the arrays gradient and hessian.
o... | python | sklearn/_loss/loss.py | 477 | [
"self",
"n_samples",
"dtype",
"order"
] | false | 6 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
detect | public static PeriodStyle detect(String value) {
Assert.notNull(value, "'value' must not be null");
for (PeriodStyle candidate : values()) {
if (candidate.matches(value)) {
return candidate;
}
}
throw new IllegalArgumentException("'" + value + "' is not a valid period");
} | Detect the style from the given source value.
@param value the source value
@return the period style
@throws IllegalArgumentException if the value is not a known style | java | core/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java | 208 | [
"value"
] | PeriodStyle | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
print_job_logs | def print_job_logs(
self,
job_name: str,
run_id: str,
continuation_tokens: LogContinuationTokens,
):
"""
Print the latest job logs to the Airflow task log and updates the continuation tokens.
:param continuation_tokens: the tokens where to resume from when re... | Print the latest job logs to the Airflow task log and updates the continuation tokens.
:param continuation_tokens: the tokens where to resume from when reading logs.
The object gets updated with the new tokens by this method. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue.py | 310 | [
"self",
"job_name",
"run_id",
"continuation_tokens"
] | true | 7 | 6.8 | apache/airflow | 43,597 | sphinx | false | |
handlePendingDisconnects | private void handlePendingDisconnects() {
lock.lock();
try {
while (true) {
Node node = pendingDisconnects.poll();
if (node == null)
break;
failUnsentRequests(node, DisconnectException.INSTANCE);
client.disc... | Check whether there is pending request. This includes both requests that
have been transmitted (i.e. in-flight requests) and those which are awaiting transmission.
@return A boolean indicating whether there is pending request | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java | 459 | [] | void | true | 3 | 7.92 | apache/kafka | 31,560 | javadoc | false |
substringAfter | public static String substringAfter(final String str, final int find) {
if (isEmpty(str)) {
return str;
}
final int pos = str.indexOf(find);
if (pos == INDEX_NOT_FOUND) {
return EMPTY;
}
return str.substring(pos + 1);
} | Gets the substring after the first occurrence of a separator. The separator is not returned.
<p>
A {@code null} string input will return {@code null}. An empty ("") string input will return the empty string.
</p>
<p>
If nothing is found, the empty string is returned.
</p>
<pre>
StringUtils.substringAfter(null, *) ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,204 | [
"str",
"find"
] | String | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
findPropertyType | public static Class<?> findPropertyType(String propertyName, Class<?> @Nullable ... beanClasses) {
if (beanClasses != null) {
for (Class<?> beanClass : beanClasses) {
PropertyDescriptor pd = getPropertyDescriptor(beanClass, propertyName);
if (pd != null) {
return pd.getPropertyType();
}
}
}
... | Determine the bean property type for the given property from the
given classes/interfaces, if possible.
@param propertyName the name of the bean property
@param beanClasses the classes to check against
@return the property type, or {@code Object.class} as fallback | java | spring-beans/src/main/java/org/springframework/beans/BeanUtils.java | 599 | [
"propertyName"
] | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
parse | public static CacheBuilderSpec parse(String cacheBuilderSpecification) {
CacheBuilderSpec spec = new CacheBuilderSpec(cacheBuilderSpecification);
if (!cacheBuilderSpecification.isEmpty()) {
for (String keyValuePair : KEYS_SPLITTER.split(cacheBuilderSpecification)) {
List<String> keyAndValue = Immu... | Creates a CacheBuilderSpec from a string.
@param cacheBuilderSpecification the string form | java | android/guava/src/com/google/common/cache/CacheBuilderSpec.java | 141 | [
"cacheBuilderSpecification"
] | CacheBuilderSpec | true | 3 | 6.56 | google/guava | 51,352 | javadoc | false |
_equal_values | def _equal_values(self, other: Self) -> bool:
"""
Used in .equals defined in base class. Only check the column values
assuming shape and indexes have already been checked.
"""
# For SingleBlockManager (i.e.Series)
if other.ndim != 1:
return False
left ... | Used in .equals defined in base class. Only check the column values
assuming shape and indexes have already been checked. | python | pandas/core/internals/managers.py | 2,231 | [
"self",
"other"
] | bool | true | 2 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
createInstance | protected abstract F createInstance(String pattern, TimeZone timeZone, Locale locale); | Create a format instance using the specified pattern, time zone
and locale.
@param pattern {@link java.text.SimpleDateFormat} compatible pattern, this will not be null.
@param timeZone time zone, this will not be null.
@param locale locale, this will not be null.
@return a pattern based date/time formatter.
@throws ... | java | src/main/java/org/apache/commons/lang3/time/AbstractFormatCache.java | 143 | [
"pattern",
"timeZone",
"locale"
] | F | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
sendSyncGroupRequest | private RequestFuture<ByteBuffer> sendSyncGroupRequest(SyncGroupRequest.Builder requestBuilder) {
if (coordinatorUnknown())
return RequestFuture.coordinatorNotAvailable();
return client.send(coordinator, requestBuilder)
.compose(new SyncGroupResponseHandler(generation));
... | Join the group and return the assignment for the next generation. This function handles both
JoinGroup and SyncGroup, delegating to {@link #onLeaderElected(String, String, List, boolean)} if
elected leader by the coordinator.
NOTE: This is visible only for testing
@return A request future which wraps the assignment ret... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 806 | [
"requestBuilder"
] | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
getErrorPath | private @Nullable String getErrorPath(Map<Integer, String> map, Integer status) {
if (map.containsKey(status)) {
return map.get(status);
}
return this.global;
} | Return the description for the given request. By default this method will return a
description based on the request {@code servletPath} and {@code pathInfo}.
@param request the source request
@return the description | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java | 238 | [
"map",
"status"
] | String | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
replaceAll | @Override
public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
checkNotNull(function);
Node<K, V> oldFirst = firstInKeyInsertionOrder;
clear();
for (Node<K, V> node = oldFirst; node != null; node = node.nextInKeyInsertionOrder) {
put(node.key, function.apply(node.key,... | Returns {@code true} if this BiMap contains an entry whose value is equal to {@code value} (or,
equivalently, if this inverse view contains a key that is equal to {@code value}).
<p>Due to the property that values in a BiMap are unique, this will tend to execute in
faster-than-linear time.
@param value the object to se... | java | guava/src/com/google/common/collect/HashBiMap.java | 598 | [
"function"
] | void | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false |
isExcludedFromDependencyCheck | protected boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) {
return (AutowireUtils.isExcludedFromDependencyCheck(pd) ||
this.ignoredDependencyTypes.contains(pd.getPropertyType()) ||
AutowireUtils.isSetterDefinedInInterface(pd, this.ignoredDependencyInterfaces));
} | Determine whether the given bean property is excluded from dependency checks.
<p>This implementation excludes properties defined by CGLIB and
properties whose type matches an ignored dependency type or which
are defined by an ignored dependency interface.
@param pd the PropertyDescriptor of the bean property
@return wh... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,618 | [
"pd"
] | true | 3 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
stream | public Stream<ConditionAndOutcome> stream() {
return StreamSupport.stream(spliterator(), false);
} | Return a {@link Stream} of the {@link ConditionAndOutcome} items.
@return a stream of the {@link ConditionAndOutcome} items.
@since 3.5.0 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | 249 | [] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
_tasks_by_type | def _tasks_by_type(self, name, limit=None, reverse=True):
"""Get all tasks by type.
This is slower than accessing :attr:`tasks_by_type`,
but will be ordered by time.
Returns:
Generator: giving ``(uuid, Task)`` pairs.
"""
return islice(
((uuid, ta... | Get all tasks by type.
This is slower than accessing :attr:`tasks_by_type`,
but will be ordered by time.
Returns:
Generator: giving ``(uuid, Task)`` pairs. | python | celery/events/state.py | 676 | [
"self",
"name",
"limit",
"reverse"
] | false | 1 | 6.08 | celery/celery | 27,741 | unknown | false | |
_get_index_str | def _get_index_str(self, index: sympy.Expr) -> str:
"""
Convert an index expression to a string suitable for Pallas indexing.
Pallas operates on full arrays, so we need to convert index expressions
to JAX array slicing. For example:
- x0 -> "..." (contiguous access, full array)
... | Convert an index expression to a string suitable for Pallas indexing.
Pallas operates on full arrays, so we need to convert index expressions
to JAX array slicing. For example:
- x0 -> "..." (contiguous access, full array)
- 2*x0 -> "::2" (strided access with stride 2)
- 2*x0 + 1 -> "1::2" (strided access with offset ... | python | torch/_inductor/codegen/pallas.py | 856 | [
"self",
"index"
] | str | true | 4 | 8.08 | pytorch/pytorch | 96,034 | google | false |
topicIdPartitionsToLogString | private String topicIdPartitionsToLogString(Collection<TopicIdPartition> partitions) {
if (!log.isTraceEnabled()) {
return String.format("%d partition(s)", partitions.size());
}
return "(" + partitions.stream().map(TopicIdPartition::toString).collect(Collectors.joining(", ")) + ")";
... | A builder that allows for presizing the PartitionData hashmap, and avoiding making a
secondary copy of the sessionPartitions, in cases where this is not necessarily.
This builder is primarily for use by the Replica Fetcher
@param size the initial size of the PartitionData hashmap
@param copySessionPartitions boolean ... | java | clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java | 399 | [
"partitions"
] | String | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
parseUnionOrIntersectionType | function parseUnionOrIntersectionType(
operator: SyntaxKind.BarToken | SyntaxKind.AmpersandToken,
parseConstituentType: () => TypeNode,
createTypeNode: (types: NodeArray<TypeNode>) => UnionOrIntersectionTypeNode,
): TypeNode {
const pos = getNodePos();
const isUnionType... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 4,819 | [
"operator",
"parseConstituentType",
"createTypeNode"
] | true | 7 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.