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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
of | public static <L, M, R> ImmutableTriple<L, M, R> of(final L left, final M middle, final R right) {
return left != null | middle != null || right != null ? new ImmutableTriple<>(left, middle, right) : nullTriple();
} | Creates an immutable triple of three objects inferring the generic types.
@param <L> the left element type.
@param <M> the middle element type.
@param <R> the right element type.
@param left the left element, may be null.
@param middle the middle element, may be null.
@param right the right element, may be null.
@re... | java | src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java | 96 | [
"left",
"middle",
"right"
] | true | 3 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
newEnumMap | public static <K extends Enum<K>, V extends @Nullable Object> EnumMap<K, V> newEnumMap(
Map<K, ? extends V> map) {
return new EnumMap<>(map);
} | Creates an {@code EnumMap} with the same mappings as the specified map.
<p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead,
use the {@code EnumMap} constructor directly, taking advantage of <a
href="https://docs.oracle.com/javase/tutorial/java/generics/genTypeInference.html#type... | java | android/guava/src/com/google/common/collect/Maps.java | 439 | [
"map"
] | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false | |
process_response | def process_response(self, ctx: AppContext, response: Response) -> Response:
"""Can be overridden in order to modify the response object
before it's sent to the WSGI server. By default this will
call all the :meth:`after_request` decorated functions.
.. versionchanged:: 0.5
... | Can be overridden in order to modify the response object
before it's sent to the WSGI server. By default this will
call all the :meth:`after_request` decorated functions.
.. versionchanged:: 0.5
As of Flask 0.5 the functions registered for after request
execution are called in reverse order of registration.
:p... | python | src/flask/app.py | 1,382 | [
"self",
"ctx",
"response"
] | Response | true | 6 | 7.92 | pallets/flask | 70,946 | sphinx | false |
throwIfGroupIdNotDefined | private void throwIfGroupIdNotDefined() {
if (groupMetadata.get().isEmpty()) {
throw new InvalidGroupIdException("To use the group management or offset commit APIs, you must " +
"provide a valid " + ConsumerConfig.GROUP_ID_CONFIG + " in the consumer configuration.");
}
} | This method sends a commit event to the EventHandler and return. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 1,192 | [] | void | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false |
_ninja_build_file | def _ninja_build_file(self) -> str:
r"""Returns the path to build.ninja.
Returns:
string: The path to build.ninja.
"""
return os.path.join(self.build_dir, "build.ninja") | r"""Returns the path to build.ninja.
Returns:
string: The path to build.ninja. | python | tools/setup_helpers/cmake.py | 80 | [
"self"
] | str | true | 1 | 6.56 | pytorch/pytorch | 96,034 | unknown | false |
_check_parser | def _check_parser(parser: str) -> None:
"""
Make sure a valid parser is passed.
Parameters
----------
parser : str
Raises
------
KeyError
* If an invalid parser is passed
"""
if parser not in PARSERS:
raise KeyError(
f"Invalid parser '{parser}' passed,... | Make sure a valid parser is passed.
Parameters
----------
parser : str
Raises
------
KeyError
* If an invalid parser is passed | python | pandas/core/computation/eval.py | 83 | [
"parser"
] | None | true | 2 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
exit | public static int exit(ApplicationContext context, ExitCodeGenerator... exitCodeGenerators) {
Assert.notNull(context, "'context' must not be null");
int exitCode = 0;
try {
try {
ExitCodeGenerators generators = new ExitCodeGenerators();
Collection<ExitCodeGenerator> beans = context.getBeansOfType(ExitC... | Static helper that can be used to exit a {@link SpringApplication} and obtain a
code indicating success (0) or otherwise. Does not throw exceptions but should
print stack traces of any encountered. Applies the specified
{@link ExitCodeGenerator ExitCodeGenerators} in addition to any Spring beans that
implement {@link E... | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 1,396 | [
"context"
] | true | 4 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false | |
maybeSendAndPollTransactionalRequest | private boolean maybeSendAndPollTransactionalRequest() {
if (transactionManager.hasInFlightRequest()) {
// as long as there are outstanding transactional requests, we simply wait for them to return
client.poll(retryBackoffMs, time.milliseconds());
return true;
}
... | Returns true if a transactional request is sent or polled, or if a FindCoordinator request is enqueued | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java | 450 | [] | true | 11 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
stop_pipeline | def stop_pipeline(
self,
pipeline_exec_arn: str,
fail_if_not_running: bool = False,
) -> str:
"""
Stop SageMaker pipeline execution.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.stop_pipeline_execution`
:param pipeline_exec_arn: Amazo... | Stop SageMaker pipeline execution.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.stop_pipeline_execution`
:param pipeline_exec_arn: Amazon Resource Name (ARN) of the pipeline execution.
It's the ARN of the pipeline itself followed by "/execution/" and an id.
:param fail_if_not_running: This method ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 1,134 | [
"self",
"pipeline_exec_arn",
"fail_if_not_running"
] | str | true | 8 | 7.76 | apache/airflow | 43,597 | sphinx | false |
parse_schedule_interval | def parse_schedule_interval(time_str: str):
"""
Parse a schedule interval string e.g. (2h13m) or "@once".
:param time_str: A string identifying a schedule interval. (eg. 2h13m, None, @once)
:return datetime.timedelta: A datetime.timedelta object or "@once" or None
"""
if time_str == "None":
... | Parse a schedule interval string e.g. (2h13m) or "@once".
:param time_str: A string identifying a schedule interval. (eg. 2h13m, None, @once)
:return datetime.timedelta: A datetime.timedelta object or "@once" or None | python | dev/airflow_perf/dags/elastic_dag.py | 52 | [
"time_str"
] | true | 3 | 6.88 | apache/airflow | 43,597 | sphinx | false | |
readByte | @CanIgnoreReturnValue // to skip a byte
@Override
public byte readByte() throws IOException {
return (byte) readUnsignedByte();
} | Reads a char as specified by {@link DataInputStream#readChar()}, except using little-endian
byte order.
@return the next two bytes of the input stream, interpreted as a {@code char} in little-endian
byte order
@throws IOException if an I/O error occurs | java | android/guava/src/com/google/common/io/LittleEndianDataInputStream.java | 210 | [] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
_apply_tasks | def _apply_tasks(self, tasks, producer=None, app=None, p=None,
add_to_parent=None, chord=None,
args=None, kwargs=None, group_index=None, **options):
"""Run all the tasks in the group.
This is used by :meth:`apply_async` to run all the tasks in the group
... | Run all the tasks in the group.
This is used by :meth:`apply_async` to run all the tasks in the group
and return a generator of their results.
Arguments:
tasks (list): List of tasks in the group.
producer (Producer): The producer to use to publish the tasks.
app (Celery): The Celery app instance.
p (b... | python | celery/canvas.py | 1,742 | [
"self",
"tasks",
"producer",
"app",
"p",
"add_to_parent",
"chord",
"args",
"kwargs",
"group_index"
] | false | 9 | 7.36 | celery/celery | 27,741 | google | false | |
of | @SafeVarargs // Creating a stream from an array is safe
public static <T> Stream<T> of(final T... values) {
return values == null ? Stream.empty() : Stream.of(values);
} | Null-safe version of {@link Stream#of(Object[])}.
@param <T> the type of stream elements.
@param values the elements of the new stream, may be {@code null}.
@return the new stream on {@code values} or {@link Stream#empty()}.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 735 | [] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
maybeCreateNewBatch | private AcknowledgementBatch maybeCreateNewBatch(AcknowledgementBatch currentBatch, Long nextOffset, List<AcknowledgementBatch> batches) {
if (nextOffset != currentBatch.lastOffset() + 1) {
List<AcknowledgementBatch> optimalBatches = maybeOptimiseAcknowledgeTypes(currentBatch);
optimalB... | Creates a new current batch if the next offset is not one higher than the current batch's
last offset. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/Acknowledgements.java | 214 | [
"currentBatch",
"nextOffset",
"batches"
] | AcknowledgementBatch | true | 3 | 6 | apache/kafka | 31,560 | javadoc | false |
is_re_compilable | def is_re_compilable(obj: object) -> bool:
"""
Check if the object can be compiled into a regex pattern instance.
Parameters
----------
obj : The object to check
The object to check if the object can be compiled into a regex pattern instance.
Returns
-------
bool
Whethe... | Check if the object can be compiled into a regex pattern instance.
Parameters
----------
obj : The object to check
The object to check if the object can be compiled into a regex pattern instance.
Returns
-------
bool
Whether `obj` can be compiled as a regex pattern.
See Also
--------
api.types.is_re : Check ... | python | pandas/core/dtypes/inference.py | 192 | [
"obj"
] | bool | true | 2 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
_safe_indexing | def _safe_indexing(X, indices, *, axis=0):
"""Return rows, items or columns of X using indices.
.. warning::
This utility is documented, but **private**. This means that
backward compatibility might be broken without any deprecation
cycle.
Parameters
----------
X : array-l... | Return rows, items or columns of X using indices.
.. warning::
This utility is documented, but **private**. This means that
backward compatibility might be broken without any deprecation
cycle.
Parameters
----------
X : array-like, sparse-matrix, list, pandas.DataFrame, pandas.Series
Data from which ... | python | sklearn/utils/_indexing.py | 265 | [
"X",
"indices",
"axis"
] | false | 19 | 6.4 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
calculateArgumentBindings | public final void calculateArgumentBindings() {
// The simple case... nothing to bind.
if (this.argumentsIntrospected || this.parameterTypes.length == 0) {
return;
}
int numUnboundArgs = this.parameterTypes.length;
Class<?>[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes();
if (maybeBindJo... | Do as much work as we can as part of the set-up so that argument binding
on subsequent advice invocations can be as fast as possible.
<p>If the first argument is of type JoinPoint or ProceedingJoinPoint then we
pass a JoinPoint in that position (ProceedingJoinPoint for around advice).
<p>If the first argument is of typ... | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java | 374 | [] | void | true | 7 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
configure | public <T extends ThreadPoolTaskScheduler> T configure(T taskScheduler) {
PropertyMapper map = PropertyMapper.get();
map.from(this.poolSize).to(taskScheduler::setPoolSize);
map.from(this.awaitTermination).to(taskScheduler::setWaitForTasksToCompleteOnShutdown);
map.from(this.awaitTerminationPeriod).asInt(Duratio... | Configure the provided {@link ThreadPoolTaskScheduler} instance using this builder.
@param <T> the type of task scheduler
@param taskScheduler the {@link ThreadPoolTaskScheduler} to configure
@return the task scheduler instance
@see #build() | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskSchedulerBuilder.java | 211 | [
"taskScheduler"
] | T | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
findThreadById | public static Thread findThreadById(final long threadId) {
if (threadId <= 0) {
throw new IllegalArgumentException("The thread id must be greater than zero");
}
final Collection<Thread> result = findThreads((Predicate<Thread>) t -> t != null && t.getId() == threadId);
return ... | Finds the active thread with the specified id.
@param threadId The thread id.
@return The thread with the specified id or {@code null} if no such thread exists.
@throws IllegalArgumentException if the specified id is zero or negative.
@throws SecurityException if the current thread cannot access the system threa... | java | src/main/java/org/apache/commons/lang3/ThreadUtils.java | 183 | [
"threadId"
] | Thread | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
partitionsNeedingReset | public synchronized Set<TopicPartition> partitionsNeedingReset(long nowMs) {
return collectPartitions(state -> state.awaitingReset() && !state.awaitingRetryBackoff(nowMs));
} | Request reset for partitions that require a position, using the configured reset strategy.
@param initPartitionsToInclude Initializing partitions to include in the reset. Assigned partitions that
require a positions but are not included in this set won't be reset.
@throws NoOffsetForParti... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 878 | [
"nowMs"
] | true | 2 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
position | @Override
public synchronized long position(TopicPartition partition) {
ensureNotClosed();
if (!this.subscriptions.isAssigned(partition))
throw new IllegalArgumentException("You can only check the position for partitions assigned to this consumer.");
SubscriptionState.FetchPositi... | Sets the maximum number of records returned in a single call to {@link #poll(Duration)}.
@param maxPollRecords the max.poll.records. | java | clients/src/main/java/org/apache/kafka/clients/consumer/MockConsumer.java | 419 | [
"partition"
] | true | 3 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
poly2herm | def poly2herm(pol):
"""
poly2herm(pol)
Convert a polynomial to a Hermite series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Hermite series, ordered
... | poly2herm(pol)
Convert a polynomial to a Hermite series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Hermite series, ordered
from lowest to highest degree.
Parameters
-------... | python | numpy/polynomial/hermite.py | 94 | [
"pol"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
transform | protected abstract Map<String, Object> transform(Result<RESPONSE> response); | Extract the configured properties from the retrieved response.
@param response the non-null response that was retrieved
@return a mapping of properties for the ip from the response | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IpinfoIpDataLookups.java | 504 | [
"response"
] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
all_displays | def all_displays():
"""Get a list of all displays from `sklearn`.
Returns
-------
displays : list of tuples
List of (name, class), where ``name`` is the display class name as
string and ``class`` is the actual type of the class.
Examples
--------
>>> from sklearn.utils.disc... | Get a list of all displays from `sklearn`.
Returns
-------
displays : list of tuples
List of (name, class), where ``name`` is the display class name as
string and ``class`` is the actual type of the class.
Examples
--------
>>> from sklearn.utils.discovery import all_displays
>>> displays = all_displays()
>>>... | python | sklearn/utils/discovery.py | 153 | [] | false | 5 | 7.36 | scikit-learn/scikit-learn | 64,340 | unknown | false | |
get | static Layers get(Context context) {
IndexedLayers indexedLayers = IndexedLayers.get(context);
if (indexedLayers == null) {
throw new JarModeErrorException("Layers are not enabled");
}
return indexedLayers;
} | Return a {@link Layers} instance for the currently running application.
@param context the command context
@return a new layers instance | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/Layers.java | 68 | [
"context"
] | Layers | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
listStreamsGroupOffsets | ListStreamsGroupOffsetsResult listStreamsGroupOffsets(Map<String, ListStreamsGroupOffsetsSpec> groupSpecs, ListStreamsGroupOffsetsOptions options); | List the streams group offsets available in the cluster for the specified streams groups.
<em>Note</em>: this method effectively does the same as the corresponding consumer group method {@link Admin#listConsumerGroupOffsets} does.
@param groupSpecs Map of streams group ids to a spec that specifies the topic partitions ... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 963 | [
"groupSpecs",
"options"
] | ListStreamsGroupOffsetsResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
iterator | @Override
default Iterator<ConfigurationPropertyName> iterator() {
return stream().iterator();
} | Return an iterator for the {@link ConfigurationPropertyName names} managed by this
source.
@return an iterator (never {@code null}) | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/IterableConfigurationPropertySource.java | 52 | [] | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
toString | @Override
public String toString() {
StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this));
sb.append(": defining beans [");
sb.append(StringUtils.collectionToCommaDelimitedString(this.beanDefinitionNames));
sb.append("]; ");
BeanFactory parent = getParentBeanFactory();
if (parent == nul... | Public method to determine the applicable order value for a given bean.
@param beanName the name of the bean
@param beanInstance the bean instance to check
@return the corresponding order value (default is {@link Ordered#LOWEST_PRECEDENCE})
@since 7.0
@see #getOrder(String) | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 2,383 | [] | String | true | 2 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
isError | function isError(value) {
if (!isObjectLike(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == errorTag || tag == domExcTag ||
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
} | Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
`SyntaxError`, `TypeError`, or `URIError` object.
@static
@memberOf _
@since 3.0.0
@category Lang
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is an error object, else `false`.
@example
_.isError(new Error... | javascript | lodash.js | 11,698 | [
"value"
] | false | 6 | 7.2 | lodash/lodash | 61,490 | jsdoc | false | |
predictBeanType | @Override
protected @Nullable Class<?> predictBeanType(String beanName, RootBeanDefinition mbd, Class<?>... typesToMatch) {
Class<?> targetType = determineTargetType(beanName, mbd, typesToMatch);
// Apply SmartInstantiationAwareBeanPostProcessors to predict the
// eventual type after a before-instantiation short... | Actually create the specified bean. Pre-creation processing has already happened
at this point, for example, checking {@code postProcessBeforeInstantiation} callbacks.
<p>Differentiates between default bean instantiation, use of a
factory method, and autowiring a constructor.
@param beanName the name of the bean
@param... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 653 | [
"beanName",
"mbd"
] | true | 8 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
listenersController | function listenersController() {
const listeners = [];
return {
addEventListener(emitter, event, handler, flags) {
eventTargetAgnosticAddListener(emitter, event, handler, flags);
ArrayPrototypePush(listeners, [emitter, event, handler, flags]);
},
removeAll() {
while (listeners.length ... | Returns an `AsyncIterator` that iterates `event` events.
@param {EventEmitter} emitter
@param {string | symbol} event
@param {{
signal: AbortSignal;
close?: string[];
highWaterMark?: number,
lowWaterMark?: number
}} [options]
@returns {AsyncIterator} | javascript | lib/events.js | 1,202 | [] | false | 2 | 6.64 | nodejs/node | 114,839 | jsdoc | false | |
multiplyBy | public Fraction multiplyBy(final Fraction fraction) {
Objects.requireNonNull(fraction, "fraction");
if (numerator == 0 || fraction.numerator == 0) {
return ZERO;
}
// knuth 4.5.1
// make sure we don't overflow unless the result *must* overflow.
final int d1 = ... | Multiplies the value of this fraction by another, returning the
result in reduced form.
@param fraction the fraction to multiply by, must not be {@code null}
@return a {@link Fraction} instance with the resulting values
@throws NullPointerException if the fraction is {@code null}
@throws ArithmeticException if the res... | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 781 | [
"fraction"
] | Fraction | true | 3 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
make_mask | def make_mask(m, copy=False, shrink=True, dtype=MaskType):
"""
Create a boolean mask from an array.
Return `m` as a boolean mask, creating a copy if necessary or requested.
The function can accept any sequence that is convertible to integers,
or ``nomask``. Does not require that contents must be 0... | Create a boolean mask from an array.
Return `m` as a boolean mask, creating a copy if necessary or requested.
The function can accept any sequence that is convertible to integers,
or ``nomask``. Does not require that contents must be 0s and 1s, values
of 0 are interpreted as False, everything else as True.
Parameter... | python | numpy/ma/core.py | 1,596 | [
"m",
"copy",
"shrink",
"dtype"
] | false | 7 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
_add_log_from_parsed_log_streams_to_heap | def _add_log_from_parsed_log_streams_to_heap(
heap: list[tuple[int, StructuredLogMessage]],
parsed_log_streams: dict[int, ParsedLogStream],
) -> None:
"""
Add one log record from each parsed log stream to the heap, and will remove empty log stream from the dict after iterating.
:param heap: heap to... | Add one log record from each parsed log stream to the heap, and will remove empty log stream from the dict after iterating.
:param heap: heap to store log records
:param parsed_log_streams: dict of parsed log streams | python | airflow-core/src/airflow/utils/log/file_task_handler.py | 303 | [
"heap",
"parsed_log_streams"
] | None | true | 6 | 7.04 | apache/airflow | 43,597 | sphinx | false |
setCurrentInjectionPoint | static InjectionPoint setCurrentInjectionPoint(@Nullable InjectionPoint injectionPoint) {
InjectionPoint old = currentInjectionPoint.get();
if (injectionPoint != null) {
currentInjectionPoint.set(injectionPoint);
}
else {
currentInjectionPoint.remove();
}
return old;
} | Return a {@link Predicate} for a parameter type that checks if its target
value is a {@link Class} and the value type is a {@link String}. This is
a regular use case where a {@link Class} is defined in the bean definition
as a fully-qualified class name.
@param valueType the type of the value
@return a predicate to ind... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java | 1,270 | [
"injectionPoint"
] | InjectionPoint | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
replaceChars | public static String replaceChars(final String str, final String searchChars, String replaceChars) {
if (isEmpty(str) || isEmpty(searchChars)) {
return str;
}
replaceChars = ObjectUtils.toString(replaceChars);
boolean modified = false;
final int replaceCharsLength = r... | Replaces multiple characters in a String in one go. This method can also be used to delete characters.
<p>
For example:<br>
{@code replaceChars("hello", "ho", "jy") = jelly}.
</p>
<p>
A {@code null} string input returns {@code null}. An empty ("") string input returns an empty string. A nu... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 6,306 | [
"str",
"searchChars",
"replaceChars"
] | String | true | 7 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
deserialize | def deserialize(cls, json_str: str) -> "GemmOperation": # type: ignore[name-defined] # noqa: F821
"""Deserialize JSON string to a GEMM operation.
Args:
json_str: JSON string of a GEMM operation
Returns:
GemmOperation: Reconstructed operation
"""
json_d... | Deserialize JSON string to a GEMM operation.
Args:
json_str: JSON string of a GEMM operation
Returns:
GemmOperation: Reconstructed operation | python | torch/_inductor/codegen/cuda/serialization.py | 47 | [
"cls",
"json_str"
] | "GemmOperation" | true | 1 | 6.08 | pytorch/pytorch | 96,034 | google | false |
createBootstrapContext | private DefaultBootstrapContext createBootstrapContext() {
DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext();
this.bootstrapRegistryInitializers.forEach((initializer) -> initializer.initialize(bootstrapContext));
return bootstrapContext;
} | Run the Spring application, creating and refreshing a new
{@link ApplicationContext}.
@param args the application arguments (usually passed from a Java main method)
@return a running {@link ApplicationContext} | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 344 | [] | DefaultBootstrapContext | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
max | public static double max(final double a, final double b) {
if (Double.isNaN(a)) {
return b;
}
if (Double.isNaN(b)) {
return a;
}
return Math.max(a, b);
} | Gets the maximum of two {@code double} values.
<p>NaN is only returned if all numbers are NaN as per IEEE-754r.</p>
@param a value 1.
@param b value 2.
@return the largest of the values. | java | src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java | 63 | [
"a",
"b"
] | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
subscription | @Override
public Set<String> subscription() {
acquireAndEnsureOpen();
try {
return Collections.unmodifiableSet(subscriptions.subscription());
} finally {
release();
}
} | Get the current subscription. or an empty set if no such call has
been made.
@return The set of topics currently subscribed to | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 1,775 | [] | true | 1 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
newMetadataRequestBuilder | protected MetadataRequest.Builder newMetadataRequestBuilder() {
return MetadataRequest.Builder.allTopics();
} | Constructs and returns a metadata request builder for fetching cluster data and all active topics.
@return the constructed non-null metadata builder | java | clients/src/main/java/org/apache/kafka/clients/Metadata.java | 740 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
constantFuture | public static <T> Future<T> constantFuture(final T value) {
return new ConstantFuture<>(value);
} | Gets an implementation of {@link Future} that is immediately done
and returns the specified constant value.
<p>
This can be useful to return a simple constant immediately from the
concurrent processing, perhaps as part of avoiding nulls.
A constant future can also be useful in testing.
</p>
@param <T> the type of the v... | java | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | 127 | [
"value"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
nbytes | def nbytes(self) -> int:
"""
Return the number of bytes in the underlying data.
See Also
--------
Series.ndim : Number of dimensions of the underlying data.
Series.size : Return the number of elements in the underlying data.
Examples
--------
For... | Return the number of bytes in the underlying data.
See Also
--------
Series.ndim : Number of dimensions of the underlying data.
Series.size : Return the number of elements in the underlying data.
Examples
--------
For Series:
>>> s = pd.Series(["Ant", "Bear", "Cow"])
>>> s
0 Ant
1 Bear
2 Cow
dtype: str
>>... | python | pandas/core/base.py | 437 | [
"self"
] | int | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | unknown | false |
doIntValue | @Override
public int doIntValue() throws IOException {
try {
return parser.getIntValue();
} 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 | 263 | [] | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
EvictingCacheMap | EvictingCacheMap(EvictingCacheMap&&) = default; | Construct a EvictingCacheMap
@param maxSize maximum size of the cache map. Once the map size exceeds
maxSize, the map will begin to evict.
@param clearSize the number of elements to clear at a time when automatic
eviction on insert is triggered. | cpp | folly/container/EvictingCacheMap.h | 175 | [] | true | 2 | 6.64 | facebook/folly | 30,157 | doxygen | false | |
toInteger | public static int toInteger(final boolean bool) {
return bool ? 1 : 0;
} | Converts a boolean to an int using the convention that
{@code true} is {@code 1} and {@code false} is {@code 0}.
<pre>
BooleanUtils.toInteger(true) = 1
BooleanUtils.toInteger(false) = 0
</pre>
@param bool the boolean to convert
@return one if {@code true}, zero if {@code false} | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 886 | [
"bool"
] | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false | |
standard | static <T> JsonWriter<T> standard() {
return of(Members::add);
} | Factory method to return a {@link JsonWriter} for standard Java types. See
{@link JsonValueWriter class-level javadoc} for details.
@param <T> the type to write
@return a {@link JsonWriter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 140 | [] | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false | |
deserialize | public static <T> T deserialize(final byte[] objectData) {
Objects.requireNonNull(objectData, "objectData");
return deserialize(new ByteArrayInputStream(objectData));
} | Deserializes a single {@link Object} from an array of bytes.
<p>
If the call site incorrectly types the return value, a {@link ClassCastException} is thrown from the call site.
Without Generics in this declaration, the call site must type cast and can cause the same ClassCastException.
Note that in both cases, the Clas... | java | src/main/java/org/apache/commons/lang3/SerializationUtils.java | 163 | [
"objectData"
] | T | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
nextAlphabetic | public String nextAlphabetic(final int count) {
return next(count, true, false);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of Latin alphabetic characters (a-z, A-Z).
</p>
@param count the length of random string to create.
@return the random string.
@throws IllegalArgumentException if {@code count} < 0. | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 809 | [
"count"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
isNestedOrIndexedProperty | public static boolean isNestedOrIndexedProperty(@Nullable String propertyPath) {
if (propertyPath == null) {
return false;
}
for (int i = 0; i < propertyPath.length(); i++) {
char ch = propertyPath.charAt(i);
if (ch == PropertyAccessor.NESTED_PROPERTY_SEPARATOR_CHAR ||
ch == PropertyAccessor.PROPERT... | Check whether the given property path indicates an indexed or nested property.
@param propertyPath the property path to check
@return whether the path indicates an indexed or nested property | java | spring-beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java | 47 | [
"propertyPath"
] | true | 5 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
prepareApplicationContext | @Override
protected GenericApplicationContext prepareApplicationContext(Class<?> application) {
return new AotProcessorHook(application).run(() -> {
Method mainMethod = getMainMethod(application);
mainMethod.setAccessible(true);
if (mainMethod.getParameterCount() == 0) {
ReflectionUtils.invokeMethod(mai... | Create a new processor for the specified application and settings.
@param application the application main class
@param settings the general AOT processor settings
@param applicationArgs the arguments to provide to the main method | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplicationAotProcessor.java | 58 | [
"application"
] | GenericApplicationContext | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
read | int read(ByteBuffer dst, long pos) throws IOException; | Read a sequence of bytes from this channel into the given buffer, starting at the
given block position.
@param dst the buffer into which bytes are to be transferred
@param pos the position within the block at which the transfer is to begin
@return the number of bytes read, possibly zero, or {@code -1} if the given
posi... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/DataBlock.java | 51 | [
"dst",
"pos"
] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
subSequence | public static CharSequence subSequence(final CharSequence cs, final int start) {
return cs == null ? null : cs.subSequence(start, cs.length());
} | Returns a new {@link CharSequence} that is a subsequence of this
sequence starting with the {@code char} value at the specified index.
<p>This provides the {@link CharSequence} equivalent to {@link String#substring(int)}.
The length (in {@code char}) of the returned sequence is {@code length() - start},
so if {@code st... | java | src/main/java/org/apache/commons/lang3/CharSequenceUtils.java | 355 | [
"cs",
"start"
] | CharSequence | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false |
get_debug_flag | def get_debug_flag() -> bool:
"""Get whether debug mode should be enabled for the app, indicated by the
:envvar:`FLASK_DEBUG` environment variable. The default is ``False``.
"""
val = os.environ.get("FLASK_DEBUG")
return bool(val and val.lower() not in {"0", "false", "no"}) | Get whether debug mode should be enabled for the app, indicated by the
:envvar:`FLASK_DEBUG` environment variable. The default is ``False``. | python | src/flask/helpers.py | 27 | [] | bool | true | 2 | 6.56 | pallets/flask | 70,946 | unknown | false |
checkBitVectorable | private static <E extends Enum<E>> Class<E> checkBitVectorable(final Class<E> enumClass) {
final E[] constants = asEnum(enumClass).getEnumConstants();
Validate.isTrue(constants.length <= Long.SIZE, CANNOT_STORE_S_S_VALUES_IN_S_BITS, Integer.valueOf(constants.length), enumClass.getSimpleName(),
... | Validate that {@code enumClass} is compatible with representation in a {@code long}.
@param <E> the type of the enumeration.
@param enumClass to check.
@return {@code enumClass}.
@throws NullPointerException if {@code enumClass} is {@code null}.
@throws IllegalArgumentException if {@code enumClass} is not an enum class... | java | src/main/java/org/apache/commons/lang3/EnumUtils.java | 73 | [
"enumClass"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
activation_offload_sink_wait | def activation_offload_sink_wait(fwd_module: fx.GraphModule) -> None:
"""
Sink wait_event operations for offload completion to the end of the graph.
This function identifies wait_event nodes for offload completion and moves them
to the end of the graph, allowing computation to overlap with offload oper... | Sink wait_event operations for offload completion to the end of the graph.
This function identifies wait_event nodes for offload completion and moves them
to the end of the graph, allowing computation to overlap with offload operations.
Args:
fwd_module: Forward module graph | python | torch/_functorch/_activation_offloading/activation_offloading.py | 717 | [
"fwd_module"
] | None | true | 5 | 6.72 | pytorch/pytorch | 96,034 | google | false |
createClassNameGenerator | protected ClassNameGenerator createClassNameGenerator() {
return new ClassNameGenerator(ClassName.get(getApplicationClass()));
} | Callback to customize the {@link ClassNameGenerator}.
<p>By default, a standard {@link ClassNameGenerator} using the configured
{@linkplain #getApplicationClass() application entry point} as the default
target is used.
@return the class name generator | java | spring-context/src/main/java/org/springframework/context/aot/ContextAotProcessor.java | 122 | [] | ClassNameGenerator | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
explicit | public static <T> Ordering<T> explicit(T leastValue, T... remainingValuesInOrder) {
return explicit(Lists.asList(leastValue, remainingValuesInOrder));
} | Returns an ordering that compares objects according to the order in which they are given to
this method. Only objects present in the argument list (according to {@link Object#equals}) may
be compared. This comparator imposes a "partial ordering" over the type {@code T}. Null values
in the argument list are not supporte... | java | android/guava/src/com/google/common/collect/Ordering.java | 256 | [
"leastValue"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
numberValue | @Override
public Number numberValue() throws IOException {
try {
return parser.getNumberValue();
} 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 | 245 | [] | Number | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
instancesOf | @SuppressWarnings("unchecked") // After the isInstance check, we still need to type-cast.
private static <E> Stream<E> instancesOf(final Class<? super E> clazz, final Stream<?> stream) {
return (Stream<E>) of(stream).filter(clazz::isInstance);
} | Streams only instances of the give Class in a collection.
<p>
This method shorthand for:
</p>
<pre>
{@code (Stream<E>) Streams.toStream(collection).filter(collection, SomeClass.class::isInstance);}
</pre>
@param <E> the type of elements in the collection we want to stream.
@param clazz the type of elements in the colle... | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 613 | [
"clazz",
"stream"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
unregisterBroker | @InterfaceStability.Unstable
default UnregisterBrokerResult unregisterBroker(int brokerId) {
return unregisterBroker(brokerId, new UnregisterBrokerOptions());
} | Unregister a broker.
<p>
This operation does not have any effect on partition assignments.
This is a convenience method for {@link #unregisterBroker(int, UnregisterBrokerOptions)}
@param brokerId the broker id to unregister.
@return the {@link UnregisterBrokerResult} containing the result | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,640 | [
"brokerId"
] | UnregisterBrokerResult | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
freqstr | def freqstr(self) -> str | None:
"""
Return the frequency object as a string if it's set, otherwise None.
See Also
--------
DatetimeIndex.inferred_freq : Returns a string representing a frequency
generated by infer_freq.
Examples
--------
For... | Return the frequency object as a string if it's set, otherwise None.
See Also
--------
DatetimeIndex.inferred_freq : Returns a string representing a frequency
generated by infer_freq.
Examples
--------
For DatetimeIndex:
>>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00"], freq="D")
>>> idx.freqstr
'D'
The f... | python | pandas/core/arrays/datetimelike.py | 870 | [
"self"
] | str | None | true | 2 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
ndim | def ndim(a):
"""
Return the number of dimensions of an array.
Parameters
----------
a : array_like
Input array. If it is not already an ndarray, a conversion is
attempted.
Returns
-------
number_of_dimensions : int
The number of dimensions in `a`. Scalars are ... | Return the number of dimensions of an array.
Parameters
----------
a : array_like
Input array. If it is not already an ndarray, a conversion is
attempted.
Returns
-------
number_of_dimensions : int
The number of dimensions in `a`. Scalars are zero-dimensional.
See Also
--------
ndarray.ndim : equivalen... | python | numpy/_core/fromnumeric.py | 3,483 | [
"a"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
uniqueIndex | @CanIgnoreReturnValue
public static <K, V> ImmutableMap<K, V> uniqueIndex(
Iterable<V> values, Function<? super V, K> keyFunction) {
if (values instanceof Collection) {
return uniqueIndex(
values.iterator(),
keyFunction,
ImmutableMap.builderWithExpectedSize(((Collection<?... | Returns a map with the given {@code values}, indexed by keys derived from those values. In
other words, each input value produces an entry in the map whose key is the result of applying
{@code keyFunction} to that value. These entries appear in the same order as the input values.
Example usage:
{@snippet :
Color red = ... | java | android/guava/src/com/google/common/collect/Maps.java | 1,290 | [
"values",
"keyFunction"
] | true | 2 | 7.6 | google/guava | 51,352 | javadoc | false | |
containsVariableTypeSameParametrizedTypeBound | private static boolean containsVariableTypeSameParametrizedTypeBound(final TypeVariable<?> typeVariable, final ParameterizedType parameterizedType) {
return ArrayUtils.contains(typeVariable.getBounds(), parameterizedType);
} | Tests, recursively, whether any of the type parameters associated with {@code type} are bound to variables.
@param type The type to check for type variables.
@return Whether any of the type parameters associated with {@code type} are bound to variables.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 398 | [
"typeVariable",
"parameterizedType"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
predict_proba | def predict_proba(self, X):
"""Return probability estimates for the test data X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features), \
or (n_queries, n_indexed) if metric == 'precomputed', or None
Test samples. If `None`, p... | Return probability estimates for the test data X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features), \
or (n_queries, n_indexed) if metric == 'precomputed', or None
Test samples. If `None`, predictions for all indexed points are
returned; in this case, points are no... | python | sklearn/neighbors/_classification.py | 314 | [
"self",
"X"
] | false | 15 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
wrapInstance | public static <T> Plugin<T> wrapInstance(T instance, Metrics metrics, String key) {
return wrapInstance(instance, metrics, () -> tags(key, instance));
} | Wrap an instance into a Plugin.
@param instance the instance to wrap
@param metrics the metrics
@param key the value for the <code>config</code> tag
@return the plugin | java | clients/src/main/java/org/apache/kafka/common/internals/Plugin.java | 73 | [
"instance",
"metrics",
"key"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
getUnassignedPartitions | private List<TopicPartition> getUnassignedPartitions(List<TopicPartition> sortedAssignedPartitions) {
List<String> sortedAllTopics = new ArrayList<>(partitionsPerTopic.keySet());
// sort all topics first, then we can have sorted all topic partitions by adding partitions starting from 0
... | get the unassigned partition list by computing the difference set of all sorted partitions
and sortedAssignedPartitions. If no assigned partitions, we'll just return all sorted topic partitions.
To compute the difference set, we use two pointers technique here:
We loop through the all sorted topics, and then iterate al... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java | 883 | [
"sortedAssignedPartitions"
] | true | 7 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
readFully | public static int readFully(InputStream reader, byte[] dest) throws IOException {
return readFully(reader, dest, 0, dest.length);
} | Read up to {code count} bytes from {@code input} and store them into {@code buffer}.
The buffers position will be incremented by the number of bytes read from the stream.
@param input stream to read from
@param buffer buffer to read into
@param count maximum number of bytes to read
@return number of bytes read from the... | java | libs/core/src/main/java/org/elasticsearch/core/Streams.java | 123 | [
"reader",
"dest"
] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
resolveEmbeddedValue | @Override
public @Nullable String resolveEmbeddedValue(@Nullable String value) {
if (value == null) {
return null;
}
String result = value;
for (StringValueResolver resolver : this.embeddedValueResolvers) {
result = resolver.resolveStringValue(result);
if (result == null) {
return null;
}
}
... | Return the custom TypeConverter to use, if any.
@return the custom TypeConverter, or {@code null} if none specified | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 952 | [
"value"
] | String | true | 3 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
isFileSystemCaseSensitive | function isFileSystemCaseSensitive(): boolean {
// win32\win64 are case insensitive platforms
if (platform === "win32" || platform === "win64") {
return false;
}
// If this file exists under a different case, we must be case-insensitve.
r... | Strips non-TS paths from the profile, so users with private projects shouldn't
need to worry about leaking paths by submitting a cpu profile to us | typescript | src/compiler/sys.ts | 1,722 | [] | true | 3 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
configureTransactionState | private TransactionManager configureTransactionState(ProducerConfig config,
LogContext logContext) {
TransactionManager transactionManager = null;
if (config.getBoolean(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG)) {
final String transac... | A producer is instantiated by providing a set of key-value pairs as configuration, a key and a value {@link Serializer}.
Valid configuration strings are documented <a href="http://kafka.apache.org/documentation.html#producerconfigs">here</a>.
<p>
Note: after creating a {@code KafkaProducer} you must always {@link #clos... | java | clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java | 607 | [
"config",
"logContext"
] | TransactionManager | true | 3 | 6.4 | apache/kafka | 31,560 | javadoc | false |
degree | def degree(self):
"""The degree of the series.
Returns
-------
degree : int
Degree of the series, one less than the number of coefficients.
Examples
--------
Create a polynomial object for ``1 + 7*x + 4*x**2``:
>>> np.polynomial.set_default... | The degree of the series.
Returns
-------
degree : int
Degree of the series, one less than the number of coefficients.
Examples
--------
Create a polynomial object for ``1 + 7*x + 4*x**2``:
>>> np.polynomial.set_default_printstyle("unicode")
>>> poly = np.polynomial.Polynomial([1, 7, 4])
>>> print(poly)
1.0 + 7... | python | numpy/polynomial/_polybase.py | 670 | [
"self"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | unknown | false | |
_frommethod | def _frommethod(methodname: str, reversed: bool = False):
"""
Define functions from existing MaskedArray methods.
Parameters
----------
methodname : str
Name of the method to transform.
reversed : bool, optional
Whether to reverse the first two arguments of the method. Default i... | Define functions from existing MaskedArray methods.
Parameters
----------
methodname : str
Name of the method to transform.
reversed : bool, optional
Whether to reverse the first two arguments of the method. Default is False. | python | numpy/ma/core.py | 7,037 | [
"methodname",
"reversed"
] | true | 4 | 6.88 | numpy/numpy | 31,054 | numpy | false | |
pre_fork_setup | def pre_fork_setup():
"""
Setup that must be done prior to forking with a process pool.
"""
# ensure properties have been calculated before processes
# are forked
caching_device_properties()
# Computing the triton key can be slow. If we call it before fork,
# it will be cached for the f... | Setup that must be done prior to forking with a process pool. | python | torch/_inductor/async_compile.py | 82 | [] | false | 2 | 6.24 | pytorch/pytorch | 96,034 | unknown | false | |
whenEqualTo | public Source<T> whenEqualTo(@Nullable Object object) {
return when((value) -> value.equals(object));
} | Return a filtered version of the source that will only map values equal to the
specified {@code object}.
@param object the object to match
@return a new filtered source instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 244 | [
"object"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
export | def export(args, api_client: Client = NEW_API_CLIENT) -> None:
"""
Export all pools.
If output is json, write to file. Otherwise, print to console.
"""
try:
pools_response = api_client.pools.list()
pools_list = [
{
"name": pool.name,
"slot... | Export all pools.
If output is json, write to file. Otherwise, print to console. | python | airflow-ctl/src/airflowctl/ctl/commands/pool_command.py | 50 | [
"args",
"api_client"
] | None | true | 3 | 6 | apache/airflow | 43,597 | unknown | false |
copy | @CanIgnoreReturnValue
public static long copy(InputStream from, OutputStream to) throws IOException {
checkNotNull(from);
checkNotNull(to);
byte[] buf = createBuffer();
long total = 0;
while (true) {
int r = from.read(buf);
if (r == -1) {
break;
}
to.write(buf, 0, r... | Copies all bytes from the input stream to the output stream. Does not close or flush either
stream.
<p><b>Java 9 users and later:</b> this method should be treated as deprecated; use the
equivalent {@link InputStream#transferTo} method instead.
@param from the input stream to read from
@param to the output stream to wr... | java | android/guava/src/com/google/common/io/ByteStreams.java | 108 | [
"from",
"to"
] | true | 3 | 8.08 | google/guava | 51,352 | javadoc | false | |
equalsImpl | static boolean equalsImpl(Table<?, ?, ?> table, @Nullable Object obj) {
if (obj == table) {
return true;
} else if (obj instanceof Table) {
Table<?, ?, ?> that = (Table<?, ?, ?>) obj;
return table.cellSet().equals(that.cellSet());
} else {
return false;
}
} | Returns a synchronized (thread-safe) table backed by the specified table. In order to guarantee
serial access, it is critical that <b>all</b> access to the backing table is accomplished
through the returned table.
<p>It is imperative that the user manually synchronize on the returned table when accessing any
of its col... | java | android/guava/src/com/google/common/collect/Tables.java | 696 | [
"table",
"obj"
] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
delete_fargate_profile | def delete_fargate_profile(self, clusterName: str, fargateProfileName: str) -> dict:
"""
Delete an AWS Fargate profile from a specified Amazon EKS cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.delete_fargate_profile`
:param clusterName: The name of the Amazon ... | Delete an AWS Fargate profile from a specified Amazon EKS cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.delete_fargate_profile`
:param clusterName: The name of the Amazon EKS cluster associated with the Fargate profile to delete.
:param fargateProfileName: The name of the Fargate profile to delete.
... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 287 | [
"self",
"clusterName",
"fargateProfileName"
] | dict | true | 1 | 6.24 | apache/airflow | 43,597 | sphinx | false |
getTypeForFactoryBeanFromMethod | private ResolvableType getTypeForFactoryBeanFromMethod(Class<?> beanClass, String factoryMethodName) {
// CGLIB subclass methods hide generic parameters; look at the original user class.
Class<?> factoryBeanClass = ClassUtils.getUserClass(beanClass);
FactoryBeanMethodTypeFinder finder = new FactoryBeanMethodTypeF... | Introspect the factory method signatures on the given bean class,
trying to find a common {@code FactoryBean} object type declared there.
@param beanClass the bean class to find the factory method on
@param factoryMethodName the name of the factory method
@return the common {@code FactoryBean} object type, or {@code nu... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 952 | [
"beanClass",
"factoryMethodName"
] | ResolvableType | true | 1 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
format | <B extends Appendable> B format(Calendar calendar, B buf); | Formats a {@link Calendar} object into the supplied {@link Appendable}.
The TimeZone set on the Calendar is only used to adjust the time offset.
The TimeZone specified during the construction of the Parser will determine the TimeZone
used in the formatted string.
@param calendar the calendar to format.
@param buf the... | java | src/main/java/org/apache/commons/lang3/time/DatePrinter.java | 61 | [
"calendar",
"buf"
] | B | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
baseGet | function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
} | The base implementation of `_.get` without support for default values.
@private
@param {Object} object The object to query.
@param {Array|string} path The path of the property to get.
@returns {*} Returns the resolved value. | javascript | lodash.js | 3,070 | [
"object",
"path"
] | false | 5 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
load | public SslConfiguration load(Path basePath) {
Objects.requireNonNull(basePath, "Base Path cannot be null");
final List<String> protocols = resolveListSetting(PROTOCOLS, Function.identity(), defaultProtocols);
final List<String> ciphers = resolveListSetting(CIPHERS, Function.identity(), defaultCi... | 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 | 298 | [
"basePath"
] | SslConfiguration | true | 5 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
cellIterator | @Override
Iterator<Cell<R, C, @Nullable V>> cellIterator() {
return new AbstractIndexedListIterator<Cell<R, C, @Nullable V>>(size()) {
@Override
protected Cell<R, C, @Nullable V> get(int index) {
return getCell(index);
}
};
} | Returns an unmodifiable set of all row key / column key / value triplets. Changes to the table
will update the returned set.
<p>The returned set's iterator traverses the mappings with the first row key, the mappings with
the second row key, and so on.
<p>The value in the returned cells may change if the table subsequen... | java | android/guava/src/com/google/common/collect/ArrayTable.java | 545 | [] | true | 1 | 7.04 | google/guava | 51,352 | javadoc | false | |
lastCaughtUpTimestamp | public OptionalLong lastCaughtUpTimestamp() {
return lastCaughtUpTimestamp;
} | Return the last millisecond timestamp at which this replica was known to be
caught up with the leader.
@return The value of the lastCaughtUpTime if known, empty otherwise | java | clients/src/main/java/org/apache/kafka/clients/admin/QuorumInfo.java | 172 | [] | OptionalLong | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
__call__ | def __call__(
self,
declarations: str | Iterable[tuple[str, str]],
inherited: dict[str, str] | None = None,
) -> dict[str, str]:
"""
The given declarations to atomic properties.
Parameters
----------
declarations_str : str | Iterable[tuple[str, str]]
... | The given declarations to atomic properties.
Parameters
----------
declarations_str : str | Iterable[tuple[str, str]]
A CSS string or set of CSS declaration tuples
e.g. "font-weight: bold; background: blue" or
{("font-weight", "bold"), ("background", "blue")}
inherited : dict, optional
Atomic propertie... | python | pandas/io/formats/css.py | 219 | [
"self",
"declarations",
"inherited"
] | dict[str, str] | true | 3 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false |
register_source | def register_source(app, env, modname):
"""
Registers source code.
:param app: application
:param env: environment of the plugin
:param modname: name of the module to load
:return: True if the code is registered successfully, False otherwise
"""
if modname is None:
return False
... | Registers source code.
:param app: application
:param env: environment of the plugin
:param modname: name of the module to load
:return: True if the code is registered successfully, False otherwise | python | devel-common/src/sphinx_exts/exampleinclude.py | 130 | [
"app",
"env",
"modname"
] | false | 9 | 7.44 | apache/airflow | 43,597 | sphinx | false | |
isVarThatIsPossiblyChanged | static bool isVarThatIsPossiblyChanged(const Decl *Func, const Stmt *LoopStmt,
const Stmt *Cond, ASTContext *Context) {
if (const auto *DRE = dyn_cast<DeclRefExpr>(Cond)) {
if (const auto *VD = dyn_cast<ValueDecl>(DRE->getDecl()))
return isVarPossiblyChanged(Func, Loop... | Return whether `Cond` is a variable that is possibly changed in `LoopStmt`. | cpp | clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp | 91 | [] | true | 11 | 6.72 | llvm/llvm-project | 36,021 | doxygen | false | |
_translate | def _translate(self, styler: StylerRenderer, d: dict):
"""
Mutate the render dictionary to allow for tooltips:
- Add ``<span>`` HTML element to each data cells ``display_value``. Ignores
headers.
- Add table level CSS styles to control pseudo classes.
Parameters
... | Mutate the render dictionary to allow for tooltips:
- Add ``<span>`` HTML element to each data cells ``display_value``. Ignores
headers.
- Add table level CSS styles to control pseudo classes.
Parameters
----------
styler_data : DataFrame
Underlying ``Styler`` DataFrame used for reindexing.
uuid : str
The u... | python | pandas/io/formats/style_render.py | 2,239 | [
"self",
"styler",
"d"
] | true | 15 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false | |
wrapperToPrimitive | public static Class<?> wrapperToPrimitive(final Class<?> cls) {
return WRAPPER_PRIMITIVE_MAP.get(cls);
} | Converts the specified wrapper class to its corresponding primitive class.
<p>
This method is the counter part of {@code primitiveToWrapper()}. If the passed in class is a wrapper class for a
primitive type, this primitive type will be returned (e.g. {@code Integer.TYPE} for {@code Integer.class}). For other
classes, o... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 1,702 | [
"cls"
] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
getAlgorithmNameFromOid | private static String getAlgorithmNameFromOid(String oidString) throws GeneralSecurityException {
return switch (oidString) {
case "1.2.840.10040.4.1" -> "DSA";
case "1.2.840.113549.1.1.1" -> "RSA";
case "1.2.840.10045.2.1" -> "EC";
case "1.3.14.3.2.7" -> "DES-CBC... | Parses a DER encoded private key and reads its algorithm identifier Object OID.
@param keyBytes the private key raw bytes
@return A string identifier for the key algorithm (RSA, DSA, or EC)
@throws GeneralSecurityException if the algorithm oid that is parsed from ASN.1 is unknown
@throws IOException if the DER encoded ... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | 700 | [
"oidString"
] | String | true | 1 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
select_describe_func | def select_describe_func(
data: Series,
) -> Callable:
"""Select proper function for describing series based on data type.
Parameters
----------
data : Series
Series to be described.
"""
if is_bool_dtype(data.dtype):
return describe_categorical_1d
elif is_numeric_dtype(d... | Select proper function for describing series based on data type.
Parameters
----------
data : Series
Series to be described. | python | pandas/core/methods/describe.py | 323 | [
"data"
] | Callable | true | 7 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
reverse | GeneralRange<T> reverse() {
GeneralRange<T> result = reverse;
if (result == null) {
result =
new GeneralRange<>(
reverseComparator(comparator),
hasUpperBound,
getUpperEndpoint(),
getUpperBoundType(),
hasLowerBound,
... | Returns the same range relative to the reversed comparator. | java | android/guava/src/com/google/common/collect/GeneralRange.java | 269 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
trigger_tasks | def trigger_tasks(self, open_slots: int) -> None:
"""
Initiate async execution of the queued tasks, up to the number of available slots.
:param open_slots: Number of open slots
"""
sorted_queue = self.order_queued_tasks_by_priority()
workload_list = []
for _ in ... | Initiate async execution of the queued tasks, up to the number of available slots.
:param open_slots: Number of open slots | python | airflow-core/src/airflow/executors/base_executor.py | 352 | [
"self",
"open_slots"
] | None | true | 10 | 7.04 | apache/airflow | 43,597 | sphinx | false |
getModuleSpecifierText | function getModuleSpecifierText(promotedDeclaration: ImportClause | ImportEqualsDeclaration): string {
return promotedDeclaration.kind === SyntaxKind.ImportEqualsDeclaration
? tryCast(tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)?.expression, isStringLiteralLike)?.text || promote... | @param forceImportKeyword Indicates that the user has already typed `import`, so the result must start with `import`.
(In other words, do not allow `const x = require("...")` for JS files.)
@internal | typescript | src/services/codefixes/importFixes.ts | 1,786 | [
"promotedDeclaration"
] | true | 3 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
isOsNameMatch | static boolean isOsNameMatch(final String osName, final String osNamePrefix) {
if (osName == null) {
return false;
}
return Strings.CI.startsWith(osName, osNamePrefix);
} | Tests whether the operating system matches with a case-insensitive comparison.
<p>
This method is package private instead of private to support unit test invocation.
</p>
@param osName the actual OS name.
@param osNamePrefix the prefix for the expected OS name.
@return true for a case-insensitive match, or false ... | java | src/main/java/org/apache/commons/lang3/SystemUtils.java | 2,433 | [
"osName",
"osNamePrefix"
] | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
take_nd | def take_nd(
arr: ArrayLike,
indexer,
axis: AxisInt = 0,
fill_value=lib.no_default,
allow_fill: bool = True,
) -> ArrayLike:
"""
Specialized Cython take which sets NaN values in one pass
This dispatches to ``take`` defined on ExtensionArrays.
Note: this function assumes that the in... | Specialized Cython take which sets NaN values in one pass
This dispatches to ``take`` defined on ExtensionArrays.
Note: this function assumes that the indexer is a valid(ated) indexer with
no out of bound indices.
Parameters
----------
arr : np.ndarray or ExtensionArray
Input array.
indexer : ndarray
1-D arr... | python | pandas/core/array_algos/take.py | 57 | [
"arr",
"indexer",
"axis",
"fill_value",
"allow_fill"
] | ArrayLike | true | 6 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
beforePrototypeCreation | @SuppressWarnings("unchecked")
protected void beforePrototypeCreation(String beanName) {
Object curVal = this.prototypesCurrentlyInCreation.get();
if (curVal == null) {
this.prototypesCurrentlyInCreation.set(beanName);
}
else if (curVal instanceof String strValue) {
Set<String> beanNameSet = CollectionUt... | Callback before prototype creation.
<p>The default implementation registers the prototype as currently in creation.
@param beanName the name of the prototype about to be created
@see #isPrototypeCurrentlyInCreation | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,187 | [
"beanName"
] | void | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
faceIjkPentToCellBoundaryClassIII | private CellBoundary faceIjkPentToCellBoundaryClassIII(int adjRes) {
final LatLng[] points = new LatLng[CellBoundary.MAX_CELL_BNDRY_VERTS];
int numPoints = 0;
final FaceIJK fijk = new FaceIJK(this.face, new CoordIJK(0, 0, 0));
final CoordIJK lastCoord = new CoordIJK(0, 0, 0);
int... | Computes the cell boundary in spherical coordinates for a pentagonal cell
for this FaceIJK address at a specified resolution.
@param res The H3 resolution of the cell. | java | libs/h3/src/main/java/org/elasticsearch/h3/FaceIJK.java | 461 | [
"adjRes"
] | CellBoundary | true | 6 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.