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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ofIfValid | public static @Nullable ConfigurationPropertyName ofIfValid(@Nullable CharSequence name) {
return of(name, true);
} | Return a {@link ConfigurationPropertyName} for the specified string or {@code null}
if the name is not valid.
@param name the source name
@return a {@link ConfigurationPropertyName} instance
@since 2.3.1 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 650 | [
"name"
] | ConfigurationPropertyName | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
nextBytes | @Deprecated
public static byte[] nextBytes(final int count) {
return secure().randomBytes(count);
} | Generates an array of random bytes.
@param count the size of the returned array.
@return the random byte array.
@throws IllegalArgumentException if {@code count} is negative.
@deprecated Use {@link #secure()}, {@link #secureStrong()}, or {@link #insecure()}. | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 126 | [
"count"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
has_wrong_whitespace | def has_wrong_whitespace(first_line: str, second_line: str) -> bool:
"""
Checking if the two lines are mattching the unwanted pattern.
Parameters
----------
first_line : str
First line to check.
second_line : str
Second line to check.
Ret... | Checking if the two lines are mattching the unwanted pattern.
Parameters
----------
first_line : str
First line to check.
second_line : str
Second line to check.
Returns
-------
bool
True if the two received string match, an unwanted pattern.
Notes
-----
The unwanted pattern that we are trying to catch i... | python | scripts/validate_unwanted_patterns.py | 207 | [
"first_line",
"second_line"
] | bool | true | 8 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
maybeBindThisJoinPointStaticPart | private void maybeBindThisJoinPointStaticPart() {
if (this.argumentTypes[0] == JoinPoint.StaticPart.class) {
bindParameterName(0, THIS_JOIN_POINT_STATIC_PART);
}
} | If the first parameter is of type JoinPoint or ProceedingJoinPoint, bind "thisJoinPoint" as
parameter name and return true, else return false. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 319 | [] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
on | @GwtIncompatible // java.util.regex
public static Splitter on(Pattern separatorPattern) {
return onPatternInternal(new JdkPattern(separatorPattern));
} | Returns a splitter that considers any subsequence matching {@code pattern} to be a separator.
For example, {@code Splitter.on(Pattern.compile("\r?\n")).split(entireFile)} splits a string
into lines whether it uses DOS-style or UNIX-style line terminators.
@param separatorPattern the pattern that determines whether a su... | java | android/guava/src/com/google/common/base/Splitter.java | 207 | [
"separatorPattern"
] | Splitter | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false |
fnv64_FIXED | constexpr uint64_t fnv64_FIXED(
const char* buf, uint64_t hash = fnv64_hash_start) noexcept {
for (; *buf; ++buf) {
hash = fnv64_append_byte_FIXED(hash, static_cast<uint8_t>(*buf));
}
return hash;
} | FNV hash of a c-str.
Continues hashing until a null byte is reached.
@param hash The initial hash seed.
@see fnv32
@methodset fnv | cpp | folly/hash/FnvHash.h | 300 | [] | true | 2 | 7.04 | facebook/folly | 30,157 | doxygen | false | |
constant | public static <E extends @Nullable Object> Function<@Nullable Object, E> constant(
@ParametricNullness E value) {
return new ConstantFunction<>(value);
} | Returns a function that ignores its input and always returns {@code value}.
<p>Prefer to use the lambda expression {@code o -> value} instead. Note that it is not
serializable unless you explicitly make it {@link Serializable}, typically by writing {@code
(Function<Object, E> & Serializable) o -> value}.
@param value t... | java | android/guava/src/com/google/common/base/Functions.java | 357 | [
"value"
] | true | 1 | 6.96 | google/guava | 51,352 | javadoc | false | |
doubleQuoteMatcher | public static StrMatcher doubleQuoteMatcher() {
return DOUBLE_QUOTE_MATCHER;
} | Gets the matcher for the double quote character.
@return the matcher for a double quote. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 295 | [] | StrMatcher | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
drawWeb | function drawWeb(nodeToData: Map<HostInstance, Data>) {
if (canvas === null) {
initialize();
}
const dpr = window.devicePixelRatio || 1;
const canvasFlow: HTMLCanvasElement = ((canvas: any): HTMLCanvasElement);
canvasFlow.width = window.innerWidth * dpr;
canvasFlow.height = window.innerHeight * dpr;
... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/backend/views/TraceUpdates/canvas.js | 45 | [] | false | 7 | 6.4 | facebook/react | 241,750 | jsdoc | false | |
maybeWrapAsKafkaException | public static KafkaException maybeWrapAsKafkaException(Throwable t) {
if (t instanceof KafkaException)
return (KafkaException) t;
else
return new KafkaException(t);
} | Update subscription state and metadata using the provided committed offsets:
<li>Update partition offsets with the committed offsets</li>
<li>Update the metadata with any newer leader epoch discovered in the committed offsets
metadata</li>
</p>
This will ignore any partition included in the <code>offsetsAndMetadata</co... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerUtils.java | 249 | [
"t"
] | KafkaException | true | 2 | 6.24 | apache/kafka | 31,560 | javadoc | false |
ensureCoordinatorReady | private synchronized boolean ensureCoordinatorReady(final Timer timer, boolean disableWakeup) {
if (!coordinatorUnknown())
return true;
long attempts = 0L;
do {
if (fatalFindCoordinatorException != null) {
final RuntimeException fatalException = fatalFind... | Ensure that the coordinator is ready to receive requests. This will return
immediately without blocking. It is intended to be called in an asynchronous
context when wakeups are not expected.
@return true If coordinator discovery and initial connection succeeded, false otherwise | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 284 | [
"timer",
"disableWakeup"
] | true | 10 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
minutesFrac | public double minutesFrac() {
return ((double) nanos()) / C4;
} | @return the number of {@link #timeUnit()} units this value contains | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 194 | [] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
newConcurrentHashSet | public static <E> Set<E> newConcurrentHashSet() {
return Platform.newConcurrentHashSet();
} | Creates a thread-safe set backed by a hash map. The set is backed by a {@link
ConcurrentHashMap} instance, and thus carries the same concurrency guarantees.
<p>Unlike {@code HashSet}, this class does NOT allow {@code null} to be used as an element. The
set is serializable.
@return a new, empty thread-safe {@code Set}
@... | java | guava/src/com/google/common/collect/Sets.java | 280 | [] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
checkedCast | public static char checkedCast(long value) {
char result = (char) value;
checkArgument(result == value, "Out of range: %s", value);
return result;
} | Returns the {@code char} value that is equal to {@code value}, if possible.
@param value any value in the range of the {@code char} type
@return the {@code char} value that equals {@code value}
@throws IllegalArgumentException if {@code value} is greater than {@link Character#MAX_VALUE}
or less than {@link Characte... | java | android/guava/src/com/google/common/primitives/Chars.java | 85 | [
"value"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
andThen | default FailableIntUnaryOperator<E> andThen(final FailableIntUnaryOperator<E> after) {
Objects.requireNonNull(after);
return (final int t) -> after.applyAsInt(applyAsInt(t));
} | Returns a composed {@link FailableDoubleUnaryOperator} like {@link IntUnaryOperator#andThen(IntUnaryOperator)}.
@param after the operator to apply after this one.
@return a composed {@link FailableIntUnaryOperator} like {@link IntUnaryOperator#andThen(IntUnaryOperator)}.
@throws NullPointerException if after is null.
@... | java | src/main/java/org/apache/commons/lang3/function/FailableIntUnaryOperator.java | 64 | [
"after"
] | true | 1 | 6 | apache/commons-lang | 2,896 | javadoc | false | |
_explain_graph_detail | def _explain_graph_detail(
gm: torch.fx.GraphModule,
graphs: list[torch.fx.GraphModule],
op_count: int,
ops_per_graph: list[list["Target"]],
break_reasons: list[GraphCompileReason],
) -> tuple[
torch.fx.GraphModule,
list[torch.fx.GraphModule],
int,
list[list["Target"]],
list[Grap... | This function is a utility which processes a torch.fx.GraphModule and
accumulates information about its ops, graph breaks, and other details. It
is intended to be used by the ExplainWithBackend class and
`torch._dynamo.explain()` to provide details from Dynamo's graph capture.
Parameters:
gm (torch.fx.GraphModule)... | python | torch/_dynamo/backends/debugging.py | 472 | [
"gm",
"graphs",
"op_count",
"ops_per_graph",
"break_reasons"
] | tuple[
torch.fx.GraphModule,
list[torch.fx.GraphModule],
int,
list[list["Target"]],
list[GraphCompileReason],
] | true | 2 | 7.6 | pytorch/pytorch | 96,034 | google | false |
toString | @Override
public String toString() {
return getClass().getName() + ": " + this.mappedNamePatterns;
} | Determine if the given method name matches the mapped name pattern.
<p>The default implementation checks for {@code xxx*}, {@code *xxx},
{@code *xxx*}, and {@code xxx*yyy} matches, as well as direct equality.
<p>Can be overridden in subclasses.
@param methodName the method name to check
@param mappedNamePattern the met... | java | spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java | 124 | [] | String | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
convert | def convert(self) -> list[Block]:
"""
Attempt to coerce any object types to better types. Return a copy
of the block (if copy = True).
"""
if not self.is_object:
return [self.copy(deep=False)]
if self.ndim != 1 and self.shape[0] != 1:
blocks = sel... | Attempt to coerce any object types to better types. Return a copy
of the block (if copy = True). | python | pandas/core/internals/blocks.py | 488 | [
"self"
] | list[Block] | true | 9 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
render_template | def render_template(
template_name: str,
context: dict[str, Any],
extension: str,
autoescape: bool = True,
lstrip_blocks: bool = False,
trim_blocks: bool = False,
keep_trailing_newline: bool = False,
) -> str:
"""
Renders template based on its name. Reads the template from <name>_TEM... | Renders template based on its name. Reads the template from <name>_TEMPLATE.md.jinja2 in current dir.
:param template_name: name of the template to use
:param context: Jinja2 context
:param extension: Target file extension
:param autoescape: Whether to autoescape HTML
:param lstrip_blocks: Whether to strip leading bloc... | python | dev/breeze/src/airflow_breeze/utils/packages.py | 730 | [
"template_name",
"context",
"extension",
"autoescape",
"lstrip_blocks",
"trim_blocks",
"keep_trailing_newline"
] | str | true | 1 | 6.72 | apache/airflow | 43,597 | sphinx | false |
getValueParameter | public CacheInvocationParameter getValueParameter(@Nullable Object... values) {
int parameterPosition = this.valueParameterDetail.getParameterPosition();
if (parameterPosition >= values.length) {
throw new IllegalStateException("Values mismatch, value parameter at position " +
parameterPosition + " cannot b... | Return the {@link CacheInvocationParameter} for the parameter holding the value
to cache.
<p>The method arguments must match the signature of the related method invocation
@param values the parameters value for a particular invocation
@return the {@link CacheInvocationParameter} instance for the value parameter | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CachePutOperation.java | 85 | [] | CacheInvocationParameter | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
recordsWrite | boolean recordsWrite() {
return expiresAfterWrite() || refreshes();
} | Creates a new, empty map with the specified strategy, initial capacity and concurrency level. | java | android/guava/src/com/google/common/cache/LocalCache.java | 352 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
equals | @Override
public boolean equals(final Object obj) {
if (!(obj instanceof FastDateFormat)) {
return false;
}
final FastDateFormat other = (FastDateFormat) obj;
// no need to check parser, as it has same invariants as printer
return printer.equals(other.printer);
... | Compares two objects for equality.
@param obj the object to compare to.
@return {@code true} if equal. | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 390 | [
"obj"
] | true | 2 | 8.4 | apache/commons-lang | 2,896 | javadoc | false | |
lastIndexOf | public static int lastIndexOf(final boolean[] array, final boolean valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
} | Finds the last index of the given value within the array.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) if {@code null} array input.
</p>
@param array the array to traverse backwards looking for the object, may be {@code null}.
@param valueToFind the object to find.
@return the last index of the v... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 3,772 | [
"array",
"valueToFind"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
unstack | def unstack(x, /, *, axis=0):
"""
Split an array into a sequence of arrays along the given axis.
The ``axis`` parameter specifies the dimension along which the array will
be split. For example, if ``axis=0`` (the default) it will be the first
dimension and if ``axis=-1`` it will be the last dimensi... | Split an array into a sequence of arrays along the given axis.
The ``axis`` parameter specifies the dimension along which the array will
be split. For example, if ``axis=0`` (the default) it will be the first
dimension and if ``axis=-1`` it will be the last dimension.
The result is a tuple of arrays split along ``axi... | python | numpy/_core/shape_base.py | 472 | [
"x",
"axis"
] | false | 2 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
doubleValue | @Override
public double doubleValue() {
return value;
} | Returns the value of this MutableByte as a double.
@return the numeric value represented by this object after conversion to type double. | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 178 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
findKey | function findKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
} | This method is like `_.find` except that it returns the key of the first
element `predicate` returns truthy for instead of the element itself.
@static
@memberOf _
@since 1.1.0
@category Object
@param {Object} object The object to inspect.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@ret... | javascript | lodash.js | 12,983 | [
"object",
"predicate"
] | false | 1 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
masked_inside | def masked_inside(x, v1, v2, copy=True):
"""
Mask an array inside a given interval.
Shortcut to ``masked_where``, where `condition` is True for `x` inside
the interval [v1,v2] (v1 <= x <= v2). The boundaries `v1` and `v2`
can be given in either order.
See Also
--------
masked_where : ... | Mask an array inside a given interval.
Shortcut to ``masked_where``, where `condition` is True for `x` inside
the interval [v1,v2] (v1 <= x <= v2). The boundaries `v1` and `v2`
can be given in either order.
See Also
--------
masked_where : Mask where a condition is met.
Notes
-----
The array `x` is prefilled with i... | python | numpy/ma/core.py | 2,165 | [
"x",
"v1",
"v2",
"copy"
] | false | 2 | 7.44 | numpy/numpy | 31,054 | unknown | false | |
beforeKey | private void beforeKey() throws JSONException {
Scope context = peek();
if (context == Scope.NONEMPTY_OBJECT) { // first in object
this.out.append(',');
}
else if (context != Scope.EMPTY_OBJECT) { // not in an object!
throw new JSONException("Nesting problem");
}
newline();
replaceTop(Scope.DANGLING... | Inserts any necessary separators and whitespace before a name. Also adjusts the
stack to expect the key's value.
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONStringer.java | 373 | [] | void | true | 3 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
sem | def sem(
self,
ddof: int = 1,
numeric_only: bool = False,
):
"""
Compute standard error of the mean of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex.
Parameters
----------
ddof : int, default ... | Compute standard error of the mean of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex.
Parameters
----------
ddof : int, default 1
Degrees of freedom.
numeric_only : bool, default False
Include only `float`, `int` or `boolean` data.
.. versionchanged:: 2.0... | python | pandas/core/resample.py | 1,651 | [
"self",
"ddof",
"numeric_only"
] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false | |
resolveVariable | protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) {
final StrLookup<?> resolver = getVariableResolver();
if (resolver == null) {
return null;
}
return resolver.lookup(variableName);
} | Internal method that resolves the value of a variable.
<p>
Most users of this class do not need to call this method. This method is
called automatically by the substitution process.
</p>
<p>
Writers of subclasses can override this method if they need to alter
how each substitution occurs. The method is passed the varia... | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 859 | [
"variableName",
"buf",
"startPos",
"endPos"
] | String | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
forId | static @Nullable CommonStructuredLogFormat forId(String id) {
for (CommonStructuredLogFormat candidate : values()) {
if (candidate.getId().equalsIgnoreCase(id)) {
return candidate;
}
}
return null;
} | Find the {@link CommonStructuredLogFormat} for the given ID.
@param id the format identifier
@return the associated {@link CommonStructuredLogFormat} or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/CommonStructuredLogFormat.java | 68 | [
"id"
] | CommonStructuredLogFormat | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
text | String text() throws IOException; | Returns an instance of {@link Map} holding parsed map.
Serves as a replacement for the "map", "mapOrdered" and "mapStrings" methods above.
@param mapFactory factory for creating new {@link Map} objects
@param mapValueParser parser for parsing a single map value
@param <T> map value type
@return {@link Map} object | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParser.java | 108 | [] | String | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false |
getLayoutFactory | private LayoutFactory getLayoutFactory() {
if (this.layoutFactory != null) {
return this.layoutFactory;
}
List<LayoutFactory> factories = SpringFactoriesLoader.loadFactories(LayoutFactory.class, null);
if (factories.isEmpty()) {
return new DefaultLayoutFactory();
}
Assert.state(factories.size() == 1, ... | Return the {@link File} to use to back up the original source.
@return the file to use to back up the original source | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java | 384 | [] | LayoutFactory | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
check_for_write_conflict | def check_for_write_conflict(key: str) -> None:
"""
Log a warning if a variable exists outside the metastore.
If we try to write a variable to the metastore while the same key
exists in an environment variable or custom secrets backend, then
subsequent reads will not read the se... | Log a warning if a variable exists outside the metastore.
If we try to write a variable to the metastore while the same key
exists in an environment variable or custom secrets backend, then
subsequent reads will not read the set value.
:param key: Variable Key | python | airflow-core/src/airflow/models/variable.py | 454 | [
"key"
] | None | true | 4 | 6.88 | apache/airflow | 43,597 | sphinx | false |
maybeAdd | public void maybeAdd(Object candidate) {
if (candidate instanceof ClusterResourceListener) {
clusterResourceListeners.add((ClusterResourceListener) candidate);
}
} | Add only if the candidate implements {@link ClusterResourceListener}.
@param candidate Object which might implement {@link ClusterResourceListener} | java | clients/src/main/java/org/apache/kafka/common/internals/ClusterResourceListeners.java | 37 | [
"candidate"
] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
fullyQualifiedMethodName | public String fullyQualifiedMethodName() {
return fullyQualifiedMethodName;
} | Provides the fully-qualified method name, e.g. {@code ConsumerRebalanceListener.onPartitionsRevoked}. This
is used for log messages.
@return Fully-qualified method name | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerRebalanceListenerMethodName.java | 43 | [] | String | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
parseObject | @Override
public Object parseObject(final String source, final ParsePosition pos) {
return parse(source, pos);
} | Parses a formatted date string according to the format. Updates the Calendar with parsed fields. Upon success, the ParsePosition index is updated to
indicate how much of the source text was consumed. Not all source text needs to be consumed. Upon parse failure, ParsePosition error index is updated to
the offset of the ... | java | src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 1,090 | [
"source",
"pos"
] | Object | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
toObject | public static Float[] toObject(final float[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_FLOAT_OBJECT_ARRAY;
}
return setAll(new Float[array.length], i -> Float.valueOf(array[i]));
} | Converts an array of primitive floats to objects.
<p>This method returns {@code null} for a {@code null} input array.</p>
@param array a {@code float} array.
@return a {@link Float} array, {@code null} if null array input. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,744 | [
"array"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
isEqualWith | function isEqualWith(value, other, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
var result = customizer ? customizer(value, other) : undefined;
return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
} | This method is like `_.isEqual` except that it accepts `customizer` which
is invoked to compare values. If `customizer` returns `undefined`, comparisons
are handled by the method instead. The `customizer` is invoked with up to
six arguments: (objValue, othValue [, index|key, object, other, stack]).
@static
@memberOf _
... | javascript | lodash.js | 11,674 | [
"value",
"other",
"customizer"
] | false | 4 | 7.04 | lodash/lodash | 61,490 | jsdoc | false | |
lag_plot | def lag_plot(series: Series, lag: int = 1, ax: Axes | None = None, **kwds) -> Axes:
"""
Lag plot for time series.
A lag plot is a scatter plot of a time series against a lag of itself. It helps
in visualizing the temporal dependence between observations by plotting the values
at time `t` on the x-a... | Lag plot for time series.
A lag plot is a scatter plot of a time series against a lag of itself. It helps
in visualizing the temporal dependence between observations by plotting the values
at time `t` on the x-axis and the values at time `t + lag` on the y-axis.
Parameters
----------
series : Series
The time seri... | python | pandas/plotting/_misc.py | 587 | [
"series",
"lag",
"ax"
] | Axes | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
maybeMarkPartitionsPendingRevocation | private void maybeMarkPartitionsPendingRevocation() {
if (protocol != RebalanceProtocol.EAGER) {
return;
}
// When asynchronously committing offsets prior to the revocation of a set of partitions, there will be a
// window of time between when the offset commit is sent and w... | Used by COOPERATIVE rebalance protocol only.
Validate the assignments returned by the assignor such that no owned partitions are going to
be reassigned to a different consumer directly: if the assignor wants to reassign an owned partition,
it must first remove it from the new assignment of the current owner so that it ... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 866 | [] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
removeAllOccurences | @Deprecated
public static int[] removeAllOccurences(final int[] array, final int element) {
return (int[]) removeAt(array, indexesOf(array, element));
} | Removes the occurrences of the specified element from the specified int array.
<p>
All subsequent elements are shifted to the left (subtracts one from their indices).
If the array doesn't contain such an element, no elements are removed from the array.
{@code null} will be returned if the input array is {@code null}.
<... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5,360 | [
"array",
"element"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
matches | @Override
public boolean matches(Method method, Class<?> targetClass) {
if (matchesMethod(method)) {
return true;
}
// Proxy classes never have annotations on their redeclared methods.
if (Proxy.isProxyClass(targetClass)) {
return false;
}
// The method may be on an interface, so let's check on the t... | Create a new AnnotationClassFilter for the given annotation type.
@param annotationType the annotation type to look for
@param checkInherited whether to also check the superclasses and
interfaces as well as meta-annotations for the annotation type
(i.e. whether to use {@link AnnotatedElementUtils#hasAnnotation}
semanti... | java | spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java | 72 | [
"method",
"targetClass"
] | true | 4 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false | |
checkConfigMembers | public void checkConfigMembers(RootBeanDefinition beanDefinition) {
if (this.injectedElements.isEmpty()) {
this.checkedElements = Collections.emptySet();
}
else {
Set<InjectedElement> checkedElements = CollectionUtils.newLinkedHashSet(this.injectedElements.size());
for (InjectedElement element : this.inj... | Determine whether this metadata instance needs to be refreshed.
@param clazz the current target class
@return {@code true} indicating a refresh, {@code false} otherwise
@since 5.2.4 | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java | 123 | [
"beanDefinition"
] | void | true | 3 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
parseSimpleUnaryExpression | function parseSimpleUnaryExpression(): UnaryExpression {
switch (token()) {
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.ExclamationToken:
return parsePrefixUnaryExpression();
... | Parse ES7 simple-unary expression or higher:
ES7 UnaryExpression:
1) UpdateExpression[?yield]
2) delete UnaryExpression[?yield]
3) void UnaryExpression[?yield]
4) typeof UnaryExpression[?yield]
5) + UnaryExpression[?yield]
6) - UnaryExpression[?yield]
7) ~ UnaryExpression[?yi... | typescript | src/compiler/parser.ts | 5,796 | [] | true | 3 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
set_state | def set_state(self, state: str | None, session: Session = NEW_SESSION) -> bool:
"""
Set TaskInstance state.
:param state: State to set for the TI
:param session: SQLAlchemy ORM Session
:return: Was the state changed
"""
if self.state == state:
return ... | Set TaskInstance state.
:param state: State to set for the TI
:param session: SQLAlchemy ORM Session
:return: Was the state changed | python | airflow-core/src/airflow/models/taskinstance.py | 758 | [
"self",
"state",
"session"
] | bool | true | 7 | 7.76 | apache/airflow | 43,597 | sphinx | false |
_predict_recursive | def _predict_recursive(self, X, sample_weight, cluster_node):
"""Predict recursively by going down the hierarchical tree.
Parameters
----------
X : {ndarray, csr_matrix} of shape (n_samples, n_features)
The data points, currently assigned to `cluster_node`, to predict betwee... | Predict recursively by going down the hierarchical tree.
Parameters
----------
X : {ndarray, csr_matrix} of shape (n_samples, n_features)
The data points, currently assigned to `cluster_node`, to predict between
the subclusters of this node.
sample_weight : ndarray of shape (n_samples,)
The weights for ea... | python | sklearn/cluster/_bisect_k_means.py | 488 | [
"self",
"X",
"sample_weight",
"cluster_node"
] | false | 3 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_is_single_string_color | def _is_single_string_color(color: Color) -> bool:
"""Check if `color` is a single string color.
Examples of single string colors:
- 'r'
- 'g'
- 'red'
- 'green'
- 'C3'
- 'firebrick'
Parameters
----------
color : Color
Color string or sequence... | Check if `color` is a single string color.
Examples of single string colors:
- 'r'
- 'g'
- 'red'
- 'green'
- 'C3'
- 'firebrick'
Parameters
----------
color : Color
Color string or sequence of floats.
Returns
-------
bool
True if `color` looks like a valid color.
False otherwise. | python | pandas/plotting/_matplotlib/style.py | 263 | [
"color"
] | bool | true | 2 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
_sanitize_str_dtypes | def _sanitize_str_dtypes(
result: np.ndarray, data, dtype: np.dtype | None, copy: bool
) -> np.ndarray:
"""
Ensure we have a dtype that is supported by pandas.
"""
# This is to prevent mixed-type Series getting all casted to
# NumPy string type, e.g. NaN --> '-1#IND'.
if issubclass(result.d... | Ensure we have a dtype that is supported by pandas. | python | pandas/core/construction.py | 757 | [
"result",
"data",
"dtype",
"copy"
] | np.ndarray | true | 6 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
forBindables | public static BindableRuntimeHintsRegistrar forBindables(Iterable<Bindable<?>> bindables) {
Assert.notNull(bindables, "'bindables' must not be null");
return forBindables(StreamSupport.stream(bindables.spliterator(), false).toArray(Bindable[]::new));
} | Create a new {@link BindableRuntimeHintsRegistrar} for the specified bindables.
@param bindables the bindables to process
@return a new {@link BindableRuntimeHintsRegistrar} instance
@since 3.0.8 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java | 131 | [
"bindables"
] | BindableRuntimeHintsRegistrar | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
markCoordinatorUnknown | protected synchronized void markCoordinatorUnknown(boolean isDisconnected, String cause) {
if (this.coordinator != null) {
log.info("Group coordinator {} is unavailable or invalid due to cause: {}. "
+ "isDisconnected: {}. Rediscovery will be attempted.", this.coordinator,
... | Get the coordinator if its connection is still active. Otherwise mark it unknown and
return null.
@return the current coordinator or null if it is unknown | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 1,004 | [
"isDisconnected",
"cause"
] | void | true | 4 | 7.04 | apache/kafka | 31,560 | javadoc | false |
isIdentifier | function isIdentifier(): boolean {
if (token() === SyntaxKind.Identifier) {
return true;
}
// If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
// considered a keyword and is not an identifier.
if (token() === SyntaxKind.YieldKeyw... | Invokes the provided callback. If the callback returns something falsy, then it restores
the parser to the state it was in immediately prior to invoking the callback. If the
callback returns something truthy, then the parser state is not rolled back. The result
of invoking the callback is returned from this funct... | typescript | src/compiler/parser.ts | 2,318 | [] | true | 6 | 7.2 | microsoft/TypeScript | 107,154 | jsdoc | false | |
publicSuffix | public @Nullable InternetDomainName publicSuffix() {
return hasPublicSuffix() ? ancestor(publicSuffixIndex()) : null;
} | Returns the {@linkplain #isPublicSuffix() public suffix} portion of the domain name, or {@code
null} if no public suffix is present.
@since 6.0 | java | android/guava/src/com/google/common/net/InternetDomainName.java | 408 | [] | InternetDomainName | true | 2 | 6.48 | google/guava | 51,352 | javadoc | false |
_configure_async_session | def _configure_async_session() -> None:
"""
Configure async SQLAlchemy session.
This exists so tests can reconfigure the session. How SQLAlchemy configures
this does not work well with Pytest and you can end up with issues when the
session and runs in a different event loop from the test itself.
... | Configure async SQLAlchemy session.
This exists so tests can reconfigure the session. How SQLAlchemy configures
this does not work well with Pytest and you can end up with issues when the
session and runs in a different event loop from the test itself. | python | airflow-core/src/airflow/settings.py | 378 | [] | None | true | 2 | 7.04 | apache/airflow | 43,597 | unknown | false |
bindCaseBlock | function bindCaseBlock(node: CaseBlock): void {
const clauses = node.clauses;
const isNarrowingSwitch = node.parent.expression.kind === SyntaxKind.TrueKeyword || isNarrowingExpression(node.parent.expression);
let fallthroughFlow: FlowNode = unreachableFlow;
for (let i = 0; i < clau... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 1,738 | [
"node"
] | true | 10 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
_values_for_argsort | def _values_for_argsort(self) -> np.ndarray:
"""
Return values for sorting.
Returns
-------
ndarray
The transformed values should maintain the ordering between values
within the array.
See Also
--------
ExtensionArray.argsort : Re... | Return values for sorting.
Returns
-------
ndarray
The transformed values should maintain the ordering between values
within the array.
See Also
--------
ExtensionArray.argsort : Return the indices that would sort this array.
Notes
-----
The caller is responsible for *not* modifying these values in-place, so... | python | pandas/core/arrays/base.py | 877 | [
"self"
] | np.ndarray | true | 1 | 6.08 | pandas-dev/pandas | 47,362 | unknown | false |
open_slots | def open_slots(self, session: Session = NEW_SESSION) -> float:
"""
Get the number of slots open at the moment.
:param session: SQLAlchemy ORM Session
:return: the number of slots
"""
if self.slots == -1:
return float("inf")
return self.slots - self.oc... | Get the number of slots open at the moment.
:param session: SQLAlchemy ORM Session
:return: the number of slots | python | airflow-core/src/airflow/models/pool.py | 348 | [
"self",
"session"
] | float | true | 2 | 8.24 | apache/airflow | 43,597 | sphinx | false |
addTo | public void addTo(@Nullable AttributeAccessor attributes) {
if (attributes != null) {
attributes.setAttribute(NAME, this);
}
} | Add this container image metadata to the given attributes.
@param attributes the attributes to add the metadata to | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/container/ContainerImageMetadata.java | 42 | [
"attributes"
] | void | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
post | public void post(Object event) {
Iterator<Subscriber> eventSubscribers = subscribers.getSubscribers(event);
if (eventSubscribers.hasNext()) {
dispatcher.dispatch(event, eventSubscribers);
} else if (!(event instanceof DeadEvent)) {
// the event had no subscribers and was not itself a DeadEvent
... | Posts an event to all registered subscribers. This method will return successfully after the
event has been posted to all subscribers, and regardless of any exceptions thrown by
subscribers.
<p>If no subscribers have been subscribed for {@code event}'s class, and {@code event} is not
already a {@link DeadEvent}, it wil... | java | android/guava/src/com/google/common/eventbus/EventBus.java | 256 | [
"event"
] | void | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false |
resetCaches | @Override
public void resetCaches() {
CacheManager cacheManager = getCacheManager();
if (cacheManager != null && !cacheManager.isClosed()) {
for (String cacheName : cacheManager.getCacheNames()) {
javax.cache.Cache<Object, Object> jcache = cacheManager.getCache(cacheName);
if (jcache != null && !jcache.... | Return whether this cache manager accepts and converts {@code null} values
for all of its caches. | java | spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java | 133 | [] | void | true | 5 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
prepare_base_build_command | def prepare_base_build_command(image_params: CommonBuildParams) -> list[str]:
"""
Prepare build command for docker build. Depending on whether we have buildx plugin installed or not,
and whether we run cache preparation, there might be different results:
* if buildx plugin is installed - `docker buildx... | Prepare build command for docker build. Depending on whether we have buildx plugin installed or not,
and whether we run cache preparation, there might be different results:
* if buildx plugin is installed - `docker buildx` command is returned - using regular or cache builder
depending on whether we build regular ima... | python | dev/breeze/src/airflow_breeze/utils/docker_command_utils.py | 393 | [
"image_params"
] | list[str] | true | 6 | 7.92 | apache/airflow | 43,597 | sphinx | false |
getFileAttributes | private FileAttribute<?>[] getFileAttributes(FileSystem fileSystem, EnumSet<PosixFilePermission> ownerReadWrite) {
if (!fileSystem.supportedFileAttributeViews().contains("posix")) {
return NO_FILE_ATTRIBUTES;
}
return new FileAttribute<?>[] { PosixFilePermissions.asFileAttribute(ownerReadWrite) };
} | Return a subdirectory of the application temp.
@param subDir the subdirectory name
@return a subdirectory | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java | 128 | [
"fileSystem",
"ownerReadWrite"
] | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
removeEndIgnoreCase | @Deprecated
public static String removeEndIgnoreCase(final String str, final String remove) {
return Strings.CI.removeEnd(str, remove);
} | Case-insensitive removal of a substring if it is at the end of a source string, otherwise returns the source string.
<p>
A {@code null} source string will return {@code null}. An empty ("") source string will return the empty string. A {@code null} search string will return
the source string.
</p>
<pre>
StringUtils.rem... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,816 | [
"str",
"remove"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
currentJoinPoint | public static JoinPoint currentJoinPoint() {
MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation();
if (!(mi instanceof ProxyMethodInvocation pmi)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
}
JoinPoint jp = (JoinPoint) pmi.getUserAttri... | Lazily instantiate joinpoint for the current invocation.
Requires MethodInvocation to be bound with ExposeInvocationInterceptor.
<p>Do not use if access is available to the current ReflectiveMethodInvocation
(in an around advice).
@return current AspectJ joinpoint, or through an exception if we're not in a
Spring AOP i... | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java | 80 | [] | JoinPoint | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
hasMetaAnnotation | private boolean hasMetaAnnotation(Element annotationElement, String type, Set<Element> seen) {
if (seen.add(annotationElement)) {
for (AnnotationMirror annotation : annotationElement.getAnnotationMirrors()) {
DeclaredType annotationType = annotation.getAnnotationType();
if (type.equals(annotationType.toStr... | Resolve the {@link SourceMetadata} for the specified property.
@param field the field of the property (can be {@code null})
@param getter the getter of the property (can be {@code null})
@return the {@link SourceMetadata} for the specified property | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 245 | [
"annotationElement",
"type",
"seen"
] | true | 4 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
append | public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
final int precision) {
return append(seq, formatter, flags, width, precision, ' ', null);
} | Handles the common {@link Formattable} operations of truncate-pad-append,
with no ellipsis on precision overflow, and padding width underflow with
spaces.
@param seq the string to handle, not null.
@param formatter the destination formatter, not null.
@param flags the flags for formatting, see {@link Formattable}.
@... | java | src/main/java/org/apache/commons/lang3/text/FormattableUtils.java | 59 | [
"seq",
"formatter",
"flags",
"width",
"precision"
] | Formatter | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
of | static SslOptions of(String @Nullable [] ciphers, String @Nullable [] enabledProtocols) {
return new SslOptions() {
@Override
public String @Nullable [] getCiphers() {
return ciphers;
}
@Override
public String @Nullable [] getEnabledProtocols() {
return enabledProtocols;
}
@Override
... | Factory method to create a new {@link SslOptions} instance.
@param ciphers the ciphers
@param enabledProtocols the enabled protocols
@return a new {@link SslOptions} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslOptions.java | 75 | [
"ciphers",
"enabledProtocols"
] | SslOptions | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
totalSize | public int totalSize() {
return totalSize;
} | Get the total size of the message.
@return total size in bytes | java | clients/src/main/java/org/apache/kafka/common/protocol/MessageSizeAccumulator.java | 31 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
findIndefiniteField | public String findIndefiniteField() {
String indefinite = patternFilter.findIndefiniteField();
if (indefinite != null)
return indefinite;
return entryFilter.findIndefiniteField();
} | Return a string describing an ANY or UNKNOWN field, or null if there is no such field. | java | clients/src/main/java/org/apache/kafka/common/acl/AclBindingFilter.java | 93 | [] | String | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
sort_graph_by_row_values | def sort_graph_by_row_values(graph, copy=False, warn_when_not_sorted=True):
"""Sort a sparse graph such that each row is stored with increasing values.
.. versionadded:: 1.2
Parameters
----------
graph : sparse matrix of shape (n_samples, n_samples)
Distance matrix to other samples, where ... | Sort a sparse graph such that each row is stored with increasing values.
.. versionadded:: 1.2
Parameters
----------
graph : sparse matrix of shape (n_samples, n_samples)
Distance matrix to other samples, where only non-zero elements are
considered neighbors. Matrix is converted to CSR format if not already.
... | python | sklearn/neighbors/_base.py | 196 | [
"graph",
"copy",
"warn_when_not_sorted"
] | false | 11 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
postProcessAfterInstantiation | default boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
return true;
} | Perform operations after the bean has been instantiated, via a constructor or factory method,
but before Spring property population (from explicit properties or autowiring) occurs.
<p>This is the ideal callback for performing custom field injection on the given bean
instance, right before Spring's autowiring kicks in.
... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/InstantiationAwareBeanPostProcessor.java | 89 | [
"bean",
"beanName"
] | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
dot | def dot(a, b, strict=False, out=None):
"""
Return the dot product of two arrays.
This function is the equivalent of `numpy.dot` that takes masked values
into account. Note that `strict` and `out` are in different position
than in the method version. In order to maintain compatibility with the
c... | Return the dot product of two arrays.
This function is the equivalent of `numpy.dot` that takes masked values
into account. Note that `strict` and `out` are in different position
than in the method version. In order to maintain compatibility with the
corresponding method, it is recommended that the optional arguments ... | python | numpy/ma/core.py | 8,158 | [
"a",
"b",
"strict",
"out"
] | false | 10 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
get_overlapping_candidate | def get_overlapping_candidate():
"""
Return the next node in the ready queue that's neither a collective or
a wait.
"""
candidates = [
x
for x in ready
if not contains_collective(x.snode) and not contains_wait(x.snode)
]
if len(... | Return the next node in the ready queue that's neither a collective or
a wait. | python | torch/_inductor/comms.py | 1,307 | [] | false | 3 | 6.24 | pytorch/pytorch | 96,034 | unknown | false | |
create_token | def create_token(
body: LoginBody, expiration_time_in_seconds: int = conf.getint("api_auth", "jwt_expiration_time")
) -> str:
"""
Authenticate user with given configuration.
:param body: LoginBody should include username and password
:param expiration_time_in_seconds: int ex... | Authenticate user with given configuration.
:param body: LoginBody should include username and password
:param expiration_time_in_seconds: int expiration time in seconds | python | airflow-core/src/airflow/api_fastapi/auth/managers/simple/services/login.py | 33 | [
"body",
"expiration_time_in_seconds"
] | str | true | 6 | 6.08 | apache/airflow | 43,597 | sphinx | false |
rest | function rest(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start === undefined ? start : toInteger(start);
return baseRest(func, start);
} | Creates a function that invokes `func` with the `this` binding of the
created function and arguments from `start` and beyond provided as
an array.
**Note:** This method is based on the
[rest parameter](https://mdn.io/rest_parameters).
@static
@memberOf _
@since 4.0.0
@category Function
@param {Function} func The functi... | javascript | lodash.js | 10,902 | [
"func",
"start"
] | false | 3 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
SuspenseTimelineInput | function SuspenseTimelineInput() {
const bridge = useContext(BridgeContext);
const treeDispatch = useContext(TreeDispatcherContext);
const suspenseTreeDispatch = useContext(SuspenseTreeDispatcherContext);
const scrollToHostInstance = useScrollToHostInstance();
const {timeline, timelineIndex, hoveredTimelineI... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTimeline.js | 24 | [] | false | 8 | 6.16 | facebook/react | 241,750 | jsdoc | false | |
newConfiguration | protected Configuration newConfiguration() throws IOException, TemplateException {
return new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
} | Return a new {@link Configuration} object.
<p>Subclasses can override this for custom initialization — for example,
to specify a FreeMarker compatibility level (which is a new feature in
FreeMarker 2.3.21), or to use a mock object for testing.
<p>Called by {@link #createConfiguration()}.
@return the {@code Config... | java | spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java | 350 | [] | Configuration | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
gen_batches | def gen_batches(n, batch_size, *, min_batch_size=0):
"""Generator to create slices containing `batch_size` elements from 0 to `n`.
The last slice may contain less than `batch_size` elements, when
`batch_size` does not divide `n`.
Parameters
----------
n : int
Size of the sequence.
... | Generator to create slices containing `batch_size` elements from 0 to `n`.
The last slice may contain less than `batch_size` elements, when
`batch_size` does not divide `n`.
Parameters
----------
n : int
Size of the sequence.
batch_size : int
Number of elements in each batch.
min_batch_size : int, default=0
... | python | sklearn/utils/_chunking.py | 33 | [
"n",
"batch_size",
"min_batch_size"
] | false | 4 | 7.2 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
onHeartbeatFailure | private void onHeartbeatFailure() {
// The leave group request is sent out once (not retried), so we should complete the leave
// operation once the request completes, regardless of the response.
if (state == MemberState.UNSUBSCRIBED && maybeCompleteLeaveInProgress()) {
log.warn("Mem... | Notify the member that a fatal error heartbeat response was received. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 761 | [] | void | true | 3 | 7.04 | apache/kafka | 31,560 | javadoc | false |
remove | @CanIgnoreReturnValue
int remove(@CompatibleWith("E") @Nullable Object element, int occurrences); | Removes a number of occurrences of the specified element from this multiset. If the multiset
contains fewer than this number of occurrences to begin with, all occurrences will be removed.
Note that if {@code occurrences == 1}, this is functionally equivalent to the call {@code
remove(element)}.
@param element the eleme... | java | android/guava/src/com/google/common/collect/Multiset.java | 175 | [
"element",
"occurrences"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
get | @Override
public @Nullable V get(@Nullable Object key) {
int index = keySet.indexOf(key);
return (index == -1) ? null : valueList.get(index);
} | A builder for creating immutable sorted map instances, especially {@code public static final}
maps ("constant maps"). Example:
{@snippet :
static final ImmutableSortedMap<Integer, String> INT_TO_WORD =
new ImmutableSortedMap.Builder<Integer, String>(Ordering.natural())
.put(1, "one")
.put(2, "two")
... | java | android/guava/src/com/google/common/collect/ImmutableSortedMap.java | 833 | [
"key"
] | V | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false |
resolveClass | @Override
protected Class<?> resolveClass(final ObjectStreamClass desc) throws IOException, ClassNotFoundException {
final String name = desc.getName();
try {
return Class.forName(name, false, classLoader);
} catch (final ClassNotFoundException ex) {
... | Overridden version that uses the parameterized {@link ClassLoader} or the {@link ClassLoader}
of the current {@link Thread} to resolve the class.
@param desc An instance of class {@link ObjectStreamClass}.
@return A {@link Class} object corresponding to {@code desc}.
@throws IOException Any of the usual Input/Output ex... | java | src/main/java/org/apache/commons/lang3/SerializationUtils.java | 92 | [
"desc"
] | true | 4 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
rewriteCallStack | private static CacheOperationInvoker.ThrowableWrapper rewriteCallStack(
Throwable exception, String className, String methodName) {
Throwable clone = cloneException(exception);
if (clone == null) {
return new CacheOperationInvoker.ThrowableWrapper(exception);
}
StackTraceElement[] callStack = new Except... | Rewrite the call stack of the specified {@code exception} so that it matches
the current call stack up to (included) the specified method invocation.
<p>Clone the specified exception. If the exception is not {@code serializable},
the original exception is returned. If no common ancestor can be found, returns
the origin... | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheResultInterceptor.java | 124 | [
"exception",
"className",
"methodName"
] | true | 4 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false | |
deleteStreamsGroupOffsets | DeleteStreamsGroupOffsetsResult deleteStreamsGroupOffsets(String groupId,
Set<TopicPartition> partitions,
DeleteStreamsGroupOffsetsOptions options); | Delete committed offsets for a set of partitions in a streams group. This will
succeed at the partition level only if the group is not actively subscribed
to the corresponding topic.
<em>Note</em>: this method effectively does the same as the corresponding consumer group method {@link Admin#deleteConsumerGroupOffsets} ... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,047 | [
"groupId",
"partitions",
"options"
] | DeleteStreamsGroupOffsetsResult | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
hashCode | @Override
public int hashCode() {
int result = this.beanName.hashCode();
result = 29 * result + (this.toParent ? 1 : 0);
return result;
} | Set the configuration source {@code Object} for this metadata element.
<p>The exact type of the object will depend on the configuration mechanism used. | java | spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java | 164 | [] | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
matches | @Override
public boolean matches(Class<?> clazz) {
Assert.state(this.aspectJTypePatternMatcher != null, "No type pattern has been set");
return this.aspectJTypePatternMatcher.matches(clazz);
} | Should the pointcut apply to the given interface or target class?
@param clazz candidate target class
@return whether the advice should apply to this candidate target class
@throws IllegalStateException if no {@link #setTypePattern(String)} has been set | java | spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java | 102 | [
"clazz"
] | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_categorize_task_instances | def _categorize_task_instances(
self, task_keys: set[tuple[str, str, str, int]]
) -> tuple[
dict[tuple[str, str, str, int], TI], set[tuple[str, str, str, int]], set[tuple[str, str, str, int]]
]:
"""
Categorize the given task_keys into matched and not_found based on existing task ... | Categorize the given task_keys into matched and not_found based on existing task instances.
:param task_keys: set of task_keys (tuple of dag_id, dag_run_id, task_id, and map_index)
:return: tuple of (task_instances_map, matched_task_keys, not_found_task_keys) | python | airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py | 234 | [
"self",
"task_keys"
] | tuple[
dict[tuple[str, str, str, int], TI], set[tuple[str, str, str, int]], set[tuple[str, str, str, int]]
] | true | 2 | 7.92 | apache/airflow | 43,597 | sphinx | false |
set_locale | def set_locale(
new_locale: str | tuple[str, str], lc_var: int = locale.LC_ALL
) -> Generator[str | tuple[str, str]]:
"""
Context manager for temporarily setting a locale.
Parameters
----------
new_locale : str or tuple
A string of the form <language_country>.<encoding>. For example to ... | Context manager for temporarily setting a locale.
Parameters
----------
new_locale : str or tuple
A string of the form <language_country>.<encoding>. For example to set
the current locale to US English with a UTF8 encoding, you would pass
"en_US.UTF-8".
lc_var : int, default `locale.LC_ALL`
The categor... | python | pandas/_config/localization.py | 26 | [
"new_locale",
"lc_var"
] | Generator[str | tuple[str, str]] | true | 4 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
updateNodeLatencyStats | public void updateNodeLatencyStats(Integer nodeId, long nowMs, boolean canDrain) {
// Don't bother with updating stats if the feature is turned off.
if (partitionAvailabilityTimeoutMs <= 0)
return;
// When the sender gets a node (returned by the ready() function) that has data to se... | Drain all the data for the given nodes and collate them into a list of batches that will fit
within the specified size on a per-node basis. This method attempts to avoid choosing the same
topic-node over and over.
@param metadataSnapshot The current cluster metadata
@param nodes The list of node to drain
@... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java | 971 | [
"nodeId",
"nowMs",
"canDrain"
] | void | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false |
getAnnotationElementValues | Map<String, Object> getAnnotationElementValues(AnnotationMirror annotation) {
Map<String, Object> values = new LinkedHashMap<>();
annotation.getElementValues()
.forEach((name, value) -> values.put(name.getSimpleName().toString(), getAnnotationValue(value)));
return values;
} | 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 | 312 | [
"annotation"
] | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
_get_index_expr | def _get_index_expr(self, index: sympy.Expr) -> tuple[str, bool]:
"""
Get the index expression string and whether it needs flattening.
Returns:
Tuple of (index_str, needs_flatten) where needs_flatten indicates
if the buffer should be flattened before indexing (for mixed ... | Get the index expression string and whether it needs flattening.
Returns:
Tuple of (index_str, needs_flatten) where needs_flatten indicates
if the buffer should be flattened before indexing (for mixed indexing). | python | torch/_inductor/codegen/pallas.py | 1,200 | [
"self",
"index"
] | tuple[str, bool] | true | 10 | 7.6 | pytorch/pytorch | 96,034 | unknown | false |
calculate_tflops | def calculate_tflops(
config: ExperimentConfig,
time_us: float,
is_backward: bool = False,
sparsity: float = 0.0,
) -> float:
"""
Calculate TFLOPS for scaled dot product attention.
Parameters:
- config: The experiment configuration
- time_us: The execution time in microseconds
-... | Calculate TFLOPS for scaled dot product attention.
Parameters:
- config: The experiment configuration
- time_us: The execution time in microseconds
- is_backward: Whether to calculate for backward pass (includes gradient computation)
- sparsity: Sparsity factor between 0.0 and 1.0, where 0.0 means no sparsity and 1.0 ... | python | benchmarks/transformer/sdpa.py | 82 | [
"config",
"time_us",
"is_backward",
"sparsity"
] | float | true | 2 | 8.24 | pytorch/pytorch | 96,034 | google | false |
_ensure_nanosecond_dtype | def _ensure_nanosecond_dtype(dtype: DtypeObj) -> None:
"""
Convert dtypes with granularity less than nanosecond to nanosecond
>>> _ensure_nanosecond_dtype(np.dtype("M8[us]"))
>>> _ensure_nanosecond_dtype(np.dtype("M8[D]"))
Traceback (most recent call last):
...
TypeError: dtype=datetim... | Convert dtypes with granularity less than nanosecond to nanosecond
>>> _ensure_nanosecond_dtype(np.dtype("M8[us]"))
>>> _ensure_nanosecond_dtype(np.dtype("M8[D]"))
Traceback (most recent call last):
...
TypeError: dtype=datetime64[D] is not supported. Supported resolutions are 's', 'ms', 'us', and 'ns'
>>> _ensu... | python | pandas/core/dtypes/cast.py | 1,117 | [
"dtype"
] | None | true | 5 | 8 | pandas-dev/pandas | 47,362 | unknown | false |
contains | public boolean contains(final T element) {
if (element == null) {
return false;
}
return comparator.compare(element, minimum) > -1 && comparator.compare(element, maximum) < 1;
} | Checks whether the specified element occurs within this range.
@param element the element to check for, null returns false.
@return true if the specified element occurs within this range. | java | src/main/java/org/apache/commons/lang3/Range.java | 247 | [
"element"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
rpartition | def rpartition(a, sep):
"""
Partition (split) each element around the right-most separator.
Calls :meth:`str.rpartition` element-wise.
For each element in `a`, split the element as the last
occurrence of `sep`, and return 3 strings containing the part
before the separator, the separator itself... | Partition (split) each element around the right-most separator.
Calls :meth:`str.rpartition` element-wise.
For each element in `a`, split the element as the last
occurrence of `sep`, and return 3 strings containing the part
before the separator, the separator itself, and the part after
the separator. If the separator... | python | numpy/_core/defchararray.py | 361 | [
"a",
"sep"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
calcDeadlineMs | private long calcDeadlineMs(long now, Integer optionTimeoutMs) {
if (optionTimeoutMs != null)
return now + Math.max(0, optionTimeoutMs);
return now + defaultApiTimeoutMs;
} | Get the deadline for a particular call.
@param now The current time in milliseconds.
@param optionTimeoutMs The timeout option given by the user.
@return The deadline in milliseconds. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 494 | [
"now",
"optionTimeoutMs"
] | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
determineHighestPriorityCandidate | protected @Nullable String determineHighestPriorityCandidate(Map<String, Object> candidates, Class<?> requiredType) {
String highestPriorityBeanName = null;
Integer highestPriority = null;
boolean highestPriorityConflictDetected = false;
for (Map.Entry<String, Object> entry : candidates.entrySet()) {
String ... | Determine the candidate with the highest priority in the given set of beans.
<p>Based on {@code @jakarta.annotation.Priority}. As defined by the related
{@link org.springframework.core.Ordered} interface, the lowest value has
the highest priority.
@param candidates a Map of candidate names and candidate instances
(or c... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 2,137 | [
"candidates",
"requiredType"
] | String | true | 7 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
_check_ne_builtin_clash | def _check_ne_builtin_clash(expr: Expr) -> None:
"""
Attempt to prevent foot-shooting in a helpful way.
Parameters
----------
expr : Expr
Terms can contain
"""
names = expr.names
overlap = names & _ne_builtins
if overlap:
s = ", ".join([repr(x) for x in overlap])
... | Attempt to prevent foot-shooting in a helpful way.
Parameters
----------
expr : Expr
Terms can contain | python | pandas/core/computation/engines.py | 29 | [
"expr"
] | None | true | 2 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
evaluate_knapsack_output | def evaluate_knapsack_output(
self,
saved_nodes_idxs: list[int],
recomputable_node_idxs: list[int],
account_for_backward_pass: bool = False,
) -> dict[str, float]:
"""
Evaluate the theoretical runtime and peak memory usage of a given checkpointing strategy.
Ar... | Evaluate the theoretical runtime and peak memory usage of a given checkpointing strategy.
Args:
- saved_nodes_idxs (List[int]): The indices of nodes that are saved.
- recomputable_node_idxs (List[int]): The indices of nodes that need to be recomputed. | python | torch/_functorch/_activation_checkpointing/knapsack_evaluator.py | 133 | [
"self",
"saved_nodes_idxs",
"recomputable_node_idxs",
"account_for_backward_pass"
] | dict[str, float] | true | 3 | 6.64 | pytorch/pytorch | 96,034 | google | false |
writeMetadata | private void writeMetadata(ConfigurationMetadata metadata, FileObjectSupplier fileObjectProvider)
throws IOException {
if (!metadata.getItems().isEmpty()) {
try (OutputStream outputStream = fileObjectProvider.get().openOutputStream()) {
new JsonMarshaller().write(metadata, outputStream);
}
}
} | Write the metadata to the {@link FileObject} provided by the given supplier.
@param metadata the metadata to provide
@param fileObjectProvider a supplier for the {@link FileObject} to use | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java | 122 | [
"metadata",
"fileObjectProvider"
] | void | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.