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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
completeExceptionally | @Override
public boolean completeExceptionally(Throwable ex) {
throw erroneousCompletionException();
} | 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 | 57 | [
"ex"
] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
byteValue | @Override
public byte byteValue() {
return value;
} | Returns the value of this MutableByte as a byte.
@return the numeric value represented by this object after conversion to type byte. | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 136 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
nancumprod | def nancumprod(a, axis=None, dtype=None, out=None):
"""
Return the cumulative product of array elements over a given axis treating Not a
Numbers (NaNs) as one. The cumulative product does not change when NaNs are
encountered and leading NaNs are replaced by ones.
Ones are returned for slices that ... | Return the cumulative product of array elements over a given axis treating Not a
Numbers (NaNs) as one. The cumulative product does not change when NaNs are
encountered and leading NaNs are replaced by ones.
Ones are returned for slices that are all-NaN or empty.
Parameters
----------
a : array_like
Input array.... | python | numpy/lib/_nanfunctions_impl.py | 886 | [
"a",
"axis",
"dtype",
"out"
] | false | 1 | 6.4 | numpy/numpy | 31,054 | numpy | false | |
sendMetadataRequest | private RequestFuture<ClientResponse> sendMetadataRequest(MetadataRequest.Builder request) {
final Node node = client.leastLoadedNode();
if (node == null)
return RequestFuture.noBrokersAvailable();
else
return client.send(node, request);
} | Send Metadata Request to the least loaded node in Kafka cluster asynchronously
@return A future that indicates result of sent metadata request | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/TopicMetadataFetcher.java | 159 | [
"request"
] | true | 2 | 6.24 | apache/kafka | 31,560 | javadoc | false | |
optString | public String optString(String name, String fallback) {
Object object = opt(name);
String result = JSON.toString(object);
return result != null ? result : fallback;
} | Returns the value mapped by {@code name} if it exists, coercing it if necessary.
Returns {@code fallback} if no such mapping exists.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 582 | [
"name",
"fallback"
] | String | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
getAbbreviatedName | public static String getAbbreviatedName(final Class<?> cls, final int lengthHint) {
if (cls == null) {
return StringUtils.EMPTY;
}
return getAbbreviatedName(cls.getName(), lengthHint);
} | Gets the abbreviated name of a {@link Class}.
@param cls the class to get the abbreviated name for, may be {@code null}.
@param lengthHint the desired length of the abbreviated name.
@return the abbreviated name or an empty string.
@throws IllegalArgumentException if len <= 0.
@see #getAbbreviatedName(String, int)
@... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 246 | [
"cls",
"lengthHint"
] | String | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
ObserverContainer | ObserverContainer(ObserverContainer&&) = delete; | Invokes an observer interface method on all observers.
@param fn Function to call for each observer that takes a pointer
to the observer and invokes the interface method. | cpp | folly/ObserverContainer.h | 1,011 | [] | true | 2 | 6.32 | facebook/folly | 30,157 | doxygen | false | |
handle | void handle(ConfigurationClass configClass, DeferredImportSelector importSelector) {
DeferredImportSelectorHolder holder = new DeferredImportSelectorHolder(configClass, importSelector);
if (this.deferredImportSelectors == null) {
DeferredImportSelectorGroupingHandler handler = new DeferredImportSelectorGroupi... | Handle the specified {@link DeferredImportSelector}. If deferred import
selectors are being collected, this registers this instance to the list. If
they are being processed, the {@link DeferredImportSelector} is also processed
immediately according to its {@link DeferredImportSelector.Group}.
@param configClass the sou... | java | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java | 811 | [
"configClass",
"importSelector"
] | void | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
find_mismatched_vars | def find_mismatched_vars(
var: Any, types: type | tuple[type, ...], allow_none: bool = False
) -> set[VariableTracker]:
"""
Recursively finds variables whose type is not an instance of the specified types.
Args:
var: The variable to check.
types: A tuple of allowed types.
allow_n... | Recursively finds variables whose type is not an instance of the specified types.
Args:
var: The variable to check.
types: A tuple of allowed types.
allow_none (bool): Whether to allow None values. Defaults to False.
Returns:
A set of variables whose type is not an instance of the specified types. | python | torch/_dynamo/variables/higher_order_ops.py | 196 | [
"var",
"types",
"allow_none"
] | set[VariableTracker] | true | 11 | 8.08 | pytorch/pytorch | 96,034 | google | false |
memberId | protected synchronized String memberId() {
return generation.memberId;
} | Get the current generation state if the group is stable, otherwise return null
@return the current generation or null | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 1,057 | [] | String | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
strides_symbolic | def strides_symbolic(self) -> tuple[tuple[sympy.Integer, ...], ...]:
"""
Get the symbolic strides of all input nodes.
Returns:
A tuple of stride tuples for each input node
"""
return tuple(node.get_stride() for node in self._input_nodes) | Get the symbolic strides of all input nodes.
Returns:
A tuple of stride tuples for each input node | python | torch/_inductor/kernel_inputs.py | 132 | [
"self"
] | tuple[tuple[sympy.Integer, ...], ...] | true | 1 | 6.56 | pytorch/pytorch | 96,034 | unknown | false |
resolveArguments | private @Nullable AutowiredArguments resolveArguments(RegisteredBean registeredBean,
Method method) {
String beanName = registeredBean.getBeanName();
Class<?> beanClass = registeredBean.getBeanClass();
ConfigurableBeanFactory beanFactory = registeredBean.getBeanFactory();
Assert.isInstanceOf(AutowireCapable... | Resolve the method arguments for the specified registered bean and invoke
the method using reflection.
@param registeredBean the registered bean
@param instance the bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredMethodArgumentsResolver.java | 156 | [
"registeredBean",
"method"
] | AutowiredArguments | true | 7 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
_encode_relation | def _encode_relation(self, name):
'''(INTERNAL) Decodes a relation line.
The relation declaration is a line with the format ``@RELATION
<relation-name>``, where ``relation-name`` is a string.
:param name: a string.
:return: a string with the encoded relation declaration.
... | (INTERNAL) Decodes a relation line.
The relation declaration is a line with the format ``@RELATION
<relation-name>``, where ``relation-name`` is a string.
:param name: a string.
:return: a string with the encoded relation declaration. | python | sklearn/externals/_arff.py | 921 | [
"self",
"name"
] | false | 3 | 7.12 | scikit-learn/scikit-learn | 64,340 | sphinx | false | |
_to_object_array | def _to_object_array(sequence):
"""Convert sequence to a 1-D NumPy array of object dtype.
numpy.array constructor has a similar use but it's output
is ambiguous. It can be 1-D NumPy array of object dtype if
the input is a ragged array, but if the input is a list of
equal length arrays, then the out... | Convert sequence to a 1-D NumPy array of object dtype.
numpy.array constructor has a similar use but it's output
is ambiguous. It can be 1-D NumPy array of object dtype if
the input is a ragged array, but if the input is a list of
equal length arrays, then the output is a 2D numpy.array.
_to_object_array solves this a... | python | sklearn/utils/validation.py | 2,597 | [
"sequence"
] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
matchesBeanType | private boolean matchesBeanType(Class<?> targetType, String beanName, BeanFactory beanFactory) {
Class<?> beanType = beanFactory.getType(beanName);
return (beanType != null && targetType.isAssignableFrom(beanType));
} | Retrieve all applicable Lifecycle beans: all singletons that have already been created,
as well as all SmartLifecycle beans (even if they are marked as lazy-init).
@return the Map of applicable beans, with bean names as keys and bean instances as values | java | spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java | 548 | [
"targetType",
"beanName",
"beanFactory"
] | true | 2 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false | |
tokenRangeFromRange | function tokenRangeFromRange(from: SyntaxKind, to: SyntaxKind, except: readonly SyntaxKind[] = []): TokenRange {
const tokens: SyntaxKind[] = [];
for (let token = from; token <= to; token++) {
if (!contains(except, token)) {
tokens.push(token);
}
}
return tokenRangeFro... | A rule takes a two tokens (left/right) and a particular context
for which you're meant to look at them. You then declare what should the
whitespace annotation be between these tokens via the action param.
@param debugName Name to print
@param left The left side of the comparison
@param right The right side of the... | typescript | src/services/formatting/rules.ts | 455 | [
"from",
"to",
"except"
] | true | 3 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
additionalArgumentsStartsWith | private boolean additionalArgumentsStartsWith(Predicate<@Nullable Object> startsWith) {
if (this.additionalArguments == null) {
return false;
}
return Stream.of(this.additionalArguments).anyMatch(startsWith);
} | Use a specific filter to determine when a callback should apply. If no explicit
filter is set filter will be attempted using the generic type on the callback
type.
@param filter the filter to use
@return this instance
@since 3.4.8 | java | core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java | 182 | [
"startsWith"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getTopLevelType | private Element getTopLevelType(Element element) {
if (!(element.getEnclosingElement() instanceof TypeElement)) {
return element;
}
return getTopLevelType(element.getEnclosingElement());
} | Return if this property has been explicitly marked as nested (for example using an
annotation}.
@param environment the metadata generation environment
@return if the property has been marked as nested | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptor.java | 173 | [
"element"
] | Element | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
attach | public static void attach(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment).getPropertySources();
PropertySource<?> attached = getAttached(sources);
if (!isUsingSources(attached, sources)) {
att... | Attach a {@link ConfigurationPropertySource} support to the specified
{@link Environment}. Adapts each {@link PropertySource} managed by the environment
to a {@link ConfigurationPropertySource} and allows classic
{@link PropertySourcesPropertyResolver} calls to resolve using
{@link ConfigurationPropertyName configurati... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java | 89 | [
"environment"
] | void | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
toString | public static String toString(final Boolean bool, final String trueString, final String falseString, final String nullString) {
if (bool == null) {
return nullString;
}
return bool.booleanValue() ? trueString : falseString;
} | Converts a Boolean to a String returning one of the input Strings.
<pre>
BooleanUtils.toString(Boolean.TRUE, "true", "false", null) = "true"
BooleanUtils.toString(Boolean.FALSE, "true", "false", null) = "false"
BooleanUtils.toString(null, "true", "false", null) = null;
</pre>
@param bool the Boolean... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 1,037 | [
"bool",
"trueString",
"falseString",
"nullString"
] | String | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
sqr7uBulkWithOffsets | private static void sqr7uBulkWithOffsets(
MemorySegment a,
MemorySegment b,
int length,
int pitch,
MemorySegment offsets,
int count,
MemorySegment result
) {
try {
JdkVectorLibrary.sqr7uBulkWithOffset... | Computes the square distance of given float32 vectors.
@param a address of the first vector
@param b address of the second vector
@param elementCount the vector dimensions, number of float32 elements in the segment | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/jdk/JdkVectorLibrary.java | 339 | [
"a",
"b",
"length",
"pitch",
"offsets",
"count",
"result"
] | void | true | 2 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
updateLayerIndex | private void updateLayerIndex(JarArchiveEntry entry, @Nullable Library library) {
if (this.layers != null && this.layersIndex != null && !entry.getName().endsWith("/")) {
Layer layer = (library != null) ? this.layers.getLayer(library) : this.layers.getLayer(entry.getName());
this.layersIndex.add(layer, entry.ge... | Perform the actual write of a {@link JarEntry}. All other write methods delegate to
this one.
@param entry the entry to write
@param library the library for the entry or {@code null}
@param entryWriter the entry writer or {@code null} if there is no content
@throws IOException in case of I/O errors | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/AbstractJarWriter.java | 269 | [
"entry",
"library"
] | void | true | 5 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
containsDescendantOfForRandom | private static ConfigurationPropertyState containsDescendantOfForRandom(String prefix,
ConfigurationPropertyName name) {
if (name.getNumberOfElements() > 1 && name.getElement(0, Form.DASHED).equals(prefix)) {
return ConfigurationPropertyState.PRESENT;
}
return ConfigurationPropertyState.ABSENT;
} | Create a new {@link SpringConfigurationPropertySource} implementation.
@param propertySource the source property source
@param systemEnvironmentSource if the source is from the system environment
@param mappers the property mappers | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java | 134 | [
"prefix",
"name"
] | ConfigurationPropertyState | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
buildLazyResourceProxy | private Object buildLazyResourceProxy(RegisteredBean registeredBean) {
Class<?> lookupType = getLookupType(registeredBean);
TargetSource ts = new TargetSource() {
@Override
public Class<?> getTargetClass() {
return lookupType;
}
@Override
public Object getTarget() {
return resolveValue(regis... | Create a suitable {@link DependencyDescriptor} for the specified bean.
@param registeredBean the registered bean
@return a descriptor for that bean | java | spring-context/src/main/java/org/springframework/context/annotation/ResourceElementResolver.java | 150 | [
"registeredBean"
] | Object | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
from_ordinals | def from_ordinals(cls, ordinals, *, freq, name=None) -> Self:
"""
Construct a PeriodIndex from ordinals.
Parameters
----------
ordinals : array-like of int
The period offsets from the proleptic Gregorian epoch.
freq : str or period object
One of p... | Construct a PeriodIndex from ordinals.
Parameters
----------
ordinals : array-like of int
The period offsets from the proleptic Gregorian epoch.
freq : str or period object
One of pandas period strings or corresponding objects.
name : str, default None
Name of the resulting PeriodIndex.
Returns
-------
Pe... | python | pandas/core/indexes/period.py | 322 | [
"cls",
"ordinals",
"freq",
"name"
] | Self | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
groups | def groups(self) -> dict[Hashable, Index]:
"""
Dict {group name -> group labels}.
This property provides a dictionary representation of the groupings formed
during a groupby operation, where each key represents a unique group value from
the specified column(s), and each value is... | Dict {group name -> group labels}.
This property provides a dictionary representation of the groupings formed
during a groupby operation, where each key represents a unique group value from
the specified column(s), and each value is a list of index labels
that belong to that group.
See Also
--------
core.groupby.Data... | python | pandas/core/groupby/groupby.py | 488 | [
"self"
] | dict[Hashable, Index] | true | 3 | 8.4 | pandas-dev/pandas | 47,362 | unknown | false |
drop_fields | def drop_fields(base, drop_names, usemask=True, asrecarray=False):
"""
Return a new array with fields in `drop_names` dropped.
Nested fields are supported.
Parameters
----------
base : array
Input array
drop_names : string or sequence
String or sequence of strings correspon... | Return a new array with fields in `drop_names` dropped.
Nested fields are supported.
Parameters
----------
base : array
Input array
drop_names : string or sequence
String or sequence of strings corresponding to the names of the
fields to drop.
usemask : {False, True}, optional
Whether to return a mask... | python | numpy/lib/recfunctions.py | 505 | [
"base",
"drop_names",
"usemask",
"asrecarray"
] | false | 8 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
get_template_configs | def get_template_configs(
self,
kernel_inputs: KernelInputs,
templates: list[Union[KernelTemplate, ExternKernelChoice]],
op_name: str,
kwarg_overrides: Optional[dict[str, dict[str, Any]]] = None,
) -> list[ChoiceCaller]:
"""
Get list of ChoiceCallers for MM te... | Get list of ChoiceCallers for MM templates using template-specific heuristics.
Args:
kernel_inputs: MMKernelInputs containing input tensor nodes and matrix indices
layout: Output layout
templates: List of template objects (KernelTemplate or ExternKernelChoice)
op_name: Operation name (e.g., "bmm", "bad... | python | torch/_inductor/choices.py | 269 | [
"self",
"kernel_inputs",
"templates",
"op_name",
"kwarg_overrides"
] | list[ChoiceCaller] | true | 7 | 7.52 | pytorch/pytorch | 96,034 | google | false |
check_bool_indexer | def check_bool_indexer(index: Index, key) -> np.ndarray:
"""
Check if key is a valid boolean indexer for an object with such index and
perform reindexing or conversion if needed.
This function assumes that is_bool_indexer(key) == True.
Parameters
----------
index : Index
Index of t... | Check if key is a valid boolean indexer for an object with such index and
perform reindexing or conversion if needed.
This function assumes that is_bool_indexer(key) == True.
Parameters
----------
index : Index
Index of the object on which the indexing is done.
key : list-like
Boolean indexer to check.
Retur... | python | pandas/core/indexing.py | 2,647 | [
"index",
"key"
] | np.ndarray | true | 7 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
mode | def mode(
values: ArrayLike, dropna: bool = True, mask: npt.NDArray[np.bool_] | None = None
) -> tuple[np.ndarray, npt.NDArray[np.bool_]] | ExtensionArray:
"""
Returns the mode(s) of an array.
Parameters
----------
values : array-like
Array over which to check for duplicate values.
... | Returns the mode(s) of an array.
Parameters
----------
values : array-like
Array over which to check for duplicate values.
dropna : bool, default True
Don't consider counts of NaN/NaT.
Returns
-------
Union[Tuple[np.ndarray, npt.NDArray[np.bool_]], ExtensionArray] | python | pandas/core/algorithms.py | 1,015 | [
"values",
"dropna",
"mask"
] | tuple[np.ndarray, npt.NDArray[np.bool_]] | ExtensionArray | true | 4 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
countNonNull | private int countNonNull(Object... instances) {
int result = 0;
for (Object instance : instances) {
if (instance != null) {
result += 1;
}
}
return result;
} | Generate a default cache name for the specified {@link Method}.
@param method the annotated method
@return the default cache name, according to JSR-107 | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java | 230 | [] | true | 2 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
bean | <T> T bean(ParameterizedTypeReference<T> beanType) throws BeansException; | Return the bean instance that uniquely matches the given generics-containing type, if any.
@param beanType the generics-containing type the bean must match; can be an interface or superclass
@return an instance of the single bean matching the bean type
@see BeanFactory#getBean(String) | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanRegistry.java | 238 | [
"beanType"
] | T | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
times | function times(n: number) {
return () => --n > -1
} | Repeat an {@link Accumulable} function.
@param f to be repeated until...
@param again return false to exit
@returns
@example
```ts
// concats `[2]` 10 times on `[1]`
repeat(concat, times(10))([1], [2])
``` | typescript | helpers/blaze/repeat.ts | 35 | [
"n"
] | false | 1 | 7.76 | prisma/prisma | 44,834 | jsdoc | false | |
infer_dtype_from | def infer_dtype_from(val) -> tuple[DtypeObj, Any]:
"""
Interpret the dtype from a scalar or array.
Parameters
----------
val : object
"""
if not is_list_like(val):
return infer_dtype_from_scalar(val)
return infer_dtype_from_array(val) | Interpret the dtype from a scalar or array.
Parameters
----------
val : object | python | pandas/core/dtypes/cast.py | 666 | [
"val"
] | tuple[DtypeObj, Any] | true | 2 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
indexesOf | public static BitSet indexesOf(final int[] array, final int valueToFind) {
return indexesOf(array, valueToFind, 0);
} | Finds the indices of the given value in the array.
<p>This method returns an empty BitSet for a {@code null} input array.</p>
@param array the array to search for the object, may be {@code null}.
@param valueToFind the value to find.
@return a BitSet of all the indices of the value within the array,
an empty BitSet ... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,185 | [
"array",
"valueToFind"
] | BitSet | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
newHint | public static ItemHint newHint(String name, ValueHint... values) {
return new ItemHint(name, Arrays.asList(values), Collections.emptyList());
} | 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 | 90 | [
"name"
] | ItemHint | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
score_samples | def score_samples(self, X):
"""Compute the log-likelihood of each sample under the model.
Parameters
----------
X : array-like of shape (n_samples, n_features)
An array of points to query. Last dimension should match dimension
of training data (n_features).
... | Compute the log-likelihood of each sample under the model.
Parameters
----------
X : array-like of shape (n_samples, n_features)
An array of points to query. Last dimension should match dimension
of training data (n_features).
Returns
-------
density : ndarray of shape (n_samples,)
Log-likelihood of each... | python | sklearn/neighbors/_kde.py | 252 | [
"self",
"X"
] | false | 3 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
check_if_buildx_plugin_installed | def check_if_buildx_plugin_installed() -> bool:
"""
Checks if buildx plugin is locally available.
:return True if the buildx plugin is installed.
"""
check_buildx = ["docker", "buildx", "version"]
docker_buildx_version_result = run_command(
check_buildx,
no_output_dump_on_except... | Checks if buildx plugin is locally available.
:return True if the buildx plugin is installed. | python | dev/breeze/src/airflow_breeze/utils/run_utils.py | 393 | [] | bool | true | 2 | 7.04 | apache/airflow | 43,597 | unknown | false |
of | static SslStoreBundle of(@Nullable KeyStore keyStore, @Nullable String keyStorePassword,
@Nullable KeyStore trustStore) {
return new SslStoreBundle() {
@Override
public @Nullable KeyStore getKeyStore() {
return keyStore;
}
@Override
public @Nullable KeyStore getTrustStore() {
return trustS... | Factory method to create a new {@link SslStoreBundle} instance.
@param keyStore the key store or {@code null}
@param keyStorePassword the key store password or {@code null}
@param trustStore the trust store or {@code null}
@return a new {@link SslStoreBundle} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslStoreBundle.java | 64 | [
"keyStore",
"keyStorePassword",
"trustStore"
] | SslStoreBundle | true | 4 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
create | static CuVSIvfPqParams create(int numVectors, int dims, CagraIndexParams.CuvsDistanceType distanceType, int efConstruction) {
long nRows = numVectors;
long nFeatures = dims;
if (nRows <= 0 || nFeatures <= 0) {
throw new IllegalArgumentException("Dataset dimensions must be positive: ... | Creates {@link CuVSIvfPqParams} with automatically calculated parameters based on the
dataset dimensions, distance metric, and efConstruction parameter.
<p>This method replicates the parameter calculation logic from the C++ function:
{@code cuvs::neighbors::graph_build_params::ivf_pq_params(dataset_extents, metric)}
@p... | java | libs/gpu-codec/src/main/java/org/elasticsearch/gpu/codec/CuVSIvfPqParamsFactory.java | 45 | [
"numVectors",
"dims",
"distanceType",
"efConstruction"
] | CuVSIvfPqParams | true | 3 | 7.28 | elastic/elasticsearch | 75,680 | javadoc | false |
of | static SslBundleKey of(String password) {
return of(password, null);
} | Factory method to create a new {@link SslBundleKey} instance.
@param password the password used to access the key
@return a new {@link SslBundleKey} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslBundleKey.java | 77 | [
"password"
] | SslBundleKey | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
initializeAsyncLoaderHooksOnLoaderHookWorker | async function initializeAsyncLoaderHooksOnLoaderHookWorker() {
const customLoaderURLs = getOptionValue('--experimental-loader');
// The worker thread spawned for handling asynchronous loader hooks should not
// further spawn other hook threads or there will be an infinite recursion.
const shouldSpawnLoaderHoo... | Register asynchronus module loader customization hooks. This should only be run in the loader
hooks worker. In a non-loader-hooks thread, if any asynchronous loader hook is registered, the
ModuleLoader#asyncLoaderHooks are initialized to be AsyncLoaderHooksProxiedToLoaderHookWorker
which posts the messages to the async... | javascript | lib/internal/modules/esm/worker.js | 48 | [] | false | 2 | 6.8 | nodejs/node | 114,839 | jsdoc | true | |
process | private void process(final SeekUnvalidatedEvent event) {
try {
event.offsetEpoch().ifPresent(epoch -> metadata.updateLastSeenEpochIfNewer(event.partition(), epoch));
SubscriptionState.FetchPosition newPosition = new SubscriptionState.FetchPosition(
event.offset(),
... | Process event indicating whether the AcknowledgeCommitCallbackHandler is configured by the user.
@param event Event containing a boolean to indicate if the callback handler is configured or not. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 606 | [
"event"
] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
get_auth_manager | def get_auth_manager() -> BaseAuthManager:
"""Return the auth manager, provided it's been initialized before."""
if auth_manager is None:
raise RuntimeError(
"Auth Manager has not been initialized yet. "
"The `init_auth_manager` method needs to be called first."
)
ret... | Return the auth manager, provided it's been initialized before. | python | airflow-core/src/airflow/api_fastapi/app.py | 162 | [] | BaseAuthManager | true | 2 | 6.4 | apache/airflow | 43,597 | unknown | false |
_update_memory_tracking_after_swap_reorder | def _update_memory_tracking_after_swap_reorder(
candidate: BaseSchedulerNode,
gns: list[BaseSchedulerNode],
group_tail: BaseSchedulerNode,
candidate_delta_mem: int,
candidate_allocfree: SNodeMemory,
group_n_to_bufs_after_swap_dealloc_by_candidate: dict,
post_alloc_update: dict[BaseSchedulerN... | Update memory tracking structures after swap (reorder version).
Updates curr_memory, buf_to_snode_last_use, and snodes_allocfree dictionaries
to reflect the new memory state after swapping candidate with group.
Args:
candidate: Node that was moved
gns: Group nodes
group_tail: Last node of group
candid... | python | torch/_inductor/comms.py | 610 | [
"candidate",
"gns",
"group_tail",
"candidate_delta_mem",
"candidate_allocfree",
"group_n_to_bufs_after_swap_dealloc_by_candidate",
"post_alloc_update",
"curr_memory",
"buf_to_snode_last_use",
"snodes_allocfree"
] | None | true | 6 | 6.16 | pytorch/pytorch | 96,034 | google | false |
parent | function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
} | Gets the parent value at `path` of `object`.
@private
@param {Object} object The object to query.
@param {Array} path The path to get the parent value of.
@returns {*} Returns the parent value. | javascript | lodash.js | 6,678 | [
"object",
"path"
] | false | 2 | 6.16 | lodash/lodash | 61,490 | jsdoc | false | |
equals | @Override
public boolean equals(Object o) {
return o instanceof JSONArray && ((JSONArray) o).values.equals(this.values);
} | Encodes this array as a human-readable JSON string for debugging, such as: <pre>
[
94043,
90210
]</pre>
@param indentSpaces the number of spaces to indent for each level of nesting.
@return a human-readable JSON string of this array
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 658 | [
"o"
] | true | 2 | 7.68 | spring-projects/spring-boot | 79,428 | javadoc | false | |
equals | @Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof CharRange)) {
return false;
}
final CharRange other = (CharRange) obj;
return start == other.start && end == other.end && negated == othe... | Compares two CharRange objects, returning true if they represent
exactly the same range of characters defined in the same way.
@param obj the object to compare to.
@return true if equal. | java | src/main/java/org/apache/commons/lang3/CharRange.java | 281 | [
"obj"
] | true | 5 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getExitingScheduledExecutorService | @J2ktIncompatible
@GwtIncompatible // java.time.Duration
@IgnoreJRERequirement // Users will use this only if they're already using Duration.
public static ScheduledExecutorService getExitingScheduledExecutorService(
ScheduledThreadPoolExecutor executor, Duration terminationTimeout) {
return getExitingS... | Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when
the application is complete. It does so by using daemon threads and adding a shutdown hook to
wait for their completion.
<p>This is mainly for fixed thread pools. See {@link Executors#newScheduledThreadPool(int)}.
@param exec... | java | android/guava/src/com/google/common/util/concurrent/MoreExecutors.java | 148 | [
"executor",
"terminationTimeout"
] | ScheduledExecutorService | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false |
supportsEvent | private boolean supportsEvent(
ConfigurableBeanFactory beanFactory, String listenerBeanName, ResolvableType eventType) {
Class<?> listenerType = beanFactory.getType(listenerBeanName);
if (listenerType == null || GenericApplicationListener.class.isAssignableFrom(listenerType) ||
SmartApplicationListener.clas... | Filter a bean-defined listener early through checking its generically declared
event type before trying to instantiate it.
<p>If this method returns {@code true} for a given listener as a first pass,
the listener instance will get retrieved and fully evaluated through a
{@link #supportsEvent(ApplicationListener, Resolv... | java | spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java | 343 | [
"beanFactory",
"listenerBeanName",
"eventType"
] | true | 7 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false | |
add | @CanIgnoreReturnValue
int add(@ParametricNullness E element, int occurrences); | Adds a number of occurrences of an element to this multiset. Note that if {@code occurrences ==
1}, this method has the identical effect to {@link #add(Object)}. This method is functionally
equivalent (except in the case of overflow) to the call {@code
addAll(Collections.nCopies(element, occurrences))}, which would pre... | java | android/guava/src/com/google/common/collect/Multiset.java | 137 | [
"element",
"occurrences"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
maybeClearPreviousInflightPoll | private void maybeClearPreviousInflightPoll() {
if (inflightPoll.isComplete()) {
Optional<KafkaException> errorOpt = inflightPoll.error();
if (errorOpt.isPresent()) {
// If the previous inflight event is complete, check if it resulted in an error. If there was
... | {@code checkInflightPoll()} manages the lifetime of the {@link AsyncPollEvent} processing. If it is
called when no event is currently processing, it will start a new event processing asynchronously. A check
is made during each invocation to see if the <em>inflight</em> event has completed. If it has, it will be
process... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 930 | [] | void | true | 6 | 6.88 | apache/kafka | 31,560 | javadoc | false |
connectionState | public ConnectionState connectionState(String id) {
return nodeState(id).state;
} | Get the state of a given connection.
@param id the id of the connection
@return the state of our connection | java | clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java | 399 | [
"id"
] | ConnectionState | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
polydiv | def polydiv(u, v):
"""
Returns the quotient and remainder of polynomial division.
.. note::
This forms part of the old polynomial API. Since version 1.4, the
new polynomial API defined in `numpy.polynomial` is preferred.
A summary of the differences can be found in the
:doc:`tra... | Returns the quotient and remainder of polynomial division.
.. note::
This forms part of the old polynomial API. Since version 1.4, the
new polynomial API defined in `numpy.polynomial` is preferred.
A summary of the differences can be found in the
:doc:`transition guide </reference/routines.polynomials>`.
... | python | numpy/lib/_polynomial_impl.py | 990 | [
"u",
"v"
] | false | 6 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
lineLengths | function lineLengths(content) {
const contentLength = content.length;
const output = [];
let lineLength = 0;
for (let i = 0; i < contentLength; i++, lineLength++) {
const codePoint = StringPrototypeCodePointAt(content, i);
// We purposefully keep \r as part of the line-length calculation, in
// cas... | Resolves source map payload data from the source url and source map url.
If the source map url is a data url, the data is returned.
Otherwise the source map url is resolved to a file path and the file is read.
@param {string} sourceURL - url of the source file
@param {string} sourceMappingURL - url of the source map
@r... | javascript | lib/internal/source_map/source_map_cache.js | 257 | [
"content"
] | false | 5 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
printComposite | private static String printComposite(Duration duration) {
if (duration.isZero()) {
return DurationFormat.Unit.SECONDS.print(duration);
}
StringBuilder result = new StringBuilder();
if (duration.isNegative()) {
result.append('-');
duration = duration.negated();
}
long days = duration.toDaysPart();
... | Detect the style then parse the value to return a duration.
@param value the value to parse
@param unit the duration unit to use if the value doesn't specify one ({@code null}
will default to ms)
@return the parsed duration
@throws IllegalArgumentException if the value is not a known style or cannot be
parsed | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatterUtils.java | 181 | [
"duration"
] | String | true | 11 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
_make_key | def _make_key(
custom_params_encoder: Callable[..., object] | None,
*args: object,
**kwargs: object,
) -> str:
"""Generate a cache key from function parameters.
Args:
custom_params_encoder: Optional encoder to apply to function parameters.
... | Generate a cache key from function parameters.
Args:
custom_params_encoder: Optional encoder to apply to function parameters.
If None, params are pickled directly.
*args: Positional arguments to encode.
**kwargs: Keyword arguments to encode.
Returns:
A 32-character hex string... | python | torch/_inductor/runtime/caching/interfaces.py | 95 | [
"custom_params_encoder"
] | str | true | 3 | 7.76 | pytorch/pytorch | 96,034 | google | false |
toString | @Override
public String toString() {
return this.descriptions.toString();
} | Return the parameter descriptions.
@return the descriptions | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/Command.java | 175 | [] | String | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
resolveAutowiredArgument | public @Nullable Object resolveAutowiredArgument(
DependencyDescriptor descriptor, TypeConverter typeConverter, Set<String> autowiredBeanNames) {
return new ConstructorResolver((AbstractAutowireCapableBeanFactory) getBeanFactory())
.resolveAutowiredArgument(descriptor, descriptor.getDependencyType(),
ge... | Resolve an autowired argument.
@param descriptor the descriptor for the dependency (field/method/constructor)
@param typeConverter the TypeConverter to use for populating arrays and collections
@param autowiredBeanNames a Set that all names of autowired beans (used for
resolving the given dependency) are supposed to be... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/RegisteredBean.java | 247 | [
"descriptor",
"typeConverter",
"autowiredBeanNames"
] | Object | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
capitalize | public static String capitalize(final String str) {
return capitalize(str, null);
} | Capitalizes all the whitespace separated words in a String.
Only the first character of each word is changed. To convert the
rest of each word to lowercase at the same time,
use {@link #capitalizeFully(String)}.
<p>Whitespace is defined by {@link Character#isWhitespace(char)}.
A {@code null} input String returns {@code... | java | src/main/java/org/apache/commons/lang3/text/WordUtils.java | 62 | [
"str"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
removeElement | public static double[] removeElement(final double[] array, final double element) {
final int index = indexOf(array, element);
return index == INDEX_NOT_FOUND ? clone(array) : remove(array, index);
} | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(subtracts one from their indices). If the array doesn't contain
such an element, no elements are removed from the array.
<p>
This method returns a new array with the same elements of the inpu... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5,732 | [
"array",
"element"
] | true | 2 | 7.84 | apache/commons-lang | 2,896 | javadoc | false | |
getExitingExecutorService | @J2ktIncompatible
@GwtIncompatible // TODO
@IgnoreJRERequirement // Users will use this only if they're already using Duration.
public static ExecutorService getExitingExecutorService(
ThreadPoolExecutor executor, Duration terminationTimeout) {
return getExitingExecutorService(
executor, toNanos... | Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application
is complete. It does so by using daemon threads and adding a shutdown hook to wait for their
completion.
<p>This is mainly for fixed thread pools. See {@link Executors#newFixedThreadPool(int)}.
@param executor the executor to ... | java | android/guava/src/com/google/common/util/concurrent/MoreExecutors.java | 86 | [
"executor",
"terminationTimeout"
] | ExecutorService | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false |
centerValue | public double centerValue() {
return this.centerValue;
} | Get the value of this metrics center point.
@return the center point value | java | clients/src/main/java/org/apache/kafka/common/metrics/stats/Frequency.java | 55 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
readField | public static Object readField(final Field field, final Object target) throws IllegalAccessException {
return readField(field, target, false);
} | Reads an accessible {@link Field}.
@param field
the field to use.
@param target
the object to call on, may be {@code null} for {@code static} fields.
@return the field value
@throws NullPointerException
if the field is {@code null}.
@throws IllegalAccessException
if the fie... | java | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | 376 | [
"field",
"target"
] | Object | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
flush | @Override
public void flush() throws IOException {
checkNotClosed();
if (target instanceof Flushable) {
((Flushable) target).flush();
}
} | Creates a new writer that appends everything it writes to {@code target}.
@param target target to which to append output | java | android/guava/src/com/google/common/io/AppendableWriter.java | 87 | [] | void | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
bindToSpringApplication | protected void bindToSpringApplication(ConfigurableEnvironment environment) {
try {
Binder.get(environment).bind("spring.main", Bindable.ofInstance(this.properties));
}
catch (Exception ex) {
throw new IllegalStateException("Cannot bind to SpringApplication", ex);
}
} | Bind the environment to the {@link ApplicationProperties}.
@param environment the environment to bind | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 550 | [
"environment"
] | void | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
intValue | @Override
public int intValue() {
return numerator / denominator;
} | Gets the fraction as an {@code int}. This returns the whole number
part of the fraction.
@return the whole number fraction part | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 733 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
pathHasQueryOrFragment | function pathHasQueryOrFragment (url) {
return (
url.includes('?') ||
url.includes('#')
)
} | @param {string} url The path to check for query strings or fragments.
@returns {boolean} Returns true if the path contains a query string or fragment. | javascript | deps/undici/src/lib/core/util.js | 109 | [
"url"
] | false | 2 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
ready | @Override
public boolean ready() throws IOException {
return (current != null) && current.ready();
} | Closes the current reader and opens the next one, if any. | java | android/guava/src/com/google/common/io/MultiReader.java | 81 | [] | true | 2 | 6.96 | google/guava | 51,352 | javadoc | false | |
check_dag_prefix | def check_dag_prefix(env_name: str, env_value: str) -> None:
"""
Validate dag prefix value.
Checks if value of dag prefix env variable is a prefix for one of the forbidden dag ids
(which would cause runs of corresponding DAGs to be collected alongside the real test Dag Runs).
:param env_name: name ... | Validate dag prefix value.
Checks if value of dag prefix env variable is a prefix for one of the forbidden dag ids
(which would cause runs of corresponding DAGs to be collected alongside the real test Dag Runs).
:param env_name: name of the environment variable which is being checked.
:param env_value: value of the va... | python | performance/src/performance_dags/performance_dag/performance_dag_utils.py | 196 | [
"env_name",
"env_value"
] | None | true | 2 | 7.2 | apache/airflow | 43,597 | sphinx | false |
stringSize | function stringSize(string) {
return hasUnicode(string)
? unicodeSize(string)
: asciiSize(string);
} | Gets the number of symbols in `string`.
@private
@param {string} string The string to inspect.
@returns {number} Returns the string size. | javascript | lodash.js | 1,337 | [
"string"
] | false | 2 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
handle_exception | def handle_exception(self, ctx: AppContext, e: Exception) -> Response:
"""Handle an exception that did not have an error handler
associated with it, or that was raised from an error handler.
This always causes a 500 ``InternalServerError``.
Always sends the :data:`got_request_exception`... | Handle an exception that did not have an error handler
associated with it, or that was raised from an error handler.
This always causes a 500 ``InternalServerError``.
Always sends the :data:`got_request_exception` signal.
If :data:`PROPAGATE_EXCEPTIONS` is ``True``, such as in debug
mode, the error will be re-raised ... | python | src/flask/app.py | 896 | [
"self",
"ctx",
"e"
] | Response | true | 6 | 6.4 | pallets/flask | 70,946 | unknown | false |
gen_even_slices | def gen_even_slices(n, n_packs, *, n_samples=None):
"""Generator to create `n_packs` evenly spaced slices going up to `n`.
If `n_packs` does not divide `n`, except for the first `n % n_packs`
slices, remaining slices may contain fewer elements.
Parameters
----------
n : int
Size of the... | Generator to create `n_packs` evenly spaced slices going up to `n`.
If `n_packs` does not divide `n`, except for the first `n % n_packs`
slices, remaining slices may contain fewer elements.
Parameters
----------
n : int
Size of the sequence.
n_packs : int
Number of slices to generate.
n_samples : int, default... | python | sklearn/utils/_chunking.py | 89 | [
"n",
"n_packs",
"n_samples"
] | false | 5 | 7.68 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
tryAcquire | @IgnoreJRERequirement // Users will use this only if they're already using Duration.
public boolean tryAcquire(int permits, Duration timeout) {
return tryAcquire(permits, toNanosSaturated(timeout), TimeUnit.NANOSECONDS);
} | Acquires the given number of permits from this {@code RateLimiter} if it can be obtained
without exceeding the specified {@code timeout}, or returns {@code false} immediately (without
waiting) if the permits would not have been granted before the timeout expired.
@param permits the number of permits to acquire
@param t... | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 395 | [
"permits",
"timeout"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
timeFormat | public DateTimeFormatters timeFormat(@Nullable String pattern) {
this.timeFormatter = isIso(pattern) ? DateTimeFormatter.ISO_LOCAL_TIME
: (isIsoOffset(pattern) ? DateTimeFormatter.ISO_OFFSET_TIME : formatter(pattern));
return this;
} | Configures the time format using the given {@code pattern}.
@param pattern the pattern for formatting times
@return {@code this} for chained method invocation | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/DateTimeFormatters.java | 65 | [
"pattern"
] | DateTimeFormatters | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
secondary_training_status_changed | def secondary_training_status_changed(current_job_description: dict, prev_job_description: dict) -> bool:
"""
Check if training job's secondary status message has changed.
:param current_job_description: Current job description, returned from DescribeTrainingJob call.
:param prev_job_description: Previ... | Check if training job's secondary status message has changed.
:param current_job_description: Current job description, returned from DescribeTrainingJob call.
:param prev_job_description: Previous job description, returned from DescribeTrainingJob call.
:return: Whether the secondary status message of a training job ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 81 | [
"current_job_description",
"prev_job_description"
] | bool | true | 4 | 7.44 | apache/airflow | 43,597 | sphinx | false |
clear | private void clear() {
this.completedSends.clear();
this.completedReceives.clear();
this.connected.clear();
this.disconnected.clear();
// Remove closed channels after all their buffered receives have been processed or if a send was requested
for (Iterator<Map.Entry<Strin... | Clears all the results from the previous poll. This is invoked by Selector at the start of
a poll() when all the results from the previous poll are expected to have been handled.
<p>
SocketServer uses {@link #clearCompletedSends()} and {@link #clearCompletedReceives()} to
clear `completedSends` and `completedReceives` ... | java | clients/src/main/java/org/apache/kafka/common/network/Selector.java | 842 | [] | void | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false |
resume | public void resume() {
if (runningState != State.SUSPENDED) {
throw new IllegalStateException("Stopwatch must be suspended to resume.");
}
startTimeNanos += System.nanoTime() - stopTimeNanos;
runningState = State.RUNNING;
} | Resumes this StopWatch after a suspend.
<p>
This method resumes the watch after it was suspended. The watch will not include time between the suspend and resume calls in the total time.
</p>
@throws IllegalStateException if this StopWatch has not been suspended. | java | src/main/java/org/apache/commons/lang3/time/StopWatch.java | 637 | [] | void | true | 2 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
create | public static AdminClient create(Map<String, Object> conf) {
return (AdminClient) Admin.create(conf);
} | Create a new Admin with the given configuration.
@param conf The configuration.
@return The new KafkaAdminClient. | java | clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java | 48 | [
"conf"
] | AdminClient | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
createEntries | @Override
List<Entry<K, V>> createEntries() {
@WeakOuter
final class EntriesImpl extends AbstractSequentialList<Entry<K, V>> {
@Override
public int size() {
return size;
}
@Override
public ListIterator<Entry<K, V>> listIterator(int index) {
return new NodeIterato... | {@inheritDoc}
<p>The iterator generated by the returned collection traverses the entries in the order they
were added to the multimap. Because the entries may have duplicates and follow the insertion
ordering, this method returns a {@link List}, instead of the {@link Collection} specified in
the {@link ListMultimap} in... | java | guava/src/com/google/common/collect/LinkedListMultimap.java | 803 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
bytes | @Override
public UTF8Bytes bytes() {
if (bytes == null) {
byte[] byteArray = string.getBytes(StandardCharsets.UTF_8);
bytes = new UTF8Bytes(byteArray, 0, byteArray.length);
}
return bytes;
} | Whether an {@link UTF8Bytes} view of the data is already materialized. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/Text.java | 67 | [] | UTF8Bytes | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
determineRequiredStatus | protected boolean determineRequiredStatus(MergedAnnotation<?> ann) {
return (ann.getValue(this.requiredParameterName).isEmpty() ||
this.requiredParameterValue == ann.getBoolean(this.requiredParameterName));
} | Determine if the annotated field or method requires its dependency.
<p>A 'required' dependency means that autowiring should fail when no beans
are found. Otherwise, the autowiring process will simply bypass the field
or method when no beans are found.
@param ann the Autowired annotation
@return whether the annotation i... | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java | 627 | [
"ann"
] | true | 2 | 8.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
get_join_indexers_non_unique | def get_join_indexers_non_unique(
left: ArrayLike,
right: ArrayLike,
sort: bool = False,
how: JoinHow = "inner",
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]:
"""
Get join indexers for left and right.
Parameters
----------
left : ArrayLike
right : ArrayLike
sort : ... | Get join indexers for left and right.
Parameters
----------
left : ArrayLike
right : ArrayLike
sort : bool, default False
how : {'inner', 'outer', 'left', 'right'}, default 'inner'
Returns
-------
np.ndarray[np.intp]
Indexer into left.
np.ndarray[np.intp]
Indexer into right. | python | pandas/core/reshape/merge.py | 2,121 | [
"left",
"right",
"sort",
"how"
] | tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]] | true | 6 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
openStream | InputStream openStream() throws IOException {
Assert.state(this.file != null, "'file' must not be null");
return new FileInputStream(this.file);
} | Open a stream that provides the content of the source file.
@return the file content
@throws IOException on error | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Library.java | 111 | [] | InputStream | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false |
copy | def copy(
self,
file,
mode: str = "w",
propindexes: bool = True,
keys=None,
complib=None,
complevel: int | None = None,
fletcher32: bool = False,
overwrite: bool = True,
) -> HDFStore:
"""
Copy the existing store to a new file, ... | Copy the existing store to a new file, updating in place.
Parameters
----------
propindexes : bool, default True
Restore indexes in copied file.
keys : list, optional
List of keys to include in the copy (defaults to all).
overwrite : bool, default True
Whether to overwrite (remove and replace) existing nod... | python | pandas/io/pytables.py | 1,688 | [
"self",
"file",
"mode",
"propindexes",
"keys",
"complib",
"complevel",
"fletcher32",
"overwrite"
] | HDFStore | true | 10 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
_check_mode | def _check_mode(mode, encoding, newline):
"""Check mode and that encoding and newline are compatible.
Parameters
----------
mode : str
File open mode.
encoding : str
File encoding.
newline : str
Newline for text files.
"""
if "t" in mode:
if "b" in mode:... | Check mode and that encoding and newline are compatible.
Parameters
----------
mode : str
File open mode.
encoding : str
File encoding.
newline : str
Newline for text files. | python | numpy/lib/_datasource.py | 44 | [
"mode",
"encoding",
"newline"
] | false | 6 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
sem | def sem(self, ddof: int = 1, numeric_only: bool = False):
"""
Calculate the expanding standard error of mean.
Parameters
----------
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations
is ``N - ddof``, where ``N`` represents t... | Calculate the expanding standard error of mean.
Parameters
----------
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations
is ``N - ddof``, where ``N`` represents the number of elements.
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
----... | python | pandas/core/window/expanding.py | 868 | [
"self",
"ddof",
"numeric_only"
] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false | |
hexToLong | public static long hexToLong(final String src, final int srcPos, final long dstInit, final int dstPos, final int nHex) {
if (0 == nHex) {
return dstInit;
}
if ((nHex - 1) * 4 + dstPos >= Long.SIZE) {
throw new IllegalArgumentException("(nHexs - 1) * 4 + dstPos >= 64");
... | Converts an array of char into a long using the default (little-endian, LSB0) byte and bit ordering.
@param src the hexadecimal string to convert.
@param srcPos the position in {@code src}, in char unit, from where to start the conversion.
@param dstInit initial value of the destination long.
@param dstPos the po... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 800 | [
"src",
"srcPos",
"dstInit",
"dstPos",
"nHex"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
parameterize | public static final ParameterizedType parameterize(final Class<?> rawClass, final Type... typeArguments) {
return parameterizeWithOwner(null, rawClass, typeArguments);
} | Creates a parameterized type instance.
@param rawClass the raw class to create a parameterized type instance for.
@param typeArguments the types used for parameterization.
@return {@link ParameterizedType}.
@throws NullPointerException if {@code rawClass} is {@code null}.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,403 | [
"rawClass"
] | ParameterizedType | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
save | def save(file, arr, allow_pickle=True):
"""
Save an array to a binary file in NumPy ``.npy`` format.
Parameters
----------
file : file, str, or pathlib.Path
File or filename to which the data is saved. If file is a file-object,
then the filename is unchanged. If file is a string or... | Save an array to a binary file in NumPy ``.npy`` format.
Parameters
----------
file : file, str, or pathlib.Path
File or filename to which the data is saved. If file is a file-object,
then the filename is unchanged. If file is a string or Path,
a ``.npy`` extension will be appended to the filename if it d... | python | numpy/lib/_npyio_impl.py | 505 | [
"file",
"arr",
"allow_pickle"
] | false | 4 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
visitClassDeclaration | function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement | undefined> {
let statements: Statement[] | undefined;
if (hasSyntacticModifier(node, ModifierFlags.Export)) {
statements = append(
statements,
setOriginalNode(
... | Visits a ClassDeclaration node.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 1,784 | [
"node"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
createDefaultTrustManagerFactory | private static TrustManagerFactory createDefaultTrustManagerFactory() {
String defaultAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory trustManagerFactory;
try {
trustManagerFactory = TrustManagerFactory.getInstance(defaultAlgorithm);
trustManagerFactory.init((KeyStore) null);
}
... | Factory method to create a new {@link SslManagerBundle} using the given
{@link TrustManager TrustManagers} and the default {@link KeyManagerFactory}.
@param trustManagers the trust managers to use
@return a new {@link SslManagerBundle} instance
@since 3.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java | 156 | [] | TrustManagerFactory | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
create | public static <O> ReadWriteLockVisitor<O> create(final O object, final ReadWriteLock readWriteLock) {
return new LockingVisitors.ReadWriteLockVisitor<>(object, readWriteLock);
} | Creates a new instance of {@link ReadWriteLockVisitor} with the given object and lock.
@param <O> The type of the object to protect.
@param object The object to protect.
@param readWriteLock The lock to use.
@return A new {@link ReadWriteLockVisitor}.
@see LockingVisitors
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/concurrent/locks/LockingVisitors.java | 695 | [
"object",
"readWriteLock"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
max | public static byte max(byte... array) {
checkArgument(array.length > 0);
int max = toUnsignedInt(array[0]);
for (int i = 1; i < array.length; i++) {
int next = toUnsignedInt(array[i]);
if (next > max) {
max = next;
}
}
return (byte) max;
} | Returns the greatest value present in {@code array}, treating values as unsigned.
@param array a <i>nonempty</i> array of {@code byte} values
@return the value present in {@code array} that is greater than or equal to every other value
in the array according to {@link #compare}
@throws IllegalArgumentException if {... | java | android/guava/src/com/google/common/primitives/UnsignedBytes.java | 162 | [] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
asName | function asName<T extends DeclarationName | Identifier | BindingName | PropertyName | NoSubstitutionTemplateLiteral | EntityName | ThisTypeNode | undefined>(name: string | T): T | Identifier {
return typeof name === "string" ? createIdentifier(name) :
name;
} | Lifts a NodeArray containing only Statement nodes to a block.
@param nodes The NodeArray. | typescript | src/compiler/factory/nodeFactory.ts | 7,141 | [
"name"
] | true | 2 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
dashIgnoringElementEquals | private boolean dashIgnoringElementEquals(Elements e1, Elements e2, int i) {
int l1 = e1.getLength(i);
int l2 = e2.getLength(i);
int i1 = 0;
int i2 = 0;
while (i1 < l1) {
if (i2 >= l2) {
return remainderIsDashes(e1, i, i1);
}
char ch1 = e1.charAt(i, i1);
char ch2 = e2.charAt(i, i2);
if (ch1... | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 424 | [
"e1",
"e2",
"i"
] | true | 9 | 8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
open | public static FileRecords open(File file) throws IOException {
return open(file, true);
} | Get an iterator over the record batches in the file, starting at a specific position. This is similar to
{@link #batches()} except that callers specify a particular position to start reading the batches from. This
method must be used with caution: the start position passed in must be a known start of a batch.
@param st... | java | clients/src/main/java/org/apache/kafka/common/record/FileRecords.java | 465 | [
"file"
] | FileRecords | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
run_and_validate | def run_and_validate(self, program_path):
"""
Run a program and return detailed results for validation.
Args:
program_path: Path to the Python program to run
Returns:
dict: Dictionary with 'success', 'stdout', 'stderr', 'returncode'
"""
abs_path ... | Run a program and return detailed results for validation.
Args:
program_path: Path to the Python program to run
Returns:
dict: Dictionary with 'success', 'stdout', 'stderr', 'returncode' | python | tools/experimental/torchfuzz/runner.py | 77 | [
"self",
"program_path"
] | false | 7 | 6.72 | pytorch/pytorch | 96,034 | google | false | |
synchronizedQueue | @J2ktIncompatible // Synchronized
public static <E extends @Nullable Object> Queue<E> synchronizedQueue(Queue<E> queue) {
return Synchronized.queue(queue, null);
} | Returns a synchronized (thread-safe) queue backed by the specified queue. In order to guarantee
serial access, it is critical that <b>all</b> access to the backing queue is accomplished
through the returned queue.
<p>It is imperative that the user manually synchronize on the returned queue when accessing the
queue's it... | java | android/guava/src/com/google/common/collect/Queues.java | 457 | [
"queue"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
checkStrictModeEvalOrArguments | function checkStrictModeEvalOrArguments(contextNode: Node, name: Node | undefined) {
if (name && name.kind === SyntaxKind.Identifier) {
const identifier = name as Identifier;
if (isEvalOrArgumentsIdentifier(identifier)) {
// We check first if the name is inside class ... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 2,647 | [
"contextNode",
"name"
] | false | 4 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.