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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
search | static <T> ConfigurationPropertyState search(Iterable<T> source, Predicate<T> predicate) {
Assert.notNull(source, "'source' must not be null");
Assert.notNull(predicate, "'predicate' must not be null");
for (T item : source) {
if (predicate.test(item)) {
return PRESENT;
}
}
return ABSENT;
} | Search the given iterable using a predicate to determine if content is
{@link #PRESENT} or {@link #ABSENT}.
@param <T> the data type
@param source the source iterable to search
@param predicate the predicate used to test for presence
@return {@link #PRESENT} if the iterable contains a matching item, otherwise
{@link #A... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyState.java | 58 | [
"source",
"predicate"
] | ConfigurationPropertyState | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
packageImage | private void packageImage(Libraries libraries, AbstractJarWriter writer) throws IOException {
File source = isAlreadyPackaged() ? getBackupFile() : getSource();
try (JarFile sourceJar = new JarFile(source)) {
write(sourceJar, libraries, writer);
}
} | Create a packaged image.
@param libraries the contained libraries
@param exporter the exporter used to write the image
@throws IOException on IO error | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/ImagePackager.java | 65 | [
"libraries",
"writer"
] | void | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
apply | public <V, E extends Throwable> V apply(final FailableBiFunction<L, R, V, E> function) throws E {
return function.apply(getKey(), getValue());
} | Applies this key and value as arguments to the given function.
@param <V> The function return type.
@param <E> The kind of thrown exception or error.
@param function the consumer to call.
@return the function's return value.
@throws E Thrown when the consumer fails.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/tuple/Pair.java | 140 | [
"function"
] | V | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Op that = (Op) o;
return Objects.equals(key, that.key) && Objects.equals(value, that.value);
} | @return if set then the existing value is updated,
otherwise if null, the existing value is cleared | java | clients/src/main/java/org/apache/kafka/common/quota/ClientQuotaAlteration.java | 57 | [
"o"
] | true | 5 | 6.08 | apache/kafka | 31,560 | javadoc | false | |
box | def box(self, by: IndexLabel | None = None, **kwargs) -> PlotAccessor:
r"""
Make a box plot of the DataFrame columns.
A box plot is a method for graphically depicting groups of numerical
data through their quartiles.
The box extends from the Q1 to Q3 quartile values of the data,... | r"""
Make a box plot of the DataFrame columns.
A box plot is a method for graphically depicting groups of numerical
data through their quartiles.
The box extends from the Q1 to Q3 quartile values of the data,
with a line at the median (Q2). The whiskers extend from the edges
of box to show the range of the data. The p... | python | pandas/plotting/_core.py | 1,577 | [
"self",
"by"
] | PlotAccessor | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false |
getAsBoolean | public static <E extends Throwable> boolean getAsBoolean(final FailableBooleanSupplier<E> supplier) {
try {
return supplier.getAsBoolean();
} catch (final Throwable t) {
throw rethrow(t);
}
} | Invokes a boolean supplier, and returns the result.
@param supplier The boolean supplier to invoke.
@param <E> The type of checked exception, which the supplier can throw.
@return The boolean, which has been created by the supplier | java | src/main/java/org/apache/commons/lang3/function/Failable.java | 422 | [
"supplier"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
get_flashed_messages | def get_flashed_messages(
with_categories: bool = False, category_filter: t.Iterable[str] = ()
) -> list[str] | list[tuple[str, str]]:
"""Pulls all flashed messages from the session and returns them.
Further calls in the same request to the function will return
the same messages. By default just the me... | Pulls all flashed messages from the session and returns them.
Further calls in the same request to the function will return
the same messages. By default just the messages are returned,
but when `with_categories` is set to ``True``, the return value will
be a list of tuples in the form ``(category, message)`` instead.... | python | src/flask/helpers.py | 344 | [
"with_categories",
"category_filter"
] | list[str] | list[tuple[str, str]] | true | 5 | 6.24 | pallets/flask | 70,946 | sphinx | false |
getFinalExpressionInChain | function getFinalExpressionInChain(node: Expression): CallExpression | PropertyAccessExpression | ElementAccessExpression | undefined {
// foo && |foo.bar === 1|; - here the right child of the && binary expression is another binary expression.
// the rightmost member of the && chain should be the leftmost chi... | Gets a property access expression which may be nested inside of a binary expression. The final
expression in an && chain will occur as the right child of the parent binary expression, unless
it is followed by a different binary operator.
@param node the right child of a binary expression or a call expression. | typescript | src/services/refactors/convertToOptionalChainExpression.ts | 292 | [
"node"
] | true | 7 | 7.2 | microsoft/TypeScript | 107,154 | jsdoc | false | |
identity | def identity(n, dtype=None):
"""
Returns the square identity matrix of given size.
Parameters
----------
n : int
Size of the returned identity matrix.
dtype : data-type, optional
Data-type of the output. Defaults to ``float``.
Returns
-------
out : matrix
`n... | Returns the square identity matrix of given size.
Parameters
----------
n : int
Size of the returned identity matrix.
dtype : data-type, optional
Data-type of the output. Defaults to ``float``.
Returns
-------
out : matrix
`n` x `n` matrix with its main diagonal set to one,
and all other elements zero... | python | numpy/matlib.py | 155 | [
"n",
"dtype"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
stopTask | private void stopTask(ProjectId projectId, Runnable onFailure) {
ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener = ActionListener.wrap(
r -> logger.debug("Stopped geoip downloader task"),
e -> {
Throwable t = e instanceof RemoteTransportException ... | Check if a processor is a pipeline processor containing at least a geoip processor. This method also updates
pipelineHasGeoProcessorById with a result for any pipelines it looks at.
@param processor Processor config.
@param downloadDatabaseOnPipelineCreation Should the download_database_on_pipeline_creation of the geoi... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java | 552 | [
"projectId",
"onFailure"
] | void | true | 6 | 7.76 | elastic/elasticsearch | 75,680 | javadoc | false |
set_flags | def set_flags(
self,
*,
copy: bool | lib.NoDefault = lib.no_default,
allows_duplicate_labels: bool | None = None,
) -> Self:
"""
Return a new object with updated flags.
This method creates a shallow copy of the original object, preserving its
underlyi... | Return a new object with updated flags.
This method creates a shallow copy of the original object, preserving its
underlying data while modifying its global flags. In particular, it allows
you to update properties such as whether duplicate labels are permitted. This
behavior is especially useful in method chains, wher... | python | pandas/core/generic.py | 403 | [
"self",
"copy",
"allows_duplicate_labels"
] | Self | true | 2 | 8.24 | pandas-dev/pandas | 47,362 | numpy | false |
processAcknowledgementEvents | void processAcknowledgementEvents() {
List<ShareAcknowledgementEvent> events = acknowledgementEventHandler.drainEvents();
if (!events.isEmpty()) {
for (ShareAcknowledgementEvent event : events) {
try {
acknowledgementEventProcessor.process(event);
... | Process acknowledgement events, if any, that were produced by the {@link ConsumerNetworkThread network thread}. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java | 1,191 | [] | void | true | 3 | 6.08 | apache/kafka | 31,560 | javadoc | false |
is_timedelta64_ns_dtype | def is_timedelta64_ns_dtype(arr_or_dtype) -> bool:
"""
Check whether the provided array or dtype is of the timedelta64[ns] dtype.
This is a very specific dtype, so generic ones like `np.timedelta64`
will return False if passed into this function.
Parameters
----------
arr_or_dtype : array-... | Check whether the provided array or dtype is of the timedelta64[ns] dtype.
This is a very specific dtype, so generic ones like `np.timedelta64`
will return False if passed into this function.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
boolean
Whether... | python | pandas/core/dtypes/common.py | 1,118 | [
"arr_or_dtype"
] | bool | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
mid | def mid(self) -> Index:
"""
Return the midpoint of each Interval in the IntervalArray as an Index.
The midpoint of an interval is calculated as the average of its
``left`` and ``right`` bounds. This property returns a ``pandas.Index`` object
containing the midpoint for each inte... | Return the midpoint of each Interval in the IntervalArray as an Index.
The midpoint of an interval is calculated as the average of its
``left`` and ``right`` bounds. This property returns a ``pandas.Index`` object
containing the midpoint for each interval.
See Also
--------
Interval.left : Return left bound for the i... | python | pandas/core/arrays/interval.py | 1,440 | [
"self"
] | Index | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | unknown | false |
buildGetInstanceMethodForConstructor | private void buildGetInstanceMethodForConstructor(MethodSpec.Builder method, ConstructorDescriptor descriptor,
javax.lang.model.element.Modifier... modifiers) {
Constructor<?> constructor = descriptor.constructor();
Class<?> publicType = descriptor.publicType();
Class<?> actualType = descriptor.actualType();
... | Generate the instance supplier code.
@param registeredBean the bean to handle
@param instantiationDescriptor the executable to use to create the bean
@return the generated code
@since 6.1.7 | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java | 218 | [
"method",
"descriptor"
] | void | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
write | @Override
public long write(ByteBuffer[] srcs) throws IOException {
return socketChannel.write(srcs);
} | Writes a sequence of bytes to this channel from the given buffer.
@param srcs The buffer from which bytes are to be retrieved
@return The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream
@throws IOException If some other I/O error occurs | java | clients/src/main/java/org/apache/kafka/common/network/PlaintextTransportLayer.java | 149 | [
"srcs"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
fuzz_valid_stride | def fuzz_valid_stride(size: tuple[int, ...]) -> tuple[int, ...]:
"""
Fuzzes PyTorch tensor strides by generating valid stride patterns for a given size.
Args:
size: Tensor shape/size as a tuple of integers
Returns:
Tuple[int, ...]: A tuple representing valid tensor strides
"""
... | Fuzzes PyTorch tensor strides by generating valid stride patterns for a given size.
Args:
size: Tensor shape/size as a tuple of integers
Returns:
Tuple[int, ...]: A tuple representing valid tensor strides | python | tools/experimental/torchfuzz/tensor_fuzzer.py | 115 | [
"size"
] | tuple[int, ...] | true | 18 | 6.8 | pytorch/pytorch | 96,034 | google | false |
addPropertyValues | public MutablePropertyValues addPropertyValues(@Nullable PropertyValues other) {
if (other != null) {
PropertyValue[] pvs = other.getPropertyValues();
for (PropertyValue pv : pvs) {
addPropertyValue(new PropertyValue(pv));
}
}
return this;
} | Copy all given PropertyValues into this object. Guarantees PropertyValue
references are independent, although it can't deep copy objects currently
referenced by individual PropertyValue objects.
@param other the PropertyValues to copy
@return this in order to allow for adding multiple property values in a chain | java | spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java | 143 | [
"other"
] | MutablePropertyValues | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
_add_delegate_accessors | def _add_delegate_accessors(
cls,
delegate,
accessors: list[str],
typ: str,
overwrite: bool = False,
accessor_mapping: Callable[[str], str] = lambda x: x,
raise_on_missing: bool = True,
) -> None:
"""
Add accessors to cls from the delegate clas... | Add accessors to cls from the delegate class.
Parameters
----------
cls
Class to add the methods/properties to.
delegate
Class to get methods/properties and docstrings.
accessors : list of str
List of accessors to add.
typ : {'property', 'method'}
overwrite : bool, default False
Overwrite the method/pr... | python | pandas/core/accessor.py | 76 | [
"cls",
"delegate",
"accessors",
"typ",
"overwrite",
"accessor_mapping",
"raise_on_missing"
] | None | true | 8 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
estimateCompressedSizeInBytes | private static int estimateCompressedSizeInBytes(int size, CompressionType compressionType) {
return compressionType == CompressionType.NONE ? size : Math.min(Math.max(size / 2, 1024), 1 << 16);
} | Get an iterator over the deep records.
@return An iterator over the records | java | clients/src/main/java/org/apache/kafka/common/record/AbstractRecords.java | 120 | [
"size",
"compressionType"
] | true | 2 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
toCalendar | public static Calendar toCalendar(final Date date) {
final Calendar c = Calendar.getInstance();
c.setTime(Objects.requireNonNull(date, "date"));
return c;
} | Converts a {@link Date} into a {@link Calendar}.
@param date the date to convert to a Calendar.
@return the created Calendar.
@throws NullPointerException if null is passed in.
@since 3.0 | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,612 | [
"date"
] | Calendar | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
getAsInt | public static <E extends Throwable> int getAsInt(final FailableIntSupplier<E> supplier) {
try {
return supplier.getAsInt();
} catch (final Throwable t) {
throw rethrow(t);
}
} | Invokes an int supplier, and returns the result.
@param supplier The int supplier to invoke.
@param <E> The type of checked exception, which the supplier can throw.
@return The int, which has been created by the supplier | java | src/main/java/org/apache/commons/lang3/function/Failable.java | 452 | [
"supplier"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
byte_bounds | def byte_bounds(a):
"""
Returns pointers to the end-points of an array.
Parameters
----------
a : ndarray
Input array. It must conform to the Python-side of the array
interface.
Returns
-------
(low, high) : tuple of 2 integers
The first integer is the first byt... | Returns pointers to the end-points of an array.
Parameters
----------
a : ndarray
Input array. It must conform to the Python-side of the array
interface.
Returns
-------
(low, high) : tuple of 2 integers
The first integer is the first byte of the array, the second
integer is just past the last byte of... | python | numpy/lib/_array_utils_impl.py | 12 | [
"a"
] | false | 6 | 7.84 | numpy/numpy | 31,054 | numpy | false | |
random | @Deprecated
public static String random(final int count) {
return secure().next(count);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of all characters.
</p>
@param count the length of random string to create.
@return the random string.
@throws IllegalArgumentException if {@code count} < 0.
@deprecated Use {@link #next(int)} from ... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 134 | [
"count"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
sacChol8x8Damped | static inline int sacChol8x8Damped(const float (*A)[8],
float lambda,
float (*L)[8]){
const int N = 8;
int i, j, k;
float lambdap1 = lambda + 1.0f;
float x;
for(i=0;i<N;i++){/* Row */
/* Pre-diago... | Cholesky decomposition on 8x8 real positive-definite matrix defined by its
lower-triangular half. Outputs L, the lower triangular part of the
decomposition.
A and L can overlap fully (in-place) or not at all, but may not partially
overlap.
For damping, the diagonal elements are scaled by 1.0 + lambda.
Returns zero if d... | cpp | modules/calib3d/src/rho.cpp | 2,345 | [
"lambda"
] | true | 6 | 6.72 | opencv/opencv | 85,374 | doxygen | false | |
_num_features | def _num_features(X):
"""Return the number of features in an array-like X.
This helper function tries hard to avoid to materialize an array version
of X unless necessary. For instance, if X is a list of lists,
this function will return the length of the first element, assuming
that subsequent eleme... | Return the number of features in an array-like X.
This helper function tries hard to avoid to materialize an array version
of X unless necessary. For instance, if X is a list of lists,
this function will return the length of the first element, assuming
that subsequent elements are all lists of the same length without
... | python | sklearn/utils/validation.py | 318 | [
"X"
] | false | 10 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
make_function_with_closure | def make_function_with_closure(
self,
fn_name: str,
code: types.CodeType,
) -> None:
"""Creates a closure with code object `code`.
Expects the TOS to be the tuple of cells to use for this closure.
TOS will be popped to create the closure.
Args:
- ... | Creates a closure with code object `code`.
Expects the TOS to be the tuple of cells to use for this closure.
TOS will be popped to create the closure.
Args:
- fn_name: name of the function
- code: code object of the function
(does not include the tuple of cells on the TOS) | python | torch/_dynamo/codegen.py | 543 | [
"self",
"fn_name",
"code"
] | None | true | 4 | 6.72 | pytorch/pytorch | 96,034 | google | false |
maybeThrow | public void maybeThrow() {
if (exception != null) {
throw this.exception;
}
} | Throw the exception corresponding to this error if there is one | java | clients/src/main/java/org/apache/kafka/common/protocol/Errors.java | 488 | [] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
entry_points_with_dist | def entry_points_with_dist(group: str) -> Iterator[EPnD]:
"""
Retrieve entry points of the given group.
This is like the ``entry_points()`` function from ``importlib.metadata``,
except it also returns the distribution the entry point was loaded from.
Note that this may return multiple distribution... | Retrieve entry points of the given group.
This is like the ``entry_points()`` function from ``importlib.metadata``,
except it also returns the distribution the entry point was loaded from.
Note that this may return multiple distributions to the same package if they
are loaded from different ``sys.path`` entries. The ... | python | airflow-core/src/airflow/utils/entry_points.py | 47 | [
"group"
] | Iterator[EPnD] | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
using | static <T> InstanceSupplier<T> using(ThrowingSupplier<T> supplier) {
Assert.notNull(supplier, "Supplier must not be null");
if (supplier instanceof InstanceSupplier<T> instanceSupplier) {
return instanceSupplier;
}
return registeredBean -> supplier.getWithException();
} | Factory method to create an {@link InstanceSupplier} from a
{@link ThrowingSupplier}.
@param <T> the type of instance supplied by this supplier
@param supplier the source supplier
@return a new {@link InstanceSupplier} | java | spring-beans/src/main/java/org/springframework/beans/factory/support/InstanceSupplier.java | 99 | [
"supplier"
] | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_validation_error_message | def _validation_error_message(self, value, allow_listlike: bool = False) -> str:
"""
Construct an exception message on validation error.
Some methods allow only scalar inputs, while others allow either scalar
or listlike.
Parameters
----------
allow_listlike: bo... | Construct an exception message on validation error.
Some methods allow only scalar inputs, while others allow either scalar
or listlike.
Parameters
----------
allow_listlike: bool, default False
Returns
-------
str | python | pandas/core/arrays/datetimelike.py | 640 | [
"self",
"value",
"allow_listlike"
] | str | true | 6 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
pallas | def pallas(self, kernel_name: str, source_code: str):
"""
Compile Pallas (JAX experimental) kernels.
Args:
kernel_name: Name of the kernel to be defined
source_code: Source code of the Pallas kernel, as a string
Note:
Pallas kernels are Python code t... | Compile Pallas (JAX experimental) kernels.
Args:
kernel_name: Name of the kernel to be defined
source_code: Source code of the Pallas kernel, as a string
Note:
Pallas kernels are Python code that uses JAX and Pallas APIs.
We use the PyCodeCache to write the source code to a file and load it. | python | torch/_inductor/async_compile.py | 604 | [
"self",
"kernel_name",
"source_code"
] | true | 4 | 7.04 | pytorch/pytorch | 96,034 | google | false | |
arraycopy | public static <T> T arraycopy(final T source, final int sourcePos, final T dest, final int destPos, final int length) {
System.arraycopy(source, sourcePos, dest, destPos, length);
return dest;
} | A fluent version of {@link System#arraycopy(Object, int, Object, int, int)} that returns the destination array.
@param <T> the type.
@param source the source array.
@param sourcePos starting position in the source array.
@param dest the destination array.
@param destPos starting position in the destinat... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1,439 | [
"source",
"sourcePos",
"dest",
"destPos",
"length"
] | T | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
nearest | def nearest(self, limit: int | None = None):
"""
Resample by using the nearest value.
When resampling data, missing values may appear (e.g., when the
resampling frequency is higher than the original frequency).
The `nearest` method will replace ``NaN`` values that appeared in
... | Resample by using the nearest value.
When resampling data, missing values may appear (e.g., when the
resampling frequency is higher than the original frequency).
The `nearest` method will replace ``NaN`` values that appeared in
the resampled data with the value from the nearest member of the
sequence, based on the ind... | python | pandas/core/resample.py | 687 | [
"self",
"limit"
] | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false | |
readLines | @CanIgnoreReturnValue // some processors won't return a useful result
@ParametricNullness
public static <T extends @Nullable Object> T readLines(
URL url, Charset charset, LineProcessor<T> callback) throws IOException {
return asCharSource(url, charset).readLines(callback);
} | Streams lines from a URL, stopping when our callback returns false, or we have read all of the
lines.
@param url the URL to read from
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@param callback the LineProcessor to use to handle the lines... | java | android/guava/src/com/google/common/io/Resources.java | 122 | [
"url",
"charset",
"callback"
] | T | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false |
createAsMap | @Override
Map<K, Collection<V>> createAsMap() {
return new AsMap(map);
} | Returns an iterator across all key-value map entries, used by {@code entries().iterator()} and
{@code values().iterator()}. The default behavior, which traverses the values for one key, the
values for a second key, and so on, suffices for most {@code AbstractMapBasedMultimap}
implementations.
@return an iterator across... | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 1,274 | [] | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false | |
centroids | @Override
public Collection<Centroid> centroids() {
return Collections.unmodifiableCollection(summary);
} | @param q The quantile desired. Can be in the range [0,1].
@return The minimum value x such that we think that the proportion of samples is ≤ x is q. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/AVLTreeDigest.java | 362 | [] | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false | |
asList | public static List<Character> asList(char... backingArray) {
if (backingArray.length == 0) {
return Collections.emptyList();
}
return new CharArrayAsList(backingArray);
} | Returns a fixed-size list backed by the specified array, similar to {@link
Arrays#asList(Object[])}. The list supports {@link List#set(int, Object)}, but any attempt to
set a value to {@code null} will result in a {@link NullPointerException}.
<p>The returned list maintains the values, but not the identities, of {@code... | java | android/guava/src/com/google/common/primitives/Chars.java | 569 | [] | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false | |
alterShareGroupOffsets | default AlterShareGroupOffsetsResult alterShareGroupOffsets(String groupId, Map<TopicPartition, Long> offsets) {
return alterShareGroupOffsets(groupId, offsets, new AlterShareGroupOffsetsOptions());
} | Alters offsets for the specified group. In order to succeed, the group must be empty.
<p>This is a convenience method for {@link #alterShareGroupOffsets(String, Map, AlterShareGroupOffsetsOptions)} with default options.
See the overload for more details.
@param groupId The group for which to alter offsets.
@param offse... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,967 | [
"groupId",
"offsets"
] | AlterShareGroupOffsetsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
randomDouble | public double randomDouble() {
return randomDouble(0, Double.MAX_VALUE);
} | Generates a random double between 0 (inclusive) and Double.MAX_VALUE (exclusive).
@return the random double.
@see #randomDouble(double, double)
@since 3.16.0 | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 329 | [] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
indexSupportsIncludeFilter | private boolean indexSupportsIncludeFilter(TypeFilter filter) {
if (filter instanceof AnnotationTypeFilter annotationTypeFilter) {
Class<? extends Annotation> annotationType = annotationTypeFilter.getAnnotationType();
return isStereotypeAnnotationForIndex(annotationType);
}
if (filter instanceof AssignableT... | Determine if the specified include {@link TypeFilter} is supported by the index.
@param filter the filter to check
@return whether the index supports this include filter
@since 5.0
@see #registerCandidateTypeForIncludeFilter(String, TypeFilter)
@see #extractStereotype(TypeFilter) | java | spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java | 347 | [
"filter"
] | true | 3 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
flush | @Override
public void flush() throws IOException {
generator.flush();
} | Returns a version used for serialising a response.
@return a compatible version | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 1,281 | [] | void | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
readAsn1Object | public Asn1Object readAsn1Object(int requiredType) throws IOException {
final Asn1Object obj = readAsn1Object();
if (obj.type != requiredType) {
throw new IllegalStateException(
"Expected ASN.1 object of type 0x" + Integer.toHexString(requiredType) + " but was 0x" + Integer.t... | Read an object and verify its type
@param requiredType The expected type code
@throws IOException if data can not be parsed
@throws IllegalStateException if the parsed object is of the wrong type | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java | 71 | [
"requiredType"
] | Asn1Object | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
parsePackageName | function parsePackageName(specifier, base) {
let separatorIndex = StringPrototypeIndexOf(specifier, '/');
let validPackageName = true;
let isScoped = false;
if (specifier[0] === '@') {
isScoped = true;
if (separatorIndex === -1 || specifier.length === 0) {
validPackageName = false;
} else {
... | Parse a package name from a specifier.
@param {string} specifier - The import specifier.
@param {string | URL | undefined} base - The parent URL.
@returns {object} | javascript | lib/internal/modules/package_json_reader.js | 248 | [
"specifier",
"base"
] | false | 9 | 6.4 | nodejs/node | 114,839 | jsdoc | false | |
remove | public static String remove(final String str, final char remove) {
if (isEmpty(str) || str.indexOf(remove) == INDEX_NOT_FOUND) {
return str;
}
final char[] chars = str.toCharArray();
int pos = 0;
for (int i = 0; i < chars.length; i++) {
if (chars[i] != rem... | Removes all occurrences of a character from within the source string.
<p>
A {@code null} source string will return {@code null}. An empty ("") source string will return the empty string.
</p>
<pre>
StringUtils.remove(null, *) = null
StringUtils.remove("", *) = ""
StringUtils.remove("queued", 'u') = "qeed"... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,672 | [
"str",
"remove"
] | String | true | 5 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
throwInvalidPathError | function throwInvalidPathError(path: unknown, exampleUrls: string[]): never {
throw new RuntimeError(
RuntimeErrorCode.INVALID_LOADER_ARGUMENTS,
ngDevMode &&
`Image loader has detected an invalid path (\`${path}\`). ` +
`To fix this, supply a path using one of the following formats: ${exampleUrl... | Internal helper function that makes it easier to introduce custom image loaders for the
`NgOptimizedImage` directive. It is enough to specify a URL builder function to obtain full DI
configuration for a given loader: a DI token corresponding to the actual loader function, plus DI
tokens managing preconnect check functi... | typescript | packages/common/src/directives/ng_optimized_image/image_loaders/image_loader.ts | 120 | [
"path",
"exampleUrls"
] | true | 2 | 7.6 | angular/angular | 99,544 | jsdoc | false | |
write_th | def write_th(
self, s: Any, header: bool = False, indent: int = 0, tags: str | None = None
) -> None:
"""
Method for writing a formatted <th> cell.
If col_space is set on the formatter then that is used for
the value of min-width.
Parameters
----------
... | Method for writing a formatted <th> cell.
If col_space is set on the formatter then that is used for
the value of min-width.
Parameters
----------
s : object
The data to be written inside the cell.
header : bool, default False
Set to True if the <th> is for use inside <thead>. This will
cause min-width t... | python | pandas/io/formats/html.py | 147 | [
"self",
"s",
"header",
"indent",
"tags"
] | None | true | 4 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
merge | static ReleasableExponentialHistogram merge(
int maxBucketCount,
ExponentialHistogramCircuitBreaker breaker,
Iterator<? extends ExponentialHistogram> histograms
) {
try (ExponentialHistogramMerger merger = ExponentialHistogramMerger.create(maxBucketCount, breaker)) {
whil... | Merges the provided exponential histograms to a new, single histogram with at most the given amount of buckets.
@param maxBucketCount the maximum number of buckets the result histogram is allowed to have
@param breaker the circuit breaker to use to limit memory allocations
@param histograms the histograms to merge
@ret... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogram.java | 270 | [
"maxBucketCount",
"breaker",
"histograms"
] | ReleasableExponentialHistogram | true | 2 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false |
ToggleActivityList | function ToggleActivityList({
dispatch,
state,
}: {
dispatch: LayoutDispatch,
state: LayoutState,
}) {
return (
<Button
onClick={() =>
dispatch({
type: 'ACTION_SET_ACTIVITY_LIST_TOGGLE',
payload: null,
})
}
title={
state.activityListHidden ? 'S... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js | 98 | [] | false | 3 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
processRange | function processRange(range: TextRangeWithKind, rangeStart: LineAndCharacter, parent: Node, contextNode: Node, dynamicIndentation: DynamicIndentation): LineAction {
const rangeHasError = rangeContainsError(range);
let lineAction = LineAction.None;
if (!rangeHasError) {
if (!previ... | 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 | 1,079 | [
"range",
"rangeStart",
"parent",
"contextNode",
"dynamicIndentation"
] | true | 4 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
geoToH3Address | public static String geoToH3Address(double lat, double lng, int res) {
return h3ToString(geoToH3(lat, lng, res));
} | Find the H3 index of the resolution <code>res</code> cell containing the lat/lon (in degrees)
@param lat Latitude in degrees.
@param lng Longitude in degrees.
@param res Resolution, 0 <= res <= 15
@return The H3 index.
@throws IllegalArgumentException Latitude, longitude, or resolution is out of range. | java | libs/h3/src/main/java/org/elasticsearch/h3/H3.java | 215 | [
"lat",
"lng",
"res"
] | String | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
poll_sqs | async def poll_sqs(self, client: BaseAwsConnection) -> Collection:
"""
Asynchronously poll SQS queue to retrieve messages.
:param client: SQS connection
:return: A list of messages retrieved from SQS
"""
self.log.info("SqsSensor checking for message on queue: %s", self.s... | Asynchronously poll SQS queue to retrieve messages.
:param client: SQS connection
:return: A list of messages retrieved from SQS | python | providers/amazon/src/airflow/providers/amazon/aws/triggers/sqs.py | 132 | [
"self",
"client"
] | Collection | true | 4 | 8.08 | apache/airflow | 43,597 | sphinx | false |
_get_counts_nanvar | def _get_counts_nanvar(
values_shape: Shape,
mask: npt.NDArray[np.bool_] | None,
axis: AxisInt | None,
ddof: int,
dtype: np.dtype = np.dtype(np.float64),
) -> tuple[float | np.ndarray, float | np.ndarray]:
"""
Get the count of non-null values along an axis, accounting
for degrees of free... | Get the count of non-null values along an axis, accounting
for degrees of freedom.
Parameters
----------
values_shape : Tuple[int, ...]
shape tuple from values ndarray, used if mask is None
mask : Optional[ndarray[bool]]
locations in values that should be considered missing
axis : Optional[int]
axis to cou... | python | pandas/core/nanops.py | 861 | [
"values_shape",
"mask",
"axis",
"ddof",
"dtype"
] | tuple[float | np.ndarray, float | np.ndarray] | true | 5 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
maybeBindThisOrTargetOrArgsFromPointcutExpression | private void maybeBindThisOrTargetOrArgsFromPointcutExpression() {
if (this.numberOfRemainingUnboundArguments > 1) {
throw new AmbiguousBindingException("Still " + this.numberOfRemainingUnboundArguments +
" unbound args at this()/target()/args() binding stage, with no way to determine between them");
}
L... | Parse the string pointcut expression looking for this(), target() and args() expressions.
If we find one, try and extract a candidate variable name and bind it. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 481 | [] | void | true | 15 | 7.2 | spring-projects/spring-framework | 59,386 | javadoc | false |
tryInternalFastPathGetFailure | @Override
/*
* We should annotate the superclass, InternalFutureFailureAccess, to say that its copy of this
* method returns @Nullable, too. However, we're not sure if we want to make any changes to that
* class, since it's in a separate artifact that we planned to release only a single version of.
*/
p... | Usually returns {@code null} but, if this {@code Future} has failed, may <i>optionally</i>
return the cause of the failure. "Failure" means specifically "completed with an exception"; it
does not include "was cancelled." To be explicit: If this method returns a non-null value,
then:
<ul>
<li>{@code isDone()} must ret... | java | android/guava/src/com/google/common/util/concurrent/AbstractFuture.java | 809 | [] | Throwable | true | 3 | 6.4 | google/guava | 51,352 | javadoc | false |
beam_options_to_args | def beam_options_to_args(options: dict) -> list[str]:
"""
Return a formatted pipeline options from a dictionary of arguments.
The logic of this method should be compatible with Apache Beam:
https://github.com/apache/beam/blob/77f57d1fc498592089e32701b45505bbdccccd47/sdks/python/
apache_beam/options... | Return a formatted pipeline options from a dictionary of arguments.
The logic of this method should be compatible with Apache Beam:
https://github.com/apache/beam/blob/77f57d1fc498592089e32701b45505bbdccccd47/sdks/python/
apache_beam/options/pipeline_options.py#L260-L268
WARNING: In case of amending please check the ... | python | providers/apache/beam/src/airflow/providers/apache/beam/hooks/beam.py | 76 | [
"options"
] | list[str] | true | 11 | 7.92 | apache/airflow | 43,597 | sphinx | false |
registerBeanDefinitions | public int registerBeanDefinitions(Map<?, ?> map) throws BeansException {
return registerBeanDefinitions(map, null);
} | Register bean definitions contained in a Map, using all property keys (i.e. not
filtering by prefix).
@param map a map of {@code name} to {@code property} (String or Object). Property
values will be strings if coming from a Properties file etc. Property names
(keys) <b>must</b> be Strings. Class keys must be Strings.
@... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java | 323 | [
"map"
] | true | 1 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false | |
onConsume | public ConsumerRecords<K, V> onConsume(ConsumerRecords<K, V> records) {
ConsumerRecords<K, V> interceptRecords = records;
for (Plugin<ConsumerInterceptor<K, V>> interceptorPlugin : this.interceptorPlugins) {
try {
interceptRecords = interceptorPlugin.get().onConsume(intercept... | This is called when the records are about to be returned to the user.
<p>
This method calls {@link ConsumerInterceptor#onConsume(ConsumerRecords)} for each
interceptor. Records returned from each interceptor get passed to onConsume() of the next interceptor
in the chain of interceptors.
<p>
This method does not throw e... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerInterceptors.java | 66 | [
"records"
] | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
newArray | static <T extends @Nullable Object> T[] newArray(T[] reference, int length) {
T[] empty = reference.length == 0 ? reference : Arrays.copyOf(reference, 0);
return Arrays.copyOf(empty, length);
} | Returns a new array of the given length with the same type as a reference array.
@param reference any array of the desired type
@param length the length of the new array | java | android/guava/src/com/google/common/collect/Platform.java | 99 | [
"reference",
"length"
] | true | 2 | 6.96 | google/guava | 51,352 | javadoc | false | |
normalizeSelector | function normalizeSelector(selector: string): [string, boolean] {
const hasAmpersand = selector.split(/\s*,\s*/).find((token) => token == SELF_TOKEN)
? true
: false;
if (hasAmpersand) {
selector = selector.replace(SELF_TOKEN_REGEX, '');
}
// Note: the :enter and :leave aren't normalized here since ... | @license
Copyright Google LLC All Rights Reserved.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE file at https://angular.dev/license | typescript | packages/animations/browser/src/dsl/animation_ast_builder.ts | 588 | [
"selector"
] | true | 3 | 6 | angular/angular | 99,544 | jsdoc | false | |
masked_values | def masked_values(x, value, rtol=1e-5, atol=1e-8, copy=True, shrink=True):
"""
Mask using floating point equality.
Return a MaskedArray, masked where the data in array `x` are approximately
equal to `value`, determined using `isclose`. The default tolerances for
`masked_values` are the same as thos... | Mask using floating point equality.
Return a MaskedArray, masked where the data in array `x` are approximately
equal to `value`, determined using `isclose`. The default tolerances for
`masked_values` are the same as those for `isclose`.
For integer types, exact equality is used, in the same way as
`masked_equal`.
Th... | python | numpy/ma/core.py | 2,316 | [
"x",
"value",
"rtol",
"atol",
"copy",
"shrink"
] | false | 4 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
getAllParameters | @Override
public CacheInvocationParameter[] getAllParameters(@Nullable Object... values) {
if (this.allParameterDetails.size() != values.length) {
throw new IllegalStateException("Values mismatch, operation has " +
this.allParameterDetails.size() + " parameter(s) but got " + values.length + " value(s)");
}... | Construct a new {@code AbstractJCacheOperation}.
@param methodDetails the {@link CacheMethodDetails} related to the cached method
@param cacheResolver the cache resolver to resolve regular caches | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheOperation.java | 109 | [] | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
asBiConsumer | @SuppressWarnings("unchecked")
public static <T, U> BiConsumer<T, U> asBiConsumer(final Method method) {
return asInterfaceInstance(BiConsumer.class, method);
} | Produces a {@link BiConsumer} for a given <em>consumer</em> Method. For example, a classic setter method (as opposed
to a fluent setter). You call the BiConsumer with two arguments: (1) the object receiving the method call, and (2)
the method argument.
@param <T> the type of the first argument to the operation: The typ... | java | src/main/java/org/apache/commons/lang3/function/MethodInvokers.java | 83 | [
"method"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
on_kill | def on_kill(self) -> None:
"""
Cancel the submitted job run.
Note: this method will not run in deferrable mode.
"""
if self.job_id:
self.log.info("Stopping job run with jobId - %s", self.job_id)
response = self.hook.conn.cancel_job_run(applicationId=self.... | Cancel the submitted job run.
Note: this method will not run in deferrable mode. | python | providers/amazon/src/airflow/providers/amazon/aws/operators/emr.py | 1,298 | [
"self"
] | None | true | 5 | 7.04 | apache/airflow | 43,597 | unknown | false |
andThen | default TriConsumer<T, U, V> andThen(final TriConsumer<? super T, ? super U, ? super V> after) {
Objects.requireNonNull(after);
return (t, u, v) -> {
accept(t, u, v);
after.accept(t, u, v);
};
} | Returns a composed {@link TriConsumer} that performs, in sequence, this operation followed by the {@code after}
operation. If performing either operation throws an exception, it is relayed to the caller of the composed
operation. If performing this operation throws an exception, the {@code after} operation will not be ... | java | src/main/java/org/apache/commons/lang3/function/TriConsumer.java | 62 | [
"after"
] | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false | |
dtype_is_implied | def dtype_is_implied(dtype):
"""
Determine if the given dtype is implied by the representation
of its values.
Parameters
----------
dtype : dtype
Data type
Returns
-------
implied : bool
True if the dtype is implied by the representation of its values.
Examples... | Determine if the given dtype is implied by the representation
of its values.
Parameters
----------
dtype : dtype
Data type
Returns
-------
implied : bool
True if the dtype is implied by the representation of its values.
Examples
--------
>>> import numpy as np
>>> np._core.arrayprint.dtype_is_implied(int)
Tr... | python | numpy/_core/arrayprint.py | 1,518 | [
"dtype"
] | false | 5 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
cdf | @Override
public double cdf(double x) {
AVLGroupTree values = summary;
if (values.isEmpty()) {
return Double.NaN;
}
if (values.size() == 1) {
if (x < values.mean(values.first())) return 0;
if (x > values.mean(values.first())) return 1;
... | @param x the value at which the CDF should be evaluated
@return the approximate fraction of all samples that were less than or equal to x. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/AVLTreeDigest.java | 215 | [
"x"
] | true | 15 | 8.16 | elastic/elasticsearch | 75,680 | javadoc | false | |
usesAccessEntries | boolean usesAccessEntries() {
return usesAccessQueue() || recordsAccess();
} | Creates a new, empty map with the specified strategy, initial capacity and concurrency level. | java | android/guava/src/com/google/common/cache/LocalCache.java | 368 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
override | CacheOverride override(); | Override caching to temporarily enable it. Once caching is no longer needed the
returned {@link CacheOverride} should be closed to restore previous cache settings.
@return a {@link CacheOverride}
@since 3.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyCaching.java | 62 | [] | CacheOverride | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
resolveListSetting | private <V> List<V> resolveListSetting(String key, Function<String, V> parser, List<V> defaultValue) {
try {
final List<String> list = getSettingAsList(expandSettingKey(key));
if (list == null || list.isEmpty()) {
return defaultValue;
}
return list... | Resolve all necessary configuration settings, and load a {@link SslConfiguration}.
@param basePath The base path to use for any settings that represent file paths. Typically points to the Elasticsearch
configuration directory.
@throws SslConfigException For any problems with the configuration, or with l... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslConfigurationLoader.java | 477 | [
"key",
"parser",
"defaultValue"
] | true | 5 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
_find | def _find(self, name, domain=None, path=None):
"""Requests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a... | Requests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of co... | python | src/requests/cookies.py | 366 | [
"self",
"name",
"domain",
"path"
] | false | 7 | 7.12 | psf/requests | 53,586 | sphinx | false | |
createElementSet | @Override
Set<E> createElementSet() {
Set<E> delegate = countMap.keySet();
return new ForwardingSet<E>() {
@Override
protected Set<E> delegate() {
return delegate;
}
@Override
public boolean contains(@Nullable Object object) {
return object != null && Collections... | Sets the number of occurrences of {@code element} to {@code newCount}, but only if the count is
currently {@code expectedOldCount}. If {@code element} does not appear in the multiset exactly
{@code expectedOldCount} times, no changes will be made.
@return {@code true} if the change was successful. This usually indicate... | java | android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java | 471 | [] | true | 3 | 7.92 | google/guava | 51,352 | javadoc | false | |
count | public int count(String node) {
Deque<NetworkClient.InFlightRequest> queue = requests.get(node);
return queue == null ? 0 : queue.size();
} | Return the number of in-flight requests directed at the given node
@param node The node
@return The request count. | java | clients/src/main/java/org/apache/kafka/clients/InFlightRequests.java | 107 | [
"node"
] | true | 2 | 8.16 | apache/kafka | 31,560 | javadoc | false | |
getParser | public OptionParser getParser() {
if (this.parser == null) {
this.parser = new OptionParser();
options();
}
return this.parser;
} | Create a new {@link OptionHandler} instance with an argument processor.
@param argumentProcessor strategy that can be used to manipulate arguments before
they are used. | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java | 86 | [] | OptionParser | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
makeGetter | static LittleEndianBytes makeGetter() {
try {
/*
* UnsafeByteArray uses Unsafe.getLong() in an unsupported way, which is known to cause
* crashes on Android when running in 32-bit mode. For maximum safety, we shouldn't use
* Unsafe.getLong() at all, but the performance benefit on x86_64 i... | Fallback implementation for when VarHandle and Unsafe are not available in our current
environment. | java | android/guava/src/com/google/common/hash/LittleEndianByteArray.java | 257 | [] | LittleEndianBytes | true | 4 | 6.24 | google/guava | 51,352 | javadoc | false |
verifyOutputDirectory | async function verifyOutputDirectory(directory: string, datamodel: string, schemaPath: string) {
let content: string
try {
content = await fs.readFile(path.join(directory, 'package.json'), 'utf8')
} catch (e) {
if (e.code === 'ENOENT') {
// no package.json exists, we are good
return
}
... | Get all the directories involved in the generation process.
@returns | typescript | packages/client-generator-js/src/generateClient.ts | 550 | [
"directory",
"datamodel",
"schemaPath"
] | false | 7 | 6.08 | prisma/prisma | 44,834 | jsdoc | true | |
parse | def parse(self, declarations_str: str) -> Iterator[tuple[str, str]]:
"""
Generates (prop, value) pairs from declarations.
In a future version may generate parsed tokens from tinycss/tinycss2
Parameters
----------
declarations_str : str
"""
for decl in de... | Generates (prop, value) pairs from declarations.
In a future version may generate parsed tokens from tinycss/tinycss2
Parameters
----------
declarations_str : str | python | pandas/io/formats/css.py | 401 | [
"self",
"declarations_str"
] | Iterator[tuple[str, str]] | true | 5 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
beginningOffsets | @Override
public Map<TopicPartition, Long> beginningOffsets(Collection<TopicPartition> partitions, Duration timeout) {
return delegate.beginningOffsets(partitions, timeout);
} | Get the first offset for the given partitions.
<p>
This method does not change the current consumer position of the partitions.
@see #seekToBeginning(Collection)
@param partitions the partitions to get the earliest offsets
@param timeout The maximum amount of time to await retrieval of the beginning offsets
@return The... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 1,653 | [
"partitions",
"timeout"
] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
reverse | public static void reverse(final boolean[] array, final int startIndexInclusive, final int endIndexExclusive) {
if (array == null) {
return;
}
int i = Math.max(startIndexInclusive, 0);
int j = Math.min(array.length, endIndexExclusive) - 1;
boolean tmp;
while (... | Reverses the order of the given array in the given range.
<p>
This method does nothing for a {@code null} input array.
</p>
@param array
the array to reverse, may be {@code null}.
@param startIndexInclusive
the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) resul... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,364 | [
"array",
"startIndexInclusive",
"endIndexExclusive"
] | void | true | 3 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
setxor1d | def setxor1d(ar1, ar2, assume_unique=False):
"""
Set exclusive-or of 1-D arrays with unique elements.
The output is always a masked array. See `numpy.setxor1d` for more details.
See Also
--------
numpy.setxor1d : Equivalent function for ndarrays.
Examples
--------
>>> import numpy... | Set exclusive-or of 1-D arrays with unique elements.
The output is always a masked array. See `numpy.setxor1d` for more details.
See Also
--------
numpy.setxor1d : Equivalent function for ndarrays.
Examples
--------
>>> import numpy as np
>>> ar1 = np.ma.array([1, 2, 3, 2, 4])
>>> ar2 = np.ma.array([2, 3, 5, 7, 5])
... | python | numpy/ma/extras.py | 1,350 | [
"ar1",
"ar2",
"assume_unique"
] | false | 3 | 6.64 | numpy/numpy | 31,054 | unknown | false | |
notifyMonitorPointAdded | protected void notifyMonitorPointAdded() {
if (monitor != null) {
monitor.pointAdded(description + ".addPoint()", getCurrentPoints());
}
} | Implementation of this interface will receive calls with internal data at each step of the
simplification algorithm. This is of use for debugging complex cases, as well as gaining insight
into the way the algorithm works. Data provided in the callback includes:
<ul>
<li>String description of current process</li>
... | java | libs/geo/src/main/java/org/elasticsearch/geometry/simplify/StreamingGeometrySimplifier.java | 272 | [] | void | true | 2 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
_create_range_input_gen_fn | def _create_range_input_gen_fn(
base_gen_fn: Callable[[torch.Tensor], torch.Tensor],
dim_index: int,
range_start: int,
range_end: Union[int, float],
range_upper_bound: int,
) -> Callable[[torch.Tensor], torch.Tensor]:
"""Create input generator that modifies target dimension to top of range.
... | Create input generator that modifies target dimension to top of range.
range_upper_bound: Size to use for benchmarking when range_end is unbounded.
Default is DEFAULT_RANGE_UPPER_BOUND = 65536 | python | torch/_inductor/kernel/custom_op.py | 357 | [
"base_gen_fn",
"dim_index",
"range_start",
"range_end",
"range_upper_bound"
] | Callable[[torch.Tensor], torch.Tensor] | true | 2 | 6.72 | pytorch/pytorch | 96,034 | unknown | false |
createRetryPolicy | public RetryPolicy createRetryPolicy() {
PropertyMapper map = PropertyMapper.get();
RetryPolicy.Builder builder = RetryPolicy.builder();
map.from(this::getExceptionIncludes).to(builder::includes);
map.from(this::getExceptionExcludes).to(builder::excludes);
map.from(this::getExceptionPredicate).to(builder::pre... | Create a {@link RetryPolicy} based on the state of this instance.
@return a {@link RetryPolicy} | java | core/spring-boot/src/main/java/org/springframework/boot/retry/RetryPolicySettings.java | 81 | [] | RetryPolicy | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
hasUserSuppliedInterfaces | boolean hasUserSuppliedInterfaces() {
for (Class<?> ifc : this.interfaces) {
if (!SpringProxy.class.isAssignableFrom(ifc) && !isAdvisorIntroducedInterface(ifc)) {
return true;
}
}
return false;
} | Remove a proxied interface.
<p>Does nothing if the given interface isn't proxied.
@param ifc the interface to remove from the proxy
@return {@code true} if the interface was removed; {@code false}
if the interface was not found and hence could not be removed | java | spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java | 268 | [] | true | 3 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
getMaybeTokenStringContent | function getMaybeTokenStringContent(token: Token): string {
if (typeof token.content === 'string') {
return token.content;
}
return '';
} | Adds metadata for synthetic metrics for which the API does not provide metadata.
See https://github.com/grafana/grafana/issues/22337 for details.
@param metadata HELP and TYPE metadata from /api/v1/metadata | typescript | packages/grafana-prometheus/src/language_utils.ts | 288 | [
"token"
] | true | 2 | 6.72 | grafana/grafana | 71,362 | jsdoc | false | |
toBooleanObject | public static Boolean toBooleanObject(final String str) {
// Previously used equalsIgnoreCase, which was fast for interned 'true'.
// Non interned 'true' matched 15 times slower.
//
// Optimization provides same performance as before for interned 'true'.
// Similar performance fo... | Converts a String to a Boolean.
<p>{@code 'true'}, {@code 'on'}, {@code 'y'}, {@code 't'}, {@code 'yes'}
or {@code '1'} (case insensitive) will return {@code true}.
{@code 'false'}, {@code 'off'}, {@code 'n'}, {@code 'f'}, {@code 'no'}
or {@code '0'} (case insensitive) will return {@code false}.
Otherwise, {@code null}... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 734 | [
"str"
] | Boolean | true | 51 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
visitBinaryExpression | function visitBinaryExpression(node: BinaryExpression, expressionResultIsUnused: boolean): Expression {
// If we are here it is because this is a destructuring assignment.
if (isDestructuringAssignment(node)) {
return flattenDestructuringAssignment(
node,
... | Visits a BinaryExpression that contains a destructuring assignment.
@param node A BinaryExpression node.
@param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the
expression of an `ExpressionStatement`). | typescript | src/compiler/transformers/es2015.ts | 2,683 | [
"node",
"expressionResultIsUnused"
] | true | 4 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
clear | @Override
public void clear() {
if (needsAllocArrays()) {
return;
}
this.firstEntry = ENDPOINT;
this.lastEntry = ENDPOINT;
// Either both arrays are null or neither is, but we check both to satisfy the nullness checker.
if (predecessor != null && successor != null) {
Arrays.fill(pr... | Pointer to the last node in the linked list, or {@code ENDPOINT} if there are no entries. | java | android/guava/src/com/google/common/collect/CompactLinkedHashSet.java | 240 | [] | void | true | 4 | 6.88 | google/guava | 51,352 | javadoc | false |
toString | @Override
public String toString() {
return originalHeaderValue;
} | Resolves this instance to a MediaType instance defined in given MediaTypeRegistry.
Performs validation against parameters.
@param mediaTypeRegistry a registry where a mapping between a raw media type to an instance MediaType is defined
@return a MediaType instance or null if no media type could be found or if a known p... | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ParsedMediaType.java | 152 | [] | String | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false |
declaresMultipleFieldsInMacro | static bool declaresMultipleFieldsInMacro(const RecordDecl *Decl,
const SourceManager &SrcMgr) {
SourceLocation LastMacroLoc;
for (const auto &Field : Decl->fields()) {
if (!Field->getLocation().isMacroID())
continue;
SourceLocation MacroLoc = SrcMgr.getExpans... | \returns nullptr if the name is ambiguous or not found. | cpp | clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp | 69 | [] | true | 4 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false | |
errorMessage | protected boolean errorMessage(@Nullable String message) {
Log.error((message != null) ? message : "Unexpected error");
return message != null;
} | Subclass hook called after a command has run.
@param command the command that has run | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java | 263 | [
"message"
] | true | 2 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
tryParseParenthesizedArrowFunctionExpression | function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction: boolean): Expression | undefined {
const triState = isParenthesizedArrowFunctionExpression();
if (triState === Tristate.False) {
// It's definitely not a parenthesized arrow function expression.
... | 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 | 5,216 | [
"allowReturnTypeInArrowFunction"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
get | def get(
cls,
key: str,
default_var: Any = __NO_DEFAULT_SENTINEL,
deserialize_json: bool = False,
team_name: str | None = None,
) -> Any:
"""
Get a value for an Airflow Variable Key.
:param key: Variable Key
:param default_var: Default value o... | Get a value for an Airflow Variable Key.
:param key: Variable Key
:param default_var: Default value of the Variable if the Variable doesn't exist
:param deserialize_json: Deserialize the value to a Python dict
:param team_name: Team name associated to the task trying to access the variable (if any) | python | airflow-core/src/airflow/models/variable.py | 137 | [
"cls",
"key",
"default_var",
"deserialize_json",
"team_name"
] | Any | true | 9 | 6.88 | apache/airflow | 43,597 | sphinx | false |
isNumericSpace | public static boolean isNumericSpace(final CharSequence cs) {
if (cs == null) {
return false;
}
final int sz = cs.length();
for (int i = 0; i < sz; i++) {
final char nowChar = cs.charAt(i);
if (nowChar != ' ' && !Character.isDigit(nowChar)) {
... | Tests if the CharSequence contains only Unicode digits or space ({@code ' '}). A decimal point is not a Unicode digit and returns false.
<p>
{@code null} will return {@code false}. An empty CharSequence (length()=0) will return {@code true}.
</p>
<pre>
StringUtils.isNumericSpace(null) = false
StringUtils.isNumericSpa... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 3,750 | [
"cs"
] | true | 5 | 7.44 | apache/commons-lang | 2,896 | javadoc | false | |
handshakeWrap | private SSLEngineResult handshakeWrap(boolean doWrite) throws IOException {
log.trace("SSLHandshake handshakeWrap {}", channelId);
if (netWriteBuffer.hasRemaining())
throw new IllegalStateException("handshakeWrap called with netWriteBuffer not empty");
//this should never be called w... | Performs the WRAP function
@param doWrite boolean
@return SSLEngineResult
@throws IOException | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 485 | [
"doWrite"
] | SSLEngineResult | true | 5 | 7.12 | apache/kafka | 31,560 | javadoc | false |
compute_class_weight | def compute_class_weight(class_weight, *, classes, y, sample_weight=None):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, "balanced" or None
If "balanced", class weights will be given by
`n_samples / (n_classes * np.bincount(y))` or their w... | Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, "balanced" or None
If "balanced", class weights will be given by
`n_samples / (n_classes * np.bincount(y))` or their weighted equivalent if
`sample_weight` is provided.
If a dictionary is given, keys are classes ... | python | sklearn/utils/class_weight.py | 22 | [
"class_weight",
"classes",
"y",
"sample_weight"
] | false | 12 | 7.28 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
convertToOriginalForm | private CharSequence convertToOriginalForm(CharSequence element) {
return convertElement(element, false,
(ch, i) -> ch == '_' || ElementsParser.isValidChar(Character.toLowerCase(ch), i));
} | Return an element in the name in the given form.
@param elementIndex the element index
@param form the form to return
@return the last element | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 175 | [
"element"
] | CharSequence | true | 2 | 7.84 | spring-projects/spring-boot | 79,428 | javadoc | false |
firstEntryIndex | int firstEntryIndex() {
return isEmpty() ? -1 : 0;
} | Moves the last entry in the entry array into {@code dstIndex}, and nulls out its old position. | java | android/guava/src/com/google/common/collect/CompactHashMap.java | 604 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
build | public MemoryRecords build() {
if (aborted) {
throw new IllegalStateException("Attempting to build an aborted record batch");
}
close();
return builtRecords;
} | Close this builder and return the resulting buffer.
@return The built log buffer | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java | 238 | [] | MemoryRecords | true | 2 | 8.24 | apache/kafka | 31,560 | javadoc | false |
addRestParameterIfNeeded | function addRestParameterIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, inConstructorWithSynthesizedSuper: boolean): boolean {
const prologueStatements: Statement[] = [];
const parameter = lastOrUndefined(node.parameters);
if (!shouldAddRestParameter(parameter, inConstructor... | Adds statements to the body of a function-like node if it contains a rest parameter.
@param statements The statements for the new function body.
@param node A function-like node.
@param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
part of a ... | typescript | src/compiler/transformers/es2015.ts | 2,042 | [
"statements",
"node",
"inConstructorWithSynthesizedSuper"
] | true | 6 | 6.48 | 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.