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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isocalendar | def isocalendar(self) -> DataFrame:
"""
Calculate year, week, and day according to the ISO 8601 standard.
Returns
-------
DataFrame
With columns year, week and day.
See Also
--------
Timestamp.isocalendar : Function return a 3-tuple containin... | Calculate year, week, and day according to the ISO 8601 standard.
Returns
-------
DataFrame
With columns year, week and day.
See Also
--------
Timestamp.isocalendar : Function return a 3-tuple containing ISO year,
week number, and weekday for the given Timestamp object.
datetime.date.isocalendar : Return a na... | python | pandas/core/indexes/accessors.py | 401 | [
"self"
] | DataFrame | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | unknown | false |
empty | public boolean empty() {
return features.isEmpty();
} | @param features Map of feature name to SupportedVersionRange.
@return Returns a new Features object representing supported features. | java | clients/src/main/java/org/apache/kafka/common/feature/Features.java | 67 | [] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
buildGetInstanceMethodForFactoryMethod | private void buildGetInstanceMethodForFactoryMethod(MethodSpec.Builder method,
String beanName, Method factoryMethod, Class<?> targetClass,
@Nullable String factoryBeanName, javax.lang.model.element.Modifier... modifiers) {
String factoryMethodName = factoryMethod.getName();
Class<?> suppliedType = ClassUtil... | Generate the instance supplier code.
@param registeredBean the bean to handle
@param instantiationDescriptor the executable to use to create the bean
@return the generated code
@since 6.1.7 | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java | 311 | [
"method",
"beanName",
"factoryMethod",
"targetClass",
"factoryBeanName"
] | void | true | 2 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
appendLegacyRecord | private long appendLegacyRecord(long offset, long timestamp, ByteBuffer key, ByteBuffer value, byte magic) throws IOException {
ensureOpenForRecordAppend();
int size = LegacyRecord.recordSize(magic, key, value);
AbstractLegacyRecordBatch.writeHeader(appendStream, toInnerOffset(offset), size);
... | Append the record at the next consecutive offset. If no records have been appended yet, use the base
offset of this builder.
@param record The record to add | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java | 767 | [
"offset",
"timestamp",
"key",
"value",
"magic"
] | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
setPatterns | public void setPatterns(String... patterns) {
Assert.notEmpty(patterns, "'patterns' must not be empty");
this.patterns = new String[patterns.length];
for (int i = 0; i < patterns.length; i++) {
this.patterns[i] = patterns[i].strip();
}
initPatternRepresentation(this.patterns);
} | Set the regular expressions defining methods to match.
Matching will be the union of all these; if any match, the pointcut matches.
@see #setPattern | java | spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java | 80 | [] | void | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
visitModuleDeclaration | function visitModuleDeclaration(node: ModuleDeclaration): VisitResult<Statement> {
if (!shouldEmitModuleDeclaration(node)) {
return factory.createNotEmittedStatement(node);
}
Debug.assertNode(node.name, isIdentifier, "A TypeScript namespace should have an Identifier name.");
... | Visits a module declaration node.
This function will be called any time a TypeScript namespace (ModuleDeclaration) is encountered.
@param node The module declaration node. | typescript | src/compiler/transformers/ts.ts | 2,077 | [
"node"
] | true | 8 | 6.48 | microsoft/TypeScript | 107,154 | jsdoc | false | |
handleResponse | public boolean handleResponse(ShareFetchResponse response, short version) {
if ((response.error() == Errors.SHARE_SESSION_NOT_FOUND) ||
(response.error() == Errors.INVALID_SHARE_SESSION_EPOCH) ||
(response.error() == Errors.SHARE_SESSION_LIMIT_REACHED)) {
log.info("No... | Handle the ShareFetch response.
@param response The response.
@param version The version of the request.
@return True if the response is well-formed; false if it can't be processed
because of missing or unexpected partitions. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareSessionHandler.java | 263 | [
"response",
"version"
] | true | 6 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
visitReturnStatement | function visitReturnStatement(node: ReturnStatement): Statement {
if (convertedLoopState) {
convertedLoopState.nonLocalJumps! |= Jump.Return;
if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) {
node = returnCapturedThis(node);
}
... | Restores the `HierarchyFacts` for this node's ancestor after visiting this node's
subtree, propagating specific facts from the subtree.
@param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree.
@param excludeFacts The existing `HierarchyFacts` of the subtree that should not be ... | typescript | src/compiler/transformers/es2015.ts | 829 | [
"node"
] | true | 6 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
values | def values(self) -> np.ndarray:
"""
Return a Numpy representation of the DataFrame.
.. warning::
We recommend using :meth:`DataFrame.to_numpy` instead.
Only the values in the DataFrame will be returned, the axes labels
will be removed.
Returns
-----... | Return a Numpy representation of the DataFrame.
.. warning::
We recommend using :meth:`DataFrame.to_numpy` instead.
Only the values in the DataFrame will be returned, the axes labels
will be removed.
Returns
-------
numpy.ndarray
The values of the DataFrame.
See Also
--------
DataFrame.to_numpy : Recommende... | python | pandas/core/frame.py | 15,016 | [
"self"
] | np.ndarray | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | unknown | false |
newTreeSet | @SuppressWarnings({
"rawtypes", // https://github.com/google/guava/issues/989
"NonApiType", // acts as a direct substitute for a constructor call
})
public static <E extends Comparable> TreeSet<E> newTreeSet() {
return new TreeSet<>();
} | Creates a <i>mutable</i>, empty {@code TreeSet} instance sorted by the natural sort ordering of
its elements.
<p><b>Note:</b> if mutability is not required, use {@link ImmutableSortedSet#of()} instead.
<p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead,
use the {@code TreeSet} c... | java | android/guava/src/com/google/common/collect/Sets.java | 381 | [] | true | 1 | 6.08 | google/guava | 51,352 | javadoc | false | |
setNextAllowedRetry | synchronized void setNextAllowedRetry(Set<TopicPartition> partitions, long nextAllowResetTimeMs) {
for (TopicPartition partition : partitions) {
assignedState(partition).setNextAllowedRetry(nextAllowResetTimeMs);
}
} | 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 | 808 | [
"partitions",
"nextAllowResetTimeMs"
] | void | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
nextInt | @Deprecated
public static int nextInt() {
return secure().randomInt();
} | Generates a random int between 0 (inclusive) and Integer.MAX_VALUE (exclusive).
@return the random integer.
@see #nextInt(int, int)
@since 3.5
@deprecated Use {@link #secure()}, {@link #secureStrong()}, or {@link #insecure()}. | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 193 | [] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
canConnect | public boolean canConnect(String id, long now) {
NodeConnectionState state = nodeState.get(id);
if (state == null)
return true;
else
return state.state.isDisconnected() &&
now - state.lastConnectAttemptMs >= state.reconnectBackoffMs;
} | Return true iff we can currently initiate a new connection. This will be the case if we are not
connected and haven't been connected for at least the minimum reconnection backoff period.
@param id the connection id to check
@param now the current time in ms
@return true if we can initiate a new connection | java | clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java | 77 | [
"id",
"now"
] | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
fuse_seed_creation_pass | def fuse_seed_creation_pass(graph: torch.fx.Graph):
"""
Horizontally fuse all the seed generation on each device
a = inductor_seed(dev)
b = inductor_seed(dev)
Becomes:
seeds = inductor_seeds(2, dev)
a = inductor_lookup_seed(seeds, 0)
b = inductor_lookup_seed(seeds, ... | Horizontally fuse all the seed generation on each device
a = inductor_seed(dev)
b = inductor_seed(dev)
Becomes:
seeds = inductor_seeds(2, dev)
a = inductor_lookup_seed(seeds, 0)
b = inductor_lookup_seed(seeds, 1)
We do this because seed creation is entirely launch overhead bound. | python | torch/_inductor/fx_passes/replace_random.py | 36 | [
"graph"
] | true | 6 | 6.08 | pytorch/pytorch | 96,034 | unknown | false | |
lookupCache | protected final @Nullable Cache lookupCache(String name) {
return this.cacheMap.get(name);
} | Check for a registered cache of the given name.
In contrast to {@link #getCache(String)}, this method does not trigger
the lazy creation of missing caches via {@link #getMissingCache(String)}.
@param name the cache identifier (must not be {@code null})
@return the associated Cache instance, or {@code null} if none foun... | java | spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java | 138 | [
"name"
] | Cache | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false |
getGmtTimeZone | public static TimeZone getGmtTimeZone(final String pattern) {
if ("Z".equals(pattern) || "UTC".equals(pattern)) {
return GREENWICH;
}
final Matcher m = GMT_PATTERN.matcher(pattern);
if (m.matches()) {
final int hours = parseInt(m.group(2));
final int ... | Gets a TimeZone with GMT offsets. A GMT offset must be either 'Z', or 'UTC', or match
<em>(GMT)? hh?(:?mm?)?</em>, where h and m are digits representing hours and minutes.
@param pattern The GMT offset
@return A TimeZone with offset from GMT or null, if pattern does not match. | java | src/main/java/org/apache/commons/lang3/time/FastTimeZone.java | 49 | [
"pattern"
] | TimeZone | true | 6 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
indexesOf | public static BitSet indexesOf(final Object[] array, final Object objectToFind, int startIndex) {
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
}
while (startIndex < array.length) {
startIndex = indexOf(array, objectToFind, startIndex);
... | Finds the indices of the given object in the array starting at the given index.
<p>This method returns an empty BitSet for a {@code null} input array.</p>
<p>A negative startIndex is treated as zero. A startIndex larger than the array
length will return an empty BitSet.</p>
@param array the array to search for the obj... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,297 | [
"array",
"objectToFind",
"startIndex"
] | BitSet | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
optJSONObject | public JSONObject optJSONObject(int index) {
Object object = opt(index);
return object instanceof JSONObject ? (JSONObject) object : null;
} | Returns the value at {@code index} if it exists and is a {@code
JSONObject}. Returns null otherwise.
@param index the index to get the value from
@return the object at {@code index} or {@code null} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 569 | [
"index"
] | JSONObject | true | 2 | 8.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
from_pyfile | def from_pyfile(
self, filename: str | os.PathLike[str], silent: bool = False
) -> bool:
"""Updates the values in the config from a Python file. This function
behaves as if the file was imported as module with the
:meth:`from_object` function.
:param filename: the filename ... | Updates the values in the config from a Python file. This function
behaves as if the file was imported as module with the
:meth:`from_object` function.
:param filename: the filename of the config. This can either be an
absolute filename or a filename relative to the
root path.
:para... | python | src/flask/config.py | 187 | [
"self",
"filename",
"silent"
] | bool | true | 3 | 8.08 | pallets/flask | 70,946 | sphinx | false |
union1d | def union1d(ar1, ar2):
"""
Find the union of two arrays.
Return the unique, sorted array of values that are in either of the two
input arrays.
Parameters
----------
ar1, ar2 : array_like
Input arrays. They are flattened if they are not already 1D.
Returns
-------
union... | Find the union of two arrays.
Return the unique, sorted array of values that are in either of the two
input arrays.
Parameters
----------
ar1, ar2 : array_like
Input arrays. They are flattened if they are not already 1D.
Returns
-------
union1d : ndarray
Unique, sorted union of the input arrays.
Examples
--... | python | numpy/lib/_arraysetops_impl.py | 1,084 | [
"ar1",
"ar2"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
to_tvm_tensor | def to_tvm_tensor(torch_tensor: torch.Tensor) -> tvm.nd.array:
"""A helper function to transfer a torch.tensor to NDArray."""
if torch_tensor.dtype == torch.bool:
# same reason as above, fallback to numpy conversion which
# could introduce data copy overhead
return tv... | A helper function to transfer a torch.tensor to NDArray. | python | torch/_dynamo/backends/tvm.py | 144 | [
"torch_tensor"
] | tvm.nd.array | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
elementSet | @Override
public Set<E> elementSet() {
Set<E> result = elementSet;
if (result == null) {
elementSet = result = createElementSet();
}
return result;
} | {@inheritDoc}
<p>This implementation is highly efficient when {@code elementsToAdd} is itself a {@link
Multiset}. | java | android/guava/src/com/google/common/collect/AbstractMultiset.java | 130 | [] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
from | public static Iterable<ConfigurationPropertySource> from(Iterable<PropertySource<?>> sources) {
return new SpringConfigurationPropertySources(sources);
} | Return {@link Iterable} containing new {@link ConfigurationPropertySource}
instances adapted from the given Spring {@link PropertySource PropertySources}.
<p>
This method will flatten any nested property sources and will filter all
{@link StubPropertySource stub property sources}. Updates to the underlying source,
iden... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java | 156 | [
"sources"
] | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false | |
convertKey | protected Object convertKey(Object key) {
return key;
} | Hook to convert each encountered Map key.
The default implementation simply returns the passed-in key as-is.
<p>Can be overridden to perform conversion of certain keys,
for example from String to Integer.
<p>Only called if actually creating a new Map!
This is by default not the case if the type of the passed-in Map
alr... | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java | 173 | [
"key"
] | Object | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false |
get_all_providers_in_dist | def get_all_providers_in_dist(distribution_format: str, install_selected_providers: str) -> list[str]:
"""
Returns all providers in dist, optionally filtered by install_selected_providers.
:param distribution_format: package format to look for
:param install_selected_providers: list of providers to fil... | Returns all providers in dist, optionally filtered by install_selected_providers.
:param distribution_format: package format to look for
:param install_selected_providers: list of providers to filter by | python | dev/breeze/src/airflow_breeze/commands/release_management_commands.py | 1,470 | [
"distribution_format",
"install_selected_providers"
] | list[str] | true | 5 | 6.4 | apache/airflow | 43,597 | sphinx | false |
threadNamePrefix | public SimpleAsyncTaskExecutorBuilder threadNamePrefix(@Nullable String threadNamePrefix) {
return new SimpleAsyncTaskExecutorBuilder(this.virtualThreads, threadNamePrefix,
this.cancelRemainingTasksOnClose, this.rejectTasksWhenLimitReached, this.concurrencyLimit,
this.taskDecorator, this.customizers, this.tas... | Set the prefix to use for the names of newly created threads.
@param threadNamePrefix the thread name prefix to set
@return a new builder instance | java | core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskExecutorBuilder.java | 90 | [
"threadNamePrefix"
] | SimpleAsyncTaskExecutorBuilder | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
getVersion | private Runtime.Version getVersion(URL url) {
// The standard JDK handler uses #runtime to indicate that the runtime version
// should be used. This unfortunately doesn't work for us as
// jdk.internal.loader.URLClassPath only adds the runtime fragment when the URL
// is using the internal JDK handler. We need ... | Create a new {@link UrlJarFile} or {@link UrlNestedJarFile} instance.
@param jarFileUrl the jar file URL
@param closeAction the action to call when the file is closed
@return a new {@link JarFile} instance
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java | 60 | [
"url"
] | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
get_waiter | def get_waiter(
self,
waiter_name: str,
parameters: dict[str, str] | None = None,
config_overrides: dict[str, Any] | None = None,
deferrable: bool = False,
client=None,
) -> botocore.waiter.Waiter:
"""
Get an AWS Batch service waiter, using the configu... | Get an AWS Batch service waiter, using the configured ``.waiter_model``.
The ``.waiter_model`` is combined with the ``.client`` to get a specific waiter and
the properties of that waiter can be modified without any accidental impact on the
generation of new waiters from the ``.waiter_model``, e.g.
.. code-block:: pyt... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/batch_waiters.py | 146 | [
"self",
"waiter_name",
"parameters",
"config_overrides",
"deferrable",
"client"
] | botocore.waiter.Waiter | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
filter | function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, getIteratee(predicate, 3));
} | Iterates over elements of `collection`, returning an array of all elements
`predicate` returns truthy for. The predicate is invoked with three
arguments: (value, index|key, collection).
**Note:** Unlike `_.remove`, this method returns a new array.
@static
@memberOf _
@since 0.1.0
@category Collection
@param {Array|Obje... | javascript | lodash.js | 9,278 | [
"collection",
"predicate"
] | false | 2 | 7.12 | lodash/lodash | 61,490 | jsdoc | false | |
_gotitem | def _gotitem(self, key, ndim, subset=None):
"""
Sub-classes to define. Return a sliced object.
Parameters
----------
key : string / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset to act on
... | Sub-classes to define. Return a sliced object.
Parameters
----------
key : string / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset to act on | python | pandas/core/resample.py | 2,022 | [
"self",
"key",
"ndim",
"subset"
] | false | 7 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false | |
getInt | public int getInt(String name) throws JSONException {
Object object = get(name);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "int");
}
return result;
} | Returns the value mapped by {@code name} if it exists and is an int or can be
coerced to an int.
@param name the name of the property
@return the value
@throws JSONException if the mapping doesn't exist or cannot be coerced to an int. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 474 | [
"name"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
exclusiveBetween | public static <T> void exclusiveBetween(final T start, final T end, final Comparable<T> value) {
// TODO when breaking BC, consider returning value
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
throw new IllegalArgumentException(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_ME... | Validate that the specified argument object fall between the two
exclusive values specified; otherwise, throws an exception.
<pre>Validate.exclusiveBetween(0, 2, 1);</pre>
@param <T> the type of the argument object.
@param start the exclusive start value, not null.
@param end the exclusive end value, not null.
@param... | java | src/main/java/org/apache/commons/lang3/Validate.java | 176 | [
"start",
"end",
"value"
] | void | true | 3 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
sum | def sum(
self,
numeric_only: bool = False,
engine: Literal["cython", "numba"] | None = None,
engine_kwargs: dict[str, bool] | None = None,
):
"""
Calculate the expanding sum.
Parameters
----------
numeric_only : bool, default False
... | Calculate the expanding sum.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
engine : str, default None
* ``'cython'`` : Runs the operation through C-extensions from cython.
* ``'numba'`` : Runs the operation through JIT compiled code from numba.
* ``... | python | pandas/core/window/expanding.py | 422 | [
"self",
"numeric_only",
"engine",
"engine_kwargs"
] | true | 1 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
invalidate | default boolean invalidate() {
clear();
return false;
} | Invalidate the cache through removing all mappings, expecting all
entries to be immediately invisible for subsequent lookups.
@return {@code true} if the cache was known to have mappings before,
{@code false} if it did not (or if prior presence of entries could
not be determined)
@since 5.2
@see #clear() | java | spring-context/src/main/java/org/springframework/cache/Cache.java | 282 | [] | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false | |
resolveValue | private Object resolveValue(RegisteredBean registeredBean) {
ConfigurableListableBeanFactory factory = registeredBean.getBeanFactory();
Object resource;
Set<String> autowiredBeanNames;
DependencyDescriptor descriptor = createDependencyDescriptor(registeredBean);
if (this.defaultName && !factory.containsBean(... | Resolve the value to inject for this instance.
@param registeredBean the bean registration
@return the value to inject | java | spring-context/src/main/java/org/springframework/context/annotation/ResourceElementResolver.java | 177 | [
"registeredBean"
] | Object | true | 5 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
resolveInnerBeanValue | private @Nullable Object resolveInnerBeanValue(Object argName, String innerBeanName, RootBeanDefinition mbd) {
try {
// Check given bean name whether it is unique. If not already unique,
// add counter - increasing the counter until the name is unique.
String actualInnerBeanName = innerBeanName;
if (mbd.i... | Resolve an inner bean definition.
@param argName the name of the argument that the inner bean is defined for
@param innerBeanName the name of the inner bean
@param mbd the merged bean definition for the inner bean
@return the resolved inner bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java | 388 | [
"argName",
"innerBeanName",
"mbd"
] | Object | true | 7 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
appendExportsOfHoistedDeclaration | function appendExportsOfHoistedDeclaration(statements: Statement[] | undefined, decl: ClassDeclaration | FunctionDeclaration): Statement[] | undefined {
if (moduleInfo.exportEquals) {
return statements;
}
let excludeName: string | undefined;
if (hasSyntacticModifier(de... | Appends the exports of a ClassDeclaration or FunctionDeclaration 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 ... | typescript | src/compiler/transformers/module/system.ts | 1,132 | [
"statements",
"decl"
] | true | 5 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
maybeCompleteWithPreviousException | private boolean maybeCompleteWithPreviousException(CompletableFuture<Void> result) {
Throwable cachedException = cachedUpdatePositionsException.getAndSet(null);
if (cachedException != null) {
result.completeExceptionally(cachedException);
return true;
}
return fal... | Update fetch positions for assigned partitions that do not have a position. This will:
<ul>
<li>check if all assigned partitions already have fetch positions and return right away if that's the case</li>
<li>trigger an async request to validate positions (detect log truncation)</li>
<li>fetch committed offs... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java | 266 | [
"result"
] | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
isrealobj | def isrealobj(x):
"""
Return True if x is a not complex type or an array of complex numbers.
The type of the input is checked, not the value. So even if the input
has an imaginary part equal to zero, `isrealobj` evaluates to False
if the data type is complex.
Parameters
----------
x : ... | Return True if x is a not complex type or an array of complex numbers.
The type of the input is checked, not the value. So even if the input
has an imaginary part equal to zero, `isrealobj` evaluates to False
if the data type is complex.
Parameters
----------
x : any
The input can be of any type and shape.
Retur... | python | numpy/lib/_type_check_impl.py | 313 | [
"x"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
addAll | @CanIgnoreReturnValue
public Builder<E> addAll(Iterable<? extends E> elements) {
for (E element : elements) {
add(element);
}
return this;
} | Adds each element of {@code elements} to the {@code ImmutableCollection} being built.
<p>Note that each builder class overrides this method in order to covariantly return its own
type.
@param elements the elements to add
@return this {@code Builder} instance
@throws NullPointerException if {@code elements} is null or c... | java | android/guava/src/com/google/common/collect/ImmutableCollection.java | 459 | [
"elements"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
lastIndexOf | public static int lastIndexOf(final CharSequence seq, final int searchChar) {
if (isEmpty(seq)) {
return INDEX_NOT_FOUND;
}
return CharSequenceUtils.lastIndexOf(seq, searchChar, seq.length());
} | Returns the index within {@code seq} of the last occurrence of the specified character. For values of {@code searchChar} in the range from 0 to 0xFFFF
(inclusive), the index (in Unicode code units) returned is the largest value <em>k</em> such that:
<pre>
this.charAt(<em>k</em>) == searchChar
</pre>
<p>
is true. For ot... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 4,833 | [
"seq",
"searchChar"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
setupChildProcessIpcChannel | function setupChildProcessIpcChannel() {
if (process.env.NODE_CHANNEL_FD) {
const fd = NumberParseInt(process.env.NODE_CHANNEL_FD, 10);
assert(fd >= 0);
// Make sure it's not accidentally inherited by child processes.
delete process.env.NODE_CHANNEL_FD;
const serializationMode =
process.en... | Patch the process object with legacy properties and normalizations.
Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.
Replace `process.argv[1]` with the resolved absolute file path of the entry point, if found.
@param {boolean} expandArgv1 - Whether to replac... | javascript | lib/internal/process/pre_execution.js | 578 | [] | false | 3 | 6.96 | nodejs/node | 114,839 | jsdoc | false | |
calculateNextTransformValue | function calculateNextTransformValue(
srcValue: TransformValue,
targetValue: TransformValue,
changeRate: number,
): TransformValue {
const nextValue: TransformValue = {
type: 'transform',
values: new Map(),
};
for (const [func, numData] of targetValue.values) {
const srcNumData = srcValue.value... | Calculate the next `CssPropertyValue` based on the source and a target one.
@param srcValue The source value
@param targetValue The target values (it's either the final or the initial value)
@param changeRate The change rate relative to the target (i.e. 1 = target value; 0 = source value)
@returns The newly generated v... | typescript | adev/src/app/features/home/animation/calculations/calc-css-value.ts | 67 | [
"srcValue",
"targetValue",
"changeRate"
] | true | 3 | 8.08 | angular/angular | 99,544 | jsdoc | false | |
forms_of_context | def forms_of_context() -> Sequence[str]:
"""Return a sequence of context form names provided by this context class.
Returns:
A sequence of strings representing the available context forms.
""" | Return a sequence of context form names provided by this context class.
Returns:
A sequence of strings representing the available context forms. | python | torch/_inductor/runtime/caching/context.py | 28 | [] | Sequence[str] | true | 1 | 6.56 | pytorch/pytorch | 96,034 | unknown | false |
buildOrThrow | @Override
public ImmutableBiMap<K, V> buildOrThrow() {
if (size == 0) {
return of();
}
if (valueComparator != null) {
if (entriesUsed) {
alternatingKeysAndValues = Arrays.copyOf(alternatingKeysAndValues, 2 * size);
}
sortEntries(alternatingKeysAndValues, s... | Returns a newly-created immutable bimap, or throws an exception if any key or value was added
more than once. The iteration order of the returned bimap is the order in which entries were
inserted into the builder, unless {@link #orderEntriesByValue} was called, in which case
entries are sorted by value.
@throws Illegal... | java | android/guava/src/com/google/common/collect/ImmutableBiMap.java | 473 | [] | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false | |
toSearchResult | function toSearchResult<T>(value: T | undefined): SearchResult<T> {
return value !== undefined ? { value } : undefined;
} | Wraps value to SearchResult.
@returns undefined if value is undefined or { value } otherwise | typescript | src/compiler/moduleNameResolver.ts | 3,409 | [
"value"
] | true | 2 | 6.16 | microsoft/TypeScript | 107,154 | jsdoc | false | |
lstrip | def lstrip(a, chars=None):
"""
For each element in `a`, return a copy with the leading characters
removed.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
chars : scalar with the same dtype as ``a``, optional
The ``chars`` argument is a strin... | For each element in `a`, return a copy with the leading characters
removed.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
chars : scalar with the same dtype as ``a``, optional
The ``chars`` argument is a string specifying the set of
characters to be removed. If ``None`... | python | numpy/_core/strings.py | 943 | [
"a",
"chars"
] | false | 2 | 7.84 | numpy/numpy | 31,054 | numpy | false | |
getRemovalListener | @SuppressWarnings("unchecked")
<K1 extends K, V1 extends V> RemovalListener<K1, V1> getRemovalListener() {
return (RemovalListener<K1, V1>)
MoreObjects.firstNonNull(removalListener, NullListener.INSTANCE);
} | Specifies a listener instance that caches should notify each time an entry is removed for any
{@linkplain RemovalCause reason}. Each cache created by this builder will invoke this listener
as part of the routine maintenance described in the class documentation above.
<p><b>Warning:</b> after invoking this method, do no... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 995 | [] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
getTypeForFactoryMethod | protected @Nullable Class<?> getTypeForFactoryMethod(String beanName, RootBeanDefinition mbd, Class<?>... typesToMatch) {
ResolvableType cachedReturnType = mbd.factoryMethodReturnType;
if (cachedReturnType != null) {
return cachedReturnType.resolve();
}
Class<?> commonType = null;
Method uniqueCandidate =... | Determine the target type for the given bean definition which is based on
a factory method. Only called if there is no singleton instance registered
for the target bean already.
<p>This implementation determines the type matching {@link #createBean}'s
different creation strategies. As far as possible, we'll perform sta... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 712 | [
"beanName",
"mbd"
] | true | 29 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false | |
complementOf | @J2ktIncompatible
@GwtIncompatible // EnumSet.complementOf
public static <E extends Enum<E>> EnumSet<E> complementOf(
Collection<E> collection, Class<E> type) {
checkNotNull(collection);
return (collection instanceof EnumSet)
? EnumSet.complementOf((EnumSet<E>) collection)
: makeComple... | Creates an {@code EnumSet} consisting of all enum values that are not in the specified
collection. This is equivalent to {@link EnumSet#complementOf}, but can act on any input
collection, as long as the elements are of enum type.
@param collection the collection whose complement should be stored in the {@code EnumSet}
... | java | android/guava/src/com/google/common/collect/Sets.java | 527 | [
"collection",
"type"
] | true | 2 | 7.76 | google/guava | 51,352 | javadoc | false | |
declareLocal | function declareLocal(name?: string): Identifier {
const temp = name
? factory.createUniqueName(name)
: factory.createTempVariable(/*recordTempVariable*/ undefined);
hoistVariableDeclaration(temp);
return temp;
} | Visits an ElementAccessExpression that contains a YieldExpression.
@param node The node to visit. | typescript | src/compiler/transformers/generators.ts | 2,098 | [
"name?"
] | true | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getAsText | @Override
public String getAsText() {
Date value = (Date) getValue();
return (value != null ? this.dateFormat.format(value) : "");
} | Format the Date as String, using the specified DateFormat. | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomDateEditor.java | 121 | [] | String | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
nextInLineFetch | CompletedFetch nextInLineFetch() {
try {
lock.lock();
return nextInLineFetch;
} finally {
lock.unlock();
}
} | Return whether we have any completed fetches pending return to the user. This method is thread-safe. Has
visibility for testing.
@return {@code true} if there are completed fetches that match the {@link Predicate}, {@code false} otherwise | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java | 116 | [] | CompletedFetch | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
getFlattenedMap | protected final Map<String, Object> getFlattenedMap(Map<String, Object> source) {
Map<String, Object> result = new LinkedHashMap<>();
buildFlattenedMap(result, source, null);
return result;
} | Return a flattened version of the given map, recursively following any nested Map
or Collection values. Entries from the resulting map retain the same order as the
source. When called with the Map from a {@link MatchCallback} the result will
contain the same values as the {@link MatchCallback} Properties.
@param source... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java | 306 | [
"source"
] | true | 1 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
enhance | public Class<?> enhance(Class<?> configClass, @Nullable ClassLoader classLoader) {
if (EnhancedConfiguration.class.isAssignableFrom(configClass)) {
if (logger.isDebugEnabled()) {
logger.debug(String.format("Ignoring request to enhance %s as it has " +
"already been enhanced. This usually indicates that m... | Loads the specified class and generates a CGLIB subclass of it equipped with
container-aware callbacks capable of respecting scoping and other bean semantics.
@return the enhanced subclass | java | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java | 102 | [
"configClass",
"classLoader"
] | true | 10 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
populateSearchSymbolSet | function populateSearchSymbolSet(symbol: Symbol, location: Node, checker: TypeChecker, isForRename: boolean, providePrefixAndSuffixText: boolean, implementations: boolean): Symbol[] {
const result: Symbol[] = [];
forEachRelatedSymbol<void>(
symbol,
location,
chec... | Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol
is an interface, determines if some ancestor of the child symbol extends or inherits from it.
Also takes in a cache of previous results which makes this slightly more efficient and is
necessary to avoid potential loops lik... | typescript | src/services/findAllReferences.ts | 2,511 | [
"symbol",
"location",
"checker",
"isForRename",
"providePrefixAndSuffixText",
"implementations"
] | true | 6 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
wait_for_availability | def wait_for_availability(
self,
replication_group_id: str,
initial_sleep_time: float | None = None,
exponential_back_off_factor: float | None = None,
max_retries: int | None = None,
) -> bool:
"""
Check if replication group is available or not by performing a... | Check if replication group is available or not by performing a describe over it.
:param replication_group_id: ID of replication group to check for availability
:param initial_sleep_time: Initial sleep time in seconds
If this is not supplied then this is defaulted to class level value
:param exponential_back_off_fa... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/elasticache_replication_group.py | 120 | [
"self",
"replication_group_id",
"initial_sleep_time",
"exponential_back_off_factor",
"max_retries"
] | bool | true | 9 | 7.76 | apache/airflow | 43,597 | sphinx | false |
nextBatch | @Override
public FileChannelRecordBatch nextBatch() throws IOException {
FileChannel channel = fileRecords.channel();
if (position >= end - HEADER_SIZE_UP_TO_MAGIC)
return null;
logHeaderBuffer.rewind();
Utils.readFullyOrFail(channel, logHeaderBuffer, position, "log head... | Create a new log input stream over the FileChannel
@param records Underlying FileRecords instance
@param start Position in the file channel to start from
@param end Position in the file channel not to read past | java | clients/src/main/java/org/apache/kafka/common/record/FileLogInputStream.java | 62 | [] | FileChannelRecordBatch | true | 5 | 6.24 | apache/kafka | 31,560 | javadoc | false |
collectImports | private void collectImports(SourceClass sourceClass, Set<SourceClass> imports, Set<SourceClass> visited)
throws IOException {
if (visited.add(sourceClass)) {
for (SourceClass ifc : sourceClass.getInterfaces()) {
collectImports(ifc, imports, visited);
}
for (SourceClass annotation : sourceClass.getAnn... | Recursively collect all declared {@code @Import} values. Unlike most
meta-annotations it is valid to have several {@code @Import}s declared with
different values; the usual process of returning values from the first
meta-annotation on a class is not sufficient.
<p>For example, it is common for a {@code @Configuration} ... | java | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java | 562 | [
"sourceClass",
"imports",
"visited"
] | void | true | 3 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
synchronizedNavigableMap | @GwtIncompatible // NavigableMap
@J2ktIncompatible // Synchronized
public static <K extends @Nullable Object, V extends @Nullable Object>
NavigableMap<K, V> synchronizedNavigableMap(NavigableMap<K, V> navigableMap) {
return Synchronized.navigableMap(navigableMap);
} | Returns a synchronized (thread-safe) navigable map backed by the specified navigable map. In
order to guarantee serial access, it is critical that <b>all</b> access to the backing
navigable map is accomplished through the returned navigable map (or its views).
<p>It is imperative that the user manually synchronize on t... | java | android/guava/src/com/google/common/collect/Maps.java | 3,501 | [
"navigableMap"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ZstdCompression that = (ZstdCompression) o;
return level == that.level;
} | Size of intermediate buffer which contains uncompressed data.
This size should be <= ZSTD_BLOCKSIZE_MAX
see: https://github.com/facebook/zstd/blob/189653a9c10c9f4224a5413a6d6a69dd01d7c3bd/lib/zstd.h#L854 | java | clients/src/main/java/org/apache/kafka/common/compress/ZstdCompression.java | 111 | [
"o"
] | true | 4 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
forcePut | @CanIgnoreReturnValue
@Nullable V forcePut(@ParametricNullness K key, @ParametricNullness V value); | An alternate form of {@code put} that silently removes any existing entry with the value {@code
value} before proceeding with the {@link #put} operation. If the bimap previously contained the
provided key-value mapping, this method has no effect.
<p>Note that a successful call to this method could cause the size of the... | java | android/guava/src/com/google/common/collect/BiMap.java | 78 | [
"key",
"value"
] | V | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
freshAdvisorChain | private List<Advisor> freshAdvisorChain() {
Advisor[] advisors = getAdvisors();
List<Advisor> freshAdvisors = new ArrayList<>(advisors.length);
for (Advisor advisor : advisors) {
if (advisor instanceof PrototypePlaceholderAdvisor ppa) {
if (logger.isDebugEnabled()) {
logger.debug("Refreshing bean name... | Return an independent advisor chain.
We need to do this every time a new prototype instance is returned,
to return distinct instances of prototype Advisors and Advices. | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java | 458 | [] | true | 4 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false | |
getFinalizeReferentMethod | private @Nullable Method getFinalizeReferentMethod() {
Class<?> finalizableReferenceClass = finalizableReferenceClassReference.get();
if (finalizableReferenceClass == null) {
/*
* FinalizableReference's class loader was reclaimed. While there's a chance that other
* finalizable references co... | Looks up FinalizableReference.finalizeReferent() method. | java | android/guava/src/com/google/common/base/internal/Finalizer.java | 214 | [] | Method | true | 3 | 6.08 | google/guava | 51,352 | javadoc | false |
parseImportType | function parseImportType(): ImportTypeNode {
sourceFlags |= NodeFlags.PossiblyContainsDynamicImport;
const pos = getNodePos();
const isTypeOf = parseOptional(SyntaxKind.TypeOfKeyword);
parseExpected(SyntaxKind.ImportKeyword);
parseExpected(SyntaxKind.OpenParenToken);
... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 4,547 | [] | true | 9 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
writeReplace | @Override
@J2ktIncompatible // serialization
Object writeReplace() {
return new SerializedForm<E>(this);
} | A builder for creating immutable multiset instances, especially {@code public static final}
multisets ("constant multisets"). Example:
{@snippet :
public static final ImmutableSortedMultiset<Bean> BEANS =
new ImmutableSortedMultiset.Builder<Bean>(colorComparator())
.addCopies(Bean.COCOA, 4)
.addCopi... | java | android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 736 | [] | Object | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
uniqueBeanName | public static String uniqueBeanName(String beanName, BeanDefinitionRegistry registry) {
String id = beanName;
int counter = -1;
// Increase counter until the id is unique.
String prefix = beanName + GENERATED_BEAN_NAME_SEPARATOR;
while (counter == -1 || registry.containsBeanDefinition(id)) {
counter++;
... | Turn the given bean name into a unique bean name for the given bean factory,
appending a unique counter as suffix if necessary.
@param beanName the original bean name
@param registry the bean factory that the definition is going to be
registered with (to check for existing bean names)
@return the unique bean name to us... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java | 139 | [
"beanName",
"registry"
] | String | true | 3 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
generate_uuid | def generate_uuid(*values: str | None, namespace: UUID = NAMESPACE_OID) -> str:
"""
Convert input values to deterministic UUID string representation.
This function is only intended to generate a hash which used as an identifier, not for any security use.
Generates a UUID v5 (SHA-1 + Namespace) for eac... | Convert input values to deterministic UUID string representation.
This function is only intended to generate a hash which used as an identifier, not for any security use.
Generates a UUID v5 (SHA-1 + Namespace) for each value provided,
and this UUID is used as the Namespace for the next element.
If only one non-None... | python | providers/amazon/src/airflow/providers/amazon/aws/utils/identifiers.py | 25 | [
"namespace"
] | str | true | 6 | 7.04 | apache/airflow | 43,597 | sphinx | false |
pad | function pad(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
if (!length || strLength >= length) {
return string;
}
var mid = (length - strLength) / 2;
return (
createPadding(nativ... | Pads `string` on the left and right sides if it's shorter than `length`.
Padding characters are truncated if they can't be evenly divided by `length`.
@static
@memberOf _
@since 3.0.0
@category String
@param {string} [string=''] The string to pad.
@param {number} [length=0] The padding length.
@param {string} [chars=' ... | javascript | lodash.js | 14,478 | [
"string",
"length",
"chars"
] | false | 4 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
submit_event | def submit_event(cls, trigger_id, event: TriggerEvent, session: Session = NEW_SESSION) -> None:
"""
Fire an event.
Resume all tasks that were in deferred state.
Send an event to all assets associated to the trigger.
"""
# Resume deferred tasks
for task_instance i... | Fire an event.
Resume all tasks that were in deferred state.
Send an event to all assets associated to the trigger. | python | airflow-core/src/airflow/models/trigger.py | 248 | [
"cls",
"trigger_id",
"event",
"session"
] | None | true | 5 | 6 | apache/airflow | 43,597 | unknown | false |
addInitialImportContributors | private void addInitialImportContributors(List<ConfigDataEnvironmentContributor> initialContributors,
ConfigDataLocation[] locations) {
for (int i = locations.length - 1; i >= 0; i--) {
if (ConfigDataLocation.isNotEmpty(locations[i])) {
initialContributors.add(createInitialImportContributor(locations[i]));
... | Create a new {@link ConfigDataEnvironment} instance.
@param logFactory the deferred log factory
@param bootstrapContext the bootstrap context
@param environment the Spring {@link Environment}.
@param resourceLoader {@link ResourceLoader} to load resource locations
@param additionalProfiles any additional profiles to ac... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironment.java | 214 | [
"initialContributors",
"locations"
] | void | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
forEach | @Override
public void forEach(BiConsumer<? super K, ? super V> action) {
checkNotNull(action);
ImmutableList<K> keyList = keySet.asList();
for (int i = 0; i < size(); i++) {
action.accept(keyList.get(i), valueList.get(i));
}
} | A builder for creating immutable sorted map instances, especially {@code public static final}
maps ("constant maps"). Example:
{@snippet :
static final ImmutableSortedMap<Integer, String> INT_TO_WORD =
new ImmutableSortedMap.Builder<Integer, String>(Ordering.natural())
.put(1, "one")
.put(2, "two")
... | java | guava/src/com/google/common/collect/ImmutableSortedMap.java | 780 | [
"action"
] | void | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false |
start | @Override
public StartupStep start(String name) {
int id = this.idSeq.getAndIncrement();
Instant start = this.clock.instant();
while (true) {
BufferedStartupStep current = this.current.get();
BufferedStartupStep parent = getLatestActive(current);
BufferedStartupStep next = new BufferedStartupStep(parent... | Add a predicate filter to the list of existing ones.
<p>
A {@link StartupStep step} that doesn't match all filters will not be recorded.
@param filter the predicate filter to add. | java | core/spring-boot/src/main/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartup.java | 110 | [
"name"
] | StartupStep | true | 3 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
minimalWithCount | public static ZeroBucket minimalWithCount(long count) {
if (count == 0) {
return MINIMAL_EMPTY;
} else {
return new ZeroBucket(MINIMAL_EMPTY, count);
}
} | Creates a zero bucket with the smallest possible threshold and a given count.
@param count The number of values in the bucket.
@return A new {@link ZeroBucket}. | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ZeroBucket.java | 112 | [
"count"
] | ZeroBucket | true | 2 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false |
mulAndCheck | private static int mulAndCheck(final int x, final int y) {
final long m = (long) x * (long) y;
if (m < Integer.MIN_VALUE || m > Integer.MAX_VALUE) {
throw new ArithmeticException("overflow: mul");
}
return (int) m;
} | Multiplies two integers, checking for overflow.
@param x a factor
@param y a factor
@return the product {@code x*y}
@throws ArithmeticException if the result cannot be represented as
an int | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 414 | [
"x",
"y"
] | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
_fit_transform | def _fit_transform(self, X, W=None, H=None, update_H=True):
"""Learn a NMF model for the data X and returns the transformed data.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_samples, n_features)
Data matrix to be decomposed.
W : array-like of shap... | Learn a NMF model for the data X and returns the transformed data.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_samples, n_features)
Data matrix to be decomposed.
W : array-like of shape (n_samples, n_components), default=None
If `init='custom'`, it is used as initial guess for the solution.... | python | sklearn/decomposition/_nmf.py | 2,219 | [
"self",
"X",
"W",
"H",
"update_H"
] | false | 9 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
checkValue | static void checkValue(double x) {
if (Double.isNaN(x) || Double.isInfinite(x)) {
throw new IllegalArgumentException("Invalid value: " + x);
}
} | Add a single sample to this TDigest.
@param x The data value to add | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/TDigest.java | 112 | [
"x"
] | void | true | 3 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
as_ctypes | def as_ctypes(obj):
"""
Create and return a ctypes object from a numpy array. Actually
anything that exposes the __array_interface__ is accepted.
Examples
--------
Create ctypes object from inferred int ``np.array``:
>>> inferred_int_array = np.array([1, 2, 3])... | Create and return a ctypes object from a numpy array. Actually
anything that exposes the __array_interface__ is accepted.
Examples
--------
Create ctypes object from inferred int ``np.array``:
>>> inferred_int_array = np.array([1, 2, 3])
>>> c_int_array = np.ctypeslib.as_ctypes(inferred_int_array)
>>> type(c_int_arr... | python | numpy/ctypeslib/_ctypeslib.py | 562 | [
"obj"
] | false | 4 | 6.32 | numpy/numpy | 31,054 | unknown | false | |
back | public void back() {
if (--this.pos == -1) {
this.pos = 0;
}
} | Returns the current position and the entire input string.
@return the current position and the entire input string. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 534 | [] | void | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
applyScopedProxyMode | static BeanDefinitionHolder applyScopedProxyMode(
ScopeMetadata metadata, BeanDefinitionHolder definition, BeanDefinitionRegistry registry) {
ScopedProxyMode scopedProxyMode = metadata.getScopedProxyMode();
if (scopedProxyMode.equals(ScopedProxyMode.NO)) {
return definition;
}
boolean proxyTargetClass = ... | Register all relevant annotation post processors in the given registry.
@param registry the registry to operate on
@param source the configuration source element (already extracted)
that this registration was triggered from. May be {@code null}.
@return a Set of BeanDefinitionHolders, containing all bean definitions
th... | java | spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java | 278 | [
"metadata",
"definition",
"registry"
] | BeanDefinitionHolder | true | 2 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
parentContextContainsSameBean | private boolean parentContextContainsSameBean(ApplicationContext context, @Nullable String beanKey) {
if (context.getParent() == null) {
return false;
}
try {
ApplicationContext parent = this.applicationContext.getParent();
Assert.state(parent != null, "'parent' must not be null");
Assert.state(beanKe... | Set if unique runtime object names should be ensured.
@param ensureUniqueRuntimeObjectNames {@code true} if unique names should be
ensured. | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java | 80 | [
"context",
"beanKey"
] | true | 3 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
to_clipboard | def to_clipboard(
self, *, excel: bool = True, sep: str | None = None, **kwargs
) -> None:
r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
-------... | r"""
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
----------
excel : bool, default True
Produce output in a csv format for easy pasting into excel.
- True, use the provided separator for csv pasting.... | python | pandas/core/generic.py | 3,130 | [
"self",
"excel",
"sep"
] | None | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
run_query | def run_query(
self,
query: str,
query_context: dict[str, str],
result_configuration: dict[str, Any],
client_request_token: str | None = None,
workgroup: str = "primary",
) -> str:
"""
Run a Trino/Presto query on Athena with provided config.
.... | Run a Trino/Presto query on Athena with provided config.
.. seealso::
- :external+boto3:py:meth:`Athena.Client.start_query_execution`
:param query: Trino/Presto query to run.
:param query_context: Context in which query need to be run.
:param result_configuration: Dict with path to store results in and
config... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py | 93 | [
"self",
"query",
"query_context",
"result_configuration",
"client_request_token",
"workgroup"
] | str | true | 3 | 7.44 | apache/airflow | 43,597 | sphinx | false |
replaceSystemProperties | public static String replaceSystemProperties(final Object source) {
return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
} | Replaces all the occurrences of variables in the given source object with
their matching values from the system properties.
@param source the source text containing the variables to substitute, null returns null.
@return the result of the replace operation. | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 225 | [
"source"
] | String | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
mapInternal | private static MappedByteBuffer mapInternal(File file, MapMode mode, long size)
throws IOException {
checkNotNull(file);
checkNotNull(mode);
Closer closer = Closer.create();
try {
RandomAccessFile raf =
closer.register(new RandomAccessFile(file, mode == MapMode.READ_ONLY ? "r" : "... | Maps a file in to memory as per {@link FileChannel#map(java.nio.channels.FileChannel.MapMode,
long, long)} using the requested {@link MapMode}.
<p>Files are mapped from offset 0 to {@code size}.
<p>If the mode is {@link MapMode#READ_WRITE} and the file does not exist, it will be created
with the requested {@code size}.... | java | android/guava/src/com/google/common/io/Files.java | 695 | [
"file",
"mode",
"size"
] | MappedByteBuffer | true | 4 | 8.08 | google/guava | 51,352 | javadoc | false |
replace | public String replace(final String text, final String searchString, final String replacement) {
return replace(text, searchString, replacement, -1);
} | Case insensitively replaces all occurrences of a String within another String.
<p>
A {@code null} reference passed to this method is a no-op.
</p>
<p>
Case-sensitive examples
</p>
<pre>
Strings.CS.replace(null, *, *) = null
Strings.CS.replace("", *, *) = ""
Strings.CS.replace("any", null, *) = "any"
... | java | src/main/java/org/apache/commons/lang3/Strings.java | 1,237 | [
"text",
"searchString",
"replacement"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
fetchablePartitions | public synchronized List<TopicPartition> fetchablePartitions(Predicate<TopicPartition> isAvailable) {
// Since this is in the hot-path for fetching, we do this instead of using java.util.stream API
List<TopicPartition> result = new ArrayList<>();
assignment.forEach((topicPartition, topicPartitio... | Provides the number of assigned partitions in a thread safe manner.
@return the number of assigned partitions. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 486 | [
"isAvailable"
] | true | 4 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
addOrMergeSource | private void addOrMergeSource(Map<String, ConfigurationMetadataSource> sources, String name,
ConfigurationMetadataSource source) {
ConfigurationMetadataSource existingSource = sources.get(name);
if (existingSource == null) {
sources.put(name, source);
}
else {
source.getProperties().forEach((k, v) -> e... | Merge the content of the specified repository to this repository.
@param repository the repository to include | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java | 106 | [
"sources",
"name",
"source"
] | void | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
asByteArray | byte[] asByteArray() {
ByteBuffer buffer = ByteBuffer.allocate((int) size());
buffer.order(ByteOrder.LITTLE_ENDIAN);
if (this.includeSignature) {
buffer.putInt(SIGNATURE);
}
buffer.putInt(this.crc32);
buffer.putInt(this.compressedSize);
buffer.putInt(this.uncompressedSize);
return buffer.array();
} | Return the contents of this record as a byte array suitable for writing to a zip.
@return the record as a byte array | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipDataDescriptorRecord.java | 54 | [] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
anyNotNull | public static boolean anyNotNull(final Object... values) {
return firstNonNull(values) != null;
} | Tests if any value in the given array is not {@code null}.
<p>
If all the values are {@code null} or the array is {@code null} or empty then {@code false} is returned. Otherwise {@code true} is returned.
</p>
<pre>
ObjectUtils.anyNotNull(*) = true
ObjectUtils.anyNotNull(*, null) = true
ObjectUti... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 193 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
getFormatter | protected DateTimeFormatter getFormatter(DateTimeFormat annotation, Class<?> fieldType) {
DateTimeFormatterFactory factory = new DateTimeFormatterFactory();
String style = resolveEmbeddedValue(annotation.style());
if (StringUtils.hasLength(style)) {
factory.setStylePattern(style);
}
factory.setIso(annotati... | Factory method used to create a {@link DateTimeFormatter}.
@param annotation the format annotation for the field
@param fieldType the declared type of the field
@return a {@link DateTimeFormatter} instance | java | spring-context/src/main/java/org/springframework/format/datetime/standard/Jsr310DateTimeFormatAnnotationFormatterFactory.java | 118 | [
"annotation",
"fieldType"
] | DateTimeFormatter | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
loadBeans | private <T> Map<String, T> loadBeans(Class<T> type) {
return (this.beanFactory != null ?
BeanFactoryUtils.beansOfTypeIncludingAncestors(this.beanFactory, type, true, false) :
Collections.emptyMap());
} | Load all AOT services of the given type.
@param <T> the service type
@param type the service type
@return a new {@link AotServices} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java | 213 | [
"type"
] | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false | |
appendRecursiveTypes | private static void appendRecursiveTypes(final StringBuilder builder, final int[] recursiveTypeIndexes, final Type[] argumentTypes) {
for (int i = 0; i < recursiveTypeIndexes.length; i++) {
// toString() or SO
GT_JOINER.join(builder, argumentTypes[i].toString());
}
final ... | A wildcard instance matching {@code ?}.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 330 | [
"builder",
"recursiveTypeIndexes",
"argumentTypes"
] | void | true | 3 | 6 | apache/commons-lang | 2,896 | javadoc | false |
baseMatches | function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
... | The base implementation of `_.matches` which doesn't clone `source`.
@private
@param {Object} source The object of property values to match.
@returns {Function} Returns the new spec function. | javascript | lodash.js | 3,597 | [
"source"
] | false | 4 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
generateCode | @Deprecated(since = "6.1.7")
public CodeBlock generateCode(RegisteredBean registeredBean, Executable constructorOrFactoryMethod) {
return generateCode(registeredBean, new InstantiationDescriptor(
constructorOrFactoryMethod, constructorOrFactoryMethod.getDeclaringClass()));
} | Generate the instance supplier code.
@param registeredBean the bean to handle
@param constructorOrFactoryMethod the executable to use to create the bean
@return the generated code
@deprecated in favor of {@link #generateCode(RegisteredBean, InstantiationDescriptor)} | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java | 128 | [
"registeredBean",
"constructorOrFactoryMethod"
] | CodeBlock | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
maybeBindReturningVariable | private void maybeBindReturningVariable() {
if (this.numberOfRemainingUnboundArguments == 0) {
throw new IllegalStateException(
"Algorithm assumes that there must be at least one unbound parameter on entry to this method");
}
if (this.returningName != null) {
if (this.numberOfRemainingUnboundArguments... | If a returning variable was specified and there is only one choice remaining, bind it. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 362 | [] | void | true | 6 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
baseArity | function baseArity(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
} | Creates a function, with an arity of `n`, that invokes `func` with the
arguments it receives.
@private
@param {Function} func The function to wrap.
@param {number} n The arity of the new function.
@returns {Function} Returns the new function. | javascript | fp/_baseConvert.js | 16 | [
"func",
"n"
] | false | 2 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
writeEntries | final void writeEntries(JarFile jarFile, EntryTransformer entryTransformer, UnpackHandler unpackHandler,
Function<JarEntry, @Nullable Library> libraryLookup) throws IOException {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
L... | Write the specified manifest.
@param manifest the manifest to write
@throws IOException of the manifest cannot be written | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/AbstractJarWriter.java | 88 | [
"jarFile",
"entryTransformer",
"unpackHandler",
"libraryLookup"
] | void | true | 4 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
andThen | default FailableLongUnaryOperator<E> andThen(final FailableLongUnaryOperator<E> after) {
Objects.requireNonNull(after);
return (final long t) -> after.applyAsLong(applyAsLong(t));
} | Returns a composed {@link FailableDoubleUnaryOperator} like {@link LongUnaryOperator#andThen(LongUnaryOperator)}.
@param after the operator to apply after this one.
@return a composed {@link FailableLongUnaryOperator} like {@link LongUnaryOperator#andThen(LongUnaryOperator)}.
@throws NullPointerException if after is nu... | java | src/main/java/org/apache/commons/lang3/function/FailableLongUnaryOperator.java | 64 | [
"after"
] | true | 1 | 6 | apache/commons-lang | 2,896 | javadoc | false | |
kafkaShareConsumerMetrics | @Override
public KafkaShareConsumerMetrics kafkaShareConsumerMetrics() {
return kafkaShareConsumerMetrics;
} | This method can be used by cases where the caller has an event that needs to both block for completion but
also process background events. For some events, in order to fully process the associated logic, the
{@link ConsumerNetworkThread background thread} needs assistance from the application thread to complete.
If the... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java | 1,355 | [] | KafkaShareConsumerMetrics | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.