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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
equals | @Override
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}
if (other == null || getClass() != other.getClass()) {
return false;
}
AbstractBeanFactoryBasedTargetSource otherTargetSource = (AbstractBeanFactoryBasedTargetSource) other;
return (ObjectUtils.nullSafeEqual... | Copy configuration from the other AbstractBeanFactoryBasedTargetSource object.
Subclasses should override this if they wish to expose it.
@param other object to copy configuration from | java | spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java | 166 | [
"other"
] | true | 5 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
resetStateAndGeneration | private synchronized void resetStateAndGeneration(final String reason, final boolean shouldResetMemberId) {
log.info("Resetting generation {}due to: {}", shouldResetMemberId ? "and member id " : "", reason);
state = MemberState.UNJOINED;
if (shouldResetMemberId) {
generation = Gener... | Get the current generation state if the group is stable, otherwise return null
@return the current generation or null | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 1,061 | [
"reason",
"shouldResetMemberId"
] | void | true | 3 | 6.56 | apache/kafka | 31,560 | javadoc | false |
freq | def freq(self) -> BaseOffset:
"""
The frequency object of this PeriodDtype.
The `freq` property returns the `BaseOffset` object that represents the
frequency of the PeriodDtype. This frequency specifies the interval (e.g.,
daily, monthly, yearly) associated with the Period type.... | The frequency object of this PeriodDtype.
The `freq` property returns the `BaseOffset` object that represents the
frequency of the PeriodDtype. This frequency specifies the interval (e.g.,
daily, monthly, yearly) associated with the Period type. It is essential
for operations that depend on time-based calculations wit... | python | pandas/core/dtypes/dtypes.py | 1,076 | [
"self"
] | BaseOffset | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | unknown | false |
invokeListener | protected void invokeListener(ApplicationListener<?> listener, ApplicationEvent event) {
ErrorHandler errorHandler = getErrorHandler();
if (errorHandler != null) {
try {
doInvokeListener(listener, event);
}
catch (Throwable err) {
errorHandler.handleError(err);
}
}
else {
doInvokeListener... | Invoke the given listener with the given event.
@param listener the ApplicationListener to invoke
@param event the current event to propagate
@since 4.1 | java | spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java | 162 | [
"listener",
"event"
] | void | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
newHasher | @Override
public Hasher newHasher() {
Hasher[] hashers = new Hasher[functions.length];
for (int i = 0; i < hashers.length; i++) {
hashers[i] = functions[i].newHasher();
}
return fromHashers(hashers);
} | Constructs a {@code HashCode} from the {@code Hasher} objects of the functions. Each of them
has consumed the entire input and they are ready to output a {@code HashCode}. The order of the
hashers are the same order as the functions given to the constructor. | java | android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java | 53 | [] | Hasher | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false |
_permute_strides | def _permute_strides(out: torch.Tensor, query_strides: tuple[int, ...]) -> torch.Tensor:
"""
Create a new tensor with the same data and shape as the input,
but with strides permuted based on the input tensor's stride order.
Args:
out (torch.Tensor): The output tensor of attention.
query... | Create a new tensor with the same data and shape as the input,
but with strides permuted based on the input tensor's stride order.
Args:
out (torch.Tensor): The output tensor of attention.
query_strides (List[int]): The stride order of the input query tensor
Returns:
torch.Tensor: A new tensor with same s... | python | torch/_higher_order_ops/flex_attention.py | 57 | [
"out",
"query_strides"
] | torch.Tensor | true | 1 | 6.88 | pytorch/pytorch | 96,034 | google | false |
isAssignable | private static boolean isAssignable(final Type type, final Type toType, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (toType == null || toType instanceof Class<?>) {
return isAssignable(type, (Class<?>) toType);
}
if (toType instanceof ParameterizedType) {
return... | Tests if the subject type may be implicitly cast to the target type following the Java generics rules.
@param type the subject type to be assigned to the target type.
@param toType the target type.
@param typeVarAssigns optional map of type variable assignments.
@return {@code true} if {@code type} is... | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,121 | [
"type",
"toType",
"typeVarAssigns"
] | true | 7 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
createCaffeineCache | protected Cache createCaffeineCache(String name) {
return (this.asyncCacheMode ? adaptCaffeineCache(name, createAsyncCaffeineCache(name)) :
adaptCaffeineCache(name, createNativeCaffeineCache(name)));
} | Build a common {@link CaffeineCache} instance for the specified cache name,
using the common Caffeine configuration specified on this cache manager.
<p>Delegates to {@link #adaptCaffeineCache} as the adaptation method to
Spring's cache abstraction (allowing for centralized decoration etc.),
passing in a freshly built n... | java | spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java | 372 | [
"name"
] | Cache | true | 2 | 7.36 | spring-projects/spring-framework | 59,386 | javadoc | false |
toArray | public static <T> T[] toArray(@SuppressWarnings("unchecked") final T... items) {
return items;
} | Create a type-safe generic array.
<p>
The Java language does not allow an array to be created from a generic type:
</p>
<pre>
public static <T> T[] createAnArray(int size) {
return new T[size]; // compiler error here
}
public static <T> T[] createAnArray(int size) {
return (T[]) ... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,612 | [] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
get_block_type | def get_block_type(dtype: DtypeObj) -> type[Block]:
"""
Find the appropriate Block subclass to use for the given values and dtype.
Parameters
----------
dtype : numpy or pandas dtype
Returns
-------
cls : class, subclass of Block
"""
if isinstance(dtype, DatetimeTZDtype):
... | Find the appropriate Block subclass to use for the given values and dtype.
Parameters
----------
dtype : numpy or pandas dtype
Returns
-------
cls : class, subclass of Block | python | pandas/core/internals/blocks.py | 2,216 | [
"dtype"
] | type[Block] | true | 5 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
of | public static MemberPath of(String value) {
MemberPath path = MemberPath.ROOT;
StringBuilder buffer = new StringBuilder();
boolean escape = false;
for (char ch : value.toCharArray()) {
if (!escape && ch == '\\') {
escape = true;
}
else if (!escape && (ch == '.' || ch == '[')) {
path = ... | Create a new {@link MemberPath} instance from the given string.
@param value the path value
@return a new {@link MemberPath} instance | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 857 | [
"value"
] | MemberPath | true | 8 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
add | Headers add(Header header) throws IllegalStateException; | Adds a header (key inside), to the end, returning if the operation succeeded.
@param header the Header to be added.
@return this instance of the Headers, once the header is added.
@throws IllegalStateException is thrown if headers are in a read-only state. | java | clients/src/main/java/org/apache/kafka/common/header/Headers.java | 34 | [
"header"
] | Headers | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
doWith | @Nullable T doWith(MainClass mainClass); | Handle the specified main class.
@param mainClass the main class
@return a non-null value if processing should end or {@code null} to continue | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 370 | [
"mainClass"
] | T | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
getClassPathUrls | @Override
public Set<URL> getClassPathUrls(Predicate<Entry> includeFilter, Predicate<Entry> directorySearchFilter)
throws IOException {
Set<URL> urls = new LinkedHashSet<>();
LinkedList<File> files = new LinkedList<>(listFiles(this.rootDirectory));
while (!files.isEmpty()) {
File file = files.poll();
if... | Create a new {@link ExplodedArchive} instance.
@param rootDirectory the root directory | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/ExplodedArchive.java | 86 | [
"includeFilter",
"directorySearchFilter"
] | true | 6 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
searchsorted | def searchsorted(
self,
value: NumpyValueArrayLike | ExtensionArray,
side: Literal["left", "right"] = "left",
sorter: NumpySorter | None = None,
) -> npt.NDArray[np.intp] | np.intp:
"""
Find indices where elements should be inserted to maintain order.
Find th... | Find indices where elements should be inserted to maintain order.
Find the indices into a sorted array `self` (a) such that, if the
corresponding elements in `value` were inserted before the indices,
the order of `self` would be preserved.
Assuming that `self` is sorted:
====== ================================
`sid... | python | pandas/core/arrays/base.py | 1,461 | [
"self",
"value",
"side",
"sorter"
] | npt.NDArray[np.intp] | np.intp | true | 2 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
dedupAndCoalesceAndDeleteEmpty | private void dedupAndCoalesceAndDeleteEmpty() {
dedupAndCoalesce(false);
// If there was a setCount(elem, 0), those elements are still present. Eliminate them.
int size = 0;
for (int i = 0; i < length; i++) {
if (counts[i] > 0) {
elements[size] = elements[i];
counts... | Adds each element of {@code elements} to the {@code ImmutableSortedMultiset}.
@param elements the elements to add to the {@code ImmutableSortedMultiset}
@return this {@code Builder} object
@throws NullPointerException if {@code elements} is null or contains a null element | java | android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 668 | [] | void | true | 3 | 7.44 | google/guava | 51,352 | javadoc | false |
apply | def apply(self, parent, **kwargs):
"""Apply the steps in this blueprint to an object.
This will apply the ``__init__`` and ``include`` methods
of each step, with the object as argument::
step = Step(obj)
...
step.include(obj)
For :class:`StartStopSt... | Apply the steps in this blueprint to an object.
This will apply the ``__init__`` and ``include`` methods
of each step, with the object as argument::
step = Step(obj)
...
step.include(obj)
For :class:`StartStopStep` the services created
will also be added to the objects ``steps`` attribute. | python | celery/bootsteps.py | 186 | [
"self",
"parent"
] | false | 3 | 6.08 | celery/celery | 27,741 | unknown | false | |
set_caption | def set_caption(self, caption: str | tuple | list) -> Styler:
"""
Set the text added to a ``<caption>`` HTML element.
Parameters
----------
caption : str, tuple, list
For HTML output either the string input is used or the first element of the
tuple. For L... | Set the text added to a ``<caption>`` HTML element.
Parameters
----------
caption : str, tuple, list
For HTML output either the string input is used or the first element of the
tuple. For LaTeX the string input provides a caption and the additional
tuple input allows for full captions and short captions, i... | python | pandas/io/formats/style.py | 2,402 | [
"self",
"caption"
] | Styler | true | 6 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
fit | public int fit(final int element) {
return super.fit(element).intValue();
} | Fits the given value into this range by returning the given value or, if out of bounds, the range minimum if
below, or the range maximum if above.
<pre>{@code
IntegerRange range = IntegerRange.of(16, 64);
range.fit(-9) --> 16
range.fit(0) --> 16
range.fit(15) --> 16
range.fit(16) --> 16
range.fit(17) --> 17
...
r... | java | src/main/java/org/apache/commons/lang3/IntegerRange.java | 107 | [
"element"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
values | public static List<Boolean> values() {
return BOOLEAN_LIST;
} | Returns an unmodifiable list of Booleans {@code [false, true]}.
@return an unmodifiable list of Booleans {@code [false, true]}.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 1,149 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
_determine_resource | def _determine_resource() -> tuple[str, str]:
"""Determine the type of resource based on which values are present."""
if self.dagrun_id:
# The deadline is for a Dag run:
return "DagRun", f"Dag: {self.dagrun.dag_id} Run: {self.dagrun_id}"
return "Unkno... | Determine the type of resource based on which values are present. | python | airflow-core/src/airflow/models/deadline.py | 119 | [] | tuple[str, str] | true | 2 | 7.2 | apache/airflow | 43,597 | unknown | false |
findCacheOperation | protected abstract @Nullable JCacheOperation<?> findCacheOperation(Method method, @Nullable Class<?> targetType); | Subclasses need to implement this to return the caching operation
for the given method, if any.
@param method the method to retrieve the operation for
@param targetType the target class
@return the cache operation associated with this method
(or {@code null} if none) | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractFallbackJCacheOperationSource.java | 131 | [
"method",
"targetType"
] | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
close | JSONStringer close(Scope empty, Scope nonempty, String closeBracket) throws JSONException {
Scope context = peek();
if (context != nonempty && context != empty) {
throw new JSONException("Nesting problem");
}
this.stack.remove(this.stack.size() - 1);
if (context == nonempty) {
newline();
}
this.out... | Closes the current scope by appending any necessary whitespace and the given
bracket.
@param empty any necessary whitespace
@param nonempty the current scope
@param closeBracket the close bracket
@return the JSON stringer
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONStringer.java | 194 | [
"empty",
"nonempty",
"closeBracket"
] | JSONStringer | true | 4 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
equals | def equals(self, other: object) -> bool:
"""
Determine if two CategoricalIndex objects contain the same elements.
The order and orderedness of elements matters. The categories matter,
but the order of the categories matters only when ``ordered=True``.
Parameters
-------... | Determine if two CategoricalIndex objects contain the same elements.
The order and orderedness of elements matters. The categories matter,
but the order of the categories matters only when ``ordered=True``.
Parameters
----------
other : object
The CategoricalIndex object to compare with.
Returns
-------
bool
... | python | pandas/core/indexes/category.py | 275 | [
"self",
"other"
] | bool | true | 3 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false |
hasStdinWithoutTty | function hasStdinWithoutTty(): boolean {
try {
return !process.stdin.isTTY; // Via https://twitter.com/MylesBorins/status/782009479382626304
} catch (error) {
// Windows workaround for https://github.com/nodejs/node/issues/11656
}
return false;
} | Starting at the `start` port, look for a free port incrementing
by 1 until `end` inclusive. If no free port is found, undefined is returned. | typescript | src/server-main.ts | 257 | [] | true | 2 | 7.2 | microsoft/vscode | 179,840 | jsdoc | false | |
determineBasicProperties | public static Collection<? extends PropertyDescriptor> determineBasicProperties(Class<?> beanClass)
throws IntrospectionException {
Map<String, BasicPropertyDescriptor> pdMap = new TreeMap<>();
for (Method method : beanClass.getMethods()) {
String methodName = method.getName();
boolean setter;
int na... | Simple introspection algorithm for basic set/get/is accessor methods,
building corresponding JavaBeans property descriptors for them.
<p>This just supports the basic JavaBeans conventions, without indexed
properties or any customizers, and without other BeanInfo metadata.
For standard JavaBeans introspection, use the J... | java | spring-beans/src/main/java/org/springframework/beans/PropertyDescriptorUtils.java | 58 | [
"beanClass"
] | true | 19 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
shouldUseTypeOnly | function shouldUseTypeOnly(info: { addAsTypeOnly: AddAsTypeOnly; }, preferences: UserPreferences): boolean {
return needsTypeOnly(info) || !!preferences.preferTypeOnlyAutoImports && info.addAsTypeOnly !== AddAsTypeOnly.NotAllowed;
} | @param forceImportKeyword Indicates that the user has already typed `import`, so the result must start with `import`.
(In other words, do not allow `const x = require("...")` for JS files.)
@internal | typescript | src/services/codefixes/importFixes.ts | 2,033 | [
"info",
"preferences"
] | true | 3 | 6.48 | microsoft/TypeScript | 107,154 | jsdoc | false | |
timestamp | public Optional<Long> timestamp() {
if (type == StrategyType.EARLIEST)
return Optional.of(ListOffsetsRequest.EARLIEST_TIMESTAMP);
else if (type == StrategyType.LATEST)
return Optional.of(ListOffsetsRequest.LATEST_TIMESTAMP);
else if (type == StrategyType.BY_DURATION && du... | Return the timestamp to be used for the ListOffsetsRequest.
@return the timestamp for the OffsetResetStrategy,
if the strategy is EARLIEST or LATEST or duration is provided
else return Optional.empty() | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AutoOffsetResetStrategy.java | 121 | [] | true | 5 | 7.6 | apache/kafka | 31,560 | javadoc | false | |
ndindex | def ndindex(*x: int) -> Generator[tuple[int, ...]]:
"""
Generate all N-dimensional indices for a given array shape.
Given the shape of an array, an ndindex instance iterates over the N-dimensional
index of the array. At each iteration a tuple of indices is returned, the last
dimension is iterated o... | Generate all N-dimensional indices for a given array shape.
Given the shape of an array, an ndindex instance iterates over the N-dimensional
index of the array. At each iteration a tuple of indices is returned, the last
dimension is iterated over first.
This has an identical API to numpy.ndindex.
Parameters
--------... | python | sklearn/externals/array_api_extra/_lib/_utils/_helpers.py | 230 | [] | Generator[tuple[int, ...]] | true | 4 | 6.72 | scikit-learn/scikit-learn | 64,340 | numpy | false |
to_period | def to_period(self, freq=None) -> PeriodArray:
"""
Cast to PeriodArray/PeriodIndex at a particular frequency.
Converts DatetimeArray/Index to PeriodArray/PeriodIndex.
Parameters
----------
freq : str or Period, optional
One of pandas' :ref:`period aliases <t... | Cast to PeriodArray/PeriodIndex at a particular frequency.
Converts DatetimeArray/Index to PeriodArray/PeriodIndex.
Parameters
----------
freq : str or Period, optional
One of pandas' :ref:`period aliases <timeseries.period_aliases>`
or a Period object. Will be inferred by default.
Returns
-------
PeriodArra... | python | pandas/core/arrays/datetimes.py | 1,202 | [
"self",
"freq"
] | PeriodArray | true | 8 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false |
get_jit_arguments | def get_jit_arguments(engine_kwargs: dict[str, bool] | None = None) -> dict[str, bool]:
"""
Return arguments to pass to numba.JIT, falling back on pandas default JIT settings.
Parameters
----------
engine_kwargs : dict, default None
user passed keyword arguments for numba.JIT
Returns
... | Return arguments to pass to numba.JIT, falling back on pandas default JIT settings.
Parameters
----------
engine_kwargs : dict, default None
user passed keyword arguments for numba.JIT
Returns
-------
dict[str, bool]
nopython, nogil, parallel
Raises
------
NumbaUtilError | python | pandas/core/util/numba_.py | 32 | [
"engine_kwargs"
] | dict[str, bool] | true | 2 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
nankurt | def nankurt(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
mask: npt.NDArray[np.bool_] | None = None,
) -> float:
"""
Compute the sample excess kurtosis
The statistic computed here is the adjusted Fisher-Pearson standardized
moment coefficient G2, computed... | Compute the sample excess kurtosis
The statistic computed here is the adjusted Fisher-Pearson standardized
moment coefficient G2, computed directly from the second and fourth
central moment.
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
mask : ndarray[bool], optional
nan-... | python | pandas/core/nanops.py | 1,303 | [
"values",
"axis",
"skipna",
"mask"
] | float | true | 16 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
mean_poisson_deviance | def mean_poisson_deviance(y_true, y_pred, *, sample_weight=None):
"""Mean Poisson deviance regression loss.
Poisson deviance is equivalent to the Tweedie deviance with
the power parameter `power=1`.
Read more in the :ref:`User Guide <mean_tweedie_deviance>`.
Parameters
----------
y_true :... | Mean Poisson deviance regression loss.
Poisson deviance is equivalent to the Tweedie deviance with
the power parameter `power=1`.
Read more in the :ref:`User Guide <mean_tweedie_deviance>`.
Parameters
----------
y_true : array-like of shape (n_samples,)
Ground truth (correct) target values. Requires y_true >= 0.... | python | sklearn/metrics/_regression.py | 1,494 | [
"y_true",
"y_pred",
"sample_weight"
] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_get_time_truncation_expression | def _get_time_truncation_expression(
self,
column: InstrumentedAttribute[datetime | None],
granularity: Literal["hourly", "daily"],
dialect: str | None,
) -> sa.sql.elements.ColumnElement:
"""
Get database-specific time truncation expression for SQLAlchemy.
W... | Get database-specific time truncation expression for SQLAlchemy.
We want to return always timestamp for both hourly and daily truncation.
Unfortunately different databases have different functions for truncating datetime, so we need to handle
them separately.
Args:
column: The datetime column to truncate
gran... | python | airflow-core/src/airflow/api_fastapi/core_api/services/ui/calendar.py | 253 | [
"self",
"column",
"granularity",
"dialect"
] | sa.sql.elements.ColumnElement | true | 11 | 7.44 | apache/airflow | 43,597 | google | false |
bindOrCreate | public <T> T bindOrCreate(String name, Bindable<T> target, BindHandler handler) {
return bindOrCreate(ConfigurationPropertyName.of(name), target, handler);
} | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param h... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 333 | [
"name",
"target",
"handler"
] | T | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
packbits | def packbits(a, /, axis=None, bitorder="big"):
"""
packbits(a, /, axis=None, bitorder='big')
Packs the elements of a binary-valued array into bits in a uint8 array.
The result is padded to full bytes by inserting zero bits at the end.
Parameters
----------
a : array_like
An array ... | packbits(a, /, axis=None, bitorder='big')
Packs the elements of a binary-valued array into bits in a uint8 array.
The result is padded to full bytes by inserting zero bits at the end.
Parameters
----------
a : array_like
An array of integers or booleans whose elements should be packed to
bits.
axis : int, op... | python | numpy/_core/multiarray.py | 1,182 | [
"a",
"axis",
"bitorder"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
streamingIterator | @Override
public CloseableIterator<Record> streamingIterator(BufferSupplier bufferSupplier) {
// the older message format versions do not support streaming, so we return the normal iterator
return iterator(bufferSupplier);
} | Get an iterator for the nested entries contained within this batch. Note that
if the batch is not compressed, then this method will return an iterator over the
shallow record only (i.e. this object).
@return An iterator over the records contained within this batch | java | clients/src/main/java/org/apache/kafka/common/record/AbstractLegacyRecordBatch.java | 264 | [
"bufferSupplier"
] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
invokeDriver | private <K, V> void invokeDriver(
AdminApiHandler<K, V> handler,
AdminApiFuture<K, V> future,
Integer timeoutMs
) {
long currentTimeMs = time.milliseconds();
long deadlineMs = calcDeadlineMs(currentTimeMs, timeoutMs);
AdminApiDriver<K, V> driver = new AdminApiDriver<... | Forcefully terminates an ongoing transaction for a given transactional ID.
<p>
This API is intended for well-formed but long-running transactions that are known to the
transaction coordinator. It is primarily designed for supporting 2PC (two-phase commit) workflows,
where a coordinator may need to unilaterally terminat... | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 5,074 | [
"handler",
"future",
"timeoutMs"
] | void | true | 1 | 6.24 | apache/kafka | 31,560 | javadoc | false |
_get_period_range_edges | def _get_period_range_edges(
first: Period,
last: Period,
freq: BaseOffset,
closed: Literal["right", "left"] = "left",
origin: TimeGrouperOrigin = "start_day",
offset: Timedelta | None = None,
) -> tuple[Period, Period]:
"""
Adjust the provided `first` and `last` Periods to the respectiv... | Adjust the provided `first` and `last` Periods to the respective Period of
the given offset that encompasses them.
Parameters
----------
first : pd.Period
The beginning Period of the range to be adjusted.
last : pd.Period
The ending Period of the range to be adjusted.
freq : pd.DateOffset
The freq to which... | python | pandas/core/resample.py | 2,914 | [
"first",
"last",
"freq",
"closed",
"origin",
"offset"
] | tuple[Period, Period] | true | 2 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
toString | @Override
public String toString() {
String className = getClass().getName();
if (this.wrappedObject == null) {
return className + ": no wrapped object set";
}
return className + ": wrapping object [" + ObjectUtils.identityToString(this.wrappedObject) + ']';
} | Parse the given property name into the corresponding property name tokens.
@param propertyName the property name to parse
@return representation of the parsed property tokens | java | spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java | 1,004 | [] | String | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
decrement | public static InetAddress decrement(InetAddress address) {
byte[] addr = address.getAddress();
int i = addr.length - 1;
while (i >= 0 && addr[i] == (byte) 0x00) {
addr[i] = (byte) 0xff;
i--;
}
checkArgument(i >= 0, "Decrementing %s would wrap.", address);
addr[i]--;
return byte... | Returns a new InetAddress that is one less than the passed in address. This method works for
both IPv4 and IPv6 addresses.
@param address the InetAddress to decrement
@return a new InetAddress that is one less than the passed in address
@throws IllegalArgumentException if InetAddress is at the beginning of its range
@s... | java | android/guava/src/com/google/common/net/InetAddresses.java | 1,179 | [
"address"
] | InetAddress | true | 3 | 8.08 | google/guava | 51,352 | javadoc | false |
orElseThrow | public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
if (this.value == null) {
throw exceptionSupplier.get();
}
return this.value;
} | Return the object that was bound, or throw an exception to be created by the
provided supplier if no value has been bound.
@param <X> the type of the exception to be thrown
@param exceptionSupplier the supplier which will return the exception to be thrown
@return the present value
@throws X if there is no value present | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java | 127 | [
"exceptionSupplier"
] | T | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
_slow16 | private int _slow16() throws IOException {
if (_inputPtr >= _inputEnd) {
loadMoreGuaranteed();
}
int v = (_inputBuffer[_inputPtr++] & 0xFF);
if (_inputPtr >= _inputEnd) {
loadMoreGuaranteed();
}
return (v << 8) + (_inputBuffer[_inputPtr++] & 0xFF);... | Method used to decode explicit length of a variable-length value
(or, for indefinite/chunked, indicate that one is not known).
Note that long (64-bit) length is only allowed if it fits in
32-bit signed int, for now; expectation being that longer values
are always encoded as chunks. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/cbor/ESCborParser.java | 156 | [] | true | 3 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false | |
execute | def execute(self, context: Context):
"""
Execute AWS Glue Job from Airflow.
:return: the current Glue job ID.
"""
self.log.info(
"Initializing AWS Glue Job: %s. Wait for completion: %s",
self.job_name,
self.wait_for_completion,
)
... | Execute AWS Glue Job from Airflow.
:return: the current Glue job ID. | python | providers/amazon/src/airflow/providers/amazon/aws/operators/glue.py | 214 | [
"self",
"context"
] | true | 4 | 6.8 | apache/airflow | 43,597 | unknown | false | |
addClassIfPresent | private static void addClassIfPresent(Collection<Class<?>> collection, String className) {
try {
collection.add(ClassUtils.forName(className, null));
}
catch (Throwable ex) {
// Ignore
}
} | 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 | 302 | [
"collection",
"className"
] | void | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
computeNext | @Override
protected @Nullable String computeNext() {
/*
* The returned string will be from the end of the last match to the beginning of the next
* one. nextStart is the start position of the returned substring, while offset is the place
* to start looking for a separator.
*/
... | Returns the first index in {@code toSplit} after {@code separatorPosition} that does not
contain a separator. This method is only invoked after a call to {@code separatorStart}. | java | android/guava/src/com/google/common/base/Splitter.java | 550 | [] | String | true | 14 | 6.64 | google/guava | 51,352 | javadoc | false |
diff | def diff(
self,
periods: int = 1,
) -> NDFrameT:
"""
First discrete difference of element.
Calculates the difference of each element compared with another
element in the group (default is element in previous row).
Parameters
----------
period... | First discrete difference of element.
Calculates the difference of each element compared with another
element in the group (default is element in previous row).
Parameters
----------
periods : int, default 1
Periods to shift for calculating difference, accepts negative values.
Returns
-------
Series or DataFrame... | python | pandas/core/groupby/groupby.py | 5,263 | [
"self",
"periods"
] | NDFrameT | true | 5 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
booleanValue | public boolean booleanValue() {
return value;
} | Returns the value of this MutableBoolean as a boolean.
@return the boolean value represented by this object. | java | src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java | 80 | [] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
truncateIfIntegral | static std::optional<llvm::APSInt>
truncateIfIntegral(const FloatingLiteral &FloatLiteral) {
const double Value = FloatLiteral.getValueAsApproximateDouble();
if (std::fmod(Value, 1) == 0) {
if (Value >= static_cast<double>(1U << 31))
return std::nullopt;
return llvm::APSInt::get(static_cast<int64_t>(... | Returns an integer if the fractional part of a `FloatingLiteral` is `0`. | cpp | clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp | 21 | [] | true | 3 | 6.56 | llvm/llvm-project | 36,021 | doxygen | false | |
getOrigin | @SuppressWarnings("unchecked")
static <K> @Nullable Origin getOrigin(@Nullable Object source, K key) {
if (!(source instanceof OriginLookup)) {
return null;
}
try {
return ((OriginLookup<K>) source).getOrigin(key);
}
catch (Throwable ex) {
return null;
}
} | Attempt to look up the origin from the given source. If the source is not a
{@link OriginLookup} or if an exception occurs during lookup then {@code null} is
returned.
@param source the source object
@param key the key to lookup
@param <K> the key type
@return an {@link Origin} or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/origin/OriginLookup.java | 49 | [
"source",
"key"
] | Origin | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
_str_map | def _str_map(
self,
f,
na_value=lib.no_default,
dtype: NpDtype | None = None,
convert: bool = True,
):
"""
Map a callable over valid elements of the array.
Parameters
----------
f : Callable
A function to call on each non-N... | Map a callable over valid elements of the array.
Parameters
----------
f : Callable
A function to call on each non-NA element.
na_value : Scalar, optional
The value to set for NA values. Might also be used for the
fill value if the callable `f` raises an exception.
This defaults to ``self.dtype.na_valu... | python | pandas/core/strings/object_array.py | 50 | [
"self",
"f",
"na_value",
"dtype",
"convert"
] | true | 11 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false | |
register_option | def register_option(
key: str,
defval: object,
doc: str = "",
validator: Callable[[object], Any] | None = None,
cb: Callable[[str], Any] | None = None,
) -> None:
"""
Register an option in the package-wide pandas config object
Parameters
----------
key : str
Fully-qualif... | Register an option in the package-wide pandas config object
Parameters
----------
key : str
Fully-qualified key, e.g. "x.y.option - z".
defval : object
Default value of the option.
doc : str
Description of the option.
validator : Callable, optional
Function of a single argument, should raise `ValueErro... | python | pandas/_config/config.py | 521 | [
"key",
"defval",
"doc",
"validator",
"cb"
] | None | true | 11 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
complete | public void complete(T value) {
try {
if (value instanceof RuntimeException)
throw new IllegalArgumentException("The argument to complete can not be an instance of RuntimeException");
if (!result.compareAndSet(INCOMPLETE_SENTINEL, value))
throw new Illega... | Complete the request successfully. After this call, {@link #succeeded()} will return true
and the value can be obtained through {@link #value()}.
@param value corresponding value (or null if there is none)
@throws IllegalStateException if the future has already been completed
@throws IllegalArgumentException if the arg... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestFuture.java | 122 | [
"value"
] | void | true | 3 | 6.08 | apache/kafka | 31,560 | javadoc | false |
write_dag | def write_dag(
cls,
*,
dag_id: str,
bundle_name: str,
bundle_version: str | None = None,
version_number: int = 1,
session: Session = NEW_SESSION,
) -> DagVersion:
"""
Write a new DagVersion into database.
Checks if a version of the DAG... | Write a new DagVersion into database.
Checks if a version of the DAG exists and increments the version number if it does.
:param dag_id: The DAG ID.
:param version_number: The version number.
:param session: The database session.
:return: The DagVersion object. | python | airflow-core/src/airflow/models/dag_version.py | 107 | [
"cls",
"dag_id",
"bundle_name",
"bundle_version",
"version_number",
"session"
] | DagVersion | true | 2 | 8.08 | apache/airflow | 43,597 | sphinx | false |
build | public ThreadPoolTaskExecutor build() {
return configure(new ThreadPoolTaskExecutor());
} | Build a new {@link ThreadPoolTaskExecutor} instance and configure it using this
builder.
@return a configured {@link ThreadPoolTaskExecutor} instance.
@see #build(Class)
@see #configure(ThreadPoolTaskExecutor) | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskExecutorBuilder.java | 301 | [] | ThreadPoolTaskExecutor | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_current_worker_task | def get_current_worker_task():
"""Currently executing task, that was applied by the worker.
This is used to differentiate between the actual task
executed by the worker and any task that was called within
a task (using ``task.__call__`` or ``task.apply``)
"""
for task in reversed(_task_stack.st... | Currently executing task, that was applied by the worker.
This is used to differentiate between the actual task
executed by the worker and any task that was called within
a task (using ``task.__call__`` or ``task.apply``) | python | celery/_state.py | 126 | [] | false | 3 | 6.24 | celery/celery | 27,741 | unknown | false | |
_has_externally_shared_axis | def _has_externally_shared_axis(ax1: Axes, compare_axis: str) -> bool:
"""
Return whether an axis is externally shared.
Parameters
----------
ax1 : matplotlib.axes.Axes
Axis to query.
compare_axis : str
`"x"` or `"y"` according to whether the X-axis or Y-axis is being
co... | Return whether an axis is externally shared.
Parameters
----------
ax1 : matplotlib.axes.Axes
Axis to query.
compare_axis : str
`"x"` or `"y"` according to whether the X-axis or Y-axis is being
compared.
Returns
-------
bool
`True` if the axis is externally shared. Otherwise `False`.
Notes
-----
If t... | python | pandas/plotting/_matplotlib/tools.py | 342 | [
"ax1",
"compare_axis"
] | bool | true | 6 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
split_and_operate | def split_and_operate(self, func, *args, **kwargs) -> list[Block]:
"""
Split the block and apply func column-by-column.
Parameters
----------
func : Block method
*args
**kwargs
Returns
-------
List[Block]
"""
assert self.n... | Split the block and apply func column-by-column.
Parameters
----------
func : Block method
*args
**kwargs
Returns
-------
List[Block] | python | pandas/core/internals/blocks.py | 404 | [
"self",
"func"
] | list[Block] | true | 3 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
readFrom | public int readFrom(final Readable readable) throws IOException {
final int oldSize = size;
if (readable instanceof Reader) {
final Reader r = (Reader) readable;
ensureCapacity(size + 1);
int read;
while ((read = r.read(buffer, size, buffer.length - size))... | If possible, reads chars from the provided {@link Readable} directly into underlying
character buffer without making extra copies.
@param readable object to read from
@return the number of characters read
@throws IOException if an I/O error occurs.
@since 3.4
@see #appendTo(Appendable) | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,492 | [
"readable"
] | true | 6 | 7.44 | apache/commons-lang | 2,896 | javadoc | false | |
getInstant | public @Nullable Instant getInstant(String key) {
String s = get(key);
if (s != null) {
try {
return Instant.ofEpochMilli(Long.parseLong(s));
}
catch (NumberFormatException ex) {
// Not valid epoch time
}
}
return null;
} | Return the value of the specified property as an {@link Instant} or {@code null} if
the value is not a valid {@link Long} representation of an epoch time.
@param key the key of the property
@return the property value | java | core/spring-boot/src/main/java/org/springframework/boot/info/InfoProperties.java | 65 | [
"key"
] | Instant | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
visitDestructuringAssignment | function visitDestructuringAssignment(node: DestructuringAssignment, valueIsDiscarded: boolean): VisitResult<Expression> {
if (hasExportedReferenceInDestructuringTarget(node.left)) {
return flattenDestructuringAssignment(
node,
visitor,
context,
... | Visits a DestructuringAssignment to flatten destructuring to exported symbols.
@param node The node to visit. | typescript | src/compiler/transformers/module/system.ts | 1,643 | [
"node",
"valueIsDiscarded"
] | true | 2 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
replaceIn | public boolean replaceIn(final StringBuffer source, final int offset, final int length) {
if (source == null) {
return false;
}
final StrBuilder buf = new StrBuilder(length).append(source, offset, length);
if (!substitute(buf, 0, length)) {
return false;
}... | Replaces all the occurrences of variables within the given source buffer
with their matching values from the resolver.
The buffer is updated with the result.
<p>
Only the specified portion of the buffer will be processed.
The rest of the buffer is not processed, but it is not deleted.
</p>
@param source the buffer to ... | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 785 | [
"source",
"offset",
"length"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
getAnalysis | private static FailureAnalysis getAnalysis(Throwable rootFailure, Throwable cause) {
StringBuilder description = new StringBuilder(String.format("%s:%n", cause.getMessage()));
if (rootFailure != cause) {
description.append(String.format("%n Resulting Failure: %s", getExceptionTypeAndMessage(rootFailure)));
... | Analyze the given failure for missing parameter name exceptions.
@param failure the failure to analyze
@return a failure analysis or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParameterNamesFailureAnalyzer.java | 98 | [
"rootFailure",
"cause"
] | FailureAnalysis | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
nanskew | def nanskew(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
mask: npt.NDArray[np.bool_] | None = None,
) -> float:
"""
Compute the sample skewness.
The statistic computed here is the adjusted Fisher-Pearson standardized
moment coefficient G1. The algorithm ... | Compute the sample skewness.
The statistic computed here is the adjusted Fisher-Pearson standardized
moment coefficient G1. The algorithm computes this coefficient directly
from the second and third central moment.
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
mask : ndarray[... | python | pandas/core/nanops.py | 1,214 | [
"values",
"axis",
"skipna",
"mask"
] | float | true | 16 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
subarray | public static char[] subarray(final char[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
return null;
}
startIndexInclusive = max0(startIndexInclusive);
endIndexExclusive = Math.min(endIndexExclusive, array.length);
final int newSize = ... | Produces a new {@code char} array containing the elements between the start and end indices.
<p>
The start index is inclusive, the end index exclusive. Null array input produces null output.
</p>
@param array the input array.
@param startIndexInclusive the starting index. Undervalue (<0) is promoted to... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 7,816 | [
"array",
"startIndexInclusive",
"endIndexExclusive"
] | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
setPlainTextToMimePart | private void setPlainTextToMimePart(MimePart mimePart, String text) throws MessagingException {
if (getEncoding() != null) {
mimePart.setText(text, getEncoding());
}
else {
mimePart.setText(text);
}
} | Set the given plain text and HTML text as alternatives, offering
both options to the email client. Requires multipart mode.
<p><b>NOTE:</b> Invoke {@link #addInline} <i>after</i> {@code setText};
else, mail readers might not be able to resolve inline references correctly.
@param plainText the plain text for the message... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 867 | [
"mimePart",
"text"
] | void | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
visitFunctionDeclaration | function visitFunctionDeclaration(node: FunctionDeclaration): VisitResult<Statement | undefined> {
if (hasSyntacticModifier(node, ModifierFlags.Export)) {
hoistedStatements = append(
hoistedStatements,
factory.updateFunctionDeclaration(
node,
... | Visits a FunctionDeclaration, hoisting it to the outer module body function.
@param node The node to visit. | typescript | src/compiler/transformers/module/system.ts | 799 | [
"node"
] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
aws_template_fields | def aws_template_fields(*template_fields: str) -> tuple[str, ...]:
"""Merge provided template_fields with generic one and return in alphabetical order."""
if not all(isinstance(tf, str) for tf in template_fields):
msg = (
"Expected that all provided arguments are strings, but got "
... | Merge provided template_fields with generic one and return in alphabetical order. | python | providers/amazon/src/airflow/providers/amazon/aws/utils/mixins.py | 153 | [] | tuple[str, ...] | true | 2 | 6.4 | apache/airflow | 43,597 | unknown | false |
shift | public static void shift(final char[] array, final int offset) {
if (array != null) {
shift(array, 0, array.length, offset);
}
} | Shifts the order of the given char array.
<p>There is no special handling for multi-dimensional arrays. This method
does nothing for {@code null} or empty input arrays.</p>
@param array the array to shift, may be {@code null}.
@param offset
The number of positions to rotate the elements. If the offset is lar... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,929 | [
"array",
"offset"
] | void | true | 2 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
combine | @CanIgnoreReturnValue
@Override
Builder<E> combine(ImmutableSet.Builder<E> builder) {
copyIfNecessary();
Builder<E> other = (Builder<E>) builder;
for (int i = 0; i < other.n; i++) {
add(other.elements[i]);
}
return this;
} | Adds each element of {@code elements} to the {@code ImmutableSortedSet}, ignoring duplicate
elements (only the first duplicate element is added).
@param elements the elements to add to the {@code ImmutableSortedSet}
@return this {@code Builder} object
@throws NullPointerException if {@code elements} contains a null ele... | java | guava/src/com/google/common/collect/ImmutableSortedSet.java | 571 | [
"builder"
] | true | 2 | 7.28 | google/guava | 51,352 | javadoc | false | |
attrs | def attrs(self) -> dict[Hashable, Any]:
"""
Dictionary of global attributes of this dataset.
.. warning::
attrs is experimental and may change without warning.
See Also
--------
DataFrame.flags : Global flags applying to this object.
Notes
-... | Dictionary of global attributes of this dataset.
.. warning::
attrs is experimental and may change without warning.
See Also
--------
DataFrame.flags : Global flags applying to this object.
Notes
-----
Many operations that create new datasets will copy ``attrs``. Copies
are always deep so that changing ``attrs``... | python | pandas/core/generic.py | 320 | [
"self"
] | dict[Hashable, Any] | true | 1 | 6.08 | pandas-dev/pandas | 47,362 | unknown | false |
getComment | public String getComment() {
try {
return ZipString.readString(this.data, this.commentPos, this.commentLength);
}
catch (UncheckedIOException ex) {
if (ex.getCause() instanceof ClosedChannelException) {
throw new IllegalStateException("Zip content closed", ex);
}
throw ex;
}
} | Return the zip comment, if any.
@return the comment or {@code null} | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 183 | [] | String | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
randomLong | private long randomLong(final long n) {
// Extracted from o.a.c.rng.core.BaseProvider.nextLong(long)
long bits;
long val;
do {
bits = random().nextLong() >>> 1;
val = bits % n;
} while (bits - val + n - 1 < 0);
return val;
} | Generates a {@code long} value between 0 (inclusive) and the specified value (exclusive).
@param n Bound on the random number to be returned. Must be positive.
@return a random {@code long} value between 0 (inclusive) and {@code n} (exclusive). | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 425 | [
"n"
] | true | 1 | 7.2 | apache/commons-lang | 2,896 | javadoc | false | |
setMaxPollRecords | public synchronized void setMaxPollRecords(long maxPollRecords) {
if (maxPollRecords < 1) {
throw new IllegalArgumentException("MaxPollRecords must be strictly superior to 0");
}
this.maxPollRecords = maxPollRecords;
} | Sets the maximum number of records returned in a single call to {@link #poll(Duration)}.
@param maxPollRecords the max.poll.records. | java | clients/src/main/java/org/apache/kafka/clients/consumer/MockConsumer.java | 337 | [
"maxPollRecords"
] | void | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
_get_connection | def _get_connection(self, write=False):
"""Prepare the connection for action.
Arguments:
write (bool): are we a writer?
"""
if self._session is not None:
return
self._lock.acquire()
try:
if self._session is not None:
re... | Prepare the connection for action.
Arguments:
write (bool): are we a writer? | python | celery/backends/cassandra.py | 142 | [
"self",
"write"
] | false | 7 | 6 | celery/celery | 27,741 | google | false | |
hasnans | def hasnans(self) -> bool:
"""
Return True if there are any NaNs.
Enables various performance speedups.
Returns
-------
bool
See Also
--------
Series.isna : Detect missing values.
Series.notna : Detect existing (non-missing) values.
... | Return True if there are any NaNs.
Enables various performance speedups.
Returns
-------
bool
See Also
--------
Series.isna : Detect missing values.
Series.notna : Detect existing (non-missing) values.
Examples
--------
>>> s = pd.Series([1, 2, 3, None])
>>> s
0 1.0
1 2.0
2 3.0
3 NaN
dtype: float64
>>> ... | python | pandas/core/base.py | 916 | [
"self"
] | bool | true | 1 | 7.44 | pandas-dev/pandas | 47,362 | unknown | false |
rootLast | public static StandardStackTracePrinter rootLast() {
return new StandardStackTracePrinter(EnumSet.noneOf(Option.class), UNLIMITED, null, null, null, null, null,
null);
} | Return a {@link StandardStackTracePrinter} that prints the stack trace with the
root exception last (the same as {@link Throwable#printStackTrace()}).
@return a {@link StandardStackTracePrinter} that prints the stack trace root last | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 297 | [] | StandardStackTracePrinter | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
compareMultiple | function compareMultiple(object, other, orders) {
var index = -1,
objCriteria = object.criteria,
othCriteria = other.criteria,
length = objCriteria.length,
ordersLength = orders.length;
while (++index < length) {
var result = compareAscending(objCriteria[inde... | Used by `_.orderBy` to compare multiple properties of a value to another
and stable sort them.
If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
specify an order of "desc" for descending or "asc" for ascending sort order
of corresponding values.
@private
@param {Object} object The object ... | javascript | lodash.js | 4,733 | [
"object",
"other",
"orders"
] | false | 5 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
as_float_array | def as_float_array(X, *, copy=True, ensure_all_finite=True):
"""Convert an array-like to an array of floats.
The new dtype will be np.float32 or np.float64, depending on the original
type. The function can create a copy or modify the argument depending
on the argument copy.
Parameters
--------... | Convert an array-like to an array of floats.
The new dtype will be np.float32 or np.float64, depending on the original
type. The function can create a copy or modify the argument depending
on the argument copy.
Parameters
----------
X : {array-like, sparse matrix}
The input data.
copy : bool, default=True
If... | python | sklearn/utils/validation.py | 231 | [
"X",
"copy",
"ensure_all_finite"
] | false | 14 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
pad_or_backfill_inplace | def pad_or_backfill_inplace(
values: np.ndarray,
method: Literal["pad", "backfill"] = "pad",
axis: AxisInt = 0,
limit: int | None = None,
limit_area: Literal["inside", "outside"] | None = None,
) -> None:
"""
Perform an actual interpolation of values, values will be make 2-d if
needed fi... | Perform an actual interpolation of values, values will be make 2-d if
needed fills inplace, returns the result.
Parameters
----------
values: np.ndarray
Input array.
method: str, default "pad"
Interpolation method. Could be "bfill" or "pad"
axis: 0 or 1
Interpolation axis
limit: int, optional
Index lim... | python | pandas/core/missing.py | 821 | [
"values",
"method",
"axis",
"limit",
"limit_area"
] | None | true | 4 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
setitem | def setitem(self, indexer, value):
"""
Attempt self.values[indexer] = value, possibly creating a new array.
This differs from Block.setitem by not allowing setitem to change
the dtype of the Block.
Parameters
----------
indexer : tuple, list-like, array-like, sl... | Attempt self.values[indexer] = value, possibly creating a new array.
This differs from Block.setitem by not allowing setitem to change
the dtype of the Block.
Parameters
----------
indexer : tuple, list-like, array-like, slice, int
The subset of self.values to set
value : object
The value being set
Returns
-... | python | pandas/core/internals/blocks.py | 1,630 | [
"self",
"indexer",
"value"
] | false | 6 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false | |
analyzeCamelCaseWord | function analyzeCamelCaseWord(word: string): ICamelCaseAnalysis {
let upper = 0, lower = 0, alpha = 0, numeric = 0, code = 0;
for (let i = 0; i < word.length; i++) {
code = word.charCodeAt(i);
if (isUpper(code)) { upper++; }
if (isLower(code)) { lower++; }
if (isAlphanumeric(code)) { alpha++; }
if (isNumb... | Gets alternative codes to the character code passed in. This comes in the
form of an array of character codes, all of which must match _in order_ to
successfully match.
@param code The character code to check. | typescript | src/vs/base/common/filters.ts | 242 | [
"word"
] | true | 6 | 7.04 | microsoft/vscode | 179,840 | jsdoc | false | |
min | public static int min(int a, final int b, final int c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
} | Gets the minimum of three {@code int} values.
@param a value 1.
@param b value 2.
@param c value 3.
@return the smallest of the values. | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,250 | [
"a",
"b",
"c"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
convertLinkedEditInfoToRanges | function convertLinkedEditInfoToRanges(linkedEdit: LinkedEditingInfo, scriptInfo: ScriptInfo): protocol.LinkedEditingRangesBody {
const ranges = linkedEdit.ranges.map(
r => {
return {
start: scriptInfo.positionToLineOffset(r.start),
end: scriptInfo.positionTo... | @param projects Projects initially known to contain {@link initialLocation}
@param defaultProject The default project containing {@link initialLocation}
@param initialLocation Where the search operation was triggered
@param getResultsForPosition This is where you plug in `findReferences`, `renameLocation`, etc
@par... | typescript | src/server/session.ts | 4,006 | [
"linkedEdit",
"scriptInfo"
] | true | 2 | 7.12 | microsoft/TypeScript | 107,154 | jsdoc | false | |
mean | def mean(
self,
numeric_only: bool = False,
):
"""
Compute mean of groups, excluding missing values.
Parameters
----------
numeric_only : bool, default False
Include only `float`, `int` or `boolean` data.
.. versionchanged:: 2.0.0
... | Compute mean of groups, excluding missing values.
Parameters
----------
numeric_only : bool, default False
Include only `float`, `int` or `boolean` data.
.. versionchanged:: 2.0.0
numeric_only now defaults to ``False``.
Returns
-------
DataFrame or Series
Mean of values within each group.
See A... | python | pandas/core/resample.py | 1,479 | [
"self",
"numeric_only"
] | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false | |
findThreadsByName | public static Collection<Thread> findThreadsByName(final String threadName, final String threadGroupName) {
Objects.requireNonNull(threadName, "threadName");
Objects.requireNonNull(threadGroupName, "threadGroupName");
return Collections.unmodifiableCollection(findThreadGroups(predicateThreadGrou... | Finds active threads with the specified name if they belong to a thread group with the specified group name.
@param threadName The thread name.
@param threadGroupName The thread group name.
@return The threads which belongs to a thread group with the specified group name and the thread's name match the specified n... | java | src/main/java/org/apache/commons/lang3/ThreadUtils.java | 409 | [
"threadName",
"threadGroupName"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
hashCode | @Override
public final int hashCode() {
// If we have at least 4 bytes (32 bits), just take the first 4 bytes. Since this is
// already a (presumably) high-quality hash code, any four bytes of it will do.
if (bits() >= 32) {
return asInt();
}
// If we have less than 4 bytes, use them all.
... | Returns a "Java hash code" for this {@code HashCode} instance; this is well-defined (so, for
example, you can safely put {@code HashCode} instances into a {@code HashSet}) but is otherwise
probably not what you want to use. | java | android/guava/src/com/google/common/hash/HashCode.java | 383 | [] | true | 3 | 6.72 | google/guava | 51,352 | javadoc | false | |
convert_optional_dependencies_to_table | def convert_optional_dependencies_to_table(
optional_dependencies: dict[str, list[str]],
markdown: bool = True,
) -> str:
"""
Converts optional dependencies to a Markdown/RST table
:param optional_dependencies: dict of optional dependencies
:param markdown: if True, Markdown format is used else ... | Converts optional dependencies to a Markdown/RST table
:param optional_dependencies: dict of optional dependencies
:param markdown: if True, Markdown format is used else rst
:return: formatted table | python | dev/breeze/src/airflow_breeze/utils/packages.py | 634 | [
"optional_dependencies",
"markdown"
] | str | true | 5 | 7.12 | apache/airflow | 43,597 | sphinx | false |
writeIfNecessary | public void writeIfNecessary(ThrowingConsumer<List<String>> writer) {
if (this.excludes.isEmpty()) {
return;
}
List<String> lines = new ArrayList<>();
for (String exclude : this.excludes) {
int lastSlash = exclude.lastIndexOf('/');
String jar = (lastSlash != -1) ? exclude.substring(lastSlash + 1) : exc... | Write the arguments file if it is necessary.
@param writer consumer that should write the contents | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/NativeImageArgFile.java | 54 | [
"writer"
] | void | true | 3 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
addInline | public void addInline(String contentId, String inlineFilename, InputStreamSource inputStreamSource, String contentType)
throws MessagingException {
Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
if (inputStreamSource instanceof Resource resource && resource.isOpen()) {
throw new Ill... | Add an inline element to the MimeMessage, taking the content from an
{@code org.springframework.core.InputStreamResource}, and
specifying the inline fileName and content type explicitly.
<p>You can determine the content type for any given filename via a Java
Activation Framework's FileTypeMap, for example the one held ... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 1,082 | [
"contentId",
"inlineFilename",
"inputStreamSource",
"contentType"
] | void | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
getRootMimeMultipart | public final MimeMultipart getRootMimeMultipart() throws IllegalStateException {
if (this.rootMimeMultipart == null) {
throw new IllegalStateException("Not in multipart mode - " +
"create an appropriate MimeMessageHelper via a constructor that takes a 'multipart' flag " +
"if you need to set alternative ... | Return the root MIME "multipart/mixed" object, if any.
Can be used to manually add attachments.
<p>This will be the direct content of the MimeMessage,
in case of a multipart mail.
@throws IllegalStateException if this helper is not in multipart mode
@see #isMultipart
@see #getMimeMessage
@see jakarta.mail.internet.Mime... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 391 | [] | MimeMultipart | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
getErrorTypeScore | function getErrorTypeScore(error: EngineValidationError): number {
switch (error.kind) {
case 'InvalidArgumentValue':
case 'ValueTooLarge':
return 20
case 'InvalidArgumentType':
return 10
case 'RequiredArgumentMissing':
return -10
default:
return 0
}
} | Function is invoked to determine most relevant error based on its type.
Specific numbers returned from this function do not really matter, it's only
important how they compare relatively to each other.
Current logic is:
- InvalidArgumentValue/ValueTooLarge is treated as the best possible error to display
since when it ... | typescript | packages/client/src/runtime/core/errorRendering/applyUnionError.ts | 140 | [
"error"
] | true | 1 | 6.72 | prisma/prisma | 44,834 | jsdoc | false | |
aot_load | def aot_load(so_path: str, device: str) -> Callable:
"""
Loads a shared library generated by aot_compile and returns a callable
Args:
so_path: Path to the shared library
Returns:
A callable
"""
aot_compile_warning()
if device == "cpu":
runner: AOTIModelContainerRun... | Loads a shared library generated by aot_compile and returns a callable
Args:
so_path: Path to the shared library
Returns:
A callable | python | torch/_export/__init__.py | 156 | [
"so_path",
"device"
] | Callable | true | 9 | 7.12 | pytorch/pytorch | 96,034 | google | false |
immediateCancelledFuture | @SuppressWarnings("unchecked") // ImmediateCancelledFuture can work with any type
public static <V extends @Nullable Object> ListenableFuture<V> immediateCancelledFuture() {
ListenableFuture<Object> instance = ImmediateCancelledFuture.INSTANCE;
if (instance != null) {
return (ListenableFuture<V>) instan... | Creates a {@code ListenableFuture} which is cancelled immediately upon construction, so that
{@code isCancelled()} always returns {@code true}.
@since 14.0 | java | android/guava/src/com/google/common/util/concurrent/Futures.java | 174 | [] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
size | public abstract long size(); | Returns the number of points that have been added to this TDigest.
@return The sum of the weights on all centroids. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/TDigest.java | 134 | [] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
estimateTotalCost | inline unsigned estimateTotalCost(const BinaryContext &BC,
const PredicateTy &SkipPredicate,
SchedulingPolicy &SchedPolicy) {
if (SchedPolicy == SchedulingPolicy::SP_TRIVIAL)
return BC.getBinaryFunctions().size();
unsigned TotalCost = 0;
for... | A single thread pool that is used to run parallel tasks | cpp | bolt/lib/Core/ParallelUtilities.cpp | 79 | [] | true | 3 | 6.56 | llvm/llvm-project | 36,021 | doxygen | false | |
build | @Override
public ImmutableMultiset<E> build() {
requireNonNull(contents); // see the comment on the field
if (contents.size() == 0) {
return of();
}
if (isLinkedHash) {
// we need ObjectCountHashMap-backed contents, with its keys and values array in direct
// insertio... | Returns a newly-created {@code ImmutableMultiset} based on the contents of the {@code
Builder}. | java | android/guava/src/com/google/common/collect/ImmutableMultiset.java | 656 | [] | true | 3 | 6.24 | google/guava | 51,352 | javadoc | false | |
parse | T parse(String text, Locale locale) throws ParseException; | Parse a text String to produce a T.
@param text the text string
@param locale the current user locale
@return an instance of T
@throws ParseException when a parse exception occurs in a java.text parsing library
@throws IllegalArgumentException when a parse exception occurs | java | spring-context/src/main/java/org/springframework/format/Parser.java | 40 | [
"text",
"locale"
] | T | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
indexOf | public static int indexOf(final double[] array, final double valueToFind) {
return indexOf(array, valueToFind, 0);
} | Finds the index of the given value in the array.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.
</p>
@param array the array to search for the object, may be {@code null}.
@param valueToFind the value to find.
@return the index of the value within the array, {@link #I... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,491 | [
"array",
"valueToFind"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
declareModuleSymbol | function declareModuleSymbol(node: ModuleDeclaration): ModuleInstanceState {
const state = getModuleInstanceState(node);
const instantiated = state !== ModuleInstanceState.NonInstantiated;
declareSymbolAndAddToSymbolTable(
node,
instantiated ? SymbolFlags.ValueModule... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 2,388 | [
"node"
] | true | 3 | 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.