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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
is_any_real_numeric_dtype | def is_any_real_numeric_dtype(arr_or_dtype) -> bool:
"""
Check whether the provided array or dtype is of a real number dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
boolean
Whether or not the array or dtype ... | Check whether the provided array or dtype is of a real number dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
boolean
Whether or not the array or dtype is of a real number dtype.
See Also
--------
is_numeric_dtype : Check if a dtype is numeric.
is_... | python | pandas/core/dtypes/common.py | 1,301 | [
"arr_or_dtype"
] | bool | true | 3 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false |
getProfiles | private Collection<String> getProfiles(Environment environment, Binder binder, ProfilesValidator validator,
Type type) {
String environmentPropertyValue = environment.getProperty(type.getName());
Set<String> environmentPropertyProfiles = (!StringUtils.hasLength(environmentPropertyValue))
? Collections.emptyS... | Create a new {@link Profiles} instance based on the {@link Environment} and
{@link Binder}.
@param environment the source environment
@param binder the binder for profile properties
@param additionalProfiles any additional active profiles | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java | 102 | [
"environment",
"binder",
"validator",
"type"
] | true | 5 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
is | private boolean is(Type formalType, TypeVariable<?> declaration) {
if (runtimeType.equals(formalType)) {
return true;
}
if (formalType instanceof WildcardType) {
WildcardType your = canonicalizeWildcardType(declaration, (WildcardType) formalType);
// if "formalType" is <? extends Foo>, "th... | {@code A.is(B)} is defined as {@code Foo<A>.isSubtypeOf(Foo<B>)}.
<p>Specifically, returns true if any of the following conditions is met:
<ol>
<li>'this' and {@code formalType} are equal.
<li>'this' and {@code formalType} have equal canonical form.
<li>{@code formalType} is {@code <? extends Foo>} and 'this' is ... | java | android/guava/src/com/google/common/reflect/TypeToken.java | 984 | [
"formalType",
"declaration"
] | true | 4 | 8.64 | google/guava | 51,352 | javadoc | false | |
handleShareAcknowledgeFailure | private void handleShareAcknowledgeFailure(Node fetchTarget,
ShareAcknowledgeRequestData requestData,
AcknowledgeRequestState acknowledgeRequestState,
Throwable error,
... | The method checks whether the leader for a topicIdPartition has changed.
@param nodeId The previous leader for the partition.
@param topicIdPartition The TopicIdPartition to check.
@return Returns true if leader information is available and leader has changed.
If the leader information is not available or if the leader... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 1,017 | [
"fetchTarget",
"requestData",
"acknowledgeRequestState",
"error",
"responseCompletionTimeMs"
] | void | true | 3 | 7.92 | apache/kafka | 31,560 | javadoc | false |
generate_online_numba_ewma_func | def generate_online_numba_ewma_func(
nopython: bool,
nogil: bool,
parallel: bool,
):
"""
Generate a numba jitted groupby ewma function specified by values
from engine_kwargs.
Parameters
----------
nopython : bool
nopython to be passed into numba.jit
nogil : bool
... | Generate a numba jitted groupby ewma function specified by values
from engine_kwargs.
Parameters
----------
nopython : bool
nopython to be passed into numba.jit
nogil : bool
nogil to be passed into numba.jit
parallel : bool
parallel to be passed into numba.jit
Returns
-------
Numba function | python | pandas/core/window/online.py | 10 | [
"nopython",
"nogil",
"parallel"
] | true | 13 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false | |
sendEligibleCalls | private long sendEligibleCalls(long now) {
long pollTimeout = Long.MAX_VALUE;
for (Iterator<Map.Entry<Node, List<Call>>> iter = callsToSend.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry<Node, List<Call>> entry = iter.next();
List<Call> calls = entry.getValu... | Send the calls which are ready.
@param now The current time in milliseconds.
@return The minimum timeout we need for poll(). | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 1,240 | [
"now"
] | true | 10 | 8.32 | apache/kafka | 31,560 | javadoc | false | |
parseTypeQuery | function parseTypeQuery(): TypeQueryNode {
const pos = getNodePos();
parseExpected(SyntaxKind.TypeOfKeyword);
const entityName = parseEntityName(/*allowReservedWords*/ true);
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation exp... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 3,946 | [] | true | 2 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
isNotPropertyAccessOnIntegerLiteral | function isNotPropertyAccessOnIntegerLiteral(context: FormattingContext): boolean {
return !isPropertyAccessExpression(context.contextNode)
|| !isNumericLiteral(context.contextNode.expression)
|| context.contextNode.expression.getText().includes(".");
} | 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 | 989 | [
"context"
] | true | 3 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
create | public static ConfigurationMetadataRepositoryJsonBuilder create() {
return create(StandardCharsets.UTF_8);
} | Create a new builder instance using {@link StandardCharsets#UTF_8} as the default
charset.
@return a new {@link ConfigurationMetadataRepositoryJsonBuilder} instance. | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java | 166 | [] | ConfigurationMetadataRepositoryJsonBuilder | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
check_random_state | def check_random_state(seed):
"""Turn seed into an np.random.RandomState instance.
Parameters
----------
seed : None, int or instance of RandomState
If seed is None, return the RandomState singleton used by np.random.
If seed is an int, return a new RandomState instance seeded with seed... | Turn seed into an np.random.RandomState instance.
Parameters
----------
seed : None, int or instance of RandomState
If seed is None, return the RandomState singleton used by np.random.
If seed is an int, return a new RandomState instance seeded with seed.
If seed is already a RandomState instance, return i... | python | sklearn/utils/validation.py | 1,439 | [
"seed"
] | false | 5 | 7.04 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
drainBufferedTimeline | public StartupTimeline drainBufferedTimeline() {
List<TimelineEvent> events = new ArrayList<>();
Iterator<TimelineEvent> iterator = this.events.iterator();
while (iterator.hasNext()) {
events.add(iterator.next());
iterator.remove();
}
this.estimatedSize.set(0);
return new StartupTimeline(this.startTim... | Return the {@link StartupTimeline timeline} by pulling steps from the buffer.
<p>
This removes steps from the buffer, see {@link #getBufferedTimeline()} for its
read-only counterpart.
@return buffered steps drained from the buffer. | java | core/spring-boot/src/main/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartup.java | 164 | [] | StartupTimeline | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
deferred_slots | def deferred_slots(self, session: Session = NEW_SESSION) -> int:
"""
Get the number of slots deferred at the moment.
:param session: SQLAlchemy ORM Session
:return: the number of deferred slots
"""
from airflow.models.taskinstance import TaskInstance # Avoid circular im... | Get the number of slots deferred at the moment.
:param session: SQLAlchemy ORM Session
:return: the number of deferred slots | python | airflow-core/src/airflow/models/pool.py | 329 | [
"self",
"session"
] | int | true | 2 | 8.24 | apache/airflow | 43,597 | sphinx | false |
_replace_booleans | def _replace_booleans(tok: tuple[int, str]) -> tuple[int, str]:
"""
Replace ``&`` with ``and`` and ``|`` with ``or`` so that bitwise
precedence is changed to boolean precedence.
Parameters
----------
tok : tuple of int, str
ints correspond to the all caps constants in the tokenize modul... | Replace ``&`` with ``and`` and ``|`` with ``or`` so that bitwise
precedence is changed to boolean precedence.
Parameters
----------
tok : tuple of int, str
ints correspond to the all caps constants in the tokenize module
Returns
-------
tuple of int, str
Either the input or token or the replacement values | python | pandas/core/computation/expr.py | 74 | [
"tok"
] | tuple[int, str] | true | 4 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
classToString | private static <T> String classToString(final Class<T> cls) {
if (cls.isArray()) {
return toString(cls.getComponentType()) + "[]";
}
if (isCyclical(cls)) {
return cls.getSimpleName() + "(cycle)";
}
final StringBuilder buf = new StringBuilder();
if ... | Formats a {@link Class} as a {@link String}.
@param cls {@link Class} to format.
@return The class as a String. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 347 | [
"cls"
] | String | true | 5 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
putmask_inplace | def putmask_inplace(values: ArrayLike, mask: npt.NDArray[np.bool_], value: Any) -> None:
"""
ExtensionArray-compatible implementation of np.putmask. The main
difference is we do not handle repeating or truncating like numpy.
Parameters
----------
values: np.ndarray or ExtensionArray
mask :... | ExtensionArray-compatible implementation of np.putmask. The main
difference is we do not handle repeating or truncating like numpy.
Parameters
----------
values: np.ndarray or ExtensionArray
mask : np.ndarray[bool]
We assume extract_bool_array has already been called.
value : Any | python | pandas/core/array_algos/putmask.py | 30 | [
"values",
"mask",
"value"
] | None | true | 10 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
fit | def fit(self, X, y=None):
"""Fit data X by computing the binning thresholds.
The last bin is reserved for missing values, whether missing values
are present in the data or not.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to... | Fit data X by computing the binning thresholds.
The last bin is reserved for missing values, whether missing values
are present in the data or not.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to bin.
y: None
Ignored.
Returns
-------
self : object | python | sklearn/ensemble/_hist_gradient_boosting/binning.py | 178 | [
"self",
"X",
"y"
] | false | 15 | 6.16 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getRootJarFile | private File getRootJarFile(JarFile jarFile) {
String name = jarFile.getName();
int separator = name.indexOf("!/");
if (separator > 0) {
name = name.substring(0, separator);
}
return new File(name);
} | Create a new {@link ApplicationHome} instance for the specified source class.
@param sourceClass the source class or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java | 132 | [
"jarFile"
] | File | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
nextAlphanumeric | public String nextAlphanumeric(final int minLengthInclusive, final int maxLengthExclusive) {
return nextAlphanumeric(randomUtils().randomInt(minLengthInclusive, maxLengthExclusive));
} | Creates a random string whose length is between the inclusive minimum and the exclusive maximum.
<p>
Characters will be chosen from the set of Latin alphabetic characters (a-z, A-Z) and the digits 0-9.
</p>
@param minLengthInclusive the inclusive minimum length of the string to generate.
@param maxLengthExclusive the e... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 856 | [
"minLengthInclusive",
"maxLengthExclusive"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
equals | public static boolean equals(final Annotation a1, final Annotation a2) {
if (a1 == a2) {
return true;
}
if (a1 == null || a2 == null) {
return false;
}
final Class<? extends Annotation> type1 = a1.annotationType();
final Class<? extends Annotation>... | Checks if two annotations are equal using the criteria for equality
presented in the {@link Annotation#equals(Object)} API docs.
@param a1 the first Annotation to compare, {@code null} returns
{@code false} unless both are {@code null}
@param a2 the second Annotation to compare, {@code null} returns
{@code false} unles... | java | src/main/java/org/apache/commons/lang3/AnnotationUtils.java | 196 | [
"a1",
"a2"
] | true | 9 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
opj_int_floorlog2 | static INLINE OPJ_INT32 opj_int_floorlog2(OPJ_INT32 a)
{
OPJ_INT32 l;
for (l = 0; a > 1; l++) {
a >>= 1;
}
return l;
} | Get logarithm of an integer and round downwards
@return Returns log2(a) | cpp | 3rdparty/openjpeg/openjp2/opj_intmath.h | 236 | [
"a"
] | true | 2 | 6.4 | opencv/opencv | 85,374 | doxygen | false | |
createAvlTreeDigest | public static AVLTreeDigest createAvlTreeDigest(TDigestArrays arrays, double compression) {
return AVLTreeDigest.create(arrays, compression);
} | Creates an {@link AVLTreeDigest}. This is the most accurate implementation, delivering relative accuracy close to 0.01% for large
sample populations. Still, its construction takes 2x-10x longer than {@link MergingDigest}, while its memory footprint increases
(slowly) with the sample population size.
@param compression... | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/TDigest.java | 68 | [
"arrays",
"compression"
] | AVLTreeDigest | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
resource_name_for_dag | def resource_name_for_dag(dag_id: str) -> str:
"""
Return the resource name for a DAG id.
Note: This function is kept for backwards compatibility.
"""
if dag_id == RESOURCE_DAG:
return dag_id
if dag_id.startswith(RESOURCE_DAG_PREFIX):
return dag_id
return f"{RESOURCE_DAG_PRE... | Return the resource name for a DAG id.
Note: This function is kept for backwards compatibility. | python | airflow-core/src/airflow/security/permissions.py | 116 | [
"dag_id"
] | str | true | 3 | 7.04 | apache/airflow | 43,597 | unknown | false |
parseRsaDer | private static RSAPrivateCrtKeySpec parseRsaDer(byte[] keyBytes) throws IOException {
DerParser parser = new DerParser(keyBytes);
DerParser.Asn1Object sequence = parser.readAsn1Object();
parser = sequence.getParser();
parser.readAsn1Object().getInteger(); // (version) We don't need it bu... | Parses a DER encoded RSA key to a {@link RSAPrivateCrtKeySpec} using a minimal {@link DerParser}
@param keyBytes the private key raw bytes
@return {@link RSAPrivateCrtKeySpec}
@throws IOException if the DER encoded key can't be parsed | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | 623 | [
"keyBytes"
] | RSAPrivateCrtKeySpec | true | 1 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
toString | @Override
public String toString() {
StringBuilder sb = new StringBuilder("AspectJExpressionPointcut: (");
for (int i = 0; i < this.pointcutParameterTypes.length; i++) {
sb.append(this.pointcutParameterTypes[i].getName());
sb.append(' ');
sb.append(this.pointcutParameterNames[i]);
if ((i+1) < this.poin... | Get a new pointcut expression based on a target class's loader rather than the default. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java | 567 | [] | String | true | 4 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
create_nodegroup | def create_nodegroup(
self,
clusterName: str,
nodegroupName: str,
subnets: list[str],
nodeRole: str | None,
*,
tags: dict | None = None,
**kwargs,
) -> dict:
"""
Create an Amazon EKS managed node group for an Amazon EKS Cluster.
... | Create an Amazon EKS managed node group for an Amazon EKS Cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.create_nodegroup`
:param clusterName: The name of the Amazon EKS cluster to create the EKS Managed Nodegroup in.
:param nodegroupName: The unique name to give your managed nodegroup.
:param subnet... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 161 | [
"self",
"clusterName",
"nodegroupName",
"subnets",
"nodeRole",
"tags"
] | dict | true | 3 | 8.08 | apache/airflow | 43,597 | sphinx | false |
rootFirst | public static StandardStackTracePrinter rootFirst() {
return new StandardStackTracePrinter(EnumSet.of(Option.ROOT_FIRST), UNLIMITED, null, null, null, null, null,
null);
} | Return a {@link StandardStackTracePrinter} that prints the stack trace with the
root exception first (the opposite of {@link Throwable#printStackTrace()}).
@return a {@link StandardStackTracePrinter} that prints the stack trace root first | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 307 | [] | StandardStackTracePrinter | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
dispatchListenerEvents | private void dispatchListenerEvents() {
if (!monitor.isOccupiedByCurrentThread()) {
listeners.dispatch();
}
} | Attempts to execute all the listeners in {@link #listeners} while not holding the {@link
#monitor}. | java | android/guava/src/com/google/common/util/concurrent/AbstractService.java | 507 | [] | void | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false |
nextPage | public void nextPage() {
if (!isLastPage()) {
this.page++;
}
} | Switch to next page.
Will stay on last page if already on last page. | java | spring-beans/src/main/java/org/springframework/beans/support/PagedListHolder.java | 248 | [] | void | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
beforeInitialize | @Override
public void beforeInitialize() {
LoggerContext loggerContext = getLoggerContext();
if (isAlreadyInitialized(loggerContext)) {
return;
}
if (!configureJdkLoggingBridgeHandler()) {
super.beforeInitialize();
}
loggerContext.getConfiguration().addFilter(FILTER);
} | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 171 | [] | void | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
ifBound | public void ifBound(Consumer<? super T> consumer) {
Assert.notNull(consumer, "'consumer' must not be null");
if (this.value != null) {
consumer.accept(this.value);
}
} | Invoke the specified consumer with the bound value, or do nothing if no value has
been bound.
@param consumer block to execute if a value has been bound | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java | 76 | [
"consumer"
] | void | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
bindOrCreate | @SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1232
public <T> T bindOrCreate(ConfigurationPropertyName name, Bindable<T> target, @Nullable BindHandler handler) {
return bind(name, target, handler, true);
} | 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 | 348 | [
"name",
"target",
"handler"
] | T | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
call | public static <V, E extends Throwable> V call(final FailableCallable<V, E> callable) {
return get(callable::call);
} | Calls a callable and rethrows any exception as a {@link RuntimeException}.
@param callable the callable to call
@param <V> the return type of the callable
@param <E> the type of checked exception the callable may throw
@return the value returned from the callable | java | src/main/java/org/apache/commons/lang3/function/Failable.java | 395 | [
"callable"
] | V | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
getAndAdd | public long getAndAdd(final Number operand) {
final long last = value;
this.value += operand.longValue();
return last;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately prior to the addition operation. This method is not thread safe.
@param operand the quantity to add, not null.
@throws NullPointerException if {@code operand} is null.
@return the value associated... | java | src/main/java/org/apache/commons/lang3/mutable/MutableLong.java | 221 | [
"operand"
] | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false | |
combinations | public static <E> Set<Set<E>> combinations(Set<E> set, int size) {
ImmutableMap<E, Integer> index = Maps.indexMap(set);
checkNonnegative(size, "size");
checkArgument(size <= index.size(), "size (%s) must be <= set.size() (%s)", size, index.size());
if (size == 0) {
return ImmutableSet.of(Immutable... | Returns the set of all subsets of {@code set} of size {@code size}. For example, {@code
combinations(ImmutableSet.of(1, 2, 3), 2)} returns the set {@code {{1, 2}, {1, 3}, {2, 3}}}.
<p>Elements appear in these subsets in the same iteration order as they appeared in the input
set. The order in which these subsets appear ... | java | android/guava/src/com/google/common/collect/Sets.java | 1,764 | [
"set",
"size"
] | true | 9 | 8 | google/guava | 51,352 | javadoc | false | |
hashCode | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(getExceptionName());
result = prime * result + ObjectUtils.nullSafeHashCode(this.path);
result = prime * result + getStatusCode();
return result;
} | Return if this error page is a global one (matches all unmatched status and
exception types).
@return if this is a global error page | java | core/spring-boot/src/main/java/org/springframework/boot/web/error/ErrorPage.java | 124 | [] | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
copy | CopyableBucketIterator copy(); | Creates a copy of this bucket iterator, pointing at the same bucket of the same range of buckets.
Calling {@link #advance()} on the copied iterator does not affect this instance and vice-versa.
@return a copy of this iterator | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/CopyableBucketIterator.java | 35 | [] | CopyableBucketIterator | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
wasProcessed | boolean wasProcessed(String className); | Return {@code true} if the specified class name was processed by the annotation
processor.
@param className the source class
@return if the class was processed | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadata.java | 39 | [
"className"
] | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false | |
kurt | def kurt(
self,
axis: Axis | None = 0,
skipna: bool = True,
numeric_only: bool = False,
**kwargs,
) -> Series | Any:
"""
Return unbiased kurtosis over requested axis.
Kurtosis obtained using Fisher's definition of
kurtosis (kurtosis of normal ... | Return unbiased kurtosis over requested axis.
Kurtosis obtained using Fisher's definition of
kurtosis (kurtosis of normal == 0.0). Normalized by N-1.
Parameters
----------
axis : {index (0), columns (1)}
Axis for the function to be applied on.
For `Series` this parameter is unused and defaults to 0.
For ... | python | pandas/core/frame.py | 13,910 | [
"self",
"axis",
"skipna",
"numeric_only"
] | Series | Any | true | 2 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
resetInitializingPositions | public synchronized void resetInitializingPositions(Predicate<TopicPartition> initPartitionsToInclude) {
final Set<TopicPartition> partitionsWithNoOffsets = new HashSet<>();
assignment.forEach((tp, partitionState) -> {
if (partitionState.shouldInitialize() && initPartitionsToInclude.test(tp)... | 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 | 859 | [
"initPartitionsToInclude"
] | void | true | 5 | 6.24 | apache/kafka | 31,560 | javadoc | false |
batchIterator | @Override
public AbstractIterator<MutableRecordBatch> batchIterator() {
return new RecordBatchIterator<>(new ByteBufferLogInputStream(buffer.duplicate(), Integer.MAX_VALUE));
} | The total number of bytes in this message set not including any partial, trailing messages. This
may be smaller than what is returned by {@link #sizeInBytes()}.
@return The number of valid bytes | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java | 109 | [] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
postProcessProperties | default @Nullable PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName)
throws BeansException {
return pvs;
} | Post-process the given property values before the factory applies them
to the given bean.
<p>The default implementation returns the given {@code pvs} as-is.
@param pvs the property values that the factory is about to apply (never {@code null})
@param bean the bean instance created, but whose properties have not yet bee... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/InstantiationAwareBeanPostProcessor.java | 105 | [
"pvs",
"bean",
"beanName"
] | PropertyValues | true | 1 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false |
findSchemaRoot | async function findSchemaRoot(filePath: string, filesResolver: FilesResolver): Promise<string | undefined> {
let dir = path.dirname(filePath)
while (dir !== filePath) {
const parentDir = path.dirname(dir)
const contents = await filesResolver.listDirContents(parentDir)
const prismaFiles = contents.filter... | Given a single file path, returns
all files composing the same schema
@param filePath
@param filesResolver
@returns | typescript | packages/schema-files-loader/src/loadRelatedSchemaFiles.ts | 32 | [
"filePath",
"filesResolver"
] | true | 3 | 7.6 | prisma/prisma | 44,834 | jsdoc | true | |
getProperty | @Override
public @Nullable Object getProperty(String name) {
if (StringUtils.hasLength(name)) {
for (Mapping mapping : MAPPINGS) {
String prefix = mapping.getPrefix();
if (name.startsWith(prefix)) {
String postfix = name.substring(prefix.length());
AnsiElement element = mapping.getElement(postfi... | Create a new {@link AnsiPropertySource} instance.
@param name the name of the property source
@param encode if the output should be encoded | java | core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java | 77 | [
"name"
] | Object | true | 5 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
increment | static <K> void increment(final Map<K, MutableInt> occurrences, final K boxed) {
occurrences.computeIfAbsent(boxed, k -> new MutableInt()).increment();
} | Gets a hash code for an array handling multidimensional arrays correctly.
<p>
Multi-dimensional primitive arrays are also handled correctly by this method.
</p>
@param array the array to get a hash code for, {@code null} returns zero.
@return a hash code for the array. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1,879 | [
"occurrences",
"boxed"
] | void | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
process | private void process(final ResetOffsetEvent event) {
try {
Collection<TopicPartition> parts = event.topicPartitions().isEmpty() ?
subscriptions.assignedPartitions() : event.topicPartitions();
subscriptions.requestOffsetReset(parts, event.offsetResetStrategy());
... | Process event indicating that the consumer unsubscribed from all topics. This will make
the consumer release its assignment and send a request to leave the group.
@param event Unsubscribe event containing a future that will complete when the callback
execution for releasing the assignment completes, and th... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 429 | [
"event"
] | void | true | 3 | 6.72 | apache/kafka | 31,560 | javadoc | false |
convert | private static Iterable<?> convert(Object value) {
if (value == null) {
return null;
}
if (value instanceof Map) {
return ((Map<?, ?>) value).values();
} else if ((value instanceof Iterable) && (value instanceof Path == false)) {
return (Iterable<?>) v... | Returns a version used for serialising a response.
@return a compatible version | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 1,316 | [
"value"
] | true | 6 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false | |
clone | def clone(self, args=None, kwargs=None, **opts):
"""Create a copy of this signature.
Arguments:
args (Tuple): Partial args to be prepended to the existing args.
kwargs (Dict): Partial kwargs to be merged with existing kwargs.
options (Dict): Partial options to be mer... | Create a copy of this signature.
Arguments:
args (Tuple): Partial args to be prepended to the existing args.
kwargs (Dict): Partial kwargs to be merged with existing kwargs.
options (Dict): Partial options to be merged with
existing options. | python | celery/canvas.py | 444 | [
"self",
"args",
"kwargs"
] | false | 7 | 6.24 | celery/celery | 27,741 | google | false | |
createHybridDigest | public static HybridDigest createHybridDigest(TDigestArrays arrays, double compression) {
return HybridDigest.create(arrays, compression);
} | Creates a {@link HybridDigest}. HybridDigest uses a SortingDigest for small sample populations, then switches to a MergingDigest,
thus combining the best of both implementations: fastest overall, small footprint and perfect accuracy for small populations,
constant memory footprint and acceptable accuracy for larger o... | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/TDigest.java | 91 | [
"arrays",
"compression"
] | HybridDigest | true | 1 | 6.48 | elastic/elasticsearch | 75,680 | javadoc | false |
searchForOffsetFromPosition | public LogOffsetPosition searchForOffsetFromPosition(long targetOffset, int startingPosition) {
FileChannelRecordBatch prevBatch = null;
// The following logic is intentionally designed to minimize memory usage by avoiding
// unnecessary calls to lastOffset() for every batch.
// Instead,... | Search forward for the file position of the message batch whose last offset that is greater
than or equal to the target offset. If no such batch is found, return null.
@param targetOffset The offset to search for.
@param startingPosition The starting position in the file to begin searching from.
@return the batch's bas... | java | clients/src/main/java/org/apache/kafka/common/record/FileRecords.java | 313 | [
"targetOffset",
"startingPosition"
] | LogOffsetPosition | true | 7 | 8.24 | apache/kafka | 31,560 | javadoc | false |
_try_cast | def _try_cast(
arr: list | np.ndarray,
dtype: np.dtype,
copy: bool,
) -> ArrayLike:
"""
Convert input to numpy ndarray and optionally cast to a given dtype.
Parameters
----------
arr : ndarray or list
Excludes: ExtensionArray, Series, Index.
dtype : np.dtype
copy : bool
... | Convert input to numpy ndarray and optionally cast to a given dtype.
Parameters
----------
arr : ndarray or list
Excludes: ExtensionArray, Series, Index.
dtype : np.dtype
copy : bool
If False, don't copy the data if not needed.
Returns
-------
np.ndarray or ExtensionArray | python | pandas/core/construction.py | 791 | [
"arr",
"dtype",
"copy"
] | ArrayLike | true | 14 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
ISO8859_1_UNESCAPE | public static String[][] ISO8859_1_UNESCAPE() {
return ISO8859_1_UNESCAPE.clone();
} | Reverse of {@link #ISO8859_1_ESCAPE()} for unescaping purposes.
@return the mapping table. | java | src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java | 445 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
introspectInterfaces | private void introspectInterfaces(Class<?> beanClass, Class<?> currClass, Set<String> readMethodNames)
throws IntrospectionException {
for (Class<?> ifc : currClass.getInterfaces()) {
if (!ClassUtils.isJavaLanguageInterface(ifc)) {
for (PropertyDescriptor pd : getBeanInfo(ifc).getPropertyDescriptors()) {
... | Create a new CachedIntrospectionResults instance for the given class.
@param beanClass the bean class to analyze
@throws BeansException in case of introspection failure | java | spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java | 303 | [
"beanClass",
"currClass",
"readMethodNames"
] | void | true | 8 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
all_locale_paths | def all_locale_paths():
"""
Return a list of paths to user-provides languages files.
"""
globalpath = os.path.join(
os.path.dirname(sys.modules[settings.__module__].__file__), "locale"
)
app_paths = []
for app_config in apps.get_app_configs():
locale_path = os.path.join(app_c... | Return a list of paths to user-provides languages files. | python | django/utils/translation/trans_real.py | 450 | [] | false | 3 | 6.24 | django/django | 86,204 | unknown | false | |
is_mask | def is_mask(m):
"""
Return True if m is a valid, standard mask.
This function does not check the contents of the input, only that the
type is MaskType. In particular, this function returns False if the
mask has a flexible dtype.
Parameters
----------
m : array_like
Array to tes... | Return True if m is a valid, standard mask.
This function does not check the contents of the input, only that the
type is MaskType. In particular, this function returns False if the
mask has a flexible dtype.
Parameters
----------
m : array_like
Array to test.
Returns
-------
result : bool
True if `m.dtype.t... | python | numpy/ma/core.py | 1,517 | [
"m"
] | false | 1 | 6.4 | numpy/numpy | 31,054 | numpy | false | |
limit | @J2ktIncompatible
public static InputStream limit(InputStream in, long limit) {
return new LimitedInputStream(in, limit);
} | Wraps a {@link InputStream}, limiting the number of bytes which can be read.
@param in the input stream to be wrapped
@param limit the maximum number of bytes to be read
@return a length-limited {@link InputStream}
@since 14.0 (since 1.0 as com.google.common.io.LimitInputStream) | java | android/guava/src/com/google/common/io/ByteStreams.java | 709 | [
"in",
"limit"
] | InputStream | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false |
getAnnotationElementStringValue | String getAnnotationElementStringValue(AnnotationMirror annotation, String name) {
return annotation.getElementValues()
.entrySet()
.stream()
.filter((element) -> element.getKey().getSimpleName().toString().equals(name))
.map((element) -> asString(getAnnotationValue(element.getValue())))
.findFirst()
... | Collect the annotations that are annotated or meta-annotated with the specified
{@link TypeElement annotation}.
@param element the element to inspect
@param annotationType the annotation to discover
@return the annotations that are annotated or meta-annotated with this annotation | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 319 | [
"annotation",
"name"
] | String | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
rethrow | private void rethrow(Throwable ex) throws IOException, ServletException {
if (ex instanceof RuntimeException runtimeException) {
throw runtimeException;
}
if (ex instanceof Error error) {
throw error;
}
if (ex instanceof IOException ioException) {
throw ioException;
}
if (ex instanceof ServletExc... | Return the description for the given request. By default this method will return a
description based on the request {@code servletPath} and {@code pathInfo}.
@param request the source request
@return the description | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java | 262 | [
"ex"
] | void | true | 5 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
pendingRequestCount | public int pendingRequestCount() {
lock.lock();
try {
return unsent.requestCount() + client.inFlightRequestCount();
} finally {
lock.unlock();
}
} | Get the total count of pending requests from all nodes. This includes both requests that
have been transmitted (i.e. in-flight requests) and those which are awaiting transmission.
@return The total count of pending requests | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java | 397 | [] | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
createDataSource | protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() {
@Override
public InputStream getInputStream() throws IOException {
return inputStreamSource.getInputStream();
}
@Override
public OutputStream... | Create an Activation Framework DataSource for the given InputStreamSource.
@param inputStreamSource the InputStreamSource (typically a Spring Resource)
@param contentType the content type
@param name the name of the DataSource
@return the Activation Framework DataSource | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 1,207 | [
"inputStreamSource",
"contentType",
"name"
] | DataSource | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
forPayload | static <T> ApplicationListener<PayloadApplicationEvent<T>> forPayload(Consumer<T> consumer) {
return event -> consumer.accept(event.getPayload());
} | Create a new {@code ApplicationListener} for the given payload consumer.
@param consumer the event payload consumer
@param <T> the type of the event payload
@return a corresponding {@code ApplicationListener} instance
@since 5.3
@see PayloadApplicationEvent | java | spring-context/src/main/java/org/springframework/context/ApplicationListener.java | 72 | [
"consumer"
] | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_escape_latex_math | def _escape_latex_math(s: str) -> str:
r"""
All characters in LaTeX math mode are preserved.
The substrings in LaTeX math mode, which either are surrounded
by two characters ``$`` or start with the character ``\(`` and end with ``\)``,
are preserved without escaping. Otherwise regular LaTeX escapin... | r"""
All characters in LaTeX math mode are preserved.
The substrings in LaTeX math mode, which either are surrounded
by two characters ``$`` or start with the character ``\(`` and end with ``\)``,
are preserved without escaping. Otherwise regular LaTeX escaping applies.
Parameters
----------
s : str
Input to be e... | python | pandas/io/formats/style_render.py | 2,648 | [
"s"
] | str | true | 7 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
svd_flip | def svd_flip(u, v, u_based_decision=True):
"""Sign correction to ensure deterministic output from SVD.
Adjusts the columns of u and the rows of v such that the loadings in the
columns in u that are largest in absolute value are always positive.
If u_based_decision is False, then the same sign correcti... | Sign correction to ensure deterministic output from SVD.
Adjusts the columns of u and the rows of v such that the loadings in the
columns in u that are largest in absolute value are always positive.
If u_based_decision is False, then the same sign correction is applied to
so that the rows in v that are largest in abs... | python | sklearn/utils/extmath.py | 920 | [
"u",
"v",
"u_based_decision"
] | false | 5 | 6.16 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
isRequestStateInProgress | private boolean isRequestStateInProgress(AcknowledgeRequestState acknowledgeRequestState) {
if (acknowledgeRequestState == null) {
return false;
} else if (acknowledgeRequestState.isCloseRequest()) {
return !acknowledgeRequestState.isProcessed;
} else {
return... | Prunes the empty acknowledgementRequestStates in {@link #acknowledgeRequestStates}
@return Returns true if there are still any acknowledgements left to be processed. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 511 | [
"acknowledgeRequestState"
] | true | 3 | 6.08 | apache/kafka | 31,560 | javadoc | false | |
finite | public static void finite(final double value, final String message, final Object... values) {
if (Double.isNaN(value) || Double.isInfinite(value)) {
throw new IllegalArgumentException(getMessage(message, values));
}
} | Validates that the specified argument is not infinite or Not-a-Number (NaN);
otherwise throwing an exception with the specified message.
<pre>Validate.finite(myDouble, "The argument must contain a numeric value");</pre>
@param value the value to validate.
@param message the {@link String#format(String, Object...)} exc... | java | src/main/java/org/apache/commons/lang3/Validate.java | 237 | [
"value",
"message"
] | void | true | 3 | 6.24 | apache/commons-lang | 2,896 | javadoc | false |
or | default FailableBiPredicate<T, U, E> or(final FailableBiPredicate<? super T, ? super U, E> other) {
Objects.requireNonNull(other);
return (final T t, final U u) -> test(t, u) || other.test(t, u);
} | Returns a composed {@link FailableBiPredicate} like {@link BiPredicate#and(BiPredicate)}.
@param other a predicate that will be logically-ORed with this predicate.
@return a composed {@link FailableBiPredicate} like {@link BiPredicate#and(BiPredicate)}.
@throws NullPointerException if other is null | java | src/main/java/org/apache/commons/lang3/function/FailableBiPredicate.java | 96 | [
"other"
] | true | 2 | 7.36 | apache/commons-lang | 2,896 | javadoc | false | |
tryAcquire | @SuppressWarnings("GoodTime") // should accept a java.time.Duration
public boolean tryAcquire(long timeout, TimeUnit unit) {
return tryAcquire(1, timeout, unit);
} | Acquires a permit from this {@code RateLimiter} if it can be obtained without exceeding the
specified {@code timeout}, or returns {@code false} immediately (without waiting) if the permit
would not have been granted before the timeout expired.
<p>This method is equivalent to {@code tryAcquire(1, timeout, unit)}.
@param... | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 352 | [
"timeout",
"unit"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
runPeriodic | private void runPeriodic() {
if (isCancelled() || isCompleted() || threadPool.scheduler().isShutdown()) {
logger.debug("Not running periodic downloader because task is cancelled, completed, or shutting down");
return;
}
logger.trace("Running periodic downloader");
... | Runs the downloader now and schedules the next periodic run using the poll interval. | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/AbstractGeoIpDownloader.java | 89 | [] | void | true | 4 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
assertNoUnboundChildren | private void assertNoUnboundChildren(Set<String> unboundIndexedChildren, IterableConfigurationPropertySource source,
ConfigurationPropertyName root) {
if (unboundIndexedChildren.isEmpty()) {
return;
}
Set<ConfigurationProperty> unboundProperties = new TreeSet<>();
for (ConfigurationPropertyName name : sou... | Bind indexed elements to the supplied collection.
@param name the name of the property to bind
@param target the target bindable
@param elementBinder the binder to use for elements
@param aggregateType the aggregate type, may be a collection or an array
@param elementType the element type
@param result the destination ... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java | 141 | [
"unboundIndexedChildren",
"source",
"root"
] | void | true | 5 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
tryAcquire | @IgnoreJRERequirement // Users will use this only if they're already using Duration.
public boolean tryAcquire(Duration timeout) {
return tryAcquire(1, toNanosSaturated(timeout), TimeUnit.NANOSECONDS);
} | Acquires a permit from this {@code RateLimiter} if it can be obtained without exceeding the
specified {@code timeout}, or returns {@code false} immediately (without waiting) if the permit
would not have been granted before the timeout expired.
<p>This method is equivalent to {@code tryAcquire(1, timeout)}.
@param timeo... | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 335 | [
"timeout"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
add | void add(ItemMetadata metadata, Consumer<ItemMetadata> onConflict) {
ItemMetadata existing = find(metadata.getName());
if (existing != null) {
onConflict.accept(existing);
return;
}
add(metadata);
} | Creates a new {@code MetadataProcessor} instance.
@param mergeRequired specify whether an item can be merged
@param previousMetadata any previous metadata or {@code null} | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java | 62 | [
"metadata",
"onConflict"
] | void | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
immutableCopy | public ImmutableSet<@NonNull E> immutableCopy() {
// Not using ImmutableSet.copyOf() to avoid iterating thrice (isEmpty, size, iterator).
int maxSize = maxSize();
if (maxSize == 0) {
return ImmutableSet.of();
}
ImmutableSet.Builder<@NonNull E> builder = ImmutableSet.builderWithExpe... | Returns an immutable copy of the current contents of this set view. Does not support null
elements.
<p><b>Warning:</b> this may have unexpected results if a backing set of this view uses a
nonstandard notion of equivalence, for example if it is a {@link TreeSet} using a comparator
that is inconsistent with {@link Objec... | java | android/guava/src/com/google/common/collect/Sets.java | 602 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
markBeanAsCreated | protected void markBeanAsCreated(String beanName) {
if (!this.alreadyCreated.contains(beanName)) {
synchronized (this.mergedBeanDefinitions) {
if (!isBeanEligibleForMetadataCaching(beanName)) {
// Let the bean definition get re-merged now that we're actually creating
// the bean... just in case some ... | Mark the specified bean as already created (or about to be created).
<p>This allows the bean factory to optimize its caching for repeated
creation of the specified bean.
@param beanName the name of the bean | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,772 | [
"beanName"
] | void | true | 3 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
getEnvironment | @Override
public ConfigurableEnvironment getEnvironment() {
if (this.environment == null) {
this.environment = createEnvironment();
}
return this.environment;
} | Return the {@code Environment} for this application context in configurable
form, allowing for further customization.
<p>If none specified, a default environment will be initialized via
{@link #createEnvironment()}. | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 335 | [] | ConfigurableEnvironment | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
getdata | def getdata(a, subok=True):
"""
Return the data of a masked array as an ndarray.
Return the data of `a` (if any) as an ndarray if `a` is a ``MaskedArray``,
else return `a` as a ndarray or subclass (depending on `subok`) if not.
Parameters
----------
a : array_like
Input ``MaskedArr... | Return the data of a masked array as an ndarray.
Return the data of `a` (if any) as an ndarray if `a` is a ``MaskedArray``,
else return `a` as a ndarray or subclass (depending on `subok`) if not.
Parameters
----------
a : array_like
Input ``MaskedArray``, alternatively a ndarray or a subclass thereof.
subok : boo... | python | numpy/ma/core.py | 708 | [
"a",
"subok"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
toIntegerObject | public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) {
if (bool == null) {
return nullValue;
}
return bool.booleanValue() ? trueValue : falseValue;
} | Converts a Boolean to an Integer specifying the conversion values.
<pre>
BooleanUtils.toIntegerObject(Boolean.TRUE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(1)
BooleanUtils.toIntegerObject(Boolean.FALSE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valu... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 998 | [
"bool",
"trueValue",
"falseValue",
"nullValue"
] | Integer | true | 3 | 7.28 | apache/commons-lang | 2,896 | javadoc | false |
nullToEmpty | public static Byte[] nullToEmpty(final Byte[] array) {
return nullTo(array, EMPTY_BYTE_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,337 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
toString | @Override
public String toString() {
return "LoggerConfiguration [name=" + this.name + ", levelConfiguration=" + this.levelConfiguration
+ ", inheritedLevelConfiguration=" + this.inheritedLevelConfiguration + "]";
} | Return the level configuration for the given scope.
@param scope the configuration scope
@return the level configuration or {@code null} for
{@link ConfigurationScope#DIRECT direct scope} results without applied
configuration
@since 2.7.13 | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java | 140 | [] | String | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
markSequenceUnresolved | synchronized void markSequenceUnresolved(ProducerBatch batch) {
int nextSequence = batch.lastSequence() + 1;
partitionsWithUnresolvedSequences.compute(batch.topicPartition,
(k, v) -> v == null ? nextSequence : Math.max(v, nextSequence));
log.debug("Marking partition {} unresolved wit... | Returns the first inflight sequence for a given partition. This is the base sequence of an inflight batch with
the lowest sequence number.
@return the lowest inflight sequence if the transaction manager is tracking inflight requests for this partition.
If there are no inflight requests being tracked for this pa... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 842 | [
"batch"
] | void | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false |
wrap | public static <T> Typed<T> wrap(final Class<T> type) {
return wrap((Type) type);
} | Wraps the specified {@link Class} in a {@link Typed} wrapper.
@param <T> generic type.
@param type to wrap.
@return {@code Typed<T>}.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,731 | [
"type"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
urlDecode | public static String urlDecode(String value) {
return URLDecodeProcessor.apply(value);
} | Uses {@link URLDecodeProcessor} to URL-decode a string.
@param value string to decode
@return URL-decoded value | java | modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/Processors.java | 112 | [
"value"
] | String | true | 1 | 6.16 | elastic/elasticsearch | 75,680 | javadoc | false |
wrap | @SuppressWarnings("rawtypes")
public static Object wrap(Object o) {
if (o == null) {
return NULL;
}
if (o instanceof JSONArray || o instanceof JSONObject) {
return o;
}
if (o.equals(NULL)) {
return o;
}
try {
if (o instanceof Collection) {
return new JSONArray((Collection) o);
}
els... | Wraps the given object if necessary.
<p>
If the object is null or, returns {@link #NULL}. If the object is a
{@code JSONArray} or {@code JSONObject}, no wrapping is necessary. If the object is
{@code NULL}, no wrapping is necessary. If the object is an array or
{@code Collection}, returns an equivalent {@code JSONArray... | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 800 | [
"o"
] | Object | true | 19 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
getReferencesForSuperKeyword | function getReferencesForSuperKeyword(superKeyword: Node): SymbolAndEntries[] | undefined {
let searchSpaceNode: SuperContainer | ClassLikeDeclaration | TypeLiteralNode | InterfaceDeclaration | ObjectLiteralExpression | undefined = getSuperContainer(superKeyword, /*stopOnFunctions*/ false);
if (!searc... | Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol
is an interface, determines if some ancestor of the child symbol extends or inherits from it.
Also takes in a cache of previous results which makes this slightly more efficient and is
necessary to avoid potential loops lik... | typescript | src/services/findAllReferences.ts | 2,362 | [
"superKeyword"
] | true | 6 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
dtypes | def dtypes(self, *, device=None, kind=None):
"""
The array API data types supported by CuPy.
Note that this function only returns data types that are defined by
the array API.
Parameters
----------
device : str, optional
The device to get the data ty... | The array API data types supported by CuPy.
Note that this function only returns data types that are defined by
the array API.
Parameters
----------
device : str, optional
The device to get the data types for.
kind : str or tuple of str, optional
The kind of data types to return. If ``None``, all data types a... | python | sklearn/externals/array_api_compat/cupy/_info.py | 189 | [
"self",
"device",
"kind"
] | false | 11 | 6.96 | scikit-learn/scikit-learn | 64,340 | numpy | 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
List containing the valu... | 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
List containing the values as Python or pandas scalers.
See Also
--------
numpy.ndarray.tolist : Return the array as an a.ndi... | python | pandas/core/base.py | 843 | [
"self"
] | list | true | 1 | 6.08 | pandas-dev/pandas | 47,362 | unknown | false |
objectText | @Override
public Object objectText() throws IOException {
JsonToken currentToken = parser.getCurrentToken();
if (currentToken == JsonToken.VALUE_STRING) {
return text();
} else if (currentToken == JsonToken.VALUE_NUMBER_INT || currentToken == JsonToken.VALUE_NUMBER_FLOAT) {
... | 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 | 177 | [] | Object | true | 7 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
initializeHeapSnapshotSignalHandlers | function initializeHeapSnapshotSignalHandlers() {
const signal = getOptionValue('--heapsnapshot-signal');
const diagnosticDir = getOptionValue('--diagnostic-dir');
if (!signal)
return;
require('internal/validators').validateSignalName(signal);
const { writeHeapSnapshot } = require('v8');
function doW... | Patch the process object with legacy properties and normalizations.
Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.
Replace `process.argv[1]` with the resolved absolute file path of the entry point, if found.
@param {boolean} expandArgv1 - Whether to replac... | javascript | lib/internal/process/pre_execution.js | 459 | [] | false | 3 | 6.96 | nodejs/node | 114,839 | jsdoc | false | |
check_training_status_with_log | def check_training_status_with_log(
self,
job_name: str,
non_terminal_states: set,
failed_states: set,
wait_for_completion: bool,
check_interval: int,
max_ingestion_time: int | None = None,
):
"""
Display logs for a given training job.
... | Display logs for a given training job.
Optionally tailing them until the job is complete.
:param job_name: name of the training job to check status and display logs for
:param non_terminal_states: the set of non_terminal states
:param failed_states: the set of failed states
:param wait_for_completion: Whether to keep... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 767 | [
"self",
"job_name",
"non_terminal_states",
"failed_states",
"wait_for_completion",
"check_interval",
"max_ingestion_time"
] | true | 9 | 6.8 | apache/airflow | 43,597 | sphinx | false | |
getMessage | private static String getMessage(@Nullable ValidationErrors errors) {
StringBuilder message = new StringBuilder("Binding validation errors");
if (errors != null) {
message.append(" on ").append(errors.getName());
errors.getAllErrors().forEach((error) -> message.append(String.format("%n - %s", error)));
}
... | Return the validation errors that caused the exception.
@return the validationErrors the validation errors | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/BindValidationException.java | 50 | [
"errors"
] | String | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
formatDateTime | function formatDateTime(str: string, opt_values: string[]) {
if (opt_values) {
str = str.replace(/\{([^}]+)}/g, function (match, key) {
return opt_values != null && key in opt_values ? opt_values[key] : match;
});
}
return str;
} | Create a new Date object with the given date value, and the time set to midnight.
We cannot use `new Date(year, month, date)` because it maps years between 0 and 99 to 1900-1999.
See: https://github.com/angular/angular/issues/40377
Note that this function returns a Date object whose time is midnight in the current loca... | typescript | packages/common/src/i18n/format_date.ts | 263 | [
"str",
"opt_values"
] | false | 4 | 6.24 | angular/angular | 99,544 | jsdoc | false | |
inner | def inner(*args: _P.args, **kwargs: _P.kwargs) -> _R:
"""Call the original function and cache the result in both caches.
Args:
*args: Positional arguments to pass to the function.
**kwargs: Keyword arguments to pass to the function.
... | Call the original function and cache the result in both caches.
Args:
*args: Positional arguments to pass to the function.
**kwargs: Keyword arguments to pass to the function.
Returns:
The result of calling the original function. | python | torch/_inductor/runtime/caching/interfaces.py | 680 | [] | _R | true | 1 | 6.88 | pytorch/pytorch | 96,034 | google | false |
resolveAndLoad | Map<ConfigDataResolutionResult, ConfigData> resolveAndLoad(@Nullable ConfigDataActivationContext activationContext,
ConfigDataLocationResolverContext locationResolverContext, ConfigDataLoaderContext loaderContext,
List<ConfigDataLocation> locations) {
try {
Profiles profiles = (activationContext != null) ? a... | Resolve and load the given list of locations, filtering any that have been
previously loaded.
@param activationContext the activation context
@param locationResolverContext the location resolver context
@param loaderContext the loader context
@param locations the locations to resolve
@return a map of the loaded locatio... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataImporter.java | 82 | [
"activationContext",
"locationResolverContext",
"loaderContext",
"locations"
] | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
add_forward_offload_stream_ops | def add_forward_offload_stream_ops(graph: fx.Graph) -> None:
"""
Add stream operations for forward pass CPU offloading.
Pattern: record_event → fork → wait_event → record_stream → device_put → record_event_2 → join → wait_event_2
This ensures that:
1. Offloading waits for the last use to complete ... | Add stream operations for forward pass CPU offloading.
Pattern: record_event → fork → wait_event → record_stream → device_put → record_event_2 → join → wait_event_2
This ensures that:
1. Offloading waits for the last use to complete (record_event on default stream)
2. Offloading happens on a separate stream (fork → w... | python | torch/_functorch/_activation_offloading/activation_offloading.py | 344 | [
"graph"
] | None | true | 4 | 6.96 | pytorch/pytorch | 96,034 | google | false |
_log_state | def _log_state(*, task_instance: TaskInstance, lead_msg: str = "") -> None:
"""
Log task state.
:param task_instance: the task instance
:param lead_msg: lead message
:meta private:
"""
params: list[str | int] = [
lead_msg,
str(task_instance.state).upper(),
task_inst... | Log task state.
:param task_instance: the task instance
:param lead_msg: lead message
:meta private: | python | airflow-core/src/airflow/models/taskinstance.py | 316 | [
"task_instance",
"lead_msg"
] | None | true | 2 | 6.72 | apache/airflow | 43,597 | sphinx | false |
_cast_types | def _cast_types(self, values: ArrayLike, cast_type: DtypeObj, column) -> ArrayLike:
"""
Cast values to specified type
Parameters
----------
values : ndarray or ExtensionArray
cast_type : np.dtype or ExtensionDtype
dtype to cast values to
column : strin... | Cast values to specified type
Parameters
----------
values : ndarray or ExtensionArray
cast_type : np.dtype or ExtensionDtype
dtype to cast values to
column : string
column name - used only for error reporting
Returns
-------
converted : ndarray or ExtensionArray | python | pandas/io/parsers/python_parser.py | 485 | [
"self",
"values",
"cast_type",
"column"
] | ArrayLike | true | 10 | 6.16 | pandas-dev/pandas | 47,362 | numpy | false |
openChannel | private static FileChannel openChannel(File file,
boolean mutable,
boolean fileAlreadyExists,
int initFileSize,
boolean preallocate) throws IOExcept... | Open a channel for the given file
For windows NTFS and some old LINUX file system, set preallocate to true and initFileSize
with one value (for example 512 * 1025 *1024 ) can improve the kafka produce performance.
@param file File path
@param mutable mutable
@param fileAlreadyExists File already exists or not
@param in... | java | clients/src/main/java/org/apache/kafka/common/record/FileRecords.java | 479 | [
"file",
"mutable",
"fileAlreadyExists",
"initFileSize",
"preallocate"
] | FileChannel | true | 4 | 6.4 | apache/kafka | 31,560 | javadoc | false |
maybeBeginServerReauthentication | public boolean maybeBeginServerReauthentication(NetworkReceive saslHandshakeNetworkReceive,
Supplier<Long> nowNanosSupplier) throws AuthenticationException, IOException {
if (!ready())
throw new IllegalStateException(
"KafkaChannel should be \"ready\" when processing ... | If this is a server-side connection that has an expiration time and at least
1 second has passed since the prior re-authentication (if any) started then
begin the process of re-authenticating the connection and return true,
otherwise return false
@param saslHandshakeNetworkReceive
the mandatory {@link Netwo... | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 540 | [
"saslHandshakeNetworkReceive",
"nowNanosSupplier"
] | true | 5 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
_autotune_local_nodes | def _autotune_local_nodes(
scheduler: torch._inductor.scheduler.Scheduler,
) -> list[_SerializedChoice]:
"""
Go through the nodes in the scheduler and autotune the kernels which
should be autotuned by this rank.
"""
autotune_results: list[_SerializedChoice] = []
for node in scheduler.nodes... | Go through the nodes in the scheduler and autotune the kernels which
should be autotuned by this rank. | python | torch/_inductor/distributed_autotune.py | 310 | [
"scheduler"
] | list[_SerializedChoice] | true | 9 | 6 | pytorch/pytorch | 96,034 | unknown | false |
newLinkedHashMapWithExpectedSize | @SuppressWarnings("NonApiType") // acts as a direct substitute for a constructor call
public static <K extends @Nullable Object, V extends @Nullable Object>
LinkedHashMap<K, V> newLinkedHashMapWithExpectedSize(int expectedSize) {
return new LinkedHashMap<>(capacity(expectedSize));
} | Creates a {@code LinkedHashMap} instance, with a high enough "initial capacity" that it
<i>should</i> hold {@code expectedSize} elements without growth. This behavior cannot be
broadly guaranteed, but it is observed to be true for OpenJDK 1.7. It also can't be guaranteed
that the method isn't inadvertently <i>oversizin... | java | android/guava/src/com/google/common/collect/Maps.java | 331 | [
"expectedSize"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
quantile | def quantile(
self,
q: float,
interpolation: QuantileInterpolation = "linear",
numeric_only: bool = False,
):
"""
Calculate the expanding quantile.
Parameters
----------
q : float
Quantile to compute. 0 <= quantile <= 1.
i... | Calculate the expanding quantile.
Parameters
----------
q : float
Quantile to compute. 0 <= quantile <= 1.
interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
This optional parameter specifies the interpolation method to use,
when the desired quantile lies between two data points `i` and ... | python | pandas/core/window/expanding.py | 1,067 | [
"self",
"q",
"interpolation",
"numeric_only"
] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false | |
toHexCharArray | static char[] toHexCharArray(byte[] bytes) {
Objects.requireNonNull(bytes);
final char[] result = new char[2 * bytes.length];
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
result[2 * i] = HEX_DIGITS[b >> 4 & 0xf];
result[2 * i + 1] = HEX_DIGITS[b... | Encodes the byte array into a newly created hex char array, without allocating any other temporary variables.
@param bytes the input to be encoded as hex.
@return the hex encoding of the input as a char array. | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslUtil.java | 56 | [
"bytes"
] | true | 2 | 8.24 | 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.