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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
checkTypeArgument | private void checkTypeArgument(Object formatter) {
Class<?> typeArgument = GenericTypeResolver.resolveTypeArgument(formatter.getClass(),
StructuredLogFormatter.class);
Assert.state(this.logEventType.equals(typeArgument),
() -> "Type argument of %s must be %s but was %s".formatted(formatter.getClass().getNam... | Get a new {@link StructuredLogFormatter} instance for the specified format.
@param format the format requested (either a {@link CommonStructuredLogFormat} ID
or a fully-qualified class name)
@return a new {@link StructuredLogFormatter} instance
@throws IllegalArgumentException if the format is unknown | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLogFormatterFactory.java | 145 | [
"formatter"
] | void | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
systemPropertiesLookup | public static StrLookup<String> systemPropertiesLookup() {
return SYSTEM_PROPERTIES_LOOKUP;
} | Returns a new lookup which uses a copy of the current
{@link System#getProperties() System properties}.
<p>
If a security manager blocked access to system properties, then null will
be returned from every lookup.
</p>
<p>
If a null key is used, this lookup will throw a NullPointerException.
</p>
@return a lookup using ... | java | src/main/java/org/apache/commons/lang3/text/StrLookup.java | 147 | [] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
addAttachment | public void addAttachment(
String attachmentFilename, InputStreamSource inputStreamSource, String contentType)
throws MessagingException {
Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
if (inputStreamSource instanceof Resource resource && resource.isOpen()) {
throw new IllegalAr... | Add an attachment to the MimeMessage, taking the content from an
{@code org.springframework.core.io.InputStreamResource}.
<p>Note that the InputStream returned by the InputStreamSource
implementation needs to be a <i>fresh one on each call</i>, as
JavaMail will invoke {@code getInputStream()} multiple times.
@param att... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 1,186 | [
"attachmentFilename",
"inputStreamSource",
"contentType"
] | void | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
prepare_performance_dag_columns | def prepare_performance_dag_columns(
performance_dag_conf: dict[str, str],
) -> OrderedDict:
"""
Prepare dict containing DAG env variables.
Prepare an OrderedDict containing chosen performance dag environment variables
that will serve as columns for the results dataframe.
:param performance_da... | Prepare dict containing DAG env variables.
Prepare an OrderedDict containing chosen performance dag environment variables
that will serve as columns for the results dataframe.
:param performance_dag_conf: dict with environment variables as keys and their values as values
:return: a dict with a subset of environment ... | python | performance/src/performance_dags/performance_dag/performance_dag_utils.py | 506 | [
"performance_dag_conf"
] | OrderedDict | true | 3 | 7.68 | apache/airflow | 43,597 | sphinx | false |
mat1mat2 | def mat1mat2(self) -> tuple[Any, Any]:
"""
Get the mat1 and mat2 nodes.
Returns:
A tuple of (mat1, mat2) nodes
"""
nodes = self.nodes()
return nodes[self._mat1_idx], nodes[self._mat2_idx] | Get the mat1 and mat2 nodes.
Returns:
A tuple of (mat1, mat2) nodes | python | torch/_inductor/kernel_inputs.py | 306 | [
"self"
] | tuple[Any, Any] | true | 1 | 6.4 | pytorch/pytorch | 96,034 | unknown | false |
adjoin | def adjoin(space: int, *lists: list[str], **kwargs: Any) -> str:
"""
Glues together two sets of strings using the amount of space requested.
The idea is to prettify.
----------
space : int
number of spaces for padding
lists : str
list of str which being joined
strlen : calla... | Glues together two sets of strings using the amount of space requested.
The idea is to prettify.
----------
space : int
number of spaces for padding
lists : str
list of str which being joined
strlen : callable
function used to calculate the length of each str. Needed for unicode
handling.
justfunc : ca... | python | pandas/io/formats/printing.py | 35 | [
"space"
] | str | true | 2 | 7.04 | pandas-dev/pandas | 47,362 | unknown | false |
compare | @SuppressWarnings("InlineMeInliner") // Integer.compare unavailable under GWT+J2CL
public static int compare(int a, int b) {
return Ints.compare(flip(a), flip(b));
} | Compares the two specified {@code int} values, treating them as unsigned values between {@code
0} and {@code 2^32 - 1} inclusive.
<p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use the
equivalent {@link Integer#compareUnsigned(int, int)} method instead.
@param a the first unsigned {... | java | android/guava/src/com/google/common/primitives/UnsignedInts.java | 69 | [
"a",
"b"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
isFullMatch | public boolean isFullMatch() {
for (ConditionAndOutcome conditionAndOutcomes : this) {
if (!conditionAndOutcomes.getOutcome().isMatch()) {
return false;
}
}
return true;
} | Return {@code true} if all outcomes match.
@return {@code true} if a full match | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | 235 | [] | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
uncapitalize | public static String uncapitalize(final String str) {
final int strLen = length(str);
if (strLen == 0) {
return str;
}
final int firstCodePoint = str.codePointAt(0);
final int newCodePoint = Character.toLowerCase(firstCodePoint);
if (firstCodePoint == newCodeP... | Uncapitalizes a String, changing the first character to lower case as per {@link Character#toLowerCase(int)}. No other characters are changed.
<p>
For a word based algorithm, see {@link org.apache.commons.text.WordUtils#uncapitalize(String)}. A {@code null} input String returns {@code null}.
</p>
<pre>
StringUtils.unca... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,906 | [
"str"
] | String | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
noop | static MatcherWatchdog noop() {
return Noop.INSTANCE;
} | @return A noop implementation that does not interrupt threads and is useful for testing and pre-defined grok expressions. | java | libs/grok/src/main/java/org/elasticsearch/grok/MatcherWatchdog.java | 75 | [] | MatcherWatchdog | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false |
getAndAdd | public int getAndAdd(final int operand) {
final int last = value;
this.value += operand;
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.
@return the value associated with this instance immediately before the operand was ad... | java | src/main/java/org/apache/commons/lang3/mutable/MutableInt.java | 206 | [
"operand"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
_simple_json_normalize | def _simple_json_normalize(
ds: dict | list[dict],
sep: str = ".",
) -> dict | list[dict] | Any:
"""
An optimized basic json_normalize
Converts a nested dict into a flat dict ("record"), unlike
json_normalize and nested_to_record it doesn't do anything clever.
But for the most basic use cas... | An optimized basic json_normalize
Converts a nested dict into a flat dict ("record"), unlike
json_normalize and nested_to_record it doesn't do anything clever.
But for the most basic use cases it enhances performance.
E.g. pd.json_normalize(data)
Parameters
----------
ds : dict or list of ... | python | pandas/io/json/_normalize.py | 217 | [
"ds",
"sep"
] | dict | list[dict] | Any | true | 3 | 8.64 | pandas-dev/pandas | 47,362 | numpy | false |
is_period_dtype | def is_period_dtype(arr_or_dtype) -> bool:
"""
Check whether an array-like or dtype is of the Period dtype.
.. deprecated:: 2.2.0
Use isinstance(dtype, pd.PeriodDtype) instead.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype to check.
Retur... | Check whether an array-like or dtype is of the Period dtype.
.. deprecated:: 2.2.0
Use isinstance(dtype, pd.PeriodDtype) instead.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype to check.
Returns
-------
boolean
Whether or not the array-like or dtype is of the Period dtyp... | python | pandas/core/dtypes/common.py | 436 | [
"arr_or_dtype"
] | bool | true | 3 | 8 | pandas-dev/pandas | 47,362 | numpy | false |
max | @ParametricNullness
public <E extends T> E max(@ParametricNullness E a, @ParametricNullness E b) {
return (compare(a, b) >= 0) ? a : b;
} | Returns the greater of the two values according to this ordering. If the values compare as 0,
the first is returned.
<p><b>Implementation note:</b> this method is invoked by the default implementations of the
other {@code max} overloads, so overriding it will affect their behavior.
<p><b>Note:</b> Consider using {@code... | java | android/guava/src/com/google/common/collect/Ordering.java | 698 | [
"a",
"b"
] | E | true | 2 | 6.32 | google/guava | 51,352 | javadoc | false |
randomNumeric | @Deprecated
public static String randomNumeric(final int minLengthInclusive, final int maxLengthExclusive) {
return secure().nextNumeric(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 \p{Digit} characters.
</p>
@param minLengthInclusive the inclusive minimum length of the string to generate.
@param maxLengthExclusive the exclusive maximum length of the string... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 586 | [
"minLengthInclusive",
"maxLengthExclusive"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
indexOf | public int indexOf(final char ch, int startIndex) {
startIndex = Math.max(startIndex, 0);
if (startIndex >= size) {
return -1;
}
final char[] thisBuf = buffer;
for (int i = startIndex; i < size; i++) {
if (thisBuf[i] == ch) {
return i;
... | Searches the string builder to find the first reference to the specified char.
@param ch the character to find
@param startIndex the index to start at, invalid index rounded to edge
@return the first index of the character, or -1 if not found | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,000 | [
"ch",
"startIndex"
] | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
removeIf | @CanIgnoreReturnValue
public static <T extends @Nullable Object> boolean removeIf(
Iterator<T> removeFrom, Predicate<? super T> predicate) {
checkNotNull(predicate);
boolean modified = false;
while (removeFrom.hasNext()) {
if (predicate.apply(removeFrom.next())) {
removeFrom.remove();
... | Removes every element that satisfies the provided predicate from the iterator. The iterator
will be left exhausted: its {@code hasNext()} method will return {@code false}.
@param removeFrom the iterator to (potentially) remove elements from
@param predicate a predicate that determines whether an element should be remov... | java | android/guava/src/com/google/common/collect/Iterators.java | 227 | [
"removeFrom",
"predicate"
] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
requiresRefresh | protected boolean requiresRefresh() {
return true;
} | Determine whether a refresh is required.
Invoked for each refresh check, after the refresh check delay has elapsed.
<p>The default implementation always returns {@code true}, triggering
a refresh every time the delay has elapsed. To be overridden by subclasses
with an appropriate check of the underlying target resource... | java | spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java | 133 | [] | true | 1 | 6.96 | spring-projects/spring-framework | 59,386 | javadoc | false | |
mean | @Deprecated
// com.google.common.math.DoubleUtils
@GwtIncompatible
public static double mean(Iterator<? extends Number> values) {
checkArgument(values.hasNext(), "Cannot take mean of 0 values");
long count = 1;
double mean = checkFinite(values.next().doubleValue());
while (values.hasNext()) {
... | Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of
{@code values}.
<p>If these values are a sample drawn from a population, this is also an unbiased estimator of
the arithmetic mean of the population.
@param values a nonempty series of values, which will be converted to {@code dou... | java | android/guava/src/com/google/common/math/DoubleMath.java | 508 | [
"values"
] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
any | def any(self, *, skipna: bool = True, **kwargs) -> bool | NAType:
"""
Return whether any element is truthy.
Returns False unless there is at least one element that is truthy.
By default, NAs are skipped. If ``skipna=False`` is specified and
missing values are present, similar :r... | Return whether any element is truthy.
Returns False unless there is at least one element that is truthy.
By default, NAs are skipped. If ``skipna=False`` is specified and
missing values are present, similar :ref:`Kleene logic <boolean.kleene>`
is used as for logical operations.
Parameters
----------
skipna : bool, de... | python | pandas/core/arrays/arrow/array.py | 1,153 | [
"self",
"skipna"
] | bool | NAType | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
fixWindowsLocationPath | private static String fixWindowsLocationPath(String locationPath) {
// Same logic as Java's internal WindowsUriSupport class
if (locationPath.length() > 2 && locationPath.charAt(2) == ':') {
return locationPath.substring(1);
}
// Deal with Jetty's org.eclipse.jetty.util.URIUtil#correctURI(URI)
if (location... | Create a new {@link NestedLocation} from the given URI.
@param uri the nested URI
@return a new {@link NestedLocation} instance
@throws IllegalArgumentException if the URI is not valid | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java | 117 | [
"locationPath"
] | String | true | 5 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
loadAgent | @SuppressForbidden(reason = "The VirtualMachine API is the only way to attach a java agent dynamically")
static void loadAgent(String agentPath, String entitlementInitializationClassName) {
try {
VirtualMachine vm = VirtualMachine.attach(Long.toString(ProcessHandle.current().pid()));
... | Main entry point that activates entitlement checking. Once this method returns,
calls to methods protected by entitlements from classes without a valid
policy will throw {@link org.elasticsearch.entitlement.runtime.api.NotEntitledException}.
@param serverPolicyPatch additional entitlements to patch the embed... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java | 118 | [
"agentPath",
"entitlementInitializationClassName"
] | void | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
endOffsets | @Override
public Map<TopicPartition, Long> endOffsets(Collection<TopicPartition> partitions) {
return delegate.endOffsets(partitions);
} | Get the end offsets for the given partitions. In the default {@code read_uncommitted} isolation level, the end
offset is the high watermark (that is, the offset of the last successfully replicated message plus one). For
{@code read_committed} consumers, the end offset is the last stable offset (LSO), which is the minim... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 1,677 | [
"partitions"
] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
on | public static Splitter on(char separator) {
return on(CharMatcher.is(separator));
} | Returns a splitter that uses the given single-character separator. For example, {@code
Splitter.on(',').split("foo,,bar")} returns an iterable containing {@code ["foo", "", "bar"]}.
@param separator the character to recognize as a separator
@return a splitter, with default settings, that recognizes that separator | java | android/guava/src/com/google/common/base/Splitter.java | 126 | [
"separator"
] | Splitter | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
register_task | def register_task(self, task, **options):
"""Utility for registering a task-based class.
Note:
This is here for compatibility with old Celery 1.0
style task classes, you should not need to use this for
new projects.
"""
task = inspect.isclass(task) an... | Utility for registering a task-based class.
Note:
This is here for compatibility with old Celery 1.0
style task classes, you should not need to use this for
new projects. | python | celery/app/base.py | 609 | [
"self",
"task"
] | false | 4 | 6.08 | celery/celery | 27,741 | unknown | false | |
createStrictDateTimeFormatter | static DateTimeFormatter createStrictDateTimeFormatter(String pattern) {
// Using strict resolution to align with standard DateFormat behavior:
// otherwise, an overflow like, for example, Feb 29 for a non-leap-year wouldn't get rejected.
// However, with strict resolution, a year digit needs to be specified as '... | Create a {@link DateTimeFormatter} for the supplied pattern, configured with
{@linkplain ResolverStyle#STRICT strict} resolution.
<p>Note that the strict resolution does not affect the parsing.
@param pattern the pattern to use
@return a new {@code DateTimeFormatter}
@see ResolverStyle#STRICT | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterUtils.java | 40 | [
"pattern"
] | DateTimeFormatter | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
visitPropertyNameOfClassElement | function visitPropertyNameOfClassElement(member: ClassElement): PropertyName {
const name = member.name!;
// Computed property names need to be transformed into a hoisted variable when they are used more than once.
// The names are used more than once when the property has a decorator.
... | Visits the property name of a class element, for use when emitting property
initializers. For a computed property on a node with decorators, a temporary
value is stored for later use.
@param member The member whose name should be visited. | typescript | src/compiler/transformers/ts.ts | 1,237 | [
"member"
] | true | 5 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
asStdFunction | std::function<typename Traits::NonConstSignature> asStdFunction() && {
return std::move(*this).asSharedProxy();
} | Construct a `std::function` by moving in the contents of this `Function`.
Note that the returned `std::function` will share its state (i.e. captured
data) across all copies you make of it, so be very careful when copying. | cpp | folly/Function.h | 927 | [] | true | 2 | 6.96 | facebook/folly | 30,157 | doxygen | false | |
getOverride | public @Nullable MethodOverride getOverride(Method method) {
MethodOverride match = null;
for (MethodOverride candidate : this.overrides) {
if (candidate.matches(method)) {
match = candidate;
}
}
return match;
} | Return the override for the given method, if any.
@param method the method to check for overrides for
@return the method override, or {@code null} if none | java | spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverrides.java | 93 | [
"method"
] | MethodOverride | true | 2 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
getTimeZone | public static TimeZone getTimeZone(@Nullable LocaleContext localeContext) {
if (localeContext instanceof TimeZoneAwareLocaleContext timeZoneAware) {
TimeZone timeZone = timeZoneAware.getTimeZone();
if (timeZone != null) {
return timeZone;
}
}
return (defaultTimeZone != null ? defaultTimeZone : TimeZo... | Return the TimeZone associated with the given user context, if any,
or the system default TimeZone otherwise. This is effectively a
replacement for {@link java.util.TimeZone#getDefault()},
able to optionally respect a user-level TimeZone setting.
@param localeContext the user-level locale context to check
@return the c... | java | spring-context/src/main/java/org/springframework/context/i18n/LocaleContextHolder.java | 324 | [
"localeContext"
] | TimeZone | true | 4 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
truncate | public static String truncate(final String str, final int maxWidth) {
return truncate(str, 0, maxWidth);
} | Truncates a String. This will turn "Now is the time for all good men" into "Now is the time for".
<p>
Specifically:
</p>
<ul>
<li>If {@code str} is less than {@code maxWidth} characters long, return it.</li>
<li>Else truncate it to {@code substring(str, 0, maxWidth)}.</li>
<li>If {@code maxWidth} is less than {@code 0}... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,807 | [
"str",
"maxWidth"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
replace | private static String replace(Map<String, Map<String, Map<String, String>>> lookupsByProvider,
String value,
Pattern pattern) {
if (value == null) {
return null;
}
Matcher matcher = pattern.matcher(value);
St... | Transforms the given configuration data by using the {@link ConfigProvider} instances to
look up values to replace the variables in the pattern.
@param configs the configuration values to be transformed
@return an instance of {@link ConfigTransformerResult} | java | clients/src/main/java/org/apache/kafka/common/config/ConfigTransformer.java | 133 | [
"lookupsByProvider",
"value",
"pattern"
] | String | true | 5 | 7.44 | apache/kafka | 31,560 | javadoc | false |
wrapperReverse | function wrapperReverse() {
var value = this.__wrapped__;
if (value instanceof LazyWrapper) {
var wrapped = value;
if (this.__actions__.length) {
wrapped = new LazyWrapper(this);
}
wrapped = wrapped.reverse();
wrapped.__actions__.push({
'func': thr... | This method is the wrapper version of `_.reverse`.
**Note:** This method mutates the wrapped array.
@name reverse
@memberOf _
@since 0.1.0
@category Seq
@returns {Object} Returns the new `lodash` wrapper instance.
@example
var array = [1, 2, 3];
_(array).reverse().value()
// => [3, 2, 1]
console.log(array);
// => [3, 2... | javascript | lodash.js | 9,120 | [] | false | 3 | 8.72 | lodash/lodash | 61,490 | jsdoc | false | |
apply | @SuppressWarnings("unchecked")
private <R> @Nullable R apply(@Nullable T value, Extractor<T, R> extractor) {
if (skip(value)) {
return (R) SKIP;
}
return (value != null) ? extractor.extract(value) : null;
} | Adapt the extracted value.
@param <R> the result type
@param extractor the extractor to use
@return a new {@link ValueExtractor} | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 731 | [
"value",
"extractor"
] | R | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
_check_pos_label_consistency | def _check_pos_label_consistency(pos_label, y_true):
"""Check if `pos_label` need to be specified or not.
In binary classification, we fix `pos_label=1` if the labels are in the set
{-1, 1} or {0, 1}. Otherwise, we raise an error asking to specify the
`pos_label` parameters.
Parameters
-------... | Check if `pos_label` need to be specified or not.
In binary classification, we fix `pos_label=1` if the labels are in the set
{-1, 1} or {0, 1}. Otherwise, we raise an error asking to specify the
`pos_label` parameters.
Parameters
----------
pos_label : int, float, bool, str or None
The positive label.
y_true : n... | python | sklearn/utils/validation.py | 2,541 | [
"pos_label",
"y_true"
] | false | 10 | 6.24 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
mapShortIDs | private static boolean mapShortIDs() {
return SystemProperties.getBoolean(TimeZones.class, "mapShortIDs", () -> true);
} | Delegates to {@link TimeZone#getTimeZone(String)}, on Java 25 and up, maps an ID if it's a key in {@link ZoneId#SHORT_IDS}.
<p>
On Java 25, calling {@link TimeZone#getTimeZone(String)} with an ID in {@link ZoneId#SHORT_IDS} writes a message to {@link System#err} in the form:
</p>
<pre>
WARNING: Use of the three-letter ... | java | src/main/java/org/apache/commons/lang3/time/TimeZones.java | 70 | [] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
getProvider | public @Nullable TemplateAvailabilityProvider getProvider(String view, ApplicationContext applicationContext) {
Assert.notNull(applicationContext, "'applicationContext' must not be null");
ClassLoader classLoader = applicationContext.getClassLoader();
Assert.state(classLoader != null, "'classLoader' must not be n... | Get the provider that can be used to render the given view.
@param view the view to render
@param applicationContext the application context
@return a {@link TemplateAvailabilityProvider} or null | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java | 119 | [
"view",
"applicationContext"
] | TemplateAvailabilityProvider | true | 1 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
obtainInstanceFromSupplier | protected @Nullable Object obtainInstanceFromSupplier(Supplier<?> supplier, String beanName, RootBeanDefinition mbd)
throws Exception {
if (supplier instanceof ThrowingSupplier<?> throwingSupplier) {
return throwingSupplier.getWithException();
}
return supplier.get();
} | Obtain a bean instance from the given supplier.
@param supplier the configured supplier
@param beanName the corresponding bean name
@param mbd the bean definition for the bean
@return the bean instance (possibly {@code null})
@since 6.0.7 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,279 | [
"supplier",
"beanName",
"mbd"
] | Object | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
equals | @Override
public boolean equals(final Object obj) {
if (obj instanceof MutableByte) {
return value == ((MutableByte) obj).byteValue();
}
return false;
} | Compares this object to the specified object. The result is {@code true} if and only if the argument is
not {@code null} and is a {@link MutableByte} object that contains the same {@code byte} value
as this object.
@param obj the object to compare with, null returns false.
@return {@code true} if the objects are the s... | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 191 | [
"obj"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
above | public static JavaUnicodeEscaper above(final int codePoint) {
return outsideOf(0, codePoint);
} | Constructs a {@link JavaUnicodeEscaper} above the specified value (exclusive).
@param codePoint
above which to escape.
@return the newly created {@link UnicodeEscaper} instance. | java | src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java | 37 | [
"codePoint"
] | JavaUnicodeEscaper | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
jsonNodeToByte | public static byte jsonNodeToByte(JsonNode node, String about) {
int value = jsonNodeToInt(node, about);
if (value > Byte.MAX_VALUE) {
if (value <= 256) {
// It's more traditional to refer to bytes as unsigned,
// so we support that here.
value... | Copy a byte buffer into an array. This will not affect the buffer's
position or mark. | java | clients/src/main/java/org/apache/kafka/common/protocol/MessageUtil.java | 67 | [
"node",
"about"
] | true | 4 | 6 | apache/kafka | 31,560 | javadoc | false | |
hasCause | public static boolean hasCause(Throwable chain,
final Class<? extends Throwable> type) {
if (chain instanceof UndeclaredThrowableException) {
chain = chain.getCause();
}
return type.isInstance(chain);
} | Tests if the throwable's causal chain have an immediate or wrapped exception
of the given type?
@param chain
The root of a Throwable causal chain.
@param type
The exception type to test.
@return true, if chain is an instance of type or is an
UndeclaredThrowableException wrapping a cause.
@... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 558 | [
"chain",
"type"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getProperty | @Override
public Object getProperty(List<String> path) {
if (path.isEmpty()) {
return this;
} else if (path.size() == 1 && "value".equals(path.get(0))) {
return value();
} else if (path.size() == 1 && "normalized_value".equals(path.get(0))) {
return normal... | Returns the normalized value. If no normalised factor has been specified
this method will return {@link #value()}
@return the normalized value | java | modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/Derivative.java | 68 | [
"path"
] | Object | true | 6 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
cancelRemainingTasksOnClose | public SimpleAsyncTaskExecutorBuilder cancelRemainingTasksOnClose(boolean cancelRemainingTasksOnClose) {
return new SimpleAsyncTaskExecutorBuilder(this.virtualThreads, this.threadNamePrefix,
cancelRemainingTasksOnClose, this.rejectTasksWhenLimitReached, this.concurrencyLimit,
this.taskDecorator, this.customiz... | Set whether to cancel remaining tasks on close. By default {@code false} not
tracking active threads at all or just interrupting any remaining threads that
still have not finished after the specified
{@link #taskTerminationTimeout(Duration) taskTerminationTimeout}. Switch this to
{@code true} for immediate interruption... | java | core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskExecutorBuilder.java | 119 | [
"cancelRemainingTasksOnClose"
] | SimpleAsyncTaskExecutorBuilder | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
nunique | def nunique(x: Array, /, *, xp: ModuleType | None = None) -> Array:
"""
Count the number of unique elements in an array.
Compatible with JAX and Dask, whose laziness would be otherwise
problematic.
Parameters
----------
x : Array
Input array.
xp : array_namespace, optional
... | Count the number of unique elements in an array.
Compatible with JAX and Dask, whose laziness would be otherwise
problematic.
Parameters
----------
x : Array
Input array.
xp : array_namespace, optional
The standard-compatible namespace for `x`. Default: infer.
Returns
-------
array: 0-dimensional integer arr... | python | sklearn/externals/array_api_extra/_lib/_funcs.py | 782 | [
"x",
"xp"
] | Array | true | 5 | 6.72 | scikit-learn/scikit-learn | 64,340 | numpy | false |
get_or_create_worker | def get_or_create_worker(self, hostname, **kwargs):
"""Get or create worker by hostname.
Returns:
Tuple: of ``(worker, was_created)`` pairs.
"""
try:
worker = self.workers[hostname]
if kwargs:
worker.update(kwargs)
return w... | Get or create worker by hostname.
Returns:
Tuple: of ``(worker, was_created)`` pairs. | python | celery/events/state.py | 477 | [
"self",
"hostname"
] | false | 2 | 6.64 | celery/celery | 27,741 | unknown | false | |
_copy_metadata_to_bw_nodes_in_subgraph | def _copy_metadata_to_bw_nodes_in_subgraph(
fx_g: torch.fx.GraphModule, fwd_seq_nr_to_node: dict[str, torch.fx.Node]
) -> None:
"""Copy metadata from forward nodes to backward nodes in a single subgraph."""
for node in fx_g.graph.nodes:
annotation_log.debug("node: %s", node.name)
seq_nr = no... | Copy metadata from forward nodes to backward nodes in a single subgraph. | python | torch/_functorch/_aot_autograd/utils.py | 579 | [
"fx_g",
"fwd_seq_nr_to_node"
] | None | true | 6 | 6 | pytorch/pytorch | 96,034 | unknown | false |
lazyUv | function lazyUv() {
uvBinding ??= internalBinding('uv');
return uvBinding;
} | This function removes unnecessary frames from Node.js core errors.
@template {(...args: unknown[]) => unknown} T
@param {T} fn
@returns {T} | javascript | lib/internal/errors.js | 622 | [] | false | 1 | 6 | nodejs/node | 114,839 | jsdoc | false | |
readLine | @CanIgnoreReturnValue // to skip a line
public @Nullable String readLine() throws IOException {
while (lines.peek() == null) {
Java8Compatibility.clear(cbuf);
// The default implementation of Reader#read(CharBuffer) allocates a
// temporary char[], so we call Reader#read(char[], int, int) instea... | Reads a line of text. A line is considered to be terminated by any one of a line feed ({@code
'\n'}), a carriage return ({@code '\r'}), or a carriage return followed immediately by a
linefeed ({@code "\r\n"}).
@return a {@code String} containing the contents of the line, not including any
line-termination character... | java | android/guava/src/com/google/common/io/LineReader.java | 70 | [] | String | true | 4 | 8.24 | google/guava | 51,352 | javadoc | false |
asMap | public Map<K, Long> asMap() {
Map<K, Long> result = asMap;
return (result == null) ? asMap = createAsMap() : result;
} | Returns a live, read-only view of the map backing this {@code AtomicLongMap}. | java | android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java | 332 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
putIfAbsent | @Override
public @Nullable ValueWrapper putIfAbsent(Object key, @Nullable Object value) {
Object previous = this.cache.invoke(key, PutIfAbsentEntryProcessor.INSTANCE, toStoreValue(value));
return (previous != null ? toValueWrapper(previous) : null);
} | Create a {@code JCacheCache} instance.
@param jcache backing JCache Cache instance
@param allowNullValues whether to accept and convert null values for this cache | java | spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCache.java | 102 | [
"key",
"value"
] | ValueWrapper | true | 2 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
computeCostFor | unsigned computeCostFor(const BinaryFunction &BF,
const PredicateTy &SkipPredicate,
const SchedulingPolicy &SchedPolicy) {
if (SchedPolicy == SchedulingPolicy::SP_TRIVIAL)
return 1;
if (SkipPredicate && SkipPredicate(BF))
return 0;
switch (SchedPolicy) {
... | A single thread pool that is used to run parallel tasks | cpp | bolt/lib/Core/ParallelUtilities.cpp | 54 | [] | true | 10 | 6.4 | llvm/llvm-project | 36,021 | doxygen | false | |
make_report | def make_report() -> list[Query]:
"""
Returns a list of Query objects that are expected to be run during the performance run.
"""
queries = []
with open(LOG_FILE, "r+") as f:
raw_queries = [line for line in f.readlines() if is_query(line)]
for query in raw_queries:
time, info, s... | Returns a list of Query objects that are expected to be run during the performance run. | python | dev/airflow_perf/sql_queries.py | 142 | [] | list[Query] | true | 2 | 7.04 | apache/airflow | 43,597 | unknown | false |
appendExportsOfDeclaration | function appendExportsOfDeclaration(statements: Statement[] | undefined, decl: Declaration, excludeName?: string): Statement[] | undefined {
if (moduleInfo.exportEquals) {
return statements;
}
const name = factory.getDeclarationName(decl);
const exportSpecifiers = modu... | Appends the exports of a declaration to a statement list, returning the statement list.
@param statements A statement list to which the down-level export statements are to be
appended. If `statements` is `undefined`, a new array is allocated if statements are
appended.
@param decl The declaration to export.
@para... | typescript | src/compiler/transformers/module/system.ts | 1,160 | [
"statements",
"decl",
"excludeName?"
] | true | 4 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
visitTopLevelImportDeclaration | function visitTopLevelImportDeclaration(node: ImportDeclaration): VisitResult<Statement | undefined> {
let statements: Statement[] | undefined;
const namespaceDeclaration = getNamespaceDeclarationNode(node) as NamespaceImport | undefined;
if (moduleKind !== ModuleKind.AMD) {
if (... | Visits an ImportDeclaration node.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 1,437 | [
"node"
] | true | 14 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
thresholdMapper | private @Nullable String thresholdMapper(@Nullable String input) {
// YAML converts an unquoted OFF to false
if ("false".equals(input)) {
return "OFF";
}
return input;
} | Returns the default file charset.
@return the default file charset
@since 3.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java | 206 | [
"input"
] | String | true | 2 | 7.2 | spring-projects/spring-boot | 79,428 | javadoc | false |
handleChannelMuteEvent | public void handleChannelMuteEvent(ChannelMuteEvent event) {
boolean stateChanged = false;
switch (event) {
case REQUEST_RECEIVED:
if (muteState == ChannelMuteState.MUTED) {
muteState = ChannelMuteState.MUTED_AND_RESPONSE_PENDING;
state... | Unmute the channel. The channel can be unmuted only if it is in the MUTED state. For other muted states
(MUTED_AND_*), this is a no-op.
@return Whether or not the channel is in the NOT_MUTED state after the call | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 274 | [
"event"
] | void | true | 8 | 7.04 | apache/kafka | 31,560 | javadoc | false |
fchown | function fchown(fd, uid, gid, callback) {
validateInteger(uid, 'uid', -1, kMaxUserId);
validateInteger(gid, 'gid', -1, kMaxUserId);
callback = makeCallback(callback);
if (permission.isEnabled()) {
callback(new ERR_ACCESS_DENIED('fchown API is disabled when Permission Model is enabled.'));
return;
}
... | Sets the owner of the file.
@param {number} fd
@param {number} uid
@param {number} gid
@param {(err?: Error) => any} callback
@returns {void} | javascript | lib/fs.js | 2,072 | [
"fd",
"uid",
"gid",
"callback"
] | false | 2 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
listPartitionReassignments | default ListPartitionReassignmentsResult listPartitionReassignments(
Set<TopicPartition> partitions,
ListPartitionReassignmentsOptions options) {
return listPartitionReassignments(Optional.of(partitions), options);
} | List the current reassignments for the given partitions
<p>The following exceptions can be anticipated when calling {@code get()} on the futures obtained from
the returned {@code ListPartitionReassignmentsResult}:</p>
<ul>
<li>{@link org.apache.kafka.common.errors.ClusterAuthorizationException}
If the authenticated... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,223 | [
"partitions",
"options"
] | ListPartitionReassignmentsResult | true | 1 | 6.24 | apache/kafka | 31,560 | javadoc | false |
_with_freq | def _with_freq(self, freq) -> Self:
"""
Helper to get a view on the same data, with a new freq.
Parameters
----------
freq : DateOffset, None, or "infer"
Returns
-------
Same type as self
"""
# GH#29843
if freq is None:
... | Helper to get a view on the same data, with a new freq.
Parameters
----------
freq : DateOffset, None, or "infer"
Returns
-------
Same type as self | python | pandas/core/arrays/datetimelike.py | 2,441 | [
"self",
"freq"
] | Self | true | 7 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
resolve | Stream<PropertyDescriptor> resolve(TypeElement type, ExecutableElement factoryMethod) {
TypeElementMembers members = new TypeElementMembers(this.environment, type);
if (factoryMethod != null) {
return resolveJavaBeanProperties(type, members, factoryMethod);
}
return resolve(Bindable.of(type, this.environment... | Return the {@link PropertyDescriptor} instances that are valid candidates for the
specified {@link TypeElement type} based on the specified {@link ExecutableElement
factory method}, if any.
@param type the target type
@param factoryMethod the method that triggered the metadata for that {@code type}
or {@code null}
@ret... | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolver.java | 61 | [
"type",
"factoryMethod"
] | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
timeToNextHeartbeat | protected synchronized long timeToNextHeartbeat(long now) {
// if we have not joined the group or we are preparing rebalance,
// we don't need to send heartbeats
if (state.hasNotJoinedGroup())
return Long.MAX_VALUE;
if (heartbeatThread != null && heartbeatThread.isFailed()) {... | Check the status of the heartbeat thread (if it is active) and indicate the liveness
of the client. This must be called periodically after joining with {@link #ensureActiveGroup()}
to ensure that the member stays in the group. If an interval of time longer than the
provided rebalance timeout expires without calling thi... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 385 | [
"now"
] | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
format | public static String format(final long millis, final String pattern) {
return format(new Date(millis), pattern, null, null);
} | Formats a date/time into a specific pattern.
@param millis the date to format expressed in milliseconds.
@param pattern the pattern to use to format the date, not null.
@return the formatted date. | java | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | 315 | [
"millis",
"pattern"
] | String | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
trimResults | public Splitter trimResults() {
return trimResults(CharMatcher.whitespace());
} | Returns a splitter that behaves equivalently to {@code this} splitter, but automatically
removes leading and trailing {@linkplain CharMatcher#whitespace whitespace} from each returned
substring; equivalent to {@code trimResults(CharMatcher.whitespace())}. For example, {@code
Splitter.on(',').trimResults().split(" a, b ... | java | android/guava/src/com/google/common/base/Splitter.java | 340 | [] | Splitter | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false |
name | def name(self) -> Hashable:
"""
Return the name of the Series.
The name of a Series becomes its index or column name if it is used
to form a DataFrame. It is also used whenever displaying the Series
using the interpreter.
Returns
-------
label (hashable ... | Return the name of the Series.
The name of a Series becomes its index or column name if it is used
to form a DataFrame. It is also used whenever displaying the Series
using the interpreter.
Returns
-------
label (hashable object)
The name of the Series, also the column name if part of a DataFrame.
See Also
-----... | python | pandas/core/series.py | 695 | [
"self"
] | Hashable | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | unknown | false |
setLogLevel | private void setLogLevel(@Nullable String loggerName, @Nullable Level level) {
LoggerConfig logger = getLogger(loggerName);
if (level == null) {
clearLogLevel(loggerName, logger);
}
else {
setLogLevel(loggerName, logger, level);
}
getLoggerContext().updateLoggers();
} | 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 | 357 | [
"loggerName",
"level"
] | void | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
createProperties | protected Properties createProperties() throws IOException {
return mergeProperties();
} | Template method that subclasses may override to construct the object
returned by this factory. The default implementation returns the
plain merged Properties instance.
<p>Invoked on initialization of this FactoryBean in case of a
shared singleton; else, on each {@link #getObject()} call.
@return the object returned by ... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/PropertiesFactoryBean.java | 103 | [] | Properties | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
zeros_like | def zeros_like(
a, dtype=None, order='K', subok=True, shape=None, *, device=None
):
"""
Return an array of zeros with the same shape and type as a given array.
Parameters
----------
a : array_like
The shape and data-type of `a` define these same attributes of
the returned array.... | Return an array of zeros with the same shape and type as a given array.
Parameters
----------
a : array_like
The shape and data-type of `a` define these same attributes of
the returned array.
dtype : data-type, optional
Overrides the data type of the result.
order : {'C', 'F', 'A', or 'K'}, optional
Ov... | python | numpy/_core/numeric.py | 98 | [
"a",
"dtype",
"order",
"subok",
"shape",
"device"
] | false | 1 | 6.56 | numpy/numpy | 31,054 | numpy | false | |
_get_libstdcxx_args | def _get_libstdcxx_args() -> tuple[list[str], list[str]]:
"""
For fbcode cpu case, we should link stdc++ instead assuming the binary where dlopen is executed is built with dynamic stdc++.
"""
lib_dir_paths: list[str] = []
libs: list[str] = []
if config.is_fbcode():
lib_dir_paths = [sysco... | For fbcode cpu case, we should link stdc++ instead assuming the binary where dlopen is executed is built with dynamic stdc++. | python | torch/_inductor/cpp_builder.py | 1,413 | [] | tuple[list[str], list[str]] | true | 2 | 6.88 | pytorch/pytorch | 96,034 | unknown | false |
evalTypeScriptModuleEntryPoint | function evalTypeScriptModuleEntryPoint(source, print) {
if (print) {
throw new ERR_EVAL_ESM_CANNOT_PRINT();
}
RegExpPrototypeExec(/^/, ''); // Necessary to reset RegExp statics before user code runs.
return require('internal/modules/run_main').runEntryPointWithESMLoader(
async (loader) => {
con... | Wrapper of evalModuleEntryPoint
This function wraps the compilation of the source code in a try-catch block.
If the source code fails to be compiled, it will retry transpiling the source code
with the TypeScript parser.
@param {string} source The source code to evaluate
@param {boolean} print If the result should be pr... | javascript | lib/internal/process/execution.js | 308 | [
"source",
"print"
] | false | 6 | 6.08 | nodejs/node | 114,839 | jsdoc | true | |
parse | @Override
public Value parse(XContentParser parser, Context context) throws IOException {
return parse(parser, valueBuilder.apply(context), context);
} | Parses a Value from the given {@link XContentParser}
@param parser the parser to build a value from
@param context context needed for parsing
@return a new value instance drawn from the provided value supplier on {@link #ObjectParser(String, Supplier)}
@throws IOException if an IOException occurs. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java | 258 | [
"parser",
"context"
] | Value | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false |
stableSort | public static void stableSort(TDigestIntArray order, TDigestDoubleArray values, int n) {
for (int i = 0; i < n; i++) {
order.set(i, i);
}
stableQuickSort(order, values, 0, n, 64);
stableInsertionSort(order, values, 0, n, 64);
} | Single-key stabilized quick sort on using an index array
@param order Indexes into values
@param values The values to sort.
@param n The number of values to sort | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/Sort.java | 42 | [
"order",
"values",
"n"
] | void | true | 2 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
round_ | def round_(a, decimals=0, out=None):
"""
Return a copy of a, rounded to 'decimals' places.
When 'decimals' is negative, it specifies the number of positions
to the left of the decimal point. The real and imaginary parts of
complex numbers are rounded separately. Nothing is done if the
array is... | Return a copy of a, rounded to 'decimals' places.
When 'decimals' is negative, it specifies the number of positions
to the left of the decimal point. The real and imaginary parts of
complex numbers are rounded separately. Nothing is done if the
array is not of float type and 'decimals' is greater than or equal
to 0.
... | python | numpy/ma/core.py | 8,081 | [
"a",
"decimals",
"out"
] | false | 4 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
poll | @Override
public ConsumerRecords<K, V> poll(Duration timeout) {
return delegate.poll(timeout);
} | Deliver records for the topics specified using {@link #subscribe(Collection)}. It is an error to not have
subscribed to any topics before polling for data.
<p>
This method returns immediately if there are records available. Otherwise, it will await the passed timeout.
If the timeout expires, an empty record set will be... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaShareConsumer.java | 554 | [
"timeout"
] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
encode_log_result | def encode_log_result(log_result: str, *, keep_empty_lines: bool = True) -> list[str] | None:
"""
Encode execution log from the response and return list of log records.
Returns ``None`` on error, e.g. invalid base64-encoded string
:param log_result: base64-encoded string which contain ... | Encode execution log from the response and return list of log records.
Returns ``None`` on error, e.g. invalid base64-encoded string
:param log_result: base64-encoded string which contain Lambda execution Log.
:param keep_empty_lines: Whether or not keep empty lines. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/lambda_function.py | 199 | [
"log_result",
"keep_empty_lines"
] | list[str] | None | true | 2 | 6.72 | apache/airflow | 43,597 | sphinx | false |
failure_message_from_response | def failure_message_from_response(response: dict[str, Any]) -> str | None:
"""
Get failure message from response dictionary.
:param response: response from AWS API
:return: failure message
"""
cluster_status = response["Cluster"]["Status"]
state_change_reason = c... | Get failure message from response dictionary.
:param response: response from AWS API
:return: failure message | python | providers/amazon/src/airflow/providers/amazon/aws/sensors/emr.py | 501 | [
"response"
] | str | None | true | 2 | 7.76 | apache/airflow | 43,597 | sphinx | false |
contains | public static boolean contains(boolean[] array, boolean target) {
for (boolean value : array) {
if (value == target) {
return true;
}
}
return false;
} | Returns {@code true} if {@code target} is present as an element anywhere in {@code array}.
<p><b>Note:</b> consider representing the array as a {@link java.util.BitSet} instead,
replacing {@code Booleans.contains(array, true)} with {@code !bitSet.isEmpty()} and {@code
Booleans.contains(array, false)} with {@code bitSet... | java | android/guava/src/com/google/common/primitives/Booleans.java | 141 | [
"array",
"target"
] | true | 2 | 7.6 | google/guava | 51,352 | javadoc | false | |
noneMatcher | public static StrMatcher noneMatcher() {
return NONE_MATCHER;
} | Gets the matcher for no characters.
@return the matcher that matches nothing. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 304 | [] | StrMatcher | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
trySubstituteClassAlias | function trySubstituteClassAlias(node: Identifier): Expression | undefined {
if (enabledSubstitutions & ClassPropertySubstitutionFlags.ClassAliases) {
if (resolver.hasNodeCheckFlag(node, NodeCheckFlags.ConstructorReference)) {
// Due to the emit for class decorators, any reference... | Hooks node substitutions.
@param hint The context for the emitter.
@param node The node to substitute. | typescript | src/compiler/transformers/classFields.ts | 3,293 | [
"node"
] | true | 5 | 7.04 | microsoft/TypeScript | 107,154 | jsdoc | false | |
addAndGet | public <T> T addAndGet(final CompletableApplicationEvent<T> event) {
Objects.requireNonNull(event, "CompletableApplicationEvent provided to addAndGet must be non-null");
add(event);
// Check if the thread was interrupted before we start waiting, to ensure that we
// propagate the excepti... | Add a {@link CompletableApplicationEvent} to the handler. The method blocks waiting for the result, and will
return the result value upon successful completion; otherwise throws an error.
<p/>
See {@link ConsumerUtils#getResult(Future)} for more details.
@param event A {@link CompletableApplicationEvent} created by the... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventHandler.java | 135 | [
"event"
] | T | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false |
_fix_int_lt_zero | def _fix_int_lt_zero(x):
"""Convert `x` to double if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> import numpy as np
>>> np.li... | Convert `x` to double if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> import numpy as np
>>> np.lib.scimath._fix_int_lt_zero([1,2])
array([1, 2])
>>> np.lib.scimath._fix_int... | python | numpy/lib/_scimath_impl.py | 125 | [
"x"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
upperCase | Alphabet upperCase() {
if (!hasLowerCase()) {
return this;
}
checkState(!hasUpperCase(), "Cannot call upperCase() on a mixed-case alphabet");
char[] upperCased = new char[chars.length];
for (int i = 0; i < chars.length; i++) {
upperCased[i] = Ascii.toUpperCase(chars[i]);
... | Returns an equivalent {@code Alphabet} except it ignores case. | java | android/guava/src/com/google/common/io/BaseEncoding.java | 566 | [] | Alphabet | true | 4 | 6.4 | google/guava | 51,352 | javadoc | false |
getAndAdd | public double getAndAdd(final Number operand) {
final double last = value;
this.value += operand.doubleValue();
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/MutableDouble.java | 238 | [
"operand"
] | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false | |
forLogLevel | public static ConditionEvaluationReportLoggingListener forLogLevel(LogLevel logLevelForReport) {
return new ConditionEvaluationReportLoggingListener(logLevelForReport);
} | Static factory method that creates a
{@link ConditionEvaluationReportLoggingListener} which logs the report at the
specified log level.
@param logLevelForReport the log level to log the report at
@return a {@link ConditionEvaluationReportLoggingListener} instance.
@since 3.0.0 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java | 78 | [
"logLevelForReport"
] | ConditionEvaluationReportLoggingListener | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
containsValue | @Override
public boolean containsValue(@Nullable Object value) {
return seekByValue(value, smearedHash(value)) != null;
} | Returns {@code true} if this BiMap contains an entry whose value is equal to {@code value} (or,
equivalently, if this inverse view contains a key that is equal to {@code value}).
<p>Due to the property that values in a BiMap are unique, this will tend to execute in
faster-than-linear time.
@param value the object to se... | java | guava/src/com/google/common/collect/HashBiMap.java | 305 | [
"value"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
isStaticSymbol | function isStaticSymbol(symbol: Symbol): boolean {
if (!symbol.valueDeclaration) return false;
const modifierFlags = getEffectiveModifierFlags(symbol.valueDeclaration);
return !!(modifierFlags & ModifierFlags.Static);
} | Find symbol of the given property-name and add the symbol to the given result array
@param symbol a symbol to start searching for the given propertyName
@param propertyName a name of property to search for
@param result an array of symbol of found property symbols
@param previousIterationSymbolsCache a cache of sym... | typescript | src/services/findAllReferences.ts | 2,695 | [
"symbol"
] | true | 2 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
join | function join(head: IMatch, tail: IMatch[]): IMatch[] {
if (tail.length === 0) {
tail = [head];
} else if (head.end === tail[0].start) {
tail[0].start = head.start;
} else {
tail.unshift(head);
}
return tail;
} | Gets alternative codes to the character code passed in. This comes in the
form of an array of character codes, all of which must match _in order_ to
successfully match.
@param code The character code to check. | typescript | src/vs/base/common/filters.ts | 193 | [
"head",
"tail"
] | true | 5 | 7.04 | microsoft/vscode | 179,840 | jsdoc | false | |
check_docker_context_files | def check_docker_context_files(install_distributions_from_context: bool):
"""
Quick check - if we want to install from docker-context-files we expect some packages there but if
we don't - we don't expect them, and they might invalidate Docker cache.
This method exits with an error if what we see is une... | Quick check - if we want to install from docker-context-files we expect some packages there but if
we don't - we don't expect them, and they might invalidate Docker cache.
This method exits with an error if what we see is unexpected for given operation.
:param install_distributions_from_context: whether we want to in... | python | dev/breeze/src/airflow_breeze/commands/production_image_commands.py | 822 | [
"install_distributions_from_context"
] | true | 7 | 6.88 | apache/airflow | 43,597 | sphinx | false | |
detect | public static DurationStyle detect(String value) {
Assert.notNull(value, "'value' must not be null");
for (DurationStyle candidate : values()) {
if (candidate.matches(value)) {
return candidate;
}
}
throw new IllegalArgumentException("'" + value + "' is not a valid duration");
} | Detect the style from the given source value.
@param value the source value
@return the duration style
@throws IllegalArgumentException if the value is not a known style | java | core/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java | 166 | [
"value"
] | DurationStyle | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
getClassEntries | private static List<JarEntry> getClassEntries(JarFile source, @Nullable String classesLocation) {
classesLocation = (classesLocation != null) ? classesLocation : "";
Enumeration<JarEntry> sourceEntries = source.entries();
List<JarEntry> classEntries = new ArrayList<>();
while (sourceEntries.hasMoreElements()) {... | Perform the given callback operation on all main classes from the given jar.
@param <T> the result type
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@param callback the callback
@return the first callback result or {@code null}
@throws IOException in case o... | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 248 | [
"source",
"classesLocation"
] | true | 5 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
onTasksRevokedCallbackCompleted | public void onTasksRevokedCallbackCompleted(final StreamsOnTasksRevokedCallbackCompletedEvent event) {
Optional<KafkaException> error = event.error();
CompletableFuture<Void> future = event.future();
if (error.isPresent()) {
Exception e = error.get();
log.warn("The onTas... | Completes the future that marks the completed execution of the onTasksRevoked callback.
@param event The event containing the future sent from the application thread to the network thread to
confirm the execution of the callback. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 1,299 | [
"event"
] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
readAdditionalMetadata | ConfigurationMetadata readAdditionalMetadata(TypeElement typeElement) {
return readAdditionalMetadata(ADDITIONAL_SOURCE_METADATA_PATH.apply(typeElement, this.typeUtils));
} | Read additional {@link ConfigurationMetadata} for the {@link TypeElement} or
{@code null}.
@param typeElement the type to get additional metadata for
@return additional metadata for the given type or {@code null} if none is present | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java | 146 | [
"typeElement"
] | ConfigurationMetadata | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
clearMergedBeanDefinition | @Override
protected void clearMergedBeanDefinition(String beanName) {
super.clearMergedBeanDefinition(beanName);
this.mergedBeanDefinitionHolders.remove(beanName);
} | Determine whether the specified bean definition qualifies as an autowire candidate,
to be injected into other beans which declare a dependency of matching type.
@param beanName the name of the bean definition to check
@param mbd the merged bean definition to check
@param descriptor the descriptor of the dependency to r... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 984 | [
"beanName"
] | void | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
appendExportsOfVariableDeclarationList | function appendExportsOfVariableDeclarationList(statements: Statement[] | undefined, node: VariableDeclarationList, isForInOrOfInitializer: boolean): Statement[] | undefined {
if (currentModuleInfo.exportEquals) {
return statements;
}
for (const decl of node.declarations) {
... | Appends the exports of a VariableDeclarationList to a statement list, returning the statement
list.
@param statements A statement list to which the down-level export statements are to be
appended. If `statements` is `undefined`, a new array is allocated if statements are
appended.
@param node The VariableDeclarat... | typescript | src/compiler/transformers/module/module.ts | 2,033 | [
"statements",
"node",
"isForInOrOfInitializer"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getSharedStyleSheet | function getSharedStyleSheet(): HTMLStyleElement {
if (!_sharedStyleSheet) {
_sharedStyleSheet = createStyleSheet();
}
return _sharedStyleSheet;
} | A version of createStyleSheet which has a unified API to initialize/set the style content. | typescript | src/vs/base/browser/domStylesheets.ts | 115 | [] | true | 2 | 6.56 | microsoft/vscode | 179,840 | jsdoc | false | |
lazyGetProceedingJoinPoint | protected ProceedingJoinPoint lazyGetProceedingJoinPoint(ProxyMethodInvocation rmi) {
return new MethodInvocationProceedingJoinPoint(rmi);
} | Return the ProceedingJoinPoint for the current invocation,
instantiating it lazily if it hasn't been bound to the thread already.
@param rmi the current Spring AOP ReflectiveMethodInvocation,
which we'll use for attribute binding
@return the ProceedingJoinPoint to make available to advice methods | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAroundAdvice.java | 80 | [
"rmi"
] | ProceedingJoinPoint | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
isNested | private static boolean isNested(Class<?> type, Class<?> candidate) {
if (type.isAssignableFrom(candidate)) {
return true;
}
return (candidate.getDeclaringClass() != null && isNested(type, candidate.getDeclaringClass()));
} | Specify whether the specified property refer to a nested type. A nested type
represents a sub-namespace that need to be fully resolved. Nested types are
either inner classes or annotated with {@link NestedConfigurationProperty}.
@param propertyName the name of the property
@param propertyType the type of the property
@... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java | 323 | [
"type",
"candidate"
] | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
serialize_hoo_outputs | def serialize_hoo_outputs(self, node: torch.fx.Node) -> list[Argument]:
"""
For serializing HOO outputs since HOOs do not have a schema.
"""
meta_val = node.meta["val"]
if isinstance(meta_val, tuple):
outputs = []
for i, element_meta_val in enumerate(meta... | For serializing HOO outputs since HOOs do not have a schema. | python | torch/_export/serde/serialize.py | 1,738 | [
"self",
"node"
] | list[Argument] | true | 12 | 6 | pytorch/pytorch | 96,034 | unknown | false |
getObject | @Override
default T getObject() throws BeansException {
Iterator<T> it = iterator();
if (!it.hasNext()) {
throw new NoSuchBeanDefinitionException(Object.class);
}
T result = it.next();
if (it.hasNext()) {
throw new NoUniqueBeanDefinitionException(Object.class, 2, "more than 1 matching bean");
}
ret... | A predicate for unfiltered type matches, including non-default candidates
but still excluding non-autowire candidates when used on injection points.
@since 6.2.3
@see #stream(Predicate)
@see #orderedStream(Predicate)
@see org.springframework.beans.factory.config.BeanDefinition#isAutowireCandidate()
@see org.springframe... | java | spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java | 85 | [] | T | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
on_chord_header_start | def on_chord_header_start(self, sig, **header) -> dict:
"""Method that is called on сhord header stamping start.
Arguments:
sig (chord): chord that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: hea... | Method that is called on сhord header stamping start.
Arguments:
sig (chord): chord that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: headers to update. | python | celery/canvas.py | 175 | [
"self",
"sig"
] | dict | true | 2 | 8.08 | celery/celery | 27,741 | google | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.