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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
components | def components(self) -> DataFrame:
"""
Return a Dataframe of the components of the Timedeltas.
Each row of the DataFrame corresponds to a Timedelta in the original
Series and contains the individual components (days, hours, minutes,
seconds, milliseconds, microseconds, nanosecon... | Return a Dataframe of the components of the Timedeltas.
Each row of the DataFrame corresponds to a Timedelta in the original
Series and contains the individual components (days, hours, minutes,
seconds, milliseconds, microseconds, nanoseconds) of the Timedelta.
Returns
-------
DataFrame
See Also
--------
TimedeltaIn... | python | pandas/core/indexes/accessors.py | 511 | [
"self"
] | DataFrame | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | unknown | false |
atAll | public ConditionMessage atAll() {
return items(Collections.emptyList());
} | Used when no items are available. For example
{@code didNotFind("any beans").atAll()} results in the message "did not find
any beans".
@return a built {@link ConditionMessage} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | 337 | [] | ConditionMessage | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
tolist | def tolist(self) -> list:
"""
Return a list of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)
Returns
-------
list
Python list of values in... | Return a list of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)
Returns
-------
list
Python list of values in array.
See Also
--------
Index.to_list: Return a list of the values in the Index.
Series.to_list: Re... | python | pandas/core/arrays/base.py | 2,414 | [
"self"
] | list | true | 2 | 7.28 | pandas-dev/pandas | 47,362 | unknown | false |
of | @SafeVarargs
@SuppressWarnings("varargs")
public static <E> ManagedSet<E> of(E... elements) {
ManagedSet<E> set = new ManagedSet<>();
Collections.addAll(set, elements);
return set;
} | Create a new instance containing an arbitrary number of elements.
@param elements the elements to be contained in the set
@param <E> the {@code Set}'s element type
@return a {@code ManagedSet} containing the specified elements
@since 5.3.16 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedSet.java | 64 | [] | true | 1 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
timezoneToOffset | function timezoneToOffset(timezone: string, fallback: number): number {
// Support: IE 11 only, Edge 13-15+
// IE/Edge do not "understand" colon (`:`) in timezone
timezone = timezone.replace(/:/g, '');
const requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
return isNaN(reques... | Returns a date formatter that provides the week-numbering year for the input date. | typescript | packages/common/src/i18n/format_date.ts | 877 | [
"timezone",
"fallback"
] | true | 2 | 6 | angular/angular | 99,544 | jsdoc | false | |
dispatch | @SuppressWarnings("CatchingUnchecked") // sneaky checked exception
void dispatch() {
boolean scheduleEventRunner = false;
synchronized (this) {
if (!isThreadScheduled) {
isThreadScheduled = true;
scheduleEventRunner = true;
}
}
if (scheduleEventRunner) {
... | Dispatches all listeners {@linkplain #enqueue enqueued} prior to this call, serially and in
order. | java | android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java | 160 | [] | void | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false |
getNotebookCellMetadata | function getNotebookCellMetadata(cell: nbformat.ICell): {
[key: string]: any;
} {
// We put this only for VSC to display in diff view.
// Else we don't use this.
const cellMetadata: CellMetadata = {};
if (cell.cell_type === 'code') {
if (typeof cell['execution_count'] === 'number') {
cellMetadata.execution_co... | Concatenates a multiline string or an array of strings into a single string.
Also normalizes line endings to use LF (`\n`) instead of CRLF (`\r\n`).
Same is done in serializer as well. | typescript | extensions/ipynb/src/deserializers.ts | 153 | [
"cell"
] | true | 7 | 6 | microsoft/vscode | 179,840 | jsdoc | false | |
wrapIfMissing | public static String wrapIfMissing(final String str, final String wrapWith) {
if (isEmpty(str) || isEmpty(wrapWith)) {
return str;
}
final boolean wrapStart = !str.startsWith(wrapWith);
final boolean wrapEnd = !str.endsWith(wrapWith);
if (!wrapStart && !wrapEnd) {
... | Wraps a string with a string if that string is missing from the start or end of the given string.
<p>
A new {@link String} will not be created if {@code str} is already wrapped.
</p>
<pre>
StringUtils.wrapIfMissing(null, *) = null
StringUtils.wrapIfMissing("", *) = ""
StringUtils.wrapIfMissing("ab", n... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 9,183 | [
"str",
"wrapWith"
] | String | true | 7 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
ProtoBufferReader | explicit ProtoBufferReader(ByteBuffer* buffer)
: byte_count_(0), backup_count_(0), status_() {
/// Implemented through a grpc_byte_buffer_reader which iterates
/// over the slices that make up a byte buffer
if (!buffer->Valid() ||
!grpc_byte_buffer_reader_init(&reader_, buffer->c_buffer())) {
... | if \a buffer is invalid (the internal buffer has not been initialized). | cpp | include/grpcpp/support/proto_buffer_reader.h | 51 | [] | true | 3 | 7.04 | grpc/grpc | 44,113 | doxygen | false | |
destroyBean | protected void destroyBean(String beanName, @Nullable DisposableBean bean) {
// Trigger destruction of dependent beans first...
Set<String> dependentBeanNames;
synchronized (this.dependentBeanMap) {
// Within full synchronization in order to guarantee a disconnected Set
dependentBeanNames = this.dependentBe... | Destroy the given bean. Must destroy beans that depend on the given
bean before the bean itself. Should not throw any exceptions.
@param beanName the name of the bean
@param bean the bean instance to destroy | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java | 776 | [
"beanName",
"bean"
] | void | true | 9 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false |
RWCursor | RWCursor(IOBufQueue& queue, AtEnd) noexcept : RWCursor(queue) {
if (!queue.options().cacheChainLength) {
this->advanceToEnd();
} else {
this->crtBuf_ = this->buffer_->prev();
this->crtBegin_ = this->crtBuf_->data();
this->crtEnd_ = this->crtBuf_->tail();
this->crtPos_ = this->crtEn... | Create the cursor initially pointing to the end of queue. | cpp | folly/io/Cursor.h | 1,281 | [] | true | 3 | 7.04 | facebook/folly | 30,157 | doxygen | false | |
toMap | public static Map<Object, Object> toMap(final Object[] array) {
if (array == null) {
return null;
}
final Map<Object, Object> map = new HashMap<>((int) (array.length * 1.5));
for (int i = 0; i < array.length; i++) {
final Object object = array[i];
if (... | Converts the given array into a {@link java.util.Map}. Each element of the array must be either a {@link java.util.Map.Entry} or an Array, containing at
least two elements, where the first element is used as key and the second as value.
<p>
This method can be used to initialize:
</p>
<pre>
// Create a Map mapping color... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,637 | [
"array"
] | true | 6 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
from | public static <T extends @Nullable Object> Ordering<T> from(Comparator<T> comparator) {
return (comparator instanceof Ordering)
? (Ordering<T>) comparator
: new ComparatorOrdering<T>(comparator);
} | Returns an ordering based on an <i>existing</i> comparator instance. Note that it is
unnecessary to create a <i>new</i> anonymous inner class implementing {@code Comparator} just
to pass it in here. Instead, simply subclass {@code Ordering} and implement its {@code compare}
method directly.
<p>The returned object is se... | java | android/guava/src/com/google/common/collect/Ordering.java | 192 | [
"comparator"
] | true | 2 | 7.76 | google/guava | 51,352 | javadoc | false | |
add | @Deprecated
public static short[] add(final short[] array, final int index, final short element) {
return (short[]) add(array, index, Short.valueOf(element), Short.TYPE);
} | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
<p>
This method returns a new array with the same elements of the input
array plus the given element on the specified positio... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 711 | [
"array",
"index",
"element"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
callWithTimeout | @CanIgnoreReturnValue
@Override
@ParametricNullness
public <T extends @Nullable Object> T callWithTimeout(
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit)
throws TimeoutException, InterruptedException, ExecutionException {
checkNotNull(callable);
checkNotNull(timeoutUnit);
... | Creates a TimeLimiter instance using the given executor service to execute method calls.
<p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
up, any time callers spend waiting for a thread may count toward their time limit, and in this
case the call may even time out before th... | java | android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java | 135 | [
"callable",
"timeoutDuration",
"timeoutUnit"
] | T | true | 3 | 6.72 | google/guava | 51,352 | javadoc | false |
isEndOfDecoratorContextOnSameLine | function isEndOfDecoratorContextOnSameLine(context: FormattingContext): boolean {
return context.TokensAreOnSameLine() &&
hasDecorators(context.contextNode) &&
nodeIsInDecoratorContext(context.currentTokenParent) &&
!nodeIsInDecoratorContext(context.nextTokenParent);
} | A rule takes a two tokens (left/right) and a particular context
for which you're meant to look at them. You then declare what should the
whitespace annotation be between these tokens via the action param.
@param debugName Name to print
@param left The left side of the comparison
@param right The right side of the... | typescript | src/services/formatting/rules.ts | 805 | [
"context"
] | true | 4 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
records | @Override
public Iterable<Record> records() {
return records;
} | Get an iterator over the deep records.
@return An iterator over the records | java | clients/src/main/java/org/apache/kafka/common/record/AbstractRecords.java | 63 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
intersection | public ComposablePointcut intersection(Pointcut other) {
this.classFilter = ClassFilters.intersection(this.classFilter, other.getClassFilter());
this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other.getMethodMatcher());
return this;
} | Apply an intersection with the given Pointcut.
@param other the Pointcut to apply an intersection with
@return this composable pointcut (for call chaining) | java | spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java | 172 | [
"other"
] | ComposablePointcut | true | 1 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
throwableMembers | private static void throwableMembers(Members<LogEvent> members, Extractor extractor) {
members.add("full_message", extractor::messageAndStackTrace);
members.add("_error_type", LogEvent::getThrown).whenNotNull().as(ObjectUtils::nullSafeClassName);
members.add("_error_stack_trace", extractor::stackTrace);
members... | Converts the log4j2 event level to the Syslog event level code.
@param event the log event
@return an integer representing the syslog log level code
@see Severity class from Log4j2 which contains the conversion logic | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java | 135 | [
"members",
"extractor"
] | void | true | 1 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
nullToEmpty | public static Class<?>[] nullToEmpty(final Class<?>[] array) {
return nullTo(array, EMPTY_CLASS_ARRAY);
} | Defensive programming technique to change a {@code null}
reference to an empty one.
<p>
This method returns an empty array for a {@code null} input array.
</p>
<p>
As a memory optimizing technique an empty array passed in will be overridden with
the empty {@code public static} references in this class.
</p>
@param arra... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,394 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
generateSetBeanInstanceSupplierCode | @Override
public CodeBlock generateSetBeanInstanceSupplierCode(
GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode,
CodeBlock instanceSupplierCode, List<MethodReference> postProcessors) {
CodeBlock.Builder code = CodeBlock.builder();
if (postProcessors.isEmpty()) {
code.addSta... | Extract the target class of a public {@link FactoryBean} based on its
constructor. If the implementation does not resolve the target class
because it itself uses a generic, attempt to extract it from the bean type.
@param factoryBeanType the factory bean type
@param beanType the bean type
@return the target class to us... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragments.java | 203 | [
"generationContext",
"beanRegistrationCode",
"instanceSupplierCode",
"postProcessors"
] | CodeBlock | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
asConsumer | public static <I> Consumer<I> asConsumer(final FailableConsumer<I, ?> consumer) {
return input -> accept(consumer, input);
} | Converts the given {@link FailableConsumer} into a standard {@link Consumer}.
@param <I> the type used by the consumers
@param consumer a {@link FailableConsumer}
@return a standard {@link Consumer}
@since 3.10 | java | src/main/java/org/apache/commons/lang3/Functions.java | 403 | [
"consumer"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
from | static SslManagerBundle from(TrustManagerFactory trustManagerFactory) {
Assert.notNull(trustManagerFactory, "'trustManagerFactory' must not be null");
KeyManagerFactory defaultKeyManagerFactory = createDefaultKeyManagerFactory();
return of(defaultKeyManagerFactory, trustManagerFactory);
} | Factory method to create a new {@link SslManagerBundle} using the given
{@link TrustManagerFactory} and the default {@link KeyManagerFactory}.
@param trustManagerFactory the trust manager factory
@return a new {@link SslManagerBundle} instance
@since 3.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java | 136 | [
"trustManagerFactory"
] | SslManagerBundle | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
leaderEpochFor | public OptionalInt leaderEpochFor(TopicPartition tp) {
PartitionMetadata partitionMetadata = metadataByPartition.get(tp);
if (partitionMetadata == null || partitionMetadata.leaderEpoch.isEmpty()) {
return OptionalInt.empty();
} else {
return OptionalInt.of(partitionMetada... | Get leader-epoch for partition.
@param tp partition
@return leader-epoch if known, else return OptionalInt.empty() | java | clients/src/main/java/org/apache/kafka/clients/MetadataSnapshot.java | 134 | [
"tp"
] | OptionalInt | true | 3 | 7.28 | apache/kafka | 31,560 | javadoc | false |
getTypeForFactoryBeanFromAttributes | ResolvableType getTypeForFactoryBeanFromAttributes(AttributeAccessor attributes) {
Object attribute = attributes.getAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE);
if (attribute == null) {
return ResolvableType.NONE;
}
if (attribute instanceof ResolvableType resolvableType) {
return resolvableType;
}
if... | Determine the bean type for a FactoryBean by inspecting its attributes for a
{@link FactoryBean#OBJECT_TYPE_ATTRIBUTE} value.
@param attributes the attributes to inspect
@return a {@link ResolvableType} extracted from the attributes or
{@code ResolvableType.NONE}
@since 5.2 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java | 75 | [
"attributes"
] | ResolvableType | true | 4 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
iterations | public int iterations() {
return iterations;
} | @return the number of iterations used when creating the credential | java | clients/src/main/java/org/apache/kafka/clients/admin/ScramCredentialInfo.java | 53 | [] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
createInstance | protected abstract T createInstance() throws Exception; | Template method that subclasses must override to construct
the object returned by this factory.
<p>Invoked on initialization of this FactoryBean in case of
a singleton; else, on each {@link #getObject()} call.
@return the object returned by this factory
@throws Exception if an exception occurred during object creation
... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java | 216 | [] | T | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
format | String format(Date date); | Formats a {@link Date} object using a {@link GregorianCalendar}.
@param date the date to format
@return the formatted string | java | src/main/java/org/apache/commons/lang3/time/DatePrinter.java | 83 | [
"date"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
reorder_categories | def reorder_categories(self, new_categories, ordered=None) -> Self:
"""
Reorder categories as specified in new_categories.
``new_categories`` need to include all old categories and no new category
items.
Parameters
----------
new_categories : Index-like
... | Reorder categories as specified in new_categories.
``new_categories`` need to include all old categories and no new category
items.
Parameters
----------
new_categories : Index-like
The categories in new order.
ordered : bool, optional
Whether or not the categorical is treated as an ordered categorical.
If n... | python | pandas/core/arrays/categorical.py | 1,268 | [
"self",
"new_categories",
"ordered"
] | Self | true | 3 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false |
_format_argument_list | def _format_argument_list(allow_args: list[str]) -> str:
"""
Convert the allow_args argument (either string or integer) of
`deprecate_nonkeyword_arguments` function to a string describing
it to be inserted into warning message.
Parameters
----------
allowed_args : list, tuple or int
... | Convert the allow_args argument (either string or integer) of
`deprecate_nonkeyword_arguments` function to a string describing
it to be inserted into warning message.
Parameters
----------
allowed_args : list, tuple or int
The `allowed_args` argument for `deprecate_nonkeyword_arguments`,
but None value is not ... | python | pandas/util/_decorators.py | 227 | [
"allow_args"
] | str | true | 5 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
formatDuration | public static String formatDuration(final long durationMillis, final String format, final boolean padWithZeros) {
Validate.inclusiveBetween(0, Long.MAX_VALUE, durationMillis, "durationMillis must not be negative");
final Token[] tokens = lexx(format);
long days = 0;
long hours = 0;
... | Formats the time gap as a string, using the specified format.
Padding the left-hand side side of numbers with zeroes is optional.
<p>This method formats durations using the days and lower fields of the
format pattern. Months and larger are not used.</p>
@param durationMillis the duration to format
@param format the w... | java | src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java | 358 | [
"durationMillis",
"format",
"padWithZeros"
] | String | true | 5 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
_need_to_fix_layout | def _need_to_fix_layout(
self,
adjusted_choices: list[KernelTemplateChoice],
op_name: str,
) -> bool:
"""
Check if we need to fix the layout instead of keeping it flexible
Args:
ktc: KernelTemplateChoice object
Returns:
True if we nee... | Check if we need to fix the layout instead of keeping it flexible
Args:
ktc: KernelTemplateChoice object
Returns:
True if we need to fix the layout, False otherwise | python | torch/_inductor/choices.py | 214 | [
"self",
"adjusted_choices",
"op_name"
] | bool | true | 13 | 7.44 | pytorch/pytorch | 96,034 | google | false |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Bindable<?> other = (Bindable<?>) obj;
boolean result = true;
result = result && nullSafeEquals(this.type.resolve(), other.type.resolve());
result = r... | Returns the {@link BindMethod method} to be used to bind this bindable, or
{@code null} if no specific binding method is required.
@return the bind method or {@code null}
@since 3.0.8 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | 142 | [
"obj"
] | true | 8 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
socketOnClose | function socketOnClose() {
const session = this[kBoundSession];
if (session !== undefined) {
debugSessionObj(session, 'socket closed');
const err = session.connecting ? new ERR_SOCKET_CLOSED() : null;
const state = session[kState];
state.streams.forEach((stream) => stream.close(NGHTTP2_CANCEL));
... | This function closes all active sessions gracefully.
@param {*} server the underlying server whose sessions to be closed | javascript | lib/internal/http2/core.js | 3,513 | [] | false | 3 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
fit | def fit(self, X, y=None):
"""Fit a Minimum Covariance Determinant with the FastMCD algorithm.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of feature... | Fit a Minimum Covariance Determinant with the FastMCD algorithm.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of features.
y : Ignored
Not used, present for API consistency by convention.
Ret... | python | sklearn/covariance/_robust_covariance.py | 771 | [
"self",
"X",
"y"
] | false | 3 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
determineImports | Set<Object> determineImports(AnnotationMetadata metadata); | Return a set of objects that represent the imports. Objects within the returned
{@code Set} must implement a valid {@link Object#hashCode() hashCode} and
{@link Object#equals(Object) equals}.
<p>
Imports from multiple {@link DeterminableImports} instances may be combined by the
caller to create a complete set.
<p>
Unli... | java | core/spring-boot/src/main/java/org/springframework/boot/context/annotation/DeterminableImports.java | 59 | [
"metadata"
] | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
builder | public static <T> Builder<LazyInitializer<T>, T> builder() {
return new Builder<>();
} | Creates a new builder.
@param <T> the type of object to build.
@return a new builder.
@since 3.14.0 | java | src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java | 110 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
checkArgument | public static void checkArgument(boolean expression) {
if (!expression) {
throw new IllegalArgumentException();
}
} | Ensures the truth of an expression involving one or more parameters to the calling method.
@param expression a boolean expression
@throws IllegalArgumentException if {@code expression} is false | java | android/guava/src/com/google/common/base/Preconditions.java | 125 | [
"expression"
] | void | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false |
stopForRestart | void stopForRestart() {
if (this.running) {
this.stoppedBeans = ConcurrentHashMap.newKeySet();
stopBeans(false);
this.running = false;
}
} | Stop all registered beans that implement {@link Lifecycle} and <i>are</i>
currently running. Any bean that implements {@link SmartLifecycle} will be
stopped within its 'phase', and all phases will be ordered from highest to
lowest value. All beans that do not implement {@link SmartLifecycle} will be
stopped in the defa... | java | spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java | 349 | [] | void | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
measure | double measure(MetricConfig config, long now); | Measure this quantity and return the result as a double.
@param config The configuration for this metric
@param now The POSIX time in milliseconds the measurement is being taken
@return The measured value | java | clients/src/main/java/org/apache/kafka/common/metrics/Measurable.java | 31 | [
"config",
"now"
] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
stripComment | private static String stripComment(String line) {
int commentStart = line.indexOf(COMMENT_START);
if (commentStart == -1) {
return line;
}
return line.substring(0, commentStart);
} | Loads the names of import candidates from the classpath. The names of the import
candidates are stored in files named
{@code META-INF/spring/full-qualified-annotation-name.imports} on the classpath.
Every line contains the full qualified name of the candidate class. Comments are
supported using the # character.
@param ... | java | core/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java | 130 | [
"line"
] | String | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
saturatedCast | public static byte saturatedCast(long value) {
if (value > toUnsignedInt(MAX_VALUE)) {
return MAX_VALUE; // -1
}
if (value < 0) {
return (byte) 0;
}
return (byte) value;
} | Returns the {@code byte} value that, when treated as unsigned, is nearest in value to {@code
value}.
@param value any {@code long} value
@return {@code (byte) 255} if {@code value >= 255}, {@code (byte) 0} if {@code value <= 0}, and
{@code value} cast to {@code byte} otherwise | java | android/guava/src/com/google/common/primitives/UnsignedBytes.java | 110 | [
"value"
] | true | 3 | 7.92 | google/guava | 51,352 | javadoc | false | |
copyDefault | public void copyDefault(ProxyConfig other) {
Assert.notNull(other, "Other ProxyConfig object must not be null");
if (this.proxyTargetClass == null) {
this.proxyTargetClass = other.proxyTargetClass;
}
if (this.optimize == null) {
this.optimize = other.optimize;
}
if (this.opaque == null) {
this.opaq... | Copy default settings from the other config object,
for settings that have not been locally set.
@param other object to copy configuration from
@since 7.0 | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyConfig.java | 169 | [
"other"
] | void | true | 6 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
splitRecordsIntoBatches | private Deque<ProducerBatch> splitRecordsIntoBatches(RecordBatch recordBatch, int splitBatchSize) {
Deque<ProducerBatch> batches = new ArrayDeque<>();
Iterator<Thunk> thunkIter = thunks.iterator();
// We always allocate batch size because we are already splitting a big batch.
// And we a... | Finalize the state of a batch. Final state, once set, is immutable. This function may be called
once or twice on a batch. It may be called twice if
1. An inflight batch expires before a response from the broker is received. The batch's final
state is set to FAILED. But it could succeed on the broker and second time aro... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java | 348 | [
"recordBatch",
"splitBatchSize"
] | true | 4 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
nullTriple | @SuppressWarnings("unchecked")
public static <L, M, R> ImmutableTriple<L, M, R> nullTriple() {
return NULL;
} | Gets the immutable triple of nulls singleton.
@param <L> the left element of this triple. Value is {@code null}.
@param <M> the middle element of this triple. Value is {@code null}.
@param <R> the right element of this triple. Value is {@code null}.
@return an immutable triple of nulls.
@since 3.6 | java | src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java | 80 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
estimateSizeInBytes | public static int estimateSizeInBytes(byte magic,
CompressionType compressionType,
Iterable<SimpleRecord> records) {
int size = 0;
if (magic <= RecordBatch.MAGIC_VALUE_V1) {
for (SimpleRecord record : records... | Get an iterator over the deep records.
@return An iterator over the records | java | clients/src/main/java/org/apache/kafka/common/record/AbstractRecords.java | 107 | [
"magic",
"compressionType",
"records"
] | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
hermegauss | def hermegauss(deg):
"""
Gauss-HermiteE quadrature.
Computes the sample points and weights for Gauss-HermiteE quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[-\\inf, \\inf]`
with the weight function :... | Gauss-HermiteE quadrature.
Computes the sample points and weights for Gauss-HermiteE quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[-\\inf, \\inf]`
with the weight function :math:`f(x) = \\exp(-x^2/2)`.
Parameters
--------... | python | numpy/polynomial/hermite_e.py | 1,508 | [
"deg"
] | false | 2 | 6.24 | numpy/numpy | 31,054 | numpy | false | |
CONST | public static int CONST(final int v) {
return v;
} | Returns the provided value unchanged. This can prevent javac from inlining a constant field, e.g.,
<pre>
public final static int MAGIC_INT = ObjectUtils.CONST(123);
</pre>
This way any jars that refer to this field do not have to recompile themselves if the field's value changes at some future date.
@param v the int va... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 420 | [
"v"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
proceed | @Override
public @Nullable Object proceed() throws Throwable {
// We start with an index of -1 and increment early.
if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {
return invokeJoinpoint();
}
Object interceptorOrInterceptionAdvice =
this.interceptorsAndDynami... | Return the method invoked on the proxied interface.
May or may not correspond with a method invoked on an underlying
implementation of that interface. | java | spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java | 154 | [] | Object | true | 5 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
buildRequest | UnsentRequest buildRequest() {
// If this is the closing request, close the share session by setting the final epoch
if (isCloseRequest()) {
sessionHandler.notifyClose();
}
Map<TopicIdPartition, Acknowledgements> finalAcknowledgementsToSend = new HashMap<... | Timeout in milliseconds indicating how long the request would be retried if it fails with a retriable exception. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 1,226 | [] | UnsentRequest | true | 7 | 7.04 | apache/kafka | 31,560 | javadoc | false |
forceTerminateTransaction | default TerminateTransactionResult forceTerminateTransaction(String transactionalId) {
return forceTerminateTransaction(transactionalId, new TerminateTransactionOptions());
} | Force terminate a transaction for the given transactional ID with the default options.
<p>
This is a convenience method for {@link #forceTerminateTransaction(String, TerminateTransactionOptions)}
with default options.
@param transactionalId The ID of the transaction to terminate.
@return The TerminateTransact... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 2,131 | [
"transactionalId"
] | TerminateTransactionResult | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
print_outputs_on_timeout | def print_outputs_on_timeout(
outputs: list[Output], results: list[ApplyResult], include_success_outputs: bool
):
"""
Print outputs of the tasks that were terminated on timeout.
This function is called when some tasks were terminated on timeout.
It prints the outputs of the tasks that were terminate... | Print outputs of the tasks that were terminated on timeout.
This function is called when some tasks were terminated on timeout.
It prints the outputs of the tasks that were terminated on timeout,
and the outputs of the tasks that were successful if `include_success_outputs` is True.
:param outputs: list of Output objec... | python | dev/breeze/src/airflow_breeze/utils/parallel.py | 522 | [
"outputs",
"results",
"include_success_outputs"
] | true | 7 | 6.72 | apache/airflow | 43,597 | sphinx | false | |
fit_transform | def fit_transform(self, X, y=None):
"""Fit model to X and perform dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : Ignored
Not used, present here for API consistency ... | Fit model to X and perform dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : Ignored
Not used, present here for API consistency by convention.
Returns
-------
X_new : ndarray of shape (n_samples, n_components)
Reduced ... | python | sklearn/decomposition/_truncated_svd.py | 210 | [
"self",
"X",
"y"
] | false | 10 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
lagmulx | def lagmulx(c):
"""Multiply a Laguerre series by x.
Multiply the Laguerre series `c` by x, where x is the independent
variable.
Parameters
----------
c : array_like
1-D array of Laguerre series coefficients ordered from low to
high.
Returns
-------
out : ndarray
... | Multiply a Laguerre series by x.
Multiply the Laguerre series `c` by x, where x is the independent
variable.
Parameters
----------
c : array_like
1-D array of Laguerre series coefficients ordered from low to
high.
Returns
-------
out : ndarray
Array representing the result of the multiplication.
See Al... | python | numpy/polynomial/laguerre.py | 387 | [
"c"
] | false | 4 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
leftPad | public static String leftPad(final String str, final int size, final char padChar) {
if (str == null) {
return null;
}
final int pads = size - str.length();
if (pads <= 0) {
return str; // returns original String when possible
}
if (pads > PAD_LIMI... | Left pad a String with a specified character.
<p>
Pad to a size of {@code size}.
</p>
<pre>
StringUtils.leftPad(null, *, *) = null
StringUtils.leftPad("", 3, 'z') = "zzz"
StringUtils.leftPad("bat", 3, 'z') = "bat"
StringUtils.leftPad("bat", 5, 'z') = "zzbat"
StringUtils.leftPad("bat", 1, 'z') = "bat"
StringU... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,117 | [
"str",
"size",
"padChar"
] | String | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
get_pytorch_path | def get_pytorch_path() -> str:
"""
Retrieves the installation path of PyTorch in the current environment.
Returns:
str: The directory of the PyTorch installation.
Exits:
If PyTorch is not installed in the current Python environment, the script will exit.
"""
try:
import... | Retrieves the installation path of PyTorch in the current environment.
Returns:
str: The directory of the PyTorch installation.
Exits:
If PyTorch is not installed in the current Python environment, the script will exit. | python | tools/nightly_hotpatch.py | 64 | [] | str | true | 1 | 6.72 | pytorch/pytorch | 96,034 | unknown | false |
fetchRecords | <K, V> List<ConsumerRecord<K, V>> fetchRecords(FetchConfig fetchConfig,
Deserializers<K, V> deserializers,
int maxRecords) {
// Error when fetching the next record before deserialization.
if (corruptLas... | The {@link RecordBatch batch} of {@link Record records} is converted to a {@link List list} of
{@link ConsumerRecord consumer records} and returned. {@link BufferSupplier Decompression} and
{@link Deserializer deserialization} of the {@link Record record's} key and value are performed in
this step.
@param fetchConfig {... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CompletedFetch.java | 252 | [
"fetchConfig",
"deserializers",
"maxRecords"
] | true | 10 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
get_locales | def get_locales(
prefix: str | None = None,
normalize: bool = True,
) -> list[str]:
"""
Get all the locales that are available on the system.
Parameters
----------
prefix : str
If not ``None`` then return only those locales with the prefix
provided. For example to get all En... | Get all the locales that are available on the system.
Parameters
----------
prefix : str
If not ``None`` then return only those locales with the prefix
provided. For example to get all English language locales (those that
start with ``"en"``), pass ``prefix="en"``.
normalize : bool
Call ``locale.normal... | python | pandas/_config/localization.py | 115 | [
"prefix",
"normalize"
] | list[str] | true | 5 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
completeNext | public synchronized boolean completeNext() {
return errorNext(null);
} | Complete the earliest uncompleted call successfully.
@return true if there was an uncompleted call to complete | java | clients/src/main/java/org/apache/kafka/clients/producer/MockProducer.java | 537 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
of | public static LongRange of(final Long fromInclusive, final Long toInclusive) {
return new LongRange(fromInclusive, toInclusive);
} | Creates a closed range with the specified minimum and maximum values (both inclusive).
<p>
The range uses the natural ordering of the elements to determine where values lie in the range.
</p>
<p>
The arguments may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will return the corre... | java | src/main/java/org/apache/commons/lang3/LongRange.java | 70 | [
"fromInclusive",
"toInclusive"
] | LongRange | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
process | protected void process(MatchCallback callback) {
Yaml yaml = createYaml();
for (Resource resource : this.resources) {
boolean found = process(callback, yaml, resource);
if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND && found) {
return;
}
}
} | Provide an opportunity for subclasses to process the Yaml parsed from the supplied
resources. Each resource is parsed in turn and the documents inside checked against
the {@link #setDocumentMatchers(DocumentMatcher...) matchers}. If a document
matches it is passed into the callback, along with its representation as Pro... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java | 166 | [
"callback"
] | void | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
fit_predict | def fit_predict(self, X, y=None, **kwargs):
"""Perform fit on X and returns labels for X.
Returns -1 for outliers and 1 for inliers.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The input samples.
y : Ignored
... | Perform fit on X and returns labels for X.
Returns -1 for outliers and 1 for inliers.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The input samples.
y : Ignored
Not used, present for API consistency by convention.
**kwargs : dict
Arguments to be passed to ``fit... | python | sklearn/base.py | 1,090 | [
"self",
"X",
"y"
] | false | 3 | 6.24 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
baseClamp | function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined) {
number = number <= upper ? number : upper;
}
if (lower !== undefined) {
number = number >= lower ? number : lower;
}
}
return number;
} | The base implementation of `_.clamp` which doesn't coerce arguments.
@private
@param {number} number The number to clamp.
@param {number} [lower] The lower bound.
@param {number} upper The upper bound.
@returns {number} Returns the clamped number. | javascript | lodash.js | 2,634 | [
"number",
"lower",
"upper"
] | false | 6 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
_get_level_values | def _get_level_values(self, level) -> Index:
"""
Return an Index of values for requested level.
This is primarily useful to get an individual level of values from a
MultiIndex, but is provided on Index as well for compatibility.
Parameters
----------
level : int... | Return an Index of values for requested level.
This is primarily useful to get an individual level of values from a
MultiIndex, but is provided on Index as well for compatibility.
Parameters
----------
level : int or str
It is either the integer position or the name of the level.
Returns
-------
Index
Callin... | python | pandas/core/indexes/base.py | 2,204 | [
"self",
"level"
] | Index | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
checkCyclicSubstitution | private void checkCyclicSubstitution(final String varName, final List<String> priorVariables) {
if (!priorVariables.contains(varName)) {
return;
}
final StrBuilder buf = new StrBuilder(256);
buf.append("Infinite loop in property interpolation of ");
buf.append(priorVa... | Checks if the specified variable is already in the stack (list) of variables.
@param varName the variable name to check.
@param priorVariables the list of prior variables. | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 407 | [
"varName",
"priorVariables"
] | void | true | 2 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
visitForStatement | function visitForStatement(node: ForStatement, isTopLevel: boolean): VisitResult<Statement> {
const savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
enclosingBlockScopedContainer = node;
node = factory.updateForStatement(
node,
visitNode(node.ini... | Visits the body of a ForStatement to hoist declarations.
@param node The node to visit. | typescript | src/compiler/transformers/module/system.ts | 1,297 | [
"node",
"isTopLevel"
] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
_ensure_ndmin_ndarray | def _ensure_ndmin_ndarray(a, *, ndmin: int):
"""This is a helper function of loadtxt and genfromtxt to ensure
proper minimum dimension as requested
ndim : int. Supported values 1, 2, 3
^^ whenever this changes, keep in sync with
_ensure_ndmin_ndarray_check... | This is a helper function of loadtxt and genfromtxt to ensure
proper minimum dimension as requested
ndim : int. Supported values 1, 2, 3
^^ whenever this changes, keep in sync with
_ensure_ndmin_ndarray_check_param | python | numpy/lib/_npyio_impl.py | 803 | [
"a",
"ndmin"
] | true | 5 | 6.4 | numpy/numpy | 31,054 | unknown | false | |
ensure_index | def ensure_index(index_like: Axes, copy: bool = False) -> Index:
"""
Ensure that we have an index from some index-like object.
Parameters
----------
index_like : sequence
An Index or other sequence
copy : bool, default False
Returns
-------
index : Index or MultiIndex
... | Ensure that we have an index from some index-like object.
Parameters
----------
index_like : sequence
An Index or other sequence
copy : bool, default False
Returns
-------
index : Index or MultiIndex
See Also
--------
ensure_index_from_sequences
Examples
--------
>>> ensure_index(["a", "b"])
Index(['a', 'b'], d... | python | pandas/core/indexes/base.py | 7,737 | [
"index_like",
"copy"
] | Index | true | 11 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false |
forEachRight | function forEachRight(collection, iteratee) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee, 3));
} | This method is like `_.forEach` except that it iterates over elements of
`collection` from right to left.
@static
@memberOf _
@since 2.0.0
@alias eachRight
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [iteratee=_.identity] The function invoked per iteration.
@r... | javascript | lodash.js | 9,472 | [
"collection",
"iteratee"
] | false | 2 | 6.96 | lodash/lodash | 61,490 | jsdoc | false | |
inclusiveBetween | public static <T> void inclusiveBetween(final T start, final T end, final Comparable<T> value) {
// TODO when breaking BC, consider returning value
if (value.compareTo(start) < 0 || value.compareTo(end) > 0) {
throw new IllegalArgumentException(String.format(DEFAULT_INCLUSIVE_BETWEEN_EX_MESS... | Validate that the specified argument object fall between the two
inclusive values specified; otherwise, throws an exception.
<pre>Validate.inclusiveBetween(0, 2, 1);</pre>
@param <T> the type of the argument object.
@param start the inclusive start value, not null.
@param end the inclusive end value, not null.
@param... | java | src/main/java/org/apache/commons/lang3/Validate.java | 353 | [
"start",
"end",
"value"
] | void | true | 3 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
fillna | def fillna(
self,
value,
limit: int | None = None,
copy: bool = True,
) -> Self:
"""
Fill missing values with `value`.
Parameters
----------
value : scalar
limit : int, optional
Not supported for SparseArray, must be None.
... | Fill missing values with `value`.
Parameters
----------
value : scalar
limit : int, optional
Not supported for SparseArray, must be None.
copy: bool, default True
Ignored for SparseArray.
Returns
-------
SparseArray
Notes
-----
When `value` is specified, the result's ``fill_value`` depends on
``self.fill_val... | python | pandas/core/arrays/sparse/array.py | 795 | [
"self",
"value",
"limit",
"copy"
] | Self | true | 4 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
isAlpha | public static boolean isAlpha(final CharSequence cs) {
if (isEmpty(cs)) {
return false;
}
final int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (!Character.isLetter(cs.charAt(i))) {
return false;
}
}
return true;... | Tests if the CharSequence contains only Unicode letters.
<p>
{@code null} will return {@code false}. An empty CharSequence (length()=0) will return {@code false}.
</p>
<pre>
StringUtils.isAlpha(null) = false
StringUtils.isAlpha("") = false
StringUtils.isAlpha(" ") = false
StringUtils.isAlpha("abc") = true
Str... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 3,264 | [
"cs"
] | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
needToTriggerEpochBumpFromClient | boolean needToTriggerEpochBumpFromClient() {
return coordinatorSupportsBumpingEpoch && !isTransactionV2Enabled;
} | Determines if an epoch bump can be triggered manually based on the api versions.
<b>NOTE:</b>
This method should only be used for transactional producers.
For non-transactional producers epoch bumping is always allowed.
<ol>
<li><b>Client-Triggered Epoch Bump</b>:
If the coordinator supports epoch bumping (i... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 1,311 | [] | true | 2 | 7.36 | apache/kafka | 31,560 | javadoc | false | |
nullToEmpty | public static Object[] nullToEmpty(final Object[] array) {
return nullTo(array, EMPTY_OBJECT_ARRAY);
} | Defensive programming technique to change a {@code null}
reference to an empty one.
<p>
This method returns an empty array for a {@code null} input array.
</p>
<p>
As a memory optimizing technique an empty array passed in will be overridden with
the empty {@code public static} references in this class.
</p>
@param arra... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,565 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
getIgnoreDeprecationsVersion | function getIgnoreDeprecationsVersion(): Version {
const ignoreDeprecations = options.ignoreDeprecations;
if (ignoreDeprecations) {
if (ignoreDeprecations === "5.0" || ignoreDeprecations === "6.0") {
return new Version(ignoreDeprecations);
}
repo... | Get the referenced project if the file is input file from that reference project | typescript | src/compiler/program.ts | 4,397 | [] | true | 4 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
fromfunction | def fromfunction(function, shape, *, dtype=float, like=None, **kwargs):
"""
Construct an array by executing a function over each coordinate.
The resulting array therefore has a value ``fn(x, y, z)`` at
coordinate ``(x, y, z)``.
Parameters
----------
function : callable
The function... | Construct an array by executing a function over each coordinate.
The resulting array therefore has a value ``fn(x, y, z)`` at
coordinate ``(x, y, z)``.
Parameters
----------
function : callable
The function is called with N parameters, where N is the rank of
`shape`. Each parameter represents the coordinates... | python | numpy/_core/numeric.py | 1,821 | [
"function",
"shape",
"dtype",
"like"
] | false | 2 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
parseQuery | function parseQuery(qstr) {
var query = {};
var a = qstr.slice(1).split('&');
for (var i = 0; i < a.length; i++) {
var b = a[i].split('=');
query[decodeURIComponent(b[0])] = decodeURIComponent(b[1] || '');
}
return query;
} | Take a version from the window query string and load a specific
version of React.
@example
http://localhost:3000?version=15.4.1
(Loads React 15.4.1) | javascript | fixtures/dom/src/react-loader.js | 12 | [
"qstr"
] | false | 3 | 6.32 | facebook/react | 241,750 | jsdoc | false | |
setFetchAction | public void setFetchAction(final FetchBuffer fetchBuffer) {
final AtomicBoolean throwWakeupException = new AtomicBoolean(false);
pendingTask.getAndUpdate(task -> {
if (task == null) {
return new FetchAction(fetchBuffer);
} else if (task instanceof WakeupFuture) {
... | If there is no pending task, set the pending task active.
If wakeup was called before setting an active task, the current task will complete exceptionally with
WakeupException right away.
If there is an active task, throw exception.
@param currentTask
@param <T>
@return | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/WakeupTrigger.java | 92 | [
"fetchBuffer"
] | void | true | 5 | 8.24 | apache/kafka | 31,560 | javadoc | false |
outer | def outer(x1, x2, /):
"""
Compute the outer product of two vectors.
This function is Array API compatible. Compared to ``np.outer``
it accepts 1-dimensional inputs only.
Parameters
----------
x1 : (M,) array_like
One-dimensional input array of size ``N``.
Must have a numeri... | Compute the outer product of two vectors.
This function is Array API compatible. Compared to ``np.outer``
it accepts 1-dimensional inputs only.
Parameters
----------
x1 : (M,) array_like
One-dimensional input array of size ``N``.
Must have a numeric data type.
x2 : (N,) array_like
One-dimensional input ar... | python | numpy/linalg/_linalg.py | 888 | [
"x1",
"x2"
] | false | 3 | 6.4 | numpy/numpy | 31,054 | numpy | false | |
open | function open(path, flags, mode, callback) {
path = getValidatedPath(path);
if (arguments.length < 3) {
callback = flags;
flags = 'r';
mode = 0o666;
} else if (typeof mode === 'function') {
callback = mode;
mode = 0o666;
} else {
mode = parseFileMode(mode, 'mode', 0o666);
}
const fla... | Asynchronously opens a file.
@param {string | Buffer | URL} path
@param {string | number} [flags]
@param {string | number} [mode]
@param {(
err?: Error,
fd?: number
) => any} callback
@returns {void} | javascript | lib/fs.js | 527 | [
"path",
"flags",
"mode",
"callback"
] | false | 5 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
_has_kubernetes | def _has_kubernetes(attempt_import: bool = False) -> bool:
"""
Check if kubernetes libraries are available.
:param attempt_import: If true, attempt to import kubernetes libraries if not already loaded. If
False, only check if already in sys.modules (avoids expensive import).
:return: True if ku... | Check if kubernetes libraries are available.
:param attempt_import: If true, attempt to import kubernetes libraries if not already loaded. If
False, only check if already in sys.modules (avoids expensive import).
:return: True if kubernetes libraries are available, False otherwise. | python | airflow-core/src/airflow/serialization/serialized_objects.py | 3,745 | [
"attempt_import"
] | bool | true | 3 | 7.6 | apache/airflow | 43,597 | sphinx | false |
getattr_with_deprecation | def getattr_with_deprecation(
imports: dict[str, str],
module: str,
override_deprecated_classes: dict[str, str],
extra_message: str,
name: str,
):
"""
Retrieve the imported attribute from the redirected module and raises a deprecation warning.
:param imports: dict of imports and their r... | Retrieve the imported attribute from the redirected module and raises a deprecation warning.
:param imports: dict of imports and their redirection for the module
:param module: name of the module in the package to get the attribute from
:param override_deprecated_classes: override target attributes with deprecated one... | python | airflow-core/src/airflow/utils/deprecation_tools.py | 37 | [
"imports",
"module",
"override_deprecated_classes",
"extra_message",
"name"
] | true | 10 | 7.92 | apache/airflow | 43,597 | sphinx | false | |
toSafeInteger | function toSafeInteger(value) {
return value
? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
: (value === 0 ? value : 0);
} | Converts `value` to a safe integer. A safe integer can be compared and
represented correctly.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to convert.
@returns {number} Returns the converted integer.
@example
_.toSafeInteger(3.2);
// => 3
_.toSafeInteger(Number.MIN_VALUE);
// => 0
_.toSafe... | javascript | lodash.js | 12,637 | [
"value"
] | false | 3 | 7.04 | lodash/lodash | 61,490 | jsdoc | false | |
getAsBoolean | private static <T extends Throwable> boolean getAsBoolean(final FailableBooleanSupplier<T> supplier) {
try {
return supplier.getAsBoolean();
} catch (final Throwable t) {
throw rethrow(t);
}
} | Invokes a boolean supplier, and returns the result.
@param supplier The boolean supplier to invoke.
@param <T> The type of checked exception, which the supplier can throw.
@return The boolean, which has been created by the supplier | java | src/main/java/org/apache/commons/lang3/Functions.java | 491 | [
"supplier"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
check_cv | def check_cv(cv=5, y=None, *, classifier=False):
"""Input checker utility for building a cross-validator.
Parameters
----------
cv : int, cross-validation generator, iterable or None, default=5
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- Non... | Input checker utility for building a cross-validator.
Parameters
----------
cv : int, cross-validation generator, iterable or None, default=5
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- None, to use the default 5-fold cross validation,
- integer, to specify the num... | python | sklearn/model_selection/_split.py | 2,690 | [
"cv",
"y",
"classifier"
] | false | 11 | 6.96 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_decode_comment | def _decode_comment(self, s):
'''(INTERNAL) Decodes a comment line.
Comments are single line strings starting, obligatorily, with the ``%``
character, and can have any symbol, including whitespaces or special
characters.
This method must receive a normalized string, i.e., a str... | (INTERNAL) Decodes a comment line.
Comments are single line strings starting, obligatorily, with the ``%``
character, and can have any symbol, including whitespaces or special
characters.
This method must receive a normalized string, i.e., a string without
padding, including the "\r\n" characters.
:param s: a normal... | python | sklearn/externals/_arff.py | 674 | [
"self",
"s"
] | false | 1 | 6.24 | scikit-learn/scikit-learn | 64,340 | sphinx | false | |
evalScript | function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) {
const origModule = globalThis.module; // Set e.g. when called from the REPL.
const module = createModule(name);
const baseUrl = pathToFileURL(module.filename).href;
if (shouldUseModuleEntryPoint(name, body)) {
return getOption... | Evaluate an ESM entry point and return the promise that gets fulfilled after
it finishes evaluation.
@param {string} source Source code the ESM
@param {boolean} print Whether the result should be printed.
@returns {Promise} | javascript | lib/internal/process/execution.js | 81 | [
"name",
"body",
"breakFirstLine",
"print"
] | false | 4 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
index | public static <K, V> ImmutableListMultimap<K, V> index(
Iterator<V> values, Function<? super V, K> keyFunction) {
checkNotNull(keyFunction);
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
while (values.hasNext()) {
V value = values.next();
checkNotNull(value... | Creates an index {@code ImmutableListMultimap} that contains the results of applying a
specified function to each item in an {@code Iterator} of values. Each value will be stored as
a value in the resulting multimap, yielding a multimap with the same size as the input
iterator. The key used to store that value in the m... | java | android/guava/src/com/google/common/collect/Multimaps.java | 1,712 | [
"values",
"keyFunction"
] | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false | |
incrementAndGet | public int incrementAndGet() {
value++;
return value;
} | Increments this instance's value by 1; this method returns the value associated with the instance
immediately after the increment operation. This method is not thread safe.
@return the value associated with the instance after it is incremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableInt.java | 291 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
readAdditionalMetadata | ConfigurationMetadata readAdditionalMetadata() {
return readAdditionalMetadata(ADDITIONAL_METADATA_PATH);
} | Read additional {@link ConfigurationMetadata} for the current module or
{@code null}.
@return additional metadata or {@code null} if none is present | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java | 136 | [] | ConfigurationMetadata | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
getVisualListRange | function getVisualListRange(node: Node, list: TextRange, sourceFile: SourceFile): TextRange {
const children = node.getChildren(sourceFile);
for (let i = 1; i < children.length - 1; i++) {
if (children[i].pos === list.pos && children[i].end === list.end) {
return { pos: c... | @param assumeNewLineBeforeCloseBrace
`false` when called on text from a real source file.
`true` when we need to assume `position` is on a newline.
This is useful for codefixes. Consider
```
function f() {
|}
```
with `position` at `|`.
When inserting some text after an open brace, we would like to get inden... | typescript | src/services/formatting/smartIndenter.ts | 535 | [
"node",
"list",
"sourceFile"
] | true | 4 | 8.32 | microsoft/TypeScript | 107,154 | jsdoc | false | |
indexer_between_time | def indexer_between_time(
self, start_time, end_time, include_start: bool = True, include_end: bool = True
) -> npt.NDArray[np.intp]:
"""
Return index locations of values between particular times of day.
Parameters
----------
start_time, end_time : datetime.time, str... | Return index locations of values between particular times of day.
Parameters
----------
start_time, end_time : datetime.time, str
Time passed either as object (datetime.time) or as string in
appropriate format ("%H:%M", "%H%M", "%I:%M%p", "%I%M%p",
"%H:%M:%S", "%H%M%S", "%I:%M:%S%p","%I%M%S%p").
include_st... | python | pandas/core/indexes/datetimes.py | 1,181 | [
"self",
"start_time",
"end_time",
"include_start",
"include_end"
] | npt.NDArray[np.intp] | true | 8 | 7.92 | pandas-dev/pandas | 47,362 | numpy | false |
errorCounts | @Override
public Map<Errors, Integer> errorCounts() {
Map<Errors, Integer> errorCounts = new EnumMap<>(Errors.class);
data.topics().forEach(metadata -> {
metadata.partitions().forEach(p -> updateErrorCounts(errorCounts, Errors.forCode(p.errorCode())));
updateErrorCounts(error... | Get a map of the topicIds which had metadata errors
@return the map | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java | 127 | [] | true | 1 | 6.24 | apache/kafka | 31,560 | javadoc | false | |
to_feather | def to_feather(
df: DataFrame,
path: FilePath | WriteBuffer[bytes],
storage_options: StorageOptions | None = None,
**kwargs: Any,
) -> None:
"""
Write a DataFrame to the binary Feather format.
Parameters
----------
df : DataFrame
path : str, path object, or file-like object
... | Write a DataFrame to the binary Feather format.
Parameters
----------
df : DataFrame
path : str, path object, or file-like object
storage_options : dict, optional
Extra options that make sense for a particular storage connection, e.g.
host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
... | python | pandas/io/feather_format.py | 39 | [
"df",
"path",
"storage_options"
] | None | true | 2 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
bind | @Contract("_, _, _, _, _, true -> !null")
private <T> @Nullable T bind(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler,
Context context, boolean allowRecursiveBinding, boolean create) {
try (ConfigurationPropertyCaching.CacheOverride cacheOverride = this.configurationPropertyCaching.overri... | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param h... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 363 | [
"name",
"target",
"handler",
"context",
"allowRecursiveBinding",
"create"
] | T | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
angle | def angle(z, deg=False):
"""
Return the angle of the complex argument.
Parameters
----------
z : array_like
A complex number or sequence of complex numbers.
deg : bool, optional
Return angle in degrees if True, radians if False (default).
Returns
-------
angle : nda... | Return the angle of the complex argument.
Parameters
----------
z : array_like
A complex number or sequence of complex numbers.
deg : bool, optional
Return angle in degrees if True, radians if False (default).
Returns
-------
angle : ndarray or scalar
The counterclockwise angle from the positive real axis... | python | numpy/lib/_function_base_impl.py | 1,683 | [
"z",
"deg"
] | false | 4 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
toArray | public static char[] toArray(Collection<Character> collection) {
if (collection instanceof CharArrayAsList) {
return ((CharArrayAsList) collection).toCharArray();
}
Object[] boxedArray = collection.toArray();
int len = boxedArray.length;
char[] array = new char[len];
for (int i = 0; i < l... | Copies a collection of {@code Character} instances into a new array of primitive {@code char}
values.
<p>Elements are copied from the argument collection as if by {@code collection.toArray()}.
Calling this method is as thread-safe as calling that method.
@param collection a collection of {@code Character} objects
@retu... | java | android/guava/src/com/google/common/primitives/Chars.java | 436 | [
"collection"
] | true | 3 | 8.08 | google/guava | 51,352 | javadoc | false | |
isConfigurationCandidate | static boolean isConfigurationCandidate(AnnotationMetadata metadata) {
// Do not consider an interface or an annotation...
if (metadata.isInterface()) {
return false;
}
// Any of the typical annotations found?
for (String indicator : candidateIndicators) {
if (metadata.isAnnotated(indicator)) {
ret... | Check the given metadata for a configuration class candidate
(or nested component class declared within a configuration/component class).
@param metadata the metadata of the annotated class
@return {@code true} if the given class is to be registered for
configuration class processing; {@code false} otherwise | java | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassUtils.java | 174 | [
"metadata"
] | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
remove_extra_translations | def remove_extra_translations(language: str, summary: dict[str, LocaleSummary]):
"""
Remove extra translations for the selected language.
Removes keys that are present in the language file but missing in the English file.
"""
console = get_console()
for filename, diff in summary.items():
... | Remove extra translations for the selected language.
Removes keys that are present in the language file but missing in the English file. | python | dev/breeze/src/airflow_breeze/commands/ui_commands.py | 515 | [
"language",
"summary"
] | true | 10 | 6 | apache/airflow | 43,597 | unknown | false | |
secureRandom | static SecureRandom secureRandom() {
return SECURE_RANDOM_STRONG.get();
} | Gets the singleton instance based on {@link SecureRandom#SecureRandom()} which uses the default algorithm
and provider of {@link SecureRandom}.
<p>
The method {@link SecureRandom#SecureRandom()} is called on-demand.
</p>
@return the singleton instance based on {@link SecureRandom#SecureRandom()}.
@see SecureRandom#Secu... | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 254 | [] | SecureRandom | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.