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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tensor_always_has_static_shape | def tensor_always_has_static_shape(
tensor: Union[torch.Tensor, Any],
is_tensor: bool,
tensor_source: Source,
) -> tuple[bool, Optional[TensorStaticReason]]:
"""
Given a tensor, source, and is_tensor flag, determine if a shape should be static.
Args:
tensor - the real tensor to evaluate, pa... | Given a tensor, source, and is_tensor flag, determine if a shape should be static.
Args:
tensor - the real tensor to evaluate, parameters force a static shape.
is_tensor - internal dynamo check, essentially "is_tensor": target_cls is TensorVariable,
tensors not in a TensorVariable for whatever reason are forced static... | python | torch/_dynamo/utils.py | 3,902 | [
"tensor",
"is_tensor",
"tensor_source"
] | tuple[bool, Optional[TensorStaticReason]] | true | 8 | 6.72 | pytorch/pytorch | 96,034 | google | false |
standardPollLastEntry | protected @Nullable Entry<E> standardPollLastEntry() {
Iterator<Entry<E>> entryIterator = descendingMultiset().entrySet().iterator();
if (!entryIterator.hasNext()) {
return null;
}
Entry<E> entry = entryIterator.next();
entry = Multisets.immutableEntry(entry.getElement(), entry.getCount());
... | A sensible definition of {@link #pollLastEntry()} in terms of {@code
descendingMultiset().entrySet().iterator()}.
<p>If you override {@link #descendingMultiset()} or {@link #entrySet()}, you may wish to
override {@link #pollLastEntry()} to forward to this implementation. | java | android/guava/src/com/google/common/collect/ForwardingSortedMultiset.java | 186 | [] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
unquote_header_value | def unquote_header_value(value, is_filename=False):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str
"""
if value and value[0]... | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str | python | src/requests/utils.py | 432 | [
"value",
"is_filename"
] | false | 5 | 6.4 | psf/requests | 53,586 | sphinx | false | |
openStream | InputStream openStream() throws IOException; | Returns a new open {@link InputStream} at the beginning of the content.
@return a new {@link InputStream}
@throws IOException on IO error | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/InputStreamSupplier.java | 37 | [] | InputStream | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
toLongString | public static String toLongString(final TypeVariable<?> typeVariable) {
Objects.requireNonNull(typeVariable, "typeVariable");
final StringBuilder buf = new StringBuilder();
final GenericDeclaration d = typeVariable.getGenericDeclaration();
if (d instanceof Class<?>) {
Class<?... | Formats a {@link TypeVariable} including its {@link GenericDeclaration}.
@param typeVariable the type variable to create a String representation for, not {@code null}.
@return String.
@throws NullPointerException if {@code typeVariable} is {@code null}.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,507 | [
"typeVariable"
] | String | true | 5 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
nansem | def nansem(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
ddof: int = 1,
mask: npt.NDArray[np.bool_] | None = None,
) -> float:
"""
Compute the standard error in the mean along given axis while ignoring NaNs
Parameters
----------
values : ndarray
... | Compute the standard error in the mean along given axis while ignoring NaNs
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
where N represents the number of elements.
mask : nda... | python | pandas/core/nanops.py | 1,038 | [
"values",
"axis",
"skipna",
"ddof",
"mask"
] | float | true | 5 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
determineReplacementMetadata | private @Nullable ConfigurationMetadataProperty determineReplacementMetadata(
ConfigurationMetadataProperty metadata) {
String replacementId = metadata.getDeprecation().getReplacement();
if (StringUtils.hasText(replacementId)) {
ConfigurationMetadataProperty replacement = this.allProperties.get(replacementId)... | Analyse the {@link ConfigurableEnvironment environment} and attempt to rename
legacy properties if a replacement exists.
@return a report of the migration | java | core/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java | 157 | [
"metadata"
] | ConfigurationMetadataProperty | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
getAndDecrement | public int getAndDecrement() {
final int last = value;
value--;
return last;
} | Decrements this instance's value by 1; this method returns the value associated with the instance
immediately prior to the decrement operation. This method is not thread safe.
@return the value associated with the instance before it was decremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableInt.java | 234 | [] | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false | |
polyvander | def polyvander(x, deg):
"""Vandermonde matrix of given degree.
Returns the Vandermonde matrix of degree `deg` and sample points
`x`. The Vandermonde matrix is defined by
.. math:: V[..., i] = x^i,
where ``0 <= i <= deg``. The leading indices of `V` index the elements of
`x` and the last index... | Vandermonde matrix of given degree.
Returns the Vandermonde matrix of degree `deg` and sample points
`x`. The Vandermonde matrix is defined by
.. math:: V[..., i] = x^i,
where ``0 <= i <= deg``. The leading indices of `V` index the elements of
`x` and the last index is the power of `x`.
If `c` is a 1-D array of coe... | python | numpy/polynomial/polynomial.py | 1,074 | [
"x",
"deg"
] | false | 4 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
compile_fx | def compile_fx(
model_: GraphModule,
example_inputs_: Sequence[InputType],
inner_compile: Callable[..., OutputCode] = compile_fx_inner,
config_patches: Optional[dict[str, Any]] = None,
decompositions: Optional[dict[OpOverload, Callable[..., Any]]] = None,
ignore_shape_env: bool = False,
) -> Com... | Main entry point for compiling given FX graph. Despite the fact that this
lives in :mod:`torch._inductor`, this function is responsible for calling
into AOT Autograd (and we will eventually get a callback to
``inner_compile`` to perform actual compilation. In other words, this
function orchestrates end-to-end compila... | python | torch/_inductor/compile_fx.py | 2,464 | [
"model_",
"example_inputs_",
"inner_compile",
"config_patches",
"decompositions",
"ignore_shape_env"
] | CompileFxOutput | true | 8 | 6.8 | pytorch/pytorch | 96,034 | unknown | false |
select_as_coordinates | def select_as_coordinates(
self,
key: str,
where=None,
start: int | None = None,
stop: int | None = None,
):
"""
return the selection as an Index
.. warning::
Pandas uses PyTables for reading and writing HDF5 files, which allows
... | return the selection as an Index
.. warning::
Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be unsafe.
See: https://docs.python.org/3/library/pickle.ht... | python | pandas/io/pytables.py | 938 | [
"self",
"key",
"where",
"start",
"stop"
] | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
getNumPendingMessagesInQueue | int64_t getNumPendingMessagesInQueue() const {
if (eventBase_) {
eventBase_->dcheckIsInEventBaseThread();
}
int64_t numMsgs = 0;
for (const auto& callback : callbacks_) {
if (callback.consumer) {
numMsgs += callback.consumer->getQueue().size();
}
}
return numMsgs;
} | Get the current number of unprocessed messages in NotificationQueue.
This method must be invoked from the AsyncServerSocket's primary
EventBase thread. Use EventBase::runInEventBaseThread() to schedule the
operation in the correct EventBase if your code is not in the server
socket's primary EventBase. | cpp | folly/io/async/AsyncServerSocket.h | 704 | [] | true | 3 | 6.4 | facebook/folly | 30,157 | doxygen | false | |
truncate | public static Calendar truncate(final Calendar date, final int field) {
Objects.requireNonNull(date, "date");
return modify((Calendar) date.clone(), field, ModifyType.TRUNCATE);
} | Truncates a date, leaving the field specified as the most
significant field.
<p>For example, if you had the date-time of 28 Mar 2002
13:45:01.231, if you passed with HOUR, it would return 28 Mar
2002 13:00:00.000. If this was passed with MONTH, it would
return 1 Mar 2002 0:00:00.000.</p>
@param date the date to work ... | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,720 | [
"date",
"field"
] | Calendar | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
startFinalizer | public static void startFinalizer(
Class<?> finalizableReferenceClass,
ReferenceQueue<Object> queue,
PhantomReference<Object> frqReference) {
/*
* We use FinalizableReference.class for two things:
*
* 1) To invoke FinalizableReference.finalizeReferent()
*
* 2) To detect wh... | Starts the Finalizer thread. FinalizableReferenceQueue calls this method reflectively.
@param finalizableReferenceClass FinalizableReference.class.
@param queue a reference queue that the thread will poll.
@param frqReference a phantom reference to the FinalizableReferenceQueue, which will be queued
either when the... | java | android/guava/src/com/google/common/base/internal/Finalizer.java | 62 | [
"finalizableReferenceClass",
"queue",
"frqReference"
] | void | true | 7 | 6.4 | google/guava | 51,352 | javadoc | false |
emitPos | function emitPos(pos: number) {
if (sourceMapsDisabled || positionIsSynthesized(pos) || isJsonSourceMapSource(sourceMapSource)) {
return;
}
const { line: sourceLine, character: sourceCharacter } = getLineAndCharacterOfPosition(sourceMapSource, pos);
sourceMapGenerator!... | Emits a mapping.
If the position is synthetic (undefined or a negative value), no mapping will be
created.
@param pos The position. | typescript | src/compiler/emitter.ts | 6,211 | [
"pos"
] | false | 4 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
enforce_output_layout | def enforce_output_layout(gm: torch.fx.GraphModule):
"""
Make sure the output node's layout does not change due to compiler optimizations
by adding aten.as_strided nodes with the expected strides.
Only used for inference so we can assume all graph outputs are model outputs.
"""
*_, output_node ... | Make sure the output node's layout does not change due to compiler optimizations
by adding aten.as_strided nodes with the expected strides.
Only used for inference so we can assume all graph outputs are model outputs. | python | torch/_inductor/freezing.py | 210 | [
"gm"
] | true | 4 | 6 | pytorch/pytorch | 96,034 | unknown | false | |
recordStats | @CanIgnoreReturnValue
public CacheBuilder<K, V> recordStats() {
statsCounterSupplier = CACHE_STATS_COUNTER;
return this;
} | Enable the accumulation of {@link CacheStats} during the operation of the cache. Without this
{@link Cache#stats} will return zero for all statistics. Note that recording stats requires
bookkeeping to be performed with each operation, and thus imposes a performance penalty on
cache operation.
@return this {@code CacheB... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 1,010 | [] | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false | |
__init__ | def __init__(self, accumulator_node_name: str, removed_buffers: OrderedSet[str]):
"""
Initializes a CutlassEVTEpilogueArgumentFormatter object. Do not instantiate directly.
Use the CutlassEVTCodegen.ir_to_evt_python_code static method.
Args:
accumulator_node_name: The name ... | Initializes a CutlassEVTEpilogueArgumentFormatter object. Do not instantiate directly.
Use the CutlassEVTCodegen.ir_to_evt_python_code static method.
Args:
accumulator_node_name: The name of the accumulator node which should contain
the Matmul result before fusion according to the... | python | torch/_inductor/codegen/cuda/cutlass_python_evt.py | 146 | [
"self",
"accumulator_node_name",
"removed_buffers"
] | true | 3 | 6.4 | pytorch/pytorch | 96,034 | google | false | |
get_topological_order | def get_topological_order(self) -> list[str]:
"""
Get nodes in topological order (dependencies before dependents).
Returns:
List of node IDs in topological order
"""
visited = set()
temp_visited = set()
result = []
def visit(node_id: str):
... | Get nodes in topological order (dependencies before dependents).
Returns:
List of node IDs in topological order | python | tools/experimental/torchfuzz/ops_fuzzer.py | 156 | [
"self"
] | list[str] | true | 7 | 7.44 | pytorch/pytorch | 96,034 | unknown | false |
on_callback | def on_callback(self, callback, **header) -> dict:
"""Method that is called on callback stamping.
Arguments:
callback (Signature): callback that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: header... | Method that is called on callback stamping.
Arguments:
callback (Signature): callback that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: headers to update. | python | celery/canvas.py | 208 | [
"self",
"callback"
] | dict | true | 1 | 6.56 | celery/celery | 27,741 | google | false |
nodeIfOnline | public Optional<Node> nodeIfOnline(TopicPartition partition, int id) {
Node node = nodeById(id);
PartitionInfo partitionInfo = partition(partition);
if (node != null && partitionInfo != null &&
!Arrays.asList(partitionInfo.offlineReplicas()).contains(node) &&
Arrays.asLi... | Get the node by node id if the replica for the given partition is online
@param partition The TopicPartition
@param id The node id
@return the node | java | clients/src/main/java/org/apache/kafka/common/Cluster.java | 253 | [
"partition",
"id"
] | true | 5 | 7.28 | apache/kafka | 31,560 | javadoc | false | |
get_provider_info_dict | def get_provider_info_dict(provider_id: str) -> dict[str, Any]:
"""Retrieves provider info from the provider yaml file.
:param provider_id: package id to retrieve provider.yaml from
:return: provider_info dictionary
"""
provider_yaml_dict = get_provider_distributions_metadata().get(provider_id)
... | Retrieves provider info from the provider yaml file.
:param provider_id: package id to retrieve provider.yaml from
:return: provider_info dictionary | python | dev/breeze/src/airflow_breeze/utils/packages.py | 239 | [
"provider_id"
] | dict[str, Any] | true | 3 | 7.76 | apache/airflow | 43,597 | sphinx | false |
resolve | @SuppressWarnings("unchecked")
public <T> @Nullable T resolve(RegisteredBean registeredBean) {
Assert.notNull(registeredBean, "'registeredBean' must not be null");
return (T) (isLazyLookup(registeredBean) ? buildLazyResourceProxy(registeredBean) :
resolveValue(registeredBean));
} | Resolve the value for the specified registered bean.
@param registeredBean the registered bean
@return the resolved field or method parameter value | java | spring-context/src/main/java/org/springframework/context/annotation/ResourceElementResolver.java | 119 | [
"registeredBean"
] | T | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
getInt | public int getInt(int index) throws JSONException {
Object object = get(index);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(index, object, "int");
}
return result;
} | Returns the value at {@code index} if it exists and is an int or can be coerced to
an int.
@param index the index to get the value from
@return the {@code value}
@throws JSONException if the value at {@code index} doesn't exist or cannot be
coerced to an int. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 406 | [
"index"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
resolveCommand | function resolveCommand(command: string): string {
// Commands known to require .cmd on Windows (node-based & shim-installed)
const WINDOWS_SHIM_COMMANDS = new Set([
'npm',
'npx',
'pnpm',
'yarn',
'ng',
// Anything installed via node_modules/.bin (vite, eslint, prettier, etc)
// can be ad... | Resolve the actual executable name for a given command on the current platform.
Why this exists:
- Many Node-based CLIs (npm, npx, pnpm, yarn, vite, eslint, anything in node_modules/.bin) do NOT
ship as real executables on Windows.
- Instead, they install *.cmd and *.ps1 “shim” files.
- When using execa/child_process... | typescript | code/core/src/common/utils/command.ts | 115 | [
"command"
] | true | 3 | 7.04 | storybookjs/storybook | 88,865 | jsdoc | false | |
maybeSeekUnvalidated | synchronized void maybeSeekUnvalidated(TopicPartition tp, FetchPosition position, AutoOffsetResetStrategy requestedResetStrategy) {
TopicPartitionState state = assignedStateOrNull(tp);
if (state == null) {
log.debug("Skipping reset of partition {} since it is no longer assigned", tp);
... | Get the subscription topics for which metadata is required. For the leader, this will include
the union of the subscriptions of all group members. For followers, it is just that member's
subscription. This is used when querying topic metadata to detect the metadata changes which would
require rebalancing. The leader fe... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 449 | [
"tp",
"position",
"requestedResetStrategy"
] | void | true | 5 | 6.72 | apache/kafka | 31,560 | javadoc | false |
gen_attr_descriptor_import | def gen_attr_descriptor_import() -> str:
"""
import AttrsDescriptor if the triton version is new enough to have this
class defined.
"""
if not has_triton_package():
return ""
import triton.compiler.compiler
# Note: this works because triton.compiler.compiler imports AttrsDescriptor... | import AttrsDescriptor if the triton version is new enough to have this
class defined. | python | torch/_inductor/codegen/triton.py | 168 | [] | str | true | 4 | 6.72 | pytorch/pytorch | 96,034 | unknown | false |
isGzip | public static boolean isGzip(Path path) throws IOException {
try (InputStream is = Files.newInputStream(path); InputStream gzis = new GZIPInputStream(is)) {
gzis.read(); // nooping, the point is just whether it's a gzip or not
return true;
} catch (ZipException e) {
r... | Read the database type from the database. We do this manually instead of relying on the built-in mechanism to avoid reading the
entire database into memory merely to read the type. This is especially important to maintain on master nodes where pipelines are
validated. If we read the entire database into memory, we coul... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/MMDBUtil.java | 104 | [
"path"
] | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false | |
putBytes | @CanIgnoreReturnValue
PrimitiveSink putBytes(byte[] bytes, int off, int len); | Puts a chunk of an array of bytes into this sink. {@code bytes[off]} is the first byte written,
{@code bytes[off + len - 1]} is the last.
@param bytes a byte array
@param off the start offset in the array
@param len the number of bytes to write
@return this instance
@throws IndexOutOfBoundsException if {@code off < 0} ... | java | android/guava/src/com/google/common/hash/PrimitiveSink.java | 59 | [
"bytes",
"off",
"len"
] | PrimitiveSink | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
renameSpecialKeysFlexible | static void renameSpecialKeysFlexible(IngestDocument document) {
RENAME_KEYS.forEach((nonOtelName, otelName) -> {
boolean fieldExists = false;
Object value = null;
if (document.hasField(nonOtelName)) {
// Dotted fields are treated the same as normalized fields... | Renames specific ECS keys in the given document to their OpenTelemetry-compatible counterparts using logic compatible with the
{@link org.elasticsearch.ingest.IngestPipelineFieldAccessPattern#FLEXIBLE} access pattern and based on the {@code RENAME_KEYS} map.
<p>This method performs the following operations:
<ul>
<li>... | java | modules/ingest-otel/src/main/java/org/elasticsearch/ingest/otel/NormalizeForStreamProcessor.java | 334 | [
"document"
] | void | true | 8 | 6.48 | elastic/elasticsearch | 75,680 | javadoc | false |
__next__ | def __next__(self):
"""
Return the next value, or raise StopIteration.
Examples
--------
>>> import numpy as np
>>> x = np.ma.array([3, 2], mask=[0, 1])
>>> fl = x.flat
>>> next(fl)
3
>>> next(fl)
masked
>>> next(fl)
... | Return the next value, or raise StopIteration.
Examples
--------
>>> import numpy as np
>>> x = np.ma.array([3, 2], mask=[0, 1])
>>> fl = x.flat
>>> next(fl)
3
>>> next(fl)
masked
>>> next(fl)
Traceback (most recent call last):
...
StopIteration | python | numpy/ma/core.py | 2,730 | [
"self"
] | false | 4 | 6.48 | numpy/numpy | 31,054 | unknown | false | |
multi_stream_iter | def multi_stream_iter(self, log_group: str, streams: list, positions=None) -> Generator:
"""
Iterate over the available events.
The events coming from a set of log streams in a single log group
interleaving the events from each stream so they're yielded in timestamp order.
:par... | Iterate over the available events.
The events coming from a set of log streams in a single log group
interleaving the events from each stream so they're yielded in timestamp order.
:param log_group: The name of the log group.
:param streams: A list of the log stream names. The position of the stream in this list is
... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 252 | [
"self",
"log_group",
"streams",
"positions"
] | Generator | true | 8 | 8.08 | apache/airflow | 43,597 | sphinx | false |
asByteArray | byte[] asByteArray() {
ByteBuffer buffer = ByteBuffer.allocate(MINIMUM_SIZE);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(SIGNATURE);
buffer.putShort(this.numberOfThisDisk);
buffer.putShort(this.diskWhereCentralDirectoryStarts);
buffer.putShort(this.numberOfCentralDirectoryEntriesOnThisDisk);
buf... | Return the contents of this record as a byte array suitable for writing to a zip.
@return the record as a byte array | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipEndOfCentralDirectoryRecord.java | 83 | [] | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
include_if | def include_if(self, c: Consumer) -> bool:
"""Determine if this bootstep should be included.
Args:
c: The Celery consumer instance
Returns:
bool: True if quorum queues are detected, False otherwise
"""
return detect_quorum_queues(c.app, c.app.connection_... | Determine if this bootstep should be included.
Args:
c: The Celery consumer instance
Returns:
bool: True if quorum queues are detected, False otherwise | python | celery/worker/consumer/delayed_delivery.py | 52 | [
"self",
"c"
] | bool | true | 1 | 6.56 | celery/celery | 27,741 | google | false |
charMatcher | public static StrMatcher charMatcher(final char ch) {
return new CharMatcher(ch);
} | Creates a matcher from a character.
@param ch the character to match, must not be null.
@return a new Matcher for the given char. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 245 | [
"ch"
] | StrMatcher | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
estimatedBytesWritten | private int estimatedBytesWritten() {
if (compression.type() == CompressionType.NONE) {
return batchHeaderSizeInBytes + uncompressedRecordsSizeInBytes;
} else {
// estimate the written bytes to the underlying byte buffer based on uncompressed written bytes
return batc... | Get an estimate of the number of bytes written (based on the estimation factor hard-coded in {@link CompressionType}).
@return The estimated number of bytes written | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java | 820 | [] | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
threadNamePrefix | public SimpleAsyncTaskSchedulerBuilder threadNamePrefix(@Nullable String threadNamePrefix) {
return new SimpleAsyncTaskSchedulerBuilder(threadNamePrefix, this.concurrencyLimit, this.virtualThreads,
this.taskTerminationTimeout, this.taskDecorator, this.customizers);
} | Set the prefix to use for the names of newly created threads.
@param threadNamePrefix the thread name prefix to set
@return a new builder instance | java | core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java | 80 | [
"threadNamePrefix"
] | SimpleAsyncTaskSchedulerBuilder | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
init_IA64_32Bit | private static void init_IA64_32Bit() {
addProcessors(new Processor(Processor.Arch.BIT_32, Processor.Type.IA_64), "ia64_32", "ia64n");
} | Gets a {@link Processor} object the given value {@link String}. The {@link String} must be like a value returned by the {@code "os.arch"} system
property.
@param value A {@link String} like a value returned by the {@code os.arch} System Property.
@return A {@link Processor} when it exists, else {@code null}. | java | src/main/java/org/apache/commons/lang3/ArchUtils.java | 107 | [] | void | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
getPrimitiveStackCache | function getPrimitiveStackCache(): Map<string, Array<any>> {
// This initializes a cache of all primitive hooks so that the top
// most stack frames added by calling the primitive hook can be removed.
if (primitiveStackCache === null) {
const cache = new Map<string, Array<any>>();
let readHookLog;
try... | 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-debug-tools/src/ReactDebugHooks.js | 69 | [] | false | 8 | 6.32 | facebook/react | 241,750 | jsdoc | false | |
wait_for_job | def wait_for_job(
self,
job_id: str,
delay: int | float | None = None,
get_batch_log_fetcher: Callable[[str], AwsTaskLogFetcher | None] | None = None,
) -> None:
"""
Wait for Batch job to complete.
This assumes that the ``.waiter_model`` is configured using s... | Wait for Batch job to complete.
This assumes that the ``.waiter_model`` is configured using some
variation of the ``.default_config`` so that it can generate waiters
with the following names: "JobExists", "JobRunning" and "JobComplete".
:param job_id: a Batch job ID
:param delay: A delay before polling for job stat... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/batch_waiters.py | 200 | [
"self",
"job_id",
"delay",
"get_batch_log_fetcher"
] | None | true | 4 | 6.72 | apache/airflow | 43,597 | sphinx | false |
asPredicate | public static <T> Predicate<T> asPredicate(final FailablePredicate<T, ?> predicate) {
return input -> test(predicate, input);
} | Converts the given {@link FailablePredicate} into a standard {@link Predicate}.
@param <T> the type used by the predicates
@param predicate a {@link FailablePredicate}
@return a standard {@link Predicate} | java | src/main/java/org/apache/commons/lang3/function/Failable.java | 362 | [
"predicate"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
__iter__ | def __iter__(self) -> Iterator[int]:
"""
Return an iterator of the values.
Returns
-------
iterator
An iterator yielding ints from the RangeIndex.
Examples
--------
>>> idx = pd.RangeIndex(3)
>>> for x in idx:
... print(x)... | Return an iterator of the values.
Returns
-------
iterator
An iterator yielding ints from the RangeIndex.
Examples
--------
>>> idx = pd.RangeIndex(3)
>>> for x in idx:
... print(x)
0
1
2 | python | pandas/core/indexes/range.py | 571 | [
"self"
] | Iterator[int] | true | 1 | 6.08 | pandas-dev/pandas | 47,362 | unknown | false |
protocol_df_chunk_to_pandas | def protocol_df_chunk_to_pandas(df: DataFrameXchg) -> pd.DataFrame:
"""
Convert interchange protocol chunk to ``pd.DataFrame``.
Parameters
----------
df : DataFrameXchg
Returns
-------
pd.DataFrame
"""
columns: dict[str, Any] = {}
buffers = [] # hold on to buffers, keeps m... | Convert interchange protocol chunk to ``pd.DataFrame``.
Parameters
----------
df : DataFrameXchg
Returns
-------
pd.DataFrame | python | pandas/core/interchange/from_dataframe.py | 178 | [
"df"
] | pd.DataFrame | true | 9 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
blockingGet | @ParametricNullness
@SuppressWarnings("nullness") // TODO(b/147136275): Remove once our checker understands & and |.
final V blockingGet() throws InterruptedException, ExecutionException {
if (Thread.interrupted()) {
throw new InterruptedException();
}
@RetainedLocalRef Object localValue = valueFi... | Releases all threads in the {@link #waitersField} list, and clears the list. | java | android/guava/src/com/google/common/util/concurrent/AbstractFutureState.java | 224 | [] | V | true | 8 | 6.72 | google/guava | 51,352 | javadoc | false |
symmetric_difference | def symmetric_difference(
self,
other,
result_name: abc.Hashable | None = None,
sort: bool | None = None,
):
"""
Compute the symmetric difference of two Index objects.
Parameters
----------
other : Index or array-like
Index or an a... | Compute the symmetric difference of two Index objects.
Parameters
----------
other : Index or array-like
Index or an array-like object with elements to compute the symmetric
difference with the original Index.
result_name : str
A string representing the name of the resulting Index, if desired.
sort : bool ... | python | pandas/core/indexes/base.py | 3,489 | [
"self",
"other",
"result_name",
"sort"
] | true | 8 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false | |
lastIndexOf | function lastIndexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length;
if (fromIndex !== undefined) {
index = toInteger(fromIndex);
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(i... | This method is like `_.indexOf` except that it iterates over elements of
`array` from right to left.
@static
@memberOf _
@since 0.1.0
@category Array
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} [fromIndex=array.length-1] The index to search from.
@returns {number... | javascript | lodash.js | 7,738 | [
"array",
"value",
"fromIndex"
] | false | 6 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
english_upper | def english_upper(s):
""" Apply English case rules to convert ASCII strings to all upper case.
This is an internal utility function to replace calls to str.upper() such
that we can avoid changing behavior with changing locales. In particular,
Turkish has distinct dotted and dotless variants of the Lati... | Apply English case rules to convert ASCII strings to all upper case.
This is an internal utility function to replace calls to str.upper() such
that we can avoid changing behavior with changing locales. In particular,
Turkish has distinct dotted and dotless variants of the Latin letter "I" in
both lowercase and upperca... | python | numpy/_core/_string_helpers.py | 44 | [
"s"
] | false | 1 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
set_default_device | def set_default_device(device: "Device") -> None:
"""Sets the default ``torch.Tensor`` to be allocated on ``device``. This
does not affect factory function calls which are called with an explicit
``device`` argument. Factory calls will be performed as if they
were passed ``device`` as an argument.
... | Sets the default ``torch.Tensor`` to be allocated on ``device``. This
does not affect factory function calls which are called with an explicit
``device`` argument. Factory calls will be performed as if they
were passed ``device`` as an argument.
To only temporarily change the default device instead of setting it
glo... | python | torch/__init__.py | 1,224 | [
"device"
] | None | true | 5 | 7.84 | pytorch/pytorch | 96,034 | google | false |
createCollection | @Override
Set<V> createCollection() {
return Platform.newHashSetWithExpectedSize(expectedValuesPerKey);
} | {@inheritDoc}
<p>Creates an empty {@code HashSet} for a collection of values for one key.
@return a new {@code HashSet} containing a collection of values for one key | java | android/guava/src/com/google/common/collect/HashMultimap.java | 127 | [] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
getValue | @Deprecated
@Override
public Long getValue() {
return Long.valueOf(this.value);
} | Gets the value as a Long instance.
@return the value as a Long, never null.
@deprecated Use {@link #get()}. | java | src/main/java/org/apache/commons/lang3/mutable/MutableLong.java | 259 | [] | Long | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
maybeExpire | void maybeExpire() {
if (numAttempts > 0 && isExpired()) {
removeRequest();
future().completeExceptionally(new TimeoutException(requestDescription() +
" could not complete before timeout expired."));
}
} | Complete the request future with a TimeoutException if the request has been sent out
at least once and the timeout has been reached. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 914 | [] | void | true | 3 | 6.72 | apache/kafka | 31,560 | javadoc | false |
createSuperElementAccessInAsyncMethod | function createSuperElementAccessInAsyncMethod(argumentExpression: Expression, location: TextRange): LeftHandSideExpression {
if (enclosingSuperContainerFlags & NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync) {
return setTextRange(
factory.createPropertyAccessExpression(
... | Hooks node substitutions.
@param hint A hint as to the intended usage of the node.
@param node The node to substitute. | typescript | src/compiler/transformers/es2017.ts | 1,027 | [
"argumentExpression",
"location"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
get_dataframe_repr_params | def get_dataframe_repr_params() -> dict[str, Any]:
"""Get the parameters used to repr(dataFrame) calls using DataFrame.to_string.
Supplying these parameters to DataFrame.to_string is equivalent to calling
``repr(DataFrame)``. This is useful if you want to adjust the repr output.
Example
-------
... | Get the parameters used to repr(dataFrame) calls using DataFrame.to_string.
Supplying these parameters to DataFrame.to_string is equivalent to calling
``repr(DataFrame)``. This is useful if you want to adjust the repr output.
Example
-------
>>> import pandas as pd
>>>
>>> df = pd.DataFrame([[1, 2], [3, 4]])
>>> repr... | python | pandas/io/formats/format.py | 355 | [] | dict[str, Any] | true | 3 | 8 | pandas-dev/pandas | 47,362 | unknown | false |
construct_1d_arraylike_from_scalar | def construct_1d_arraylike_from_scalar(
value: Scalar, length: int, dtype: DtypeObj | None
) -> ArrayLike:
"""
create an np.ndarray / pandas type of specified shape and dtype
filled with values
Parameters
----------
value : scalar value
length : int
dtype : pandas_dtype or np.dtype
... | create an np.ndarray / pandas type of specified shape and dtype
filled with values
Parameters
----------
value : scalar value
length : int
dtype : pandas_dtype or np.dtype
Returns
-------
np.ndarray / pandas type of length, filled with value | python | pandas/core/dtypes/cast.py | 1,393 | [
"value",
"length",
"dtype"
] | ArrayLike | true | 11 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
getBinder | private Binder getBinder(@Nullable ConfigDataActivationContext activationContext,
Predicate<ConfigDataEnvironmentContributor> filter, Set<BinderOption> options) {
boolean failOnInactiveSource = options.contains(BinderOption.FAIL_ON_BIND_TO_INACTIVE_SOURCE);
Iterable<ConfigurationPropertySource> sources = () -> g... | Return a {@link Binder} backed by the contributors.
@param activationContext the activation context
@param filter a filter used to limit the contributors
@param options binder options to apply
@return a binder instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java | 228 | [
"activationContext",
"filter",
"options"
] | Binder | true | 3 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
formatPeriod | public static String formatPeriod(final long startMillis, final long endMillis, final String format) {
return formatPeriod(startMillis, endMillis, format, true, TimeZone.getDefault());
} | Formats the time gap as a string, using the specified format.
Padding the left-hand side side of numbers with zeroes is optional.
@param startMillis the start of the duration
@param endMillis the end of the duration
@param format the way in which to format the duration, not null
@return the formatted duration, not n... | java | src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java | 501 | [
"startMillis",
"endMillis",
"format"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
resolveItemMetadataGroup | private ItemMetadata resolveItemMetadataGroup(String prefix, MetadataGenerationEnvironment environment) {
Element propertyElement = environment.getTypeUtils().asElement(getType());
String nestedPrefix = ConfigurationMetadata.nestedPrefix(prefix, getName());
String dataType = environment.getTypeUtils().getQualifie... | Return if this property has been explicitly marked as nested (for example using an
annotation}.
@param environment the metadata generation environment
@return if the property has been marked as nested | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptor.java | 180 | [
"prefix",
"environment"
] | ItemMetadata | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
_interp_limit | def _interp_limit(
invalid: npt.NDArray[np.bool_], fw_limit: int | None, bw_limit: int | None
) -> np.ndarray:
"""
Get indexers of values that won't be filled
because they exceed the limits.
Parameters
----------
invalid : np.ndarray[bool]
fw_limit : int or None
forward limit to... | Get indexers of values that won't be filled
because they exceed the limits.
Parameters
----------
invalid : np.ndarray[bool]
fw_limit : int or None
forward limit to index
bw_limit : int or None
backward limit to index
Returns
-------
set of indexers
Notes
-----
This is equivalent to the more readable, but sl... | python | pandas/core/missing.py | 1,039 | [
"invalid",
"fw_limit",
"bw_limit"
] | np.ndarray | true | 8 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
get_output_location | def get_output_location(self, query_execution_id: str) -> str:
"""
Get the output location of the query results in S3 URI format.
.. seealso::
- :external+boto3:py:meth:`Athena.Client.get_query_execution`
:param query_execution_id: Id of submitted athena query
"""
... | Get the output location of the query results in S3 URI format.
.. seealso::
- :external+boto3:py:meth:`Athena.Client.get_query_execution`
:param query_execution_id: Id of submitted athena query | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py | 309 | [
"self",
"query_execution_id"
] | str | true | 3 | 6.24 | apache/airflow | 43,597 | sphinx | false |
toByteArray | public byte[] toByteArray() {
return bitSet.toByteArray();
} | Returns a new byte array containing all the bits in this bit set.
<p>
More precisely, if:
</p>
<ol>
<li>{@code byte[] bytes = s.toByteArray();}</li>
<li>then {@code bytes.length == (s.length()+7)/8} and</li>
<li>{@code s.get(n) == ((bytes[n/8] & (1<<(n%8))) != 0)}</li>
<li>for all {@code n < 8 * bytes.length}.</li>
</o... | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 545 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
once | public static BooleanSupplier once() {
return new OnceTrue();
} | @return a {@link BooleanSupplier} which supplies {@code true} the first time it is called, and {@code false} subsequently. | java | libs/core/src/main/java/org/elasticsearch/core/Predicates.java | 110 | [] | BooleanSupplier | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
parseYieldExpression | function parseYieldExpression(): YieldExpression {
const pos = getNodePos();
// YieldExpression[In] :
// yield
// yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
// yield [no LineTerminator here] * [Lexical go... | 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,169 | [] | true | 5 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toString | @Override
public String toString() {
return "MergingDigest"
+ "-"
+ getScaleFunction()
+ "-"
+ (useWeightLimit ? "weight" : "kSize")
+ "-"
+ (useAlternatingSort ? "alternating" : "stable")
+ "-"
+ (useTwoLevelCom... | Merges any pending inputs and compresses the data down to the public setting.
Note that this typically loses a bit of precision and thus isn't a thing to
be doing all the time. It is best done only when we want to show results to
the outside world. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/MergingDigest.java | 611 | [] | String | true | 4 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
signature | def signature(varies, *args, **kwargs):
"""Create new signature.
- if the first argument is a signature already then it's cloned.
- if the first argument is a dict, then a Signature version is returned.
Returns:
Signature: The resulting signature.
"""
app = kwargs.get('app')
if isi... | Create new signature.
- if the first argument is a signature already then it's cloned.
- if the first argument is a dict, then a Signature version is returned.
Returns:
Signature: The resulting signature. | python | celery/canvas.py | 2,373 | [
"varies"
] | false | 3 | 7.12 | celery/celery | 27,741 | unknown | false | |
binaryValue | @Override
public byte[] binaryValue() throws IOException {
try {
return parser.getBinaryValue();
} catch (IOException e) {
throw handleParserException(e);
}
} | Handle parser exception depending on type.
This converts known exceptions to XContentParseException and rethrows them. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentParser.java | 299 | [] | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
VirtualLock | boolean VirtualLock(Address address, long size); | Locks the specified region of the process's virtual address space into physical
memory, ensuring that subsequent access to the region will not incur a page fault.
@param address A pointer to the base address of the region of pages to be locked.
@param size The size of the region to be locked, in bytes.
@return true if ... | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/lib/Kernel32Library.java | 61 | [
"address",
"size"
] | true | 1 | 6.16 | elastic/elasticsearch | 75,680 | javadoc | false | |
execute | @Override
public IngestDocument execute(IngestDocument document) {
document.doNoSelfReferencesCheck(true);
IngestScript.Factory factory = precompiledIngestScriptFactory;
if (factory == null) {
factory = scriptService.compile(script, IngestScript.CONTEXT);
}
factor... | Executes the script with the Ingest document in context.
@param document The Ingest document passed into the script context under the "ctx" object. | java | modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ScriptProcessor.java | 73 | [
"document"
] | IngestDocument | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
strip_leading_zeros_from_version | def strip_leading_zeros_from_version(version: str) -> str:
"""
Strips leading zeros from version number.
This converts 1974.04.03 to 1974.4.3 as the format with leading month and day zeros is not accepted
by PIP versioning.
:param version: version number in CALVER format (potentially with leading ... | Strips leading zeros from version number.
This converts 1974.04.03 to 1974.4.3 as the format with leading month and day zeros is not accepted
by PIP versioning.
:param version: version number in CALVER format (potentially with leading 0s in date and month)
:return: string with leading 0s after dot replaced. | python | dev/breeze/src/airflow_breeze/utils/versions.py | 20 | [
"version"
] | str | true | 2 | 8.24 | apache/airflow | 43,597 | sphinx | false |
count | def count(self) -> NDFrameT:
"""
Compute count of group, excluding missing values.
Returns
-------
Series or DataFrame
Count of values within each group.
%(see_also)s
Examples
--------
For SeriesGroupBy:
>>> lst = ["a", "a", "... | Compute count of group, excluding missing values.
Returns
-------
Series or DataFrame
Count of values within each group.
%(see_also)s
Examples
--------
For SeriesGroupBy:
>>> lst = ["a", "a", "b"]
>>> ser = pd.Series([1, 2, np.nan], index=lst)
>>> ser
a 1.0
a 2.0
b NaN
dtype: float64
>>> ser.groupby(leve... | python | pandas/core/groupby/groupby.py | 2,105 | [
"self"
] | NDFrameT | true | 7 | 8.4 | pandas-dev/pandas | 47,362 | unknown | false |
extracted | private PropertyDescriptor extracted(TypeElement declaringElement, TypeElementMembers members,
VariableElement parameter) {
String parameterName = parameter.getSimpleName().toString();
String name = getPropertyName(parameter, parameterName);
TypeMirror type = parameter.asType();
ExecutableElement getter = me... | Return the {@link PropertyDescriptor} instances that are valid candidates for the
specified {@link TypeElement type} based on the specified {@link ExecutableElement
factory method}, if any.
@param type the target type
@param factoryMethod the method that triggered the metadata for that {@code type}
or {@code null}
@ret... | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolver.java | 88 | [
"declaringElement",
"members",
"parameter"
] | PropertyDescriptor | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
certificates | @Nullable List<X509Certificate> certificates(); | The certificates for this store. When a {@link #privateKey() private key} is
present the returned value is treated as a certificate chain, otherwise it is
treated a list of certificates that should all be registered.
@return the X509 certificates | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStore.java | 67 | [] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
_downsample | def _downsample(self, how, **kwargs):
"""
Downsample the cython defined function.
Parameters
----------
how : string / cython mapped function
**kwargs : kw args passed to how function
"""
ax = self.ax
if is_subperiod(ax.freq, self.freq):
... | Downsample the cython defined function.
Parameters
----------
how : string / cython mapped function
**kwargs : kw args passed to how function | python | pandas/core/resample.py | 2,210 | [
"self",
"how"
] | false | 5 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false | |
any | def any(self, axis: AxisInt = 0, *args, **kwargs) -> bool:
"""
Tests whether at least one of elements evaluate True
Returns
-------
any : bool
See Also
--------
numpy.any
"""
nv.validate_any(args, kwargs)
values = self.sp_values
... | Tests whether at least one of elements evaluate True
Returns
-------
any : bool
See Also
--------
numpy.any | python | pandas/core/arrays/sparse/array.py | 1,484 | [
"self",
"axis"
] | bool | true | 3 | 6.56 | pandas-dev/pandas | 47,362 | unknown | false |
update | function update(object, path, updater) {
return object == null ? object : baseUpdate(object, path, castFunction(updater));
} | This method is like `_.set` except that accepts `updater` to produce the
value to set. Use `_.updateWith` to customize `path` creation. The `updater`
is invoked with one argument: (value).
**Note:** This method mutates `object`.
@static
@memberOf _
@since 4.6.0
@category Object
@param {Object} object The object to modi... | javascript | lodash.js | 13,976 | [
"object",
"path",
"updater"
] | false | 2 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
findEditorByConvention | public static @Nullable PropertyEditor findEditorByConvention(@Nullable Class<?> targetType) {
if (targetType == null || targetType.isArray() || unknownEditorTypes.contains(targetType)) {
return null;
}
ClassLoader cl = targetType.getClassLoader();
if (cl == null) {
try {
cl = ClassLoader.getSystemCl... | Find a JavaBeans PropertyEditor following the 'Editor' suffix convention
(for example, "mypackage.MyDomainClass" → "mypackage.MyDomainClassEditor").
<p>Compatible to the standard JavaBeans convention as implemented by
{@link java.beans.PropertyEditorManager} but isolated from the latter's
registered default editor... | java | spring-beans/src/main/java/org/springframework/beans/BeanUtils.java | 552 | [
"targetType"
] | PropertyEditor | true | 10 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
shouldHeartbeatNow | public boolean shouldHeartbeatNow() {
MemberState state = state();
return state == MemberState.ACKNOWLEDGING || state == MemberState.LEAVING || state == MemberState.JOINING;
} | @return True if the member should send heartbeat to the coordinator without waiting for
the interval. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 692 | [] | true | 3 | 8 | apache/kafka | 31,560 | javadoc | false | |
dispatch | public void dispatch() {
// iterate by index to avoid concurrent modification exceptions
for (int i = 0; i < listeners.size(); i++) {
listeners.get(i).dispatch();
}
} | Dispatches all events enqueued prior to this call, serially and in order, for every listener.
<p>Note: this method is idempotent and safe to call from any thread | java | android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java | 118 | [] | void | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false |
groupMetadata | public ConsumerGroupMetadata groupMetadata() {
return groupMetadata;
} | Return the consumer group metadata.
@return the current consumer group metadata | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 1,010 | [] | ConsumerGroupMetadata | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
all | public KafkaFuture<Map<String, UserScramCredentialsDescription>> all() {
final KafkaFutureImpl<Map<String, UserScramCredentialsDescription>> retval = new KafkaFutureImpl<>();
dataFuture.whenComplete((data, throwable) -> {
if (throwable != null) {
retval.completeExceptionally(... | @return a future for the results of all described users with map keys (one per user) being consistent with the
contents of the list returned by {@link #users()}. The future will complete successfully only if all such user
descriptions complete successfully. | java | clients/src/main/java/org/apache/kafka/clients/admin/DescribeUserScramCredentialsResult.java | 54 | [] | true | 4 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
getNeighbor | public static final String getNeighbor(String geohash, int level, int dx, int dy) {
int cell = BASE_32_STRING.indexOf(geohash.charAt(level - 1));
// Decoding the Geohash bit pattern to determine grid coordinates
int x0 = cell & 1; // first bit of x
int y0 = cell & 2; // first bit of y... | Calculate the geohash of a neighbor of a geohash
@param geohash the geohash of a cell
@param level level of the geohash
@param dx delta of the first grid coordinate (must be -1, 0 or +1)
@param dy delta of the second grid coordinate (must be -1, 0 or +1)
@return geohash of the defined cell | java | libs/geo/src/main/java/org/elasticsearch/geometry/utils/Geohash.java | 202 | [
"geohash",
"level",
"dx",
"dy"
] | String | true | 13 | 7.28 | elastic/elasticsearch | 75,680 | javadoc | false |
open_resource | def open_resource(
self, resource: str, mode: str = "rb", encoding: str | None = "utf-8"
) -> t.IO[t.AnyStr]:
"""Open a resource file relative to :attr:`root_path` for reading. The
blueprint-relative equivalent of the app's :meth:`~.Flask.open_resource`
method.
:param resour... | Open a resource file relative to :attr:`root_path` for reading. The
blueprint-relative equivalent of the app's :meth:`~.Flask.open_resource`
method.
:param resource: Path to the resource relative to :attr:`root_path`.
:param mode: Open the file in this mode. Only reading is supported,
valid values are ``"r"`` (or ... | python | src/flask/blueprints.py | 104 | [
"self",
"resource",
"mode",
"encoding"
] | t.IO[t.AnyStr] | true | 3 | 6.4 | pallets/flask | 70,946 | sphinx | false |
applyEmptySelectionError | function applyEmptySelectionError(
error: EmptySelectionError,
argsTree: ArgumentsRenderingTree,
globalOmit?: GlobalOmitOptions,
) {
const subSelection = argsTree.arguments.getDeepSubSelectionValue(error.selectionPath)?.asObject()
if (subSelection) {
const omit = subSelection.getField('omit')?.value.asObj... | Given the validation error and arguments rendering tree, applies corresponding
formatting to an error tree and adds all relevant messages.
@param error
@param args | typescript | packages/client/src/runtime/core/errorRendering/applyValidationError.ts | 140 | [
"error",
"argsTree",
"globalOmit?"
] | false | 5 | 6.08 | prisma/prisma | 44,834 | jsdoc | false | |
setCount | @CanIgnoreReturnValue
public Builder<E> setCount(E element, int count) {
contents.setCount(checkNotNull(element), count);
return this;
} | Adds or removes the necessary occurrences of an element such that the element attains the
desired count.
@param element the element to add or remove occurrences of
@param count the desired count of the element in this multiset
@return this {@code Builder} object
@throws NullPointerException if {@code element} is null
@... | java | guava/src/com/google/common/collect/ImmutableMultiset.java | 546 | [
"element",
"count"
] | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false | |
insecure | public static RandomUtils insecure() {
return INSECURE;
} | Gets the singleton instance based on {@link ThreadLocalRandom#current()}; <b>which is not cryptographically
secure</b>; use {@link #secure()} to use an algorithms/providers specified in the
{@code securerandom.strongAlgorithms} {@link Security} property.
<p>
The method {@link ThreadLocalRandom#current()} is called on-d... | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 102 | [] | RandomUtils | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
make_run_fn | def make_run_fn(
self, *input_tensors: torch.Tensor, out: torch.Tensor
) -> Callable[[], None]:
"""
Create a function to run the CUDA kernel with the given input and output tensors.
"""
self.ensure_dll_loaded()
self.update_workspace_size()
args = [c_void_p(te... | Create a function to run the CUDA kernel with the given input and output tensors. | python | torch/_inductor/autotune_process.py | 827 | [
"self",
"out"
] | Callable[[], None] | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
constant_name | def constant_name(self, name: str, device_override: Optional[torch.device]) -> str:
"""
We AOT copy constants to the devices they are needed on.
If device_override doesn't match the constant's device, then
copy it and return a different name.
"""
if self.constants[name].d... | We AOT copy constants to the devices they are needed on.
If device_override doesn't match the constant's device, then
copy it and return a different name. | python | torch/_inductor/graph.py | 1,114 | [
"self",
"name",
"device_override"
] | str | true | 6 | 6 | pytorch/pytorch | 96,034 | unknown | false |
sendListOffsetsRequests | private RequestFuture<ListOffsetResult> sendListOffsetsRequests(final Map<TopicPartition, Long> timestampsToSearch,
final boolean requireTimestamps) {
final Set<TopicPartition> partitionsToRetry = new HashSet<>();
Map<Node, Map<TopicPar... | Search the offsets by target times for the specified partitions.
@param timestampsToSearch the mapping between partitions and target time
@param requireTimestamps true if we should fail with an UnsupportedVersionException if the broker does
not support fetching precise timestamps for offsets
... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetFetcher.java | 300 | [
"timestampsToSearch",
"requireTimestamps"
] | true | 5 | 7.28 | apache/kafka | 31,560 | javadoc | false | |
binaryBeMsb0ToHexDigit | public static char binaryBeMsb0ToHexDigit(final boolean[] src, final int srcPos) {
// JDK 9: Objects.checkIndex(int index, int length)
if (Integer.compareUnsigned(srcPos, src.length) >= 0) {
// Throw the correct exception
if (src.length == 0) {
throw new IllegalAr... | Converts a binary (represented as boolean array) in big-endian MSB0 bit ordering to a hexadecimal digit.
<p>
(1, 0, 0, 0) with srcPos = 0 is converted as follow: '8' (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0) with srcPos = 2 is converted to '5'.
</p>
@param src the binary to convert.
@param srcPos the position... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 107 | [
"src",
"srcPos"
] | true | 21 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
iteratee | function iteratee(func) {
return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
} | Creates a function that invokes `func` with the arguments of the created
function. If `func` is a property name, the created function returns the
property value for a given element. If `func` is an array or object, the
created function returns `true` for elements that contain the equivalent
source properties, otherwise... | javascript | lodash.js | 15,642 | [
"func"
] | false | 2 | 6.96 | lodash/lodash | 61,490 | jsdoc | false | |
ljust | def ljust(a, width, fillchar=' '):
"""
Return an array with the elements of `a` left-justified in a
string of length `width`.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
width : array_like, with any integer dtype
The length of the resul... | Return an array with the elements of `a` left-justified in a
string of length `width`.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
width : array_like, with any integer dtype
The length of the resulting strings, unless ``width < str_len(a)``.
fillchar : array-like, wit... | python | numpy/_core/strings.py | 762 | [
"a",
"width",
"fillchar"
] | false | 4 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
getAccessibleConstructor | public static <T> Constructor<T> getAccessibleConstructor(final Class<T> cls, final Class<?>... parameterTypes) {
Objects.requireNonNull(cls, "cls");
try {
return getAccessibleConstructor(cls.getConstructor(parameterTypes));
} catch (final NoSuchMethodException e) {
retur... | Finds a constructor given a class and signature, checking accessibility.
<p>
This finds the constructor and ensures that it is accessible. The constructor signature must match the parameter types exactly.
</p>
@param <T> the constructor type.
@param cls the class to find a constructor for, not {@c... | java | src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java | 65 | [
"cls"
] | true | 2 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
singleQuoteMatcher | public static StrMatcher singleQuoteMatcher() {
return SINGLE_QUOTE_MATCHER;
} | Gets the matcher for the single quote character.
@return the matcher for a single quote. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 322 | [] | StrMatcher | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
union_with_duplicates | def union_with_duplicates(
lvals: ArrayLike | Index, rvals: ArrayLike | Index
) -> ArrayLike | Index:
"""
Extracts the union from lvals and rvals with respect to duplicates and nans in
both arrays.
Parameters
----------
lvals: np.ndarray or ExtensionArray
left values which is ordere... | Extracts the union from lvals and rvals with respect to duplicates and nans in
both arrays.
Parameters
----------
lvals: np.ndarray or ExtensionArray
left values which is ordered in front.
rvals: np.ndarray or ExtensionArray
right values ordered after lvals.
Returns
-------
np.ndarray or ExtensionArray
Co... | python | pandas/core/algorithms.py | 1,604 | [
"lvals",
"rvals"
] | ArrayLike | Index | true | 6 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
getFile | private File getFile(String patternLocation, Resource resource) {
try {
return resource.getFile();
}
catch (Exception ex) {
throw new IllegalStateException(
"Unable to load config data resource from pattern '" + patternLocation + "'", ex);
}
} | Get a multiple resources from a location pattern.
@param location the location pattern
@param type the type of resource to return
@return the resources
@see #isPattern(String) | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/LocationResourceLoader.java | 137 | [
"patternLocation",
"resource"
] | File | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
beanOfTypeIncludingAncestors | public static <T> T beanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class<T> type)
throws BeansException {
Map<String, T> beansOfType = beansOfTypeIncludingAncestors(lbf, type);
return uniqueBean(type, beansOfType);
} | Return a single bean of the given type or subtypes, also picking up beans
defined in ancestor bean factories if the current bean factory is a
HierarchicalBeanFactory. Useful convenience method when we expect a
single bean and don't care about the bean name.
<p>Does consider objects created by FactoryBeans, which means ... | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java | 410 | [
"lbf",
"type"
] | T | true | 1 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
init_backend_registration | def init_backend_registration() -> None:
"""
Register the backend for different devices, including the scheduling
for kernel code generation and the host side wrapper code generation.
"""
from .cpp import CppScheduling
from .cpp_wrapper_cpu import CppWrapperCpu
from .cpp_wrapper_cpu_array_re... | Register the backend for different devices, including the scheduling
for kernel code generation and the host side wrapper code generation. | python | torch/_inductor/codegen/common.py | 500 | [] | None | true | 12 | 6.8 | pytorch/pytorch | 96,034 | unknown | false |
parse | static @Nullable PrivateKey parse(String text) {
return parse(text, null);
} | Parse a private key from the specified string.
@param text the text to parse
@return the parsed private key | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemPrivateKeyParser.java | 194 | [
"text"
] | PrivateKey | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return ObjectUtils.nullSafeEquals(this.value, ((BindResult<?>) obj).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 | 134 | [
"obj"
] | true | 4 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
execute | @Override
protected void execute(Terminal terminal, OptionSet options, ProcessInfo processInfo) throws Exception {
if (subcommands.isEmpty()) {
throw new IllegalStateException("No subcommands configured");
}
// .values(...) returns an unmodifiable list
final List<String>... | Construct the multi-command with the specified command description and runnable to execute before main is invoked.
@param description the multi-command description | java | libs/cli/src/main/java/org/elasticsearch/cli/MultiCommand.java | 73 | [
"terminal",
"options",
"processInfo"
] | void | true | 4 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
is_local_package_version | def is_local_package_version(version_suffix: str) -> bool:
"""
Check if the given version suffix is a local version suffix. A local version suffix will contain a
plus sign ('+'). This function does not guarantee that the version suffix is a valid local version suffix.
Args:
version_suffix (str)... | Check if the given version suffix is a local version suffix. A local version suffix will contain a
plus sign ('+'). This function does not guarantee that the version suffix is a valid local version suffix.
Args:
version_suffix (str): The version suffix to check.
Returns:
bool: True if the version suffix conta... | python | dev/breeze/src/airflow_breeze/utils/version_utils.py | 26 | [
"version_suffix"
] | bool | true | 3 | 8.08 | apache/airflow | 43,597 | google | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.