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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kafkaCompleteExceptionally | boolean kafkaCompleteExceptionally(Throwable throwable) {
return super.completeExceptionally(throwable);
} | Completes this future exceptionally. For internal use by the Kafka clients, not by user code.
@param throwable the exception.
@return {@code true} if this invocation caused this CompletableFuture
to transition to a completed state, else {@code false} | java | clients/src/main/java/org/apache/kafka/common/internals/KafkaCompletableFuture.java | 48 | [
"throwable"
] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
put | public JSONObject put(String name, boolean value) throws JSONException {
this.nameValuePairs.put(checkName(name), value);
return this;
} | Maps {@code name} to {@code value}, clobbering any existing name/value mapping with
the same name.
@param name the name of the property
@param value the value of the property
@return this object.
@throws JSONException if an error occurs | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 205 | [
"name",
"value"
] | JSONObject | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false |
entryToFunctionCall | function entryToFunctionCall(entry: FindAllReferences.NodeEntry): CallExpression | NewExpression | undefined {
if (entry.node.parent) {
const functionReference = entry.node;
const parent = functionReference.parent;
switch (parent.kind) {
// foo(...) or super(...) or new Foo(... | Gets the symbol for the contextual type of the node if it is not a union or intersection. | typescript | src/services/refactors/convertParamsToDestructuredObject.ts | 365 | [
"entry"
] | true | 14 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
get_cdxgen_port_mapping | def get_cdxgen_port_mapping(parallelism: int, pool: Pool) -> dict[str, int]:
"""
Map processes from pool to port numbers so that there is always the same port
used by the same process in the pool - effectively having one multiprocessing
process talking to the same cdxgen server
:param parallelism: ... | Map processes from pool to port numbers so that there is always the same port
used by the same process in the pool - effectively having one multiprocessing
process talking to the same cdxgen server
:param parallelism: parallelism to use
:param pool: pool to map ports for
:return: mapping of process name to port | python | dev/breeze/src/airflow_breeze/utils/cdxgen.py | 126 | [
"parallelism",
"pool"
] | dict[str, int] | true | 1 | 6.24 | apache/airflow | 43,597 | sphinx | false |
createBatchOffAccumulatorForRecord | private ProducerBatch createBatchOffAccumulatorForRecord(Record record, int batchSize) {
int initialSize = Math.max(AbstractRecords.estimateSizeInBytesUpperBound(magic(),
recordsBuilder.compression().type(), record.key(), record.value(), record.headers()), batchSize);
ByteBuffer buffer =... | Finalize the state of a batch. Final state, once set, is immutable. This function may be called
once or twice on a batch. It may be called twice if
1. An inflight batch expires before a response from the broker is received. The batch's final
state is set to FAILED. But it could succeed on the broker and second time aro... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java | 403 | [
"record",
"batchSize"
] | ProducerBatch | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
categorize_connections | def categorize_connections(self, connection_ids: set) -> tuple[dict, set, set]:
"""
Categorize the given connection_ids into matched_connection_ids and not_found_connection_ids based on existing connection_ids.
Existed connections are returned as a dict of {connection_id : Connection}.
... | Categorize the given connection_ids into matched_connection_ids and not_found_connection_ids based on existing connection_ids.
Existed connections are returned as a dict of {connection_id : Connection}.
:param connection_ids: set of connection_ids
:return: tuple of dict of existed connections, set of matched connecti... | python | airflow-core/src/airflow/api_fastapi/core_api/services/public/connections.py | 84 | [
"self",
"connection_ids"
] | tuple[dict, set, set] | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
pow | public Fraction pow(final int power) {
if (power == 1) {
return this;
}
if (power == 0) {
return ONE;
}
if (power < 0) {
if (power == Integer.MIN_VALUE) { // MIN_VALUE can't be negated.
return invert().pow(2).pow(-(power / 2));
... | Gets a fraction that is raised to the passed in power.
<p>
The returned fraction is in reduced form.
</p>
@param power the power to raise the fraction to
@return {@code this} if the power is one, {@link #ONE} if the power is zero (even if the fraction equals ZERO) or a new fraction instance raised to the
approp... | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 820 | [
"power"
] | Fraction | true | 6 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
main | public final int main(String[] args, Terminal terminal, ProcessInfo processInfo) throws IOException {
try {
mainWithoutErrorHandling(args, terminal, processInfo);
} catch (OptionException e) {
// print help to stderr on exceptions
printHelp(terminal, true);
... | Parses options for this command from args and executes it. | java | libs/cli/src/main/java/org/elasticsearch/cli/Command.java | 52 | [
"args",
"terminal",
"processInfo"
] | true | 6 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
wrapRelativePattern | function wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string | IRelativePattern, options: IGlobOptionsInternal): ParsedStringPattern {
if (typeof arg2 === 'string') {
return parsedPattern;
}
const wrappedPattern: ParsedStringPattern = function (path, basename) {
if (!options.isEqualOrParent(pat... | Check if a provided parsed pattern or expression
is empty - hence it won't ever match anything.
See {@link FALSE} and {@link NULL}. | typescript | src/vs/base/common/glob.ts | 395 | [
"parsedPattern",
"arg2",
"options"
] | true | 3 | 6 | microsoft/vscode | 179,840 | jsdoc | false | |
bucket_fsdp_reduce_scatter | def bucket_fsdp_reduce_scatter(
gm: torch.fx.GraphModule,
bucket_cap_mb_by_bucket_idx: Callable[[int], float] | None = None,
mode: BucketMode = "default",
) -> None:
"""
Bucketing pass for SimpleFSDP reduce_scatter ops.
Attributes:
gm (torch.fx.GraphModule): Graph module of the graph.
... | Bucketing pass for SimpleFSDP reduce_scatter ops.
Attributes:
gm (torch.fx.GraphModule): Graph module of the graph.
bucket_cap_mb_by_bucket_idx (Callable[[int], float] | None): callback function that
takes in bucket idx and returns size of a bucket in megabytes. By default
torch._inductor.fx_pa... | python | torch/_inductor/fx_passes/fsdp.py | 87 | [
"gm",
"bucket_cap_mb_by_bucket_idx",
"mode"
] | None | true | 3 | 6.24 | pytorch/pytorch | 96,034 | unknown | false |
addOrMerge | public static void addOrMerge(Map<String, Object> source, MutablePropertySources sources) {
if (!CollectionUtils.isEmpty(source)) {
Map<String, Object> resultingSource = new HashMap<>();
DefaultPropertiesPropertySource propertySource = new DefaultPropertiesPropertySource(resultingSource);
if (sources.contain... | Add a new {@link DefaultPropertiesPropertySource} or merge with an existing one.
@param source the {@code Map} source
@param sources the existing sources
@since 2.4.4 | java | core/spring-boot/src/main/java/org/springframework/boot/env/DefaultPropertiesPropertySource.java | 85 | [
"source",
"sources"
] | void | true | 3 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
resolve | @Nullable File resolve(String originalName, String newName) throws IOException; | Resolves the given name to a file.
@param originalName the original name of the file
@param newName the new name of the file
@return file where the contents should be written or {@code null} if this name
should be skipped
@throws IOException if something went wrong | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/ExtractCommand.java | 390 | [
"originalName",
"newName"
] | File | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
toShort | public Short toShort() {
return Short.valueOf(shortValue());
} | Gets this mutable as an instance of Short.
@return a Short instance containing the value from this mutable, never null. | java | src/main/java/org/apache/commons/lang3/mutable/MutableShort.java | 373 | [] | Short | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
performPendingMetricsOperations | private void performPendingMetricsOperations() {
modifyMetricsLock.lock();
try {
log.trace("{}: entering performPendingMetricsOperations", suiteName);
for (PendingMetricsChange change = pending.pollLast();
change != null;
change = pending.pollLas... | Perform pending metrics additions or removals.
It is important to perform them in order. For example, we don't want to try
to remove a metric that we haven't finished adding yet. | java | clients/src/main/java/org/apache/kafka/common/metrics/internals/IntGaugeSuite.java | 211 | [] | void | true | 5 | 7.04 | apache/kafka | 31,560 | javadoc | false |
resolveScopeName | protected @Nullable String resolveScopeName(String annotationType) {
return this.scopeMap.get(annotationType);
} | Resolve the given annotation type into a named Spring scope.
<p>The default implementation simply checks against registered scopes.
Can be overridden for custom mapping rules, for example, naming conventions.
@param annotationType the JSR-330 annotation type
@return the Spring scope name | java | spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java | 81 | [
"annotationType"
] | String | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
hasAllFetchPositions | public synchronized boolean hasAllFetchPositions() {
// Since this is in the hot-path for fetching, we do this instead of using java.util.stream API
Iterator<TopicPartitionState> it = assignment.stateIterator();
while (it.hasNext()) {
if (!it.next().hasValidPosition()) {
... | Unset the preferred read replica. This causes the fetcher to go back to the leader for fetches.
@param tp The topic partition
@return the removed preferred read replica if set, Empty otherwise. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 826 | [] | true | 3 | 8.4 | apache/kafka | 31,560 | javadoc | false | |
decorateBeanDefinitionIfRequired | public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele, BeanDefinitionHolder originalDef) {
return decorateBeanDefinitionIfRequired(ele, originalDef, null);
} | Decorate the given bean definition through a namespace handler, if applicable.
@param ele the current element
@param originalDef the current bean definition
@return the decorated bean definition | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java | 1,388 | [
"ele",
"originalDef"
] | BeanDefinitionHolder | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
toArray | @GwtIncompatible // Array.newArray(Class, int)
public final E[] toArray(Class<@NonNull E> type) {
return Iterables.<E>toArray(getDelegate(), type);
} | Returns an array containing all of the elements from this fluent iterable in iteration order.
<p><b>{@code Stream} equivalent:</b> if an object array is acceptable, use {@code
stream.toArray()}; if {@code type} is a class literal such as {@code MyType.class}, use {@code
stream.toArray(MyType[]::new)}. Otherwise use {@c... | java | android/guava/src/com/google/common/collect/FluentIterable.java | 785 | [
"type"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
hashMember | private static int hashMember(final String name, final Object value) {
final int part1 = name.hashCode() * 127;
if (ObjectUtils.isArray(value)) {
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
}
if (value instanceof Annotation) {
retur... | Helper method for generating a hash code for a member of an annotation.
@param name the name of the member
@param value the value of the member
@return a hash code for this member | java | src/main/java/org/apache/commons/lang3/AnnotationUtils.java | 264 | [
"name",
"value"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
instantiateWithFactoryMethod | public static <T> T instantiateWithFactoryMethod(Method method, Supplier<T> instanceSupplier) {
Method priorInvokedFactoryMethod = currentlyInvokedFactoryMethod.get();
try {
currentlyInvokedFactoryMethod.set(method);
return instanceSupplier.get();
}
finally {
if (priorInvokedFactoryMethod != null) {
... | Invoke the given {@code instanceSupplier} with the factory method exposed
as being invoked.
@param method the factory method to expose
@param instanceSupplier the instance supplier
@param <T> the type of the instance
@return the result of the instance supplier
@since 6.2 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java | 68 | [
"method",
"instanceSupplier"
] | T | true | 2 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
setdiff1d | def setdiff1d(ar1, ar2, assume_unique=False):
"""
Find the set difference of two arrays.
Return the unique values in `ar1` that are not in `ar2`.
Parameters
----------
ar1 : array_like
Input array.
ar2 : array_like
Input comparison array.
assume_unique : bool
If... | Find the set difference of two arrays.
Return the unique values in `ar1` that are not in `ar2`.
Parameters
----------
ar1 : array_like
Input array.
ar2 : array_like
Input comparison array.
assume_unique : bool
If True, the input arrays are both assumed to be unique, which
can speed up the calculation.... | python | numpy/lib/_arraysetops_impl.py | 1,121 | [
"ar1",
"ar2",
"assume_unique"
] | false | 3 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
visitExportAssignment | function visitExportAssignment(node: ExportAssignment): VisitResult<ExportAssignment | ExpressionStatement | undefined> {
if (node.isExportEquals) {
if (getEmitModuleKind(compilerOptions) === ModuleKind.Preserve) {
const statement = setOriginalNode(
factory.cr... | Visits an ImportEqualsDeclaration node.
@param node The node to visit. | typescript | src/compiler/transformers/module/esnextAnd2015.ts | 308 | [
"node"
] | true | 3 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
convertEnvironment | private ConfigurableEnvironment convertEnvironment(ConfigurableEnvironment environment,
Class<? extends ConfigurableEnvironment> type) {
ConfigurableEnvironment result = createEnvironment(type);
result.setActiveProfiles(environment.getActiveProfiles());
result.setConversionService(environment.getConversionServ... | Converts the given {@code environment} to the given {@link StandardEnvironment}
type. If the environment is already of the same type, no conversion is performed
and it is returned unchanged.
@param environment the Environment to convert
@param type the type to convert the Environment to
@return the converted Environmen... | java | core/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java | 81 | [
"environment",
"type"
] | ConfigurableEnvironment | true | 1 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
insert | public StrBuilder insert(final int index, final Object obj) {
if (obj == null) {
return insert(index, nullText);
}
return insert(index, obj.toString());
} | Inserts the string representation of an object into this builder.
Inserting null will use the stored null text value.
@param index the index to add at, must be valid
@param obj the object to insert
@return {@code this} instance.
@throws IndexOutOfBoundsException if the index is invalid | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,245 | [
"index",
"obj"
] | StrBuilder | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
inclusiveBetween | @SuppressWarnings("boxing")
public static void inclusiveBetween(final double start, final double end, final double value) {
// TODO when breaking BC, consider returning value
if (value < start || value > end) {
throw new IllegalArgumentException(String.format(DEFAULT_INCLUSIVE_BETWEEN_EX... | Validate that the specified primitive value falls between the two
inclusive values specified; otherwise, throws an exception.
<pre>Validate.inclusiveBetween(0.1, 2.1, 1.1);</pre>
@param start the inclusive start value.
@param end the inclusive end value.
@param value the value to validate.
@throws IllegalArgumentExce... | java | src/main/java/org/apache/commons/lang3/Validate.java | 269 | [
"start",
"end",
"value"
] | void | true | 3 | 6.4 | apache/commons-lang | 2,896 | javadoc | false |
collapse_resume_frames | def collapse_resume_frames(stack: StackSummary) -> StackSummary:
"""
When we graph break, we create a resume function and make a regular Python call
to it, which gets intercepted by Dynamo. This behavior is normally shown in the
traceback, which can be confusing to a user. So we can filter out resume fr... | When we graph break, we create a resume function and make a regular Python call
to it, which gets intercepted by Dynamo. This behavior is normally shown in the
traceback, which can be confusing to a user. So we can filter out resume frames
for better traceback clarity.
Example:
File "..." line 3, in f
<line 3>
Fil... | python | torch/_dynamo/exc.py | 751 | [
"stack"
] | StackSummary | true | 7 | 8.48 | pytorch/pytorch | 96,034 | unknown | false |
isNaN | function isNaN(value) {
// An `NaN` primitive is the only value that is not equal to itself.
// Perform the `toStringTag` check first to avoid errors with some
// ActiveX objects in IE.
return isNumber(value) && value != +value;
} | Checks if `value` is `NaN`.
**Note:** This method is based on
[`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
`undefined` and other non-number values.
@static
@memberOf _
@since 0.1.0
@category Lang
@param {*} value The value to check.... | javascript | lodash.js | 11,999 | [
"value"
] | false | 2 | 7.36 | lodash/lodash | 61,490 | jsdoc | false | |
lastIndexOf | public static int lastIndexOf(char[] array, char target) {
return lastIndexOf(array, target, 0, array.length);
} | Returns the index of the last appearance of the value {@code target} in {@code array}.
@param array an array of {@code char} values, possibly empty
@param target a primitive {@code char} value
@return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no
such index exists. | java | android/guava/src/com/google/common/primitives/Chars.java | 201 | [
"array",
"target"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
callRunner | private void callRunner(Runner runner, ApplicationArguments args) {
if (runner instanceof ApplicationRunner) {
callRunner(ApplicationRunner.class, runner, (applicationRunner) -> applicationRunner.run(args));
}
if (runner instanceof CommandLineRunner) {
callRunner(CommandLineRunner.class, runner,
(comma... | Called after the context has been refreshed.
@param context the application context
@param args the application arguments | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 786 | [
"runner",
"args"
] | void | true | 3 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
byteSize | public abstract int byteSize(); | Returns the number of bytes required to encode this TDigest using #asBytes().
@return The number of bytes required. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/TDigest.java | 175 | [] | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false | |
hsplit | def hsplit(ary, indices_or_sections):
"""
Split an array into multiple sub-arrays horizontally (column-wise).
Please refer to the `split` documentation. `hsplit` is equivalent
to `split` with ``axis=1``, the array is always split along the second
axis except for 1-D arrays, where it is split at ``... | Split an array into multiple sub-arrays horizontally (column-wise).
Please refer to the `split` documentation. `hsplit` is equivalent
to `split` with ``axis=1``, the array is always split along the second
axis except for 1-D arrays, where it is split at ``axis=0``.
See Also
--------
split : Split an array into multi... | python | numpy/lib/_shape_base_impl.py | 864 | [
"ary",
"indices_or_sections"
] | false | 4 | 7.6 | numpy/numpy | 31,054 | unknown | false | |
sortAdvisors | protected List<Advisor> sortAdvisors(List<Advisor> advisors) {
AnnotationAwareOrderComparator.sort(advisors);
return advisors;
} | Sort advisors based on ordering. Subclasses may choose to override this
method to customize the sorting strategy.
@param advisors the source List of Advisors
@return the sorted List of Advisors
@see org.springframework.core.Ordered
@see org.springframework.core.annotation.Order
@see org.springframework.core.annotation.... | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java | 161 | [
"advisors"
] | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
compareTo | @Override
public int compareTo(ItemHint other) {
return getName().compareTo(other.getName());
} | Return an {@link ItemHint} with the given prefix applied.
@param prefix the prefix to apply
@return a new {@link ItemHint} with the same of this instance whose property name
has the prefix applied to it | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java | 85 | [
"other"
] | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false | |
maybeCompleteValidation | public synchronized Optional<LogTruncation> maybeCompleteValidation(TopicPartition tp,
FetchPosition requestPosition,
EpochEndOffset epochEndOffset) {
TopicPartitionSta... | Attempt to complete validation with the end offset returned from the OffsetForLeaderEpoch request.
@return Log truncation details if detected and no reset policy is defined. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 568 | [
"tp",
"requestPosition",
"epochEndOffset"
] | true | 9 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
parseProjectTypes | private MetadataHolder<String, ProjectType> parseProjectTypes(JSONObject root) throws JSONException {
MetadataHolder<String, ProjectType> result = new MetadataHolder<>();
if (!root.has(TYPE_EL)) {
return result;
}
JSONObject type = root.getJSONObject(TYPE_EL);
JSONArray array = type.getJSONArray(VALUES_EL)... | Returns the defaults applicable to the service.
@return the defaults of the service | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java | 144 | [
"root"
] | true | 5 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
invokeMethod | public static Object invokeMethod(final Object object, final boolean forceAccess, final String methodName)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return invokeMethod(object, forceAccess, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY, null);
} | Invokes a named method without parameters.
<p>
This is a convenient wrapper for
{@link #invokeMethod(Object object, boolean forceAccess, String methodName, Object[] args, Class[] parameterTypes)}.
</p>
@param object invoke method on this object.
@param forceAccess force access to invoke method even if it's not accessib... | java | src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | 731 | [
"object",
"forceAccess",
"methodName"
] | Object | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
any | def any(
self, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs
) -> np.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
... | 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/masked.py | 1,705 | [
"self",
"skipna",
"axis"
] | np.bool_ | NAType | true | 7 | 8.08 | pandas-dev/pandas | 47,362 | numpy | false |
mean_gamma_deviance | def mean_gamma_deviance(y_true, y_pred, *, sample_weight=None):
"""Mean Gamma deviance regression loss.
Gamma deviance is equivalent to the Tweedie deviance with
the power parameter `power=2`. It is invariant to scaling of
the target variable, and measures relative errors.
Read more in the :ref:`U... | Mean Gamma deviance regression loss.
Gamma deviance is equivalent to the Tweedie deviance with
the power parameter `power=2`. It is invariant to scaling of
the target variable, and measures relative errors.
Read more in the :ref:`User Guide <mean_tweedie_deviance>`.
Parameters
----------
y_true : array-like of shape... | python | sklearn/metrics/_regression.py | 1,537 | [
"y_true",
"y_pred",
"sample_weight"
] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
scale | public ExponentialHistogramBuilder scale(int scale) {
this.scale = scale;
return this;
} | If known, sets the estimated total number of buckets to minimize unnecessary allocations.
Only has an effect if invoked before the first call to
{@link #setPositiveBucket(long, long)} and {@link #setNegativeBucket(long, long)}.
@param totalBuckets the total number of buckets expected to be added
@return the builder | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramBuilder.java | 92 | [
"scale"
] | ExponentialHistogramBuilder | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
_decide_split_path | def _decide_split_path(self, indexer, value) -> bool:
"""
Decide whether we will take a block-by-block path.
"""
take_split_path = not self.obj._mgr.is_single_block
if not take_split_path and isinstance(value, ABCDataFrame):
# Avoid cast of values
take_sp... | Decide whether we will take a block-by-block path. | python | pandas/core/indexing.py | 1,806 | [
"self",
"indexer",
"value"
] | bool | true | 13 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
visitCommaExpression | function visitCommaExpression(node: BinaryExpression) {
// [source]
// x = a(), yield, b();
//
// [intermediate]
// a();
// .yield resumeLabel
// .mark resumeLabel
// x = %sent%, b();
let pendingExpressions: Expression[]... | Visits a comma expression containing `yield`.
@param node The node to visit. | typescript | src/compiler/transformers/generators.ts | 879 | [
"node"
] | false | 6 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
get_cluster_state | def get_cluster_state(self, clusterName: str) -> ClusterStates:
"""
Return the current status of a given Amazon EKS Cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.describe_cluster`
:param clusterName: The name of the cluster to check.
:return: Returns t... | Return the current status of a given Amazon EKS Cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.describe_cluster`
:param clusterName: The name of the cluster to check.
:return: Returns the current status of a given Amazon EKS Cluster. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 393 | [
"self",
"clusterName"
] | ClusterStates | true | 2 | 7.6 | apache/airflow | 43,597 | sphinx | false |
_implementation | def _implementation():
"""Return a dict with the Python implementation and version.
Provide both the name and the version of the Python implementation
currently running. For example, on CPython 3.10.3 it will return
{'name': 'CPython', 'version': '3.10.3'}.
This function works best on CPython and ... | Return a dict with the Python implementation and version.
Provide both the name and the version of the Python implementation
currently running. For example, on CPython 3.10.3 it will return
{'name': 'CPython', 'version': '3.10.3'}.
This function works best on CPython and PyPy: in particular, it probably
doesn't work ... | python | src/requests/help.py | 34 | [] | false | 7 | 6.08 | psf/requests | 53,586 | unknown | false | |
chebmul | def chebmul(c1, c2):
"""
Multiply one Chebyshev series by another.
Returns the product of two Chebyshev series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
... | Multiply one Chebyshev series by another.
Returns the product of two Chebyshev series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, c2 : array_like
1-D arrays of Chebyshev serie... | python | numpy/polynomial/chebyshev.py | 698 | [
"c1",
"c2"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
partition | public static <T extends @Nullable Object> Iterable<List<T>> partition(
Iterable<T> iterable, int size) {
checkNotNull(iterable);
checkArgument(size > 0);
return new FluentIterable<List<T>>() {
@Override
public Iterator<List<T>> iterator() {
return Iterators.partition(iterable.iter... | Divides an iterable into unmodifiable sublists of the given size (the final iterable may be
smaller). For example, partitioning an iterable containing {@code [a, b, c, d, e]} with a
partition size of 3 yields {@code [[a, b, c], [d, e]]} -- an outer iterable containing two
inner lists of three and two elements, all in t... | java | android/guava/src/com/google/common/collect/Iterables.java | 565 | [
"iterable",
"size"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
_fix_real_lt_zero | def _fix_real_lt_zero(x):
"""Convert `x` to complex 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.... | Convert `x` to complex 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_real_lt_zero([1,2])
array([1, 2])
>>> np.lib.scimath._fix_r... | python | numpy/lib/_scimath_impl.py | 96 | [
"x"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
normalize | def normalize(self) -> Self:
"""
Convert times to midnight.
The time component of the date-time is converted to midnight i.e.
00:00:00. This is useful in cases, when the time does not matter.
Length is unaltered. The timezones are unaffected.
This method is available on... | Convert times to midnight.
The time component of the date-time is converted to midnight i.e.
00:00:00. This is useful in cases, when the time does not matter.
Length is unaltered. The timezones are unaffected.
This method is available on Series with datetime values under
the ``.dt`` accessor, and directly on Datetime... | python | pandas/core/arrays/datetimes.py | 1,154 | [
"self"
] | Self | true | 2 | 8 | pandas-dev/pandas | 47,362 | unknown | false |
scanClassAtom | function scanClassAtom(): string {
if (charCodeChecked(pos) === CharacterCodes.backslash) {
pos++;
const ch = charCodeChecked(pos);
switch (ch) {
case CharacterCodes.b:
pos++;
return "\... | A stack of scopes for named capturing groups. @see {scanGroupName} | typescript | src/compiler/scanner.ts | 3,440 | [] | true | 4 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getTargetClass | @Override
public synchronized Class<?> getTargetClass() {
if (this.targetObject == null) {
refresh();
}
return this.targetObject.getClass();
} | Set the delay between refresh checks, in milliseconds.
Default is -1, indicating no refresh checks at all.
<p>Note that an actual refresh will only happen when
{@link #requiresRefresh()} returns {@code true}. | java | spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java | 68 | [] | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
acquisitionLockTimeoutMs | public Optional<Integer> acquisitionLockTimeoutMs() {
return acquisitionLockTimeoutMs;
} | @return The most up-to-date value of acquisition lock timeout, if available | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetch.java | 122 | [] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
withLineSeparator | public StandardStackTracePrinter withLineSeparator(String lineSeparator) {
Assert.notNull(lineSeparator, "'lineSeparator' must not be null");
return new StandardStackTracePrinter(this.options, this.maximumLength, lineSeparator, this.filter,
this.frameFilter, this.formatter, this.frameFormatter, this.frameHasher... | Return a new {@link StandardStackTracePrinter} from this one that print the stack
trace using the specified line separator.
@param lineSeparator the line separator to use
@return a new {@link StandardStackTracePrinter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 225 | [
"lineSeparator"
] | StandardStackTracePrinter | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
from_custom_template | def from_custom_template(
cls,
searchpath: Sequence[str],
html_table: str | None = None,
html_style: str | None = None,
) -> type[Styler]:
"""
Factory function for creating a subclass of ``Styler``.
Uses custom templates and Jinja environment.
Parame... | Factory function for creating a subclass of ``Styler``.
Uses custom templates and Jinja environment.
Parameters
----------
searchpath : str or list
Path or paths of directories containing the templates.
html_table : str
Name of your custom template to replace the html_table template.
html_style : str
Name... | python | pandas/io/formats/style.py | 3,684 | [
"cls",
"searchpath",
"html_table",
"html_style"
] | type[Styler] | true | 3 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
try_import_cutlass | def try_import_cutlass() -> bool:
"""
We want to support three ways of passing in CUTLASS:
1. fbcode, handled by the internal build system.
2. User specifies cutlass_dir. The default is ../third_party/cutlass/,
which is the directory when developers build from source.
"""
if config.is_fbc... | We want to support three ways of passing in CUTLASS:
1. fbcode, handled by the internal build system.
2. User specifies cutlass_dir. The default is ../third_party/cutlass/,
which is the directory when developers build from source. | python | torch/_inductor/codegen/cuda/cutlass_utils.py | 70 | [] | bool | true | 9 | 6.8 | pytorch/pytorch | 96,034 | unknown | false |
apply | public static <I, O, T extends Throwable> O apply(final FailableFunction<I, O, T> function, final I input) {
return get(() -> function.apply(input));
} | Applies a function and rethrows any exception as a {@link RuntimeException}.
@param function the function to apply
@param input the input to apply {@code function} on
@param <I> the type of the argument the function accepts
@param <O> the return type of the function
@param <T> the type of checked exception the function... | java | src/main/java/org/apache/commons/lang3/Functions.java | 339 | [
"function",
"input"
] | O | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
trySelfParentPath | function trySelfParentPath(parent) {
if (!parent) { return false; }
if (parent.filename) {
return parent.filename;
} else if (parent.id === '<repl>' || parent.id === 'internal/preload') {
try {
return process.cwd() + path.sep;
} catch {
return false;
}
}
} | Tries to get the absolute file path of the parent module.
@param {Module} parent The parent module object.
@returns {string|false|void} | javascript | lib/internal/modules/cjs/loader.js | 603 | [
"parent"
] | false | 7 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
reverse | public static void reverse(final boolean[] array) {
if (array == null) {
return;
}
reverse(array, 0, array.length);
} | Reverses the order of the given array.
<p>
This method does nothing for a {@code null} input array.
</p>
@param array the array to reverse, may be {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,341 | [
"array"
] | void | true | 2 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
_called_with_wrong_args | def _called_with_wrong_args(f: t.Callable[..., Flask]) -> bool:
"""Check whether calling a function raised a ``TypeError`` because
the call failed or because something in the factory raised the
error.
:param f: The function that was called.
:return: ``True`` if the call failed.
"""
tb = sys... | Check whether calling a function raised a ``TypeError`` because
the call failed or because something in the factory raised the
error.
:param f: The function that was called.
:return: ``True`` if the call failed. | python | src/flask/cli.py | 94 | [
"f"
] | bool | true | 3 | 8.24 | pallets/flask | 70,946 | sphinx | false |
generator | public XContentGenerator generator() {
return this.generator;
} | Returns a version used for serialising a response.
@return a compatible version | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 1,295 | [] | XContentGenerator | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
asPemSslStoreDetails | private static PemSslStoreDetails asPemSslStoreDetails(PemSslBundleProperties.Store properties) {
return new PemSslStoreDetails(properties.getType(), properties.getCertificate(), properties.getPrivateKey(),
properties.getPrivateKeyPassword());
} | Get an {@link SslBundle} for the given {@link PemSslBundleProperties}.
@param properties the source properties
@param resourceLoader the resource loader used to load content
@return an {@link SslBundle} instance
@since 3.3.5 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/PropertiesSslBundle.java | 146 | [
"properties"
] | PemSslStoreDetails | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
findCachedValue | private @Nullable Object findCachedValue(CacheOperationInvoker invoker, Method method, CacheOperationContexts contexts) {
for (CacheOperationContext context : contexts.get(CacheableOperation.class)) {
if (isConditionPassing(context, CacheOperationExpressionEvaluator.NO_RESULT)) {
Object key = generateKey(conte... | Find a cached value only for {@link CacheableOperation} that passes the condition.
@param contexts the cacheable operations
@return a {@link Cache.ValueWrapper} holding the cached value,
or {@code null} if none is found | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 509 | [
"invoker",
"method",
"contexts"
] | Object | true | 5 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
get | public static ElasticCommonSchemaProperties get(Environment environment) {
return Binder.get(environment)
.bind("logging.structured.ecs", ElasticCommonSchemaProperties.class)
.orElse(NONE)
.withDefaults(environment);
} | Return a new {@link ElasticCommonSchemaProperties} from bound from properties in
the given {@link Environment}.
@param environment the source environment
@return a new {@link ElasticCommonSchemaProperties} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ElasticCommonSchemaProperties.java | 65 | [
"environment"
] | ElasticCommonSchemaProperties | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
transformAsyncFunctionParameterList | function transformAsyncFunctionParameterList(node: FunctionLikeDeclaration) {
if (isSimpleParameterList(node.parameters)) {
return visitParameterList(node.parameters, visitor, context);
}
const newParameters: ParameterDeclaration[] = [];
for (const parameter of node.pa... | Visits an ArrowFunction.
This function will be called when one of the following conditions are met:
- The node is marked async
@param node The node to visit. | typescript | src/compiler/transformers/es2017.ts | 702 | [
"node"
] | false | 5 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
leastSquaresFit | public LinearTransformation leastSquaresFit() {
checkState(count() > 1);
if (isNaN(sumOfProductsOfDeltas)) {
return LinearTransformation.forNaN();
}
double xSumOfSquaresOfDeltas = xStats.sumOfSquaresOfDeltas();
if (xSumOfSquaresOfDeltas > 0.0) {
if (yStats.sumOfSquaresOfDeltas() > 0.0) {... | Returns a linear transformation giving the best fit to the data according to <a
href="http://mathworld.wolfram.com/LeastSquaresFitting.html">Ordinary Least Squares linear
regression</a> of {@code y} as a function of {@code x}. The count must be greater than one, and
either the {@code x} or {@code y} data must have a no... | java | android/guava/src/com/google/common/math/PairedStats.java | 181 | [] | LinearTransformation | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false |
toString | @Override
public String toString() {
return getClass().getName() + ": class = " + this.clazz.getName() + "; methodNamePatterns = " + this.methodNamePatterns;
} | Determine if the given method name matches the method name pattern.
<p>This method is invoked by {@link #isMatch(String, int)}.
<p>The default implementation checks for direct equality as well as
{@code xxx*}, {@code *xxx}, {@code *xxx*}, and {@code xxx*yyy} matches.
<p>Can be overridden in subclasses — for examp... | java | spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java | 250 | [] | String | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
strip | public static String strip(String str, final String stripChars) {
str = stripStart(str, stripChars);
return stripEnd(str, stripChars);
} | Strips any of a set of characters from the start and end of a String. This is similar to {@link String#trim()} but allows the characters to be stripped
to be controlled.
<p>
A {@code null} input String returns {@code null}. An empty string ("") input returns the empty string.
</p>
<p>
If the stripChars String is {@code... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,831 | [
"str",
"stripChars"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
flatnonzero | def flatnonzero(a):
"""
Return indices that are non-zero in the flattened version of a.
This is equivalent to ``np.nonzero(np.ravel(a))[0]``.
Parameters
----------
a : array_like
Input data.
Returns
-------
res : ndarray
Output array, containing the indices of the ... | Return indices that are non-zero in the flattened version of a.
This is equivalent to ``np.nonzero(np.ravel(a))[0]``.
Parameters
----------
a : array_like
Input data.
Returns
-------
res : ndarray
Output array, containing the indices of the elements of ``a.ravel()``
that are non-zero.
See Also
--------
... | python | numpy/_core/numeric.py | 680 | [
"a"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
pollInternal | private PollResult pollInternal(FetchRequestPreparer fetchRequestPreparer,
ResponseHandler<ClientResponse> successHandler,
ResponseHandler<Throwable> errorHandler) {
if (pendingFetchRequestFuture == null) {
// If no explicit req... | Creates the {@link PollResult poll result} that contains a list of zero or more
{@link FetchRequest.Builder fetch requests}.
@param fetchRequestPreparer {@link FetchRequestPreparer} to generate a {@link Map} of {@link Node nodes}
to their {@link FetchSessionHandler.FetchRequestData}
@param s... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchRequestManager.java | 137 | [
"fetchRequestPreparer",
"successHandler",
"errorHandler"
] | PollResult | true | 5 | 7.6 | apache/kafka | 31,560 | javadoc | false |
collectAsynchronousDependencies | function collectAsynchronousDependencies(node: SourceFile, includeNonAmdDependencies: boolean): AsynchronousDependencies {
// names of modules with corresponding parameter in the factory function
const aliasedModuleNames: Expression[] = [];
// names of modules with no corresponding paramete... | Collect the additional asynchronous dependencies for the module.
@param node The source file.
@param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies. | typescript | src/compiler/transformers/module/module.ts | 554 | [
"node",
"includeNonAmdDependencies"
] | true | 7 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
power | def power(x, p):
"""
Return x to the power p, (x**p).
If `x` contains negative values, the output is converted to the
complex domain.
Parameters
----------
x : array_like
The input value(s).
p : array_like of ints
The power(s) to which `x` is raised. If `x` contains mul... | Return x to the power p, (x**p).
If `x` contains negative values, the output is converted to the
complex domain.
Parameters
----------
x : array_like
The input value(s).
p : array_like of ints
The power(s) to which `x` is raised. If `x` contains multiple values,
`p` has to either be a scalar, or contain t... | python | numpy/lib/_scimath_impl.py | 441 | [
"x",
"p"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
optDouble | public double optDouble(String name) {
return optDouble(name, Double.NaN);
} | Returns the value mapped by {@code name} if it exists and is a double or can be
coerced to a double. Returns {@code NaN} otherwise.
@param name the name of the property
@return the value or {@code NaN} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 450 | [
"name"
] | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false | |
shouldSkip | protected boolean shouldSkip(Class<?> beanClass, String beanName) {
return AutoProxyUtils.isOriginalInstance(beanName, beanClass);
} | Subclasses should override this method to return {@code true} if the
given bean should not be considered for auto-proxying by this post-processor.
<p>Sometimes we need to be able to avoid this happening, for example, if it will lead to
a circular reference or if the existing target instance needs to be preserved.
This ... | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java | 382 | [
"beanClass",
"beanName"
] | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
is_empty_indexer | def is_empty_indexer(indexer) -> bool:
"""
Check if we have an empty indexer.
Parameters
----------
indexer : object
Returns
-------
bool
"""
if is_list_like(indexer) and not len(indexer):
return True
if not isinstance(indexer, tuple):
indexer = (indexer,)
... | Check if we have an empty indexer.
Parameters
----------
indexer : object
Returns
-------
bool | python | pandas/core/indexers/utils.py | 102 | [
"indexer"
] | bool | true | 5 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
add | public void add(Collection<ConfigurationMetadataSource> sources) {
for (ConfigurationMetadataSource source : sources) {
String groupId = source.getGroupId();
ConfigurationMetadataGroup group = this.allGroups.computeIfAbsent(groupId,
(key) -> new ConfigurationMetadataGroup(groupId));
String sourceType = ... | Register the specified {@link ConfigurationMetadataSource sources}.
@param sources the sources to add | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java | 54 | [
"sources"
] | void | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
timetz | def timetz(self) -> npt.NDArray[np.object_]:
"""
Returns numpy array of :class:`datetime.time` objects with timezones.
The time part of the Timestamps.
See Also
--------
DatetimeIndex.time : Returns numpy array of :class:`datetime.time` objects.
The time par... | Returns numpy array of :class:`datetime.time` objects with timezones.
The time part of the Timestamps.
See Also
--------
DatetimeIndex.time : Returns numpy array of :class:`datetime.time` objects.
The time part of the Timestamps.
DatetimeIndex.tz : Return the timezone.
Examples
--------
For Series:
>>> s = pd.S... | python | pandas/core/arrays/datetimes.py | 1,470 | [
"self"
] | npt.NDArray[np.object_] | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
getLast | @ParametricNullness
public static <T extends @Nullable Object> T getLast(
Iterable<? extends T> iterable, @ParametricNullness T defaultValue) {
if (iterable instanceof Collection) {
Collection<? extends T> c = (Collection<? extends T>) iterable;
if (c.isEmpty()) {
return defaultValue;
... | Returns the last element of {@code iterable} or {@code defaultValue} if the iterable is empty.
If {@code iterable} is a {@link List} with {@link RandomAccess} support, then this operation is
guaranteed to be {@code O(1)}.
<p><b>{@code Stream} equivalent:</b> {@code Streams.findLast(stream).orElse(defaultValue)}
<p><b>J... | java | android/guava/src/com/google/common/collect/Iterables.java | 886 | [
"iterable",
"defaultValue"
] | T | true | 5 | 7.6 | google/guava | 51,352 | javadoc | false |
addAndGet | public long addAndGet(final long operand) {
this.value += operand;
return value;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately after the addition operation. This method is not thread safe.
@param operand the quantity to add, not null.
@return the value associated with this instance after adding the operand.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableLong.java | 111 | [
"operand"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
loadBeanDefinitions | public int loadBeanDefinitions(EncodedResource encodedResource, @Nullable String prefix)
throws BeanDefinitionStoreException {
if (logger.isTraceEnabled()) {
logger.trace("Loading properties bean definitions from " + encodedResource);
}
Properties props = new Properties();
try {
try (InputStream is =... | Load bean definitions from the specified properties file.
@param encodedResource the resource descriptor for the properties file,
allowing to specify an encoding to use for parsing the file
@param prefix a filter within the keys in the map: for example, 'beans.'
(can be empty or {@code null})
@return the number of bean... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java | 250 | [
"encodedResource",
"prefix"
] | true | 5 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toString | @Override
public String toString() {
if (count() > 0) {
return MoreObjects.toStringHelper(this)
.add("count", count)
.add("mean", mean)
.add("populationStandardDeviation", populationStandardDeviation())
.add("min", min)
.add("max", max)
.toString()... | {@inheritDoc}
<p><b>Note:</b> This hash code is consistent with exact equality of the calculated statistics,
including the floating point values. See the note on {@link #equals} for details. | java | android/guava/src/com/google/common/math/Stats.java | 449 | [] | String | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false |
invoke | @Override
public Object invoke(final Object proxy, final Method method, final Object[] parameters) throws Throwable {
if (eventTypes.isEmpty() || eventTypes.contains(method.getName())) {
if (hasMatchingParametersMethod(method)) {
return MethodUtils.invokeMethod(ta... | Handles a method invocation on the proxy object.
@param proxy the proxy instance.
@param method the method to be invoked.
@param parameters the parameters for the method invocation.
@return the result of the method call.
@throws SecurityException if an underlying accessible object's method denies the request.
@see Secu... | java | src/main/java/org/apache/commons/lang3/event/EventUtils.java | 75 | [
"proxy",
"method",
"parameters"
] | Object | true | 4 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
tryAcquire | public boolean tryAcquire() {
return tryAcquire(1, 0, MICROSECONDS);
} | Acquires a permit from this {@link RateLimiter} if it can be acquired immediately without
delay.
<p>This method is equivalent to {@code tryAcquire(1)}.
@return {@code true} if the permit was acquired, {@code false} otherwise
@since 14.0 | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 380 | [] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
recordsSize | public static int recordsSize(FetchResponseData.PartitionData partition) {
return partition.records() == null ? 0 : partition.records().sizeInBytes();
} | @return The size in bytes of the records. 0 is returned if records of input partition is null. | java | clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java | 225 | [
"partition"
] | true | 2 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
getBuildDateMillis | long getBuildDateMillis() throws IOException {
if (buildDate.get() == null) {
synchronized (buildDate) {
if (buildDate.get() == null) {
buildDate.set(loader.get().getMetadata().getBuildDate().getTime());
}
}
}
return bui... | Prepares the database for lookup by incrementing the usage count.
If the usage count is already negative, it indicates that the database is being closed,
and this method will return false to indicate that no lookup should be performed.
@return true if the database is ready for lookup, false if it is being closed | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/DatabaseReaderLazyLoader.java | 178 | [] | true | 3 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
valuesSpliterator | @Override
@GwtIncompatible("Spliterator")
Spliterator<@Nullable V> valuesSpliterator() {
return CollectSpliterators.<@Nullable V>indexed(size(), Spliterator.ORDERED, this::getValue);
} | Returns an unmodifiable collection of all values, which may contain duplicates. Changes to the
table will update the returned collection.
<p>The returned collection's iterator traverses the values of the first row key, the values of
the second row key, and so on.
@return collection of values | java | guava/src/com/google/common/collect/ArrayTable.java | 805 | [] | true | 1 | 7.04 | google/guava | 51,352 | javadoc | false | |
beanNamesIncludingAncestors | public static String[] beanNamesIncludingAncestors(ListableBeanFactory lbf) {
return beanNamesForTypeIncludingAncestors(lbf, Object.class);
} | Return all bean names in the factory, including ancestor factories.
@param lbf the bean factory
@return the array of matching bean names, or an empty array if none
@see #beanNamesForTypeIncludingAncestors | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java | 148 | [
"lbf"
] | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toHtmlTable | public String toHtmlTable(Map<String, String> dynamicUpdateModes) {
boolean hasUpdateModes = !dynamicUpdateModes.isEmpty();
List<ConfigKey> configs = sortedConfigs();
StringBuilder b = new StringBuilder();
b.append("<table class=\"data-table\"><tbody>\n");
b.append("<tr>\n");
... | Converts this config into an HTML table that can be embedded into docs.
If <code>dynamicUpdateModes</code> is non-empty, a "Dynamic Update Mode" column
will be included n the table with the value of the update mode. Default
mode is "read-only".
@param dynamicUpdateModes Config name -> update mode mapping | java | clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java | 1,459 | [
"dynamicUpdateModes"
] | String | true | 5 | 6.88 | apache/kafka | 31,560 | javadoc | false |
size | @Override
public int size() {
if (upperBoundWindow.equals(Range.all())) {
return rangesByLowerBound.size();
}
return Iterators.size(entryIterator());
} | upperBoundWindow represents the headMap/subMap/tailMap view of the entire "ranges by upper
bound" map; it's a constraint on the *keys*, and does not affect the values. | java | android/guava/src/com/google/common/collect/TreeRangeSet.java | 434 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
updateMemberEpoch | protected void updateMemberEpoch(int newEpoch) {
boolean newEpochReceived = this.memberEpoch != newEpoch;
this.memberEpoch = newEpoch;
// Simply notify based on epoch changes only, since the member will generate a member ID
// at startup, and it will remain unchanged for its entire lifet... | Returns the epoch a member uses to leave the group. This is group-type-specific.
@return the epoch to leave the group | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 1,300 | [
"newEpoch"
] | void | true | 3 | 7.2 | apache/kafka | 31,560 | javadoc | false |
compareMethodFit | static int compareMethodFit(final Method left, final Method right, final Class<?>[] actual) {
return compareParameterTypes(Executable.of(left), Executable.of(right), actual);
} | Compares the relative fitness of two Methods in terms of how well they match a set of runtime parameter types, such that a list ordered by the results of
the comparison would return the best match first (least).
@param left the "left" Method.
@param right the "right" Method.
@param actual the runtime parameter types... | java | src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java | 109 | [
"left",
"right",
"actual"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
getCodeFragments | private BeanRegistrationCodeFragments getCodeFragments(GenerationContext generationContext,
BeanRegistrationsCode beanRegistrationsCode) {
BeanRegistrationCodeFragments codeFragments = new DefaultBeanRegistrationCodeFragments(
beanRegistrationsCode, this.registeredBean, this.methodGeneratorFactory);
for (Be... | Return the {@link GeneratedClass} to use for the specified {@code target}.
<p>If the target class is an inner class, a corresponding inner class in
the original structure is created.
@param generationContext the generation context to use
@param target the chosen target class name for the bean definition
@return the gen... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGenerator.java | 147 | [
"generationContext",
"beanRegistrationsCode"
] | BeanRegistrationCodeFragments | true | 1 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
removeAll | public static String removeAll(final CharSequence text, final Pattern regex) {
return replaceAll(text, regex, StringUtils.EMPTY);
} | Removes each substring of the text String that matches the given regular expression pattern.
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code pattern.matcher(text).replaceAll(StringUtils.EMPTY)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>{@code
StringUtils.remove... | java | src/main/java/org/apache/commons/lang3/RegExUtils.java | 108 | [
"text",
"regex"
] | String | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
mlockall | int mlockall(int flags); | Lock all the current process's virtual address space into RAM.
@param flags flags determining how memory will be locked
@return 0 on success, -1 on failure with errno set
@see <a href="https://man7.org/linux/man-pages/man2/mlock.2.html">mlockall manpage</a> | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/lib/PosixCLibrary.java | 65 | [
"flags"
] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
asEnumSet | private EnumSet<Option> asEnumSet(Option @Nullable [] options) {
if (options == null || options.length == 0) {
return EnumSet.noneOf(Option.class);
}
return EnumSet.copyOf(Arrays.asList(options));
} | Create a new {@link CommandException} with the specified options.
@param cause the underlying cause
@param options the exception options | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandException.java | 78 | [
"options"
] | true | 3 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
doWithMainClasses | static <T> @Nullable T doWithMainClasses(File rootDirectory, MainClassCallback<T> callback) throws IOException {
if (!rootDirectory.exists()) {
return null; // nothing to do
}
if (!rootDirectory.isDirectory()) {
throw new IllegalArgumentException("Invalid root directory '" + rootDirectory + "'");
}
Stri... | Perform the given callback operation on all main classes from the given root
directory.
@param <T> the result type
@param rootDirectory the root directory
@param callback the callback
@return the first callback result or {@code null}
@throws IOException in case of I/O errors | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 127 | [
"rootDirectory",
"callback"
] | T | true | 9 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
onAcknowledgement | public void onAcknowledgement(RecordMetadata metadata, Exception exception, Headers headers) {
for (Plugin<ProducerInterceptor<K, V>> interceptorPlugin : this.interceptorPlugins) {
try {
interceptorPlugin.get().onAcknowledgement(metadata, exception, headers);
} catch (Exc... | This method is called when the record sent to the server has been acknowledged, or when sending the record fails before
it gets sent to the server. This method calls {@link ProducerInterceptor#onAcknowledgement(RecordMetadata, Exception, Headers)}
method for each interceptor.
This method does not throw exceptions. Exce... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerInterceptors.java | 92 | [
"metadata",
"exception",
"headers"
] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
at | def at(self) -> _AtIndexer:
"""
Access a single value for a row/column label pair.
Similar to ``loc``, in that both provide label-based lookups. Use
``at`` if you only need to get or set a single value in a DataFrame
or Series.
Raises
------
KeyError
... | Access a single value for a row/column label pair.
Similar to ``loc``, in that both provide label-based lookups. Use
``at`` if you only need to get or set a single value in a DataFrame
or Series.
Raises
------
KeyError
If getting a value and 'label' does not exist in a DataFrame or Series.
ValueError
If row/... | python | pandas/core/indexing.py | 636 | [
"self"
] | _AtIndexer | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | unknown | false |
reinitialize | @Override
protected void reinitialize(LoggingInitializationContext initializationContext) {
String currentLocation = getSelfInitializationConfig();
Assert.notNull(currentLocation, "'currentLocation' must not be null");
load(initializationContext, currentLocation, null);
} | 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 | 340 | [
"initializationContext"
] | void | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
findCandidateAdvisors | @Override
protected List<Advisor> findCandidateAdvisors() {
// Add all the Spring advisors found according to superclass rules.
List<Advisor> advisors = super.findCandidateAdvisors();
// Build Advisors for all AspectJ aspects in the bean factory.
if (this.aspectJAdvisorsBuilder != null) {
advisors.addAll(th... | Set a list of regex patterns, matching eligible @AspectJ bean names.
<p>Default is to consider all @AspectJ beans as eligible. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AnnotationAwareAspectJAutoProxyCreator.java | 87 | [] | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
proxy_headers | def proxy_headers(self, proxy):
"""Returns a dictionary of the headers to add to any request sent
through a proxy. This works with urllib3 magic to ensure that they are
correctly sent to the proxy, rather than in a tunnelled request if
CONNECT is being used.
This should not be c... | Returns a dictionary of the headers to add to any request sent
through a proxy. This works with urllib3 magic to ensure that they are
correctly sent to the proxy, rather than in a tunnelled request if
CONNECT is being used.
This should not be called from user code, and is only exposed for use
when subclassing the
:cla... | python | src/requests/adapters.py | 569 | [
"self",
"proxy"
] | false | 2 | 6.24 | psf/requests | 53,586 | sphinx | false | |
getAspectCreationMutex | @Override
public @Nullable Object getAspectCreationMutex() {
if (this.beanFactory.isSingleton(this.name)) {
// Rely on singleton semantics provided by the factory -> no local lock.
return null;
}
else {
// No singleton guarantees from the factory -> let's lock locally.
return this;
}
} | Create a BeanFactoryAspectInstanceFactory, providing a type that AspectJ should
introspect to create AJType metadata. Use if the BeanFactory may consider the type
to be a subclass (as when using CGLIB), and the information should relate to a superclass.
@param beanFactory the BeanFactory to obtain instance(s) from
@par... | java | spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java | 106 | [] | Object | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
and | default FailablePredicate<T, E> and(final FailablePredicate<? super T, E> other) {
Objects.requireNonNull(other);
return t -> test(t) && other.test(t);
} | Returns a composed {@link FailablePredicate} like {@link Predicate#and(Predicate)}.
@param other a predicate that will be logically-ANDed with this predicate.
@return a composed {@link FailablePredicate} like {@link Predicate#and(Predicate)}.
@throws NullPointerException if other is null | java | src/main/java/org/apache/commons/lang3/function/FailablePredicate.java | 72 | [
"other"
] | true | 2 | 7.36 | apache/commons-lang | 2,896 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.