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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getDepth | function getDepth(stack: ProcessorState['measureStack']) {
if (stack.length > 0) {
const {depth, type} = stack[stack.length - 1];
return type === 'render-idle' ? depth : depth + 1;
}
return 0;
} | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-timeline/src/import-worker/preprocessData.js | 135 | [] | false | 3 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
_update_dependency_line_with_new_version | def _update_dependency_line_with_new_version(
line: str,
provider_package_name: str,
current_min_version: str,
new_version: str,
pyproject_file: Path,
updates_made: dict[str, dict[str, Any]],
) -> tuple[str, bool]:
"""
Update a dependency line with a new version and track the change.
... | Update a dependency line with a new version and track the change.
Returns:
Tuple of (updated_line, was_modified) | python | dev/breeze/src/airflow_breeze/utils/packages.py | 1,218 | [
"line",
"provider_package_name",
"current_min_version",
"new_version",
"pyproject_file",
"updates_made"
] | tuple[str, bool] | true | 3 | 7.92 | apache/airflow | 43,597 | unknown | false |
select | def select(condlist, choicelist, default=0):
"""
Return an array drawn from elements in choicelist, depending on conditions.
Parameters
----------
condlist : list of bool ndarrays
The list of conditions which determine from which array in `choicelist`
the output elements are taken. ... | Return an array drawn from elements in choicelist, depending on conditions.
Parameters
----------
condlist : list of bool ndarrays
The list of conditions which determine from which array in `choicelist`
the output elements are taken. When multiple conditions are satisfied,
the first one encountered in `con... | python | numpy/lib/_function_base_impl.py | 813 | [
"condlist",
"choicelist",
"default"
] | false | 10 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
generateCodeForAccessibleFactoryMethod | private CodeBlock generateCodeForAccessibleFactoryMethod(String beanName,
Method factoryMethod, Class<?> targetClass, @Nullable String factoryBeanName) {
this.generationContext.getRuntimeHints().reflection().registerType(factoryMethod.getDeclaringClass());
if (factoryBeanName == null && factoryMethod.getParame... | 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 | 272 | [
"beanName",
"factoryMethod",
"targetClass",
"factoryBeanName"
] | CodeBlock | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
eigvals | def eigvals(a):
"""
Compute the eigenvalues of a general matrix.
Main difference between `eigvals` and `eig`: the eigenvectors aren't
returned.
Parameters
----------
a : (..., M, M) array_like
A complex- or real-valued matrix whose eigenvalues will be computed.
Returns
---... | Compute the eigenvalues of a general matrix.
Main difference between `eigvals` and `eig`: the eigenvectors aren't
returned.
Parameters
----------
a : (..., M, M) array_like
A complex- or real-valued matrix whose eigenvalues will be computed.
Returns
-------
w : (..., M,) ndarray
The eigenvalues, each repeate... | python | numpy/linalg/_linalg.py | 1,171 | [
"a"
] | false | 5 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
match | public boolean match(String fieldName, DeprecationHandler deprecationHandler) {
return match(null, () -> XContentLocation.UNKNOWN, fieldName, deprecationHandler);
} | Does {@code fieldName} match this field?
@param fieldName
the field name to match against this {@link ParseField}
@param deprecationHandler called if {@code fieldName} is deprecated
@return true if <code>fieldName</code> matches any of the acceptable
names for this {@link ParseField}. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ParseField.java | 141 | [
"fieldName",
"deprecationHandler"
] | true | 1 | 6.16 | elastic/elasticsearch | 75,680 | javadoc | false | |
getElementBounds | function getElementBounds({ element }: CodeLineElement): { top: number; height: number } {
const myBounds = element.getBoundingClientRect();
// Some code line elements may contain other code line elements.
// In those cases, only take the height up to that child.
const codeLineChild = element.querySelector(`.${cod... | Find the html elements that are at a specific pixel offset on the page. | typescript | extensions/markdown-language-features/preview-src/scroll-sync.ts | 125 | [
"{ element }"
] | true | 2 | 6 | microsoft/vscode | 179,840 | jsdoc | false | |
between | public static UnicodeEscaper between(final int codePointLow, final int codePointHigh) {
return new UnicodeEscaper(codePointLow, codePointHigh, true);
} | Constructs a {@link UnicodeEscaper} between the specified values (inclusive).
@param codePointLow above which to escape.
@param codePointHigh below which to escape.
@return the newly created {@link UnicodeEscaper} instance. | java | src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java | 58 | [
"codePointLow",
"codePointHigh"
] | UnicodeEscaper | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
fastAsin | static double fastAsin(double x) {
if (x < 0) {
return -fastAsin(-x);
} else if (x > 1) {
return Double.NaN;
} else {
// Cutoffs for models. Note that the ranges overlap. In the
// overlap we do linear interpolation to guarantee the overall
... | Approximates asin to within about 1e-6. This approximation works by breaking the range from 0 to 1 into 5 regions
for all but the region nearest 1, rational polynomial models get us a very good approximation of asin and by
interpolating as we move from region to region, we can guarantee continuity and we happen to get ... | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/ScaleFunction.java | 577 | [
"x"
] | true | 9 | 8.32 | elastic/elasticsearch | 75,680 | javadoc | false | |
pop | def pop(self, exc: BaseException | None = None) -> None:
"""Pop this context so that it is no longer the active context. Then
call teardown functions and signals.
Typically, this is not used directly. Instead, use a ``with`` block
to manage the context.
This context must curren... | Pop this context so that it is no longer the active context. Then
call teardown functions and signals.
Typically, this is not used directly. Instead, use a ``with`` block
to manage the context.
This context must currently be the active context, otherwise a
:exc:`RuntimeError` is raised. In some situations, such as st... | python | src/flask/ctx.py | 432 | [
"self",
"exc"
] | None | true | 7 | 6.88 | pallets/flask | 70,946 | sphinx | false |
from | static <T> InstanceSupplier<T> from(@Nullable Supplier<T> supplier) {
return (registry) -> (supplier != null) ? supplier.get() : null;
} | Factory method that can be used to create an {@link InstanceSupplier} from a
{@link Supplier}.
@param <T> the instance type
@param supplier the supplier that will provide the instance
@return a new {@link InstanceSupplier} | java | core/spring-boot/src/main/java/org/springframework/boot/bootstrap/BootstrapRegistry.java | 159 | [
"supplier"
] | true | 2 | 7.68 | spring-projects/spring-boot | 79,428 | javadoc | false | |
processApplicationEvents | private void processApplicationEvents() {
LinkedList<ApplicationEvent> events = new LinkedList<>();
applicationEventQueue.drainTo(events);
if (events.isEmpty())
return;
asyncConsumerMetrics.recordApplicationEventQueueSize(0);
long startMs = time.milliseconds();
... | Process the events-if any-that were produced by the application thread. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java | 247 | [] | void | true | 6 | 6.88 | apache/kafka | 31,560 | javadoc | false |
abs | def abs(self) -> Self:
"""
Return a Series/DataFrame with absolute numeric value of each element.
This function only applies to elements that are all numeric.
Returns
-------
abs
Series/DataFrame containing the absolute value of each element.
See Al... | Return a Series/DataFrame with absolute numeric value of each element.
This function only applies to elements that are all numeric.
Returns
-------
abs
Series/DataFrame containing the absolute value of each element.
See Also
--------
numpy.absolute : Calculate the absolute value element-wise.
Notes
-----
For ``... | python | pandas/core/generic.py | 1,522 | [
"self"
] | Self | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | unknown | false |
add | void add(DissectKey key, String value) {
matches++;
if (key.skip()) {
return;
}
switch (key.getModifier()) {
case NONE -> simpleResults.put(key.getName(), value);
case APPEND -> appendResults.computeIfAbsent(key.getName(), k -> new AppendResult(appendS... | Add the key/value that was found as result of the parsing
@param key the {@link DissectKey}
@param value the discovered value for the key | java | libs/dissect/src/main/java/org/elasticsearch/dissect/DissectMatch.java | 58 | [
"key",
"value"
] | void | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
getIndentationForNodeWorker | function getIndentationForNodeWorker(
current: Node,
currentStart: LineAndCharacter,
ignoreActualIndentationRange: TextRange | undefined,
indentationDelta: number,
sourceFile: SourceFile,
isNextChild: boolean,
options: EditorSettings,
): number {
... | @param assumeNewLineBeforeCloseBrace
`false` when called on text from a real source file.
`true` when we need to assume `position` is on a newline.
This is useful for codefixes. Consider
```
function f() {
|}
```
with `position` at `|`.
When inserting some text after an open brace, we would like to get inden... | typescript | src/services/formatting/smartIndenter.ts | 240 | [
"current",
"currentStart",
"ignoreActualIndentationRange",
"indentationDelta",
"sourceFile",
"isNextChild",
"options"
] | true | 12 | 8.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
withJsonResource | public ConfigurationMetadataRepositoryJsonBuilder withJsonResource(InputStream inputStream, Charset charset)
throws IOException {
if (inputStream == null) {
throw new IllegalArgumentException("InputStream must not be null.");
}
this.repositories.add(add(inputStream, charset));
return this;
} | Add the content of a {@link ConfigurationMetadataRepository} defined by the
specified {@link InputStream} JSON document using the specified {@link Charset}. If
this metadata repository holds items that were loaded previously, these are
ignored.
<p>
Leaves the stream open when done.
@param inputStream the source input s... | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java | 72 | [
"inputStream",
"charset"
] | ConfigurationMetadataRepositoryJsonBuilder | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
_concatenate_shapes | def _concatenate_shapes(shapes, axis):
"""Given array shapes, return the resulting shape and slices prefixes.
These help in nested concatenation.
Returns
-------
shape: tuple of int
This tuple satisfies::
shape, _ = _concatenate_shapes([arr.shape for shape in arrs], axis)
... | Given array shapes, return the resulting shape and slices prefixes.
These help in nested concatenation.
Returns
-------
shape: tuple of int
This tuple satisfies::
shape, _ = _concatenate_shapes([arr.shape for shape in arrs], axis)
shape == concatenate(arrs, axis).shape
slice_prefixes: tuple of (... | python | numpy/_core/shape_base.py | 638 | [
"shapes",
"axis"
] | false | 3 | 6.08 | numpy/numpy | 31,054 | unknown | false | |
toString | @Override
public String toString() {
return "ConfigurableEnvironmentPropertySource {propertySources=" + super.source.getPropertySources() + "}";
} | Convert the supplied value to a {@link String} using the {@link ConversionService}
from the {@link Environment}.
<p>This is a modified version of
{@link org.springframework.core.env.AbstractPropertyResolver#convertValueIfNecessary(Object, Class)}.
@param value the value to convert
@return the converted value, or the or... | java | spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java | 271 | [] | String | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
hashCode | @Override
public int hashCode() {
E e = getElement();
return ((e == null) ? 0 : e.hashCode()) ^ getCount();
} | Return this entry's hash code, following the behavior specified in {@link
Multiset.Entry#hashCode}. | java | android/guava/src/com/google/common/collect/Multisets.java | 845 | [] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
failableStream | public static <T> FailableStream<T> failableStream(final T value) {
return failableStream(streamOf(value));
} | Shorthand for {@code Streams.failableStream(value == null ? Stream.empty() : Stream.of(value))}.
@param <T> the type of stream elements.
@param value the single element of the new stream, may be {@code null}.
@return the new FailableStream on {@code value} or an empty stream.
@since 3.15.0 | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 577 | [
"value"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
truePredicate | @SuppressWarnings("unchecked")
static <T, E extends Throwable> FailablePredicate<T, E> truePredicate() {
return TRUE;
} | Gets the TRUE singleton.
@param <T> Predicate type.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailablePredicate.java | 60 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
of | @Contract("_, false -> !null")
static @Nullable ConfigurationPropertyName of(@Nullable CharSequence name, boolean returnNullIfInvalid) {
Elements elements = elementsOf(name, returnNullIfInvalid, ElementsParser.DEFAULT_CAPACITY);
return (elements != null) ? new ConfigurationPropertyName(elements) : null;
} | Return a {@link ConfigurationPropertyName} for the specified string.
@param name the source name
@param returnNullIfInvalid if null should be returned if the name is not valid
@return a {@link ConfigurationPropertyName} instance
@throws InvalidConfigurationPropertyNameException if the name is not valid and
{@code retur... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 662 | [
"name",
"returnNullIfInvalid"
] | ConfigurationPropertyName | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
right_shift | def right_shift(a, n):
"""
Shift the bits of an integer to the right.
This is the masked array version of `numpy.right_shift`, for details
see that function.
See Also
--------
numpy.right_shift
Examples
--------
>>> import numpy as np
>>> import numpy.ma as ma
>>> x = ... | Shift the bits of an integer to the right.
This is the masked array version of `numpy.right_shift`, for details
see that function.
See Also
--------
numpy.right_shift
Examples
--------
>>> import numpy as np
>>> import numpy.ma as ma
>>> x = [11, 3, 8, 1]
>>> mask = [0, 0, 0, 1]
>>> masked_x = ma.masked_array(x, mas... | python | numpy/ma/core.py | 7,457 | [
"a",
"n"
] | false | 3 | 6.48 | numpy/numpy | 31,054 | unknown | false | |
findFactoryMethod | private static @Nullable Method findFactoryMethod(ConfigurableListableBeanFactory beanFactory, String beanName) {
if (beanFactory.containsBeanDefinition(beanName)) {
BeanDefinition beanDefinition = beanFactory.getMergedBeanDefinition(beanName);
if (beanDefinition instanceof RootBeanDefinition rootBeanDefinition... | Return a {@link ConfigurationPropertiesBean @ConfigurationPropertiesBean} instance
for the given bean details or {@code null} if the bean is not a
{@link ConfigurationProperties @ConfigurationProperties} object. Annotations are
considered both on the bean itself, as well as any factory method (for example a
{@link Bean... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java | 232 | [
"beanFactory",
"beanName"
] | Method | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
_maybe_get_mask | def _maybe_get_mask(
values: np.ndarray, skipna: bool, mask: npt.NDArray[np.bool_] | None
) -> npt.NDArray[np.bool_] | None:
"""
Compute a mask if and only if necessary.
This function will compute a mask iff it is necessary. Otherwise,
return the provided mask (potentially None) when a mask does no... | Compute a mask if and only if necessary.
This function will compute a mask iff it is necessary. Otherwise,
return the provided mask (potentially None) when a mask does not need to be
computed.
A mask is never necessary if the values array is of boolean or integer
dtypes, as these are incapable of storing NaNs. If pas... | python | pandas/core/nanops.py | 211 | [
"values",
"skipna",
"mask"
] | npt.NDArray[np.bool_] | None | true | 5 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
_list_all | def _list_all(self, api_call: Callable, response_key: str, verbose: bool) -> list:
"""
Repeatedly call a provided boto3 API Callable and collates the responses into a List.
:param api_call: The api command to execute.
:param response_key: Which dict key to collect into the final list.
... | Repeatedly call a provided boto3 API Callable and collates the responses into a List.
:param api_call: The api command to execute.
:param response_key: Which dict key to collect into the final list.
:param verbose: Provides additional logging if set to True. Defaults to False.
:return: A List of the combined results ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 522 | [
"self",
"api_call",
"response_key",
"verbose"
] | list | true | 3 | 8.4 | apache/airflow | 43,597 | sphinx | false |
apply_replacements | def apply_replacements(replacements: dict[str, str], text: str) -> str:
"""
Applies the given replacements within the text.
Args:
replacements (dict): Mapping of str -> str replacements.
text (str): Text in which to make replacements.
Returns:
Text with replacements applied, if any.
... | Applies the given replacements within the text.
Args:
replacements (dict): Mapping of str -> str replacements.
text (str): Text in which to make replacements.
Returns:
Text with replacements applied, if any. | python | tools/setup_helpers/gen_version_header.py | 36 | [
"replacements",
"text"
] | str | true | 2 | 8.08 | pytorch/pytorch | 96,034 | google | false |
getValue | @Deprecated
@Override
public Short getValue() {
return Short.valueOf(this.value);
} | Gets the value as a Short instance.
@return the value as a Short, never null.
@deprecated Use {@link #get()}. | java | src/main/java/org/apache/commons/lang3/mutable/MutableShort.java | 259 | [] | Short | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
rank | def rank(
self,
method: WindowingRankType = "average",
ascending: bool = True,
pct: bool = False,
numeric_only: bool = False,
):
"""
Calculate the expanding rank.
Parameters
----------
method : {'average', 'min', 'max'}, default 'avera... | Calculate the expanding rank.
Parameters
----------
method : {'average', 'min', 'max'}, default 'average'
How to rank the group of records that have the same value (i.e. ties):
* average: average rank of the group
* min: lowest rank in the group
* max: highest rank in the group
ascending : bool, defa... | python | pandas/core/window/expanding.py | 1,125 | [
"self",
"method",
"ascending",
"pct",
"numeric_only"
] | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false | |
createDateTimeFormatter | public DateTimeFormatter createDateTimeFormatter(DateTimeFormatter fallbackFormatter) {
DateTimeFormatter dateTimeFormatter = null;
if (StringUtils.hasLength(this.pattern)) {
dateTimeFormatter = DateTimeFormatterUtils.createStrictDateTimeFormatter(this.pattern);
}
else if (this.iso != null && this.iso != ISO... | Create a new {@code DateTimeFormatter} using this factory.
<p>If no specific pattern or style has been defined,
the supplied {@code fallbackFormatter} will be used.
@param fallbackFormatter the fall-back formatter to use
when no specific factory properties have been set
@return a new date time formatter | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterFactory.java | 175 | [
"fallbackFormatter"
] | DateTimeFormatter | true | 11 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
broadcast | def broadcast(self, command, arguments=None, destination=None,
connection=None, reply=False, timeout=1.0, limit=None,
callback=None, channel=None, pattern=None, matcher=None,
**extra_kwargs):
"""Broadcast a control command to the celery workers.
Arg... | Broadcast a control command to the celery workers.
Arguments:
command (str): Name of command to send.
arguments (Dict): Keyword arguments for the command.
destination (List): If set, a list of the hosts to send the
command to, when empty broadcast to all workers.
connection (kombu.Connection): ... | python | celery/app/control.py | 753 | [
"self",
"command",
"arguments",
"destination",
"connection",
"reply",
"timeout",
"limit",
"callback",
"channel",
"pattern",
"matcher"
] | false | 5 | 6.08 | celery/celery | 27,741 | google | false | |
fillna | def fillna(self, value):
"""
Fill NA/NaN values with the specified value.
Parameters
----------
value : scalar
Scalar value to use to fill holes (e.g. 0).
This value cannot be a list-likes.
Returns
-------
Index
NA/NaN ... | Fill NA/NaN values with the specified value.
Parameters
----------
value : scalar
Scalar value to use to fill holes (e.g. 0).
This value cannot be a list-likes.
Returns
-------
Index
NA/NaN values replaced with `value`.
See Also
--------
DataFrame.fillna : Fill NaN values of a DataFrame.
Series.fillna : F... | python | pandas/core/indexes/base.py | 2,744 | [
"self",
"value"
] | false | 3 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false | |
andBitCount | public static int andBitCount(byte[] a, byte[] b) {
if (a.length != b.length) {
throw new IllegalArgumentException("vector dimensions differ: " + a.length + "!=" + b.length);
}
try {
return (int) BIT_COUNT_MH.invokeExact(a, b);
} catch (Throwable e) {
... | AND bit count computed over signed bytes.
Copied from Lucene's XOR implementation
@param a bytes containing a vector
@param b bytes containing another vector, of the same dimension
@return the value of the AND bit count of the two vectors | java | libs/simdvec/src/main/java/org/elasticsearch/simdvec/ESVectorUtil.java | 128 | [
"a",
"b"
] | true | 5 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
resolveReturnTypeForFactoryMethod | public static Class<?> resolveReturnTypeForFactoryMethod(
Method method, @Nullable Object[] args, @Nullable ClassLoader classLoader) {
Assert.notNull(method, "Method must not be null");
Assert.notNull(args, "Argument array must not be null");
TypeVariable<Method>[] declaredTypeVariables = method.getTypeParam... | Determine the target type for the generic return type of the given
<em>generic factory method</em>, where formal type variables are declared
on the given method itself.
<p>For example, given a factory method with the following signature, if
{@code resolveReturnTypeForFactoryMethod()} is invoked with the reflected
metho... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java | 178 | [
"method",
"args",
"classLoader"
] | true | 20 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false | |
forLocation | public static JksSslStoreDetails forLocation(@Nullable String location) {
return new JksSslStoreDetails(null, null, location, null);
} | Factory method to create a new {@link JksSslStoreDetails} instance for the given
location.
@param location the location
@return a new {@link JksSslStoreDetails} instance. | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/jks/JksSslStoreDetails.java | 64 | [
"location"
] | JksSslStoreDetails | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
getOrCreate | JarFile getOrCreate(boolean useCaches, URL jarFileUrl) throws IOException {
if (useCaches) {
JarFile cached = getCached(jarFileUrl);
if (cached != null) {
return cached;
}
}
return this.factory.createJarFile(jarFileUrl, this::onClose);
} | Get an existing {@link JarFile} instance from the cache, or create a new
{@link JarFile} instance that can be {@link #cacheIfAbsent(boolean, URL, JarFile)
cached later}.
@param useCaches if caches can be used
@param jarFileUrl the jar file URL
@return a new or existing {@link JarFile} instance
@throws IOException on I/... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFiles.java | 65 | [
"useCaches",
"jarFileUrl"
] | JarFile | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
check_memory | def check_memory(memory):
"""Check that ``memory`` is joblib.Memory-like.
joblib.Memory-like means that ``memory`` can be converted into a
joblib.Memory instance (typically a str denoting the ``location``)
or has the same interface (has a ``cache`` method).
Parameters
----------
memory : N... | Check that ``memory`` is joblib.Memory-like.
joblib.Memory-like means that ``memory`` can be converted into a
joblib.Memory instance (typically a str denoting the ``location``)
or has the same interface (has a ``cache`` method).
Parameters
----------
memory : None, str or object with the joblib.Memory interface
-... | python | sklearn/utils/validation.py | 405 | [
"memory"
] | false | 4 | 7.04 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
validate_periods | def validate_periods(periods: int | None) -> int | None:
"""
If a `periods` argument is passed to the Datetime/Timedelta Array/Index
constructor, cast it to an integer.
Parameters
----------
periods : None, int
Returns
-------
periods : None or int
Raises
------
TypeEr... | If a `periods` argument is passed to the Datetime/Timedelta Array/Index
constructor, cast it to an integer.
Parameters
----------
periods : None, int
Returns
-------
periods : None or int
Raises
------
TypeError
if periods is not None or int | python | pandas/core/arrays/datetimelike.py | 2,669 | [
"periods"
] | int | None | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
compose | default <V> FailableFunction<V, R, E> compose(final FailableFunction<? super V, ? extends T, E> before) {
Objects.requireNonNull(before);
return (final V v) -> apply(before.apply(v));
} | Returns a composed {@link FailableFunction} like {@link Function#compose(Function)}.
@param <V> the input type to the {@code before} function, and to the composed function.
@param before the operator to apply before this one.
@return a composed {@link FailableFunction} like {@link Function#compose(Function)}.
@throws N... | java | src/main/java/org/apache/commons/lang3/function/FailableFunction.java | 107 | [
"before"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
error | public Errors error() {
return Errors.forCode(data.errorCode());
} | The number of each type of error in the response, including {@link Errors#NONE} and top-level errors as well as
more specifically scoped errors (such as topic or partition-level errors).
@return A count of errors. | java | clients/src/main/java/org/apache/kafka/common/requests/AllocateProducerIdsResponse.java | 63 | [] | Errors | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
print_async_result_status | def print_async_result_status(completed_list: list[ApplyResult]) -> None:
"""
Print status of completed async results.
:param completed_list: list of completed async results.
"""
completed_list.sort(key=lambda x: x.get()[1])
get_console().print()
for result in completed_list:
return_... | Print status of completed async results.
:param completed_list: list of completed async results. | python | dev/breeze/src/airflow_breeze/utils/parallel.py | 346 | [
"completed_list"
] | None | true | 4 | 6.56 | apache/airflow | 43,597 | sphinx | false |
toString | @Override
public String toString() {
return getClass().getName() + ": patterns " + ObjectUtils.nullSafeToString(this.patterns) +
", excluded patterns " + ObjectUtils.nullSafeToString(this.excludedPatterns);
} | Does the exclusion pattern at the given index match the given String?
@param pattern the {@code String} pattern to match
@param patternIndex index of pattern (starting from 0)
@return {@code true} if there is a match, {@code false} otherwise | java | spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java | 217 | [] | String | true | 1 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
sort | public static double[] sort(final double[] array) {
if (array != null) {
Arrays.sort(array);
}
return array;
} | Sorts the given array into ascending order and returns it.
@param array the array to sort (may be null).
@return the given array.
@see Arrays#sort(double[]) | java | src/main/java/org/apache/commons/lang3/ArraySorter.java | 65 | [
"array"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
get | public static @Nullable LogFile get(PropertyResolver propertyResolver) {
String file = propertyResolver.getProperty(FILE_NAME_PROPERTY);
String path = propertyResolver.getProperty(FILE_PATH_PROPERTY);
if (StringUtils.hasLength(file) || StringUtils.hasLength(path)) {
return new LogFile(file, path);
}
return... | Get a {@link LogFile} from the given Spring {@link Environment}.
@param propertyResolver the {@link PropertyResolver} used to obtain the logging
properties
@return a {@link LogFile} or {@code null} if the environment didn't contain any
suitable properties | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java | 116 | [
"propertyResolver"
] | LogFile | true | 3 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
addNoMatchOutcomeToAncestors | private void addNoMatchOutcomeToAncestors(String source) {
String prefix = source + "$";
this.outcomes.forEach((candidateSource, sourceOutcomes) -> {
if (candidateSource.startsWith(prefix)) {
ConditionOutcome outcome = ConditionOutcome
.noMatch(ConditionMessage.forCondition("Ancestor " + source).because... | Returns condition outcomes from this report, grouped by the source.
@return the condition outcomes | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | 126 | [
"source"
] | void | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
getMainMethod | private static Method getMainMethod(Class<?> application) throws Exception {
try {
return application.getDeclaredMethod("main", String[].class);
}
catch (NoSuchMethodException ex) {
return application.getDeclaredMethod("main");
}
} | Create a new processor for the specified application and settings.
@param application the application main class
@param settings the general AOT processor settings
@param applicationArgs the arguments to provide to the main method | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplicationAotProcessor.java | 73 | [
"application"
] | Method | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
_read_axes | def _read_axes(
self, where, start: int | None = None, stop: int | None = None
) -> list[tuple[np.ndarray, np.ndarray] | tuple[Index, Index]]:
"""
Create the axes sniffed from the table.
Parameters
----------
where : ???
start : int or None, default None
... | Create the axes sniffed from the table.
Parameters
----------
where : ???
start : int or None, default None
stop : int or None, default None
Returns
-------
List[Tuple[index_values, column_values]] | python | pandas/io/pytables.py | 3,965 | [
"self",
"where",
"start",
"stop"
] | list[tuple[np.ndarray, np.ndarray] | tuple[Index, Index]] | true | 2 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
maybeAutoCommitOffsetsAsync | public void maybeAutoCommitOffsetsAsync(long now) {
if (autoCommitEnabled) {
nextAutoCommitTimer.update(now);
if (nextAutoCommitTimer.isExpired()) {
nextAutoCommitTimer.reset(autoCommitIntervalMs);
autoCommitOffsetsAsync();
}
}
} | Commit offsets synchronously. This method will retry until the commit completes successfully
or an unrecoverable error is encountered.
@param offsets The offsets to be committed
@throws org.apache.kafka.common.errors.AuthorizationException if the consumer is not authorized to the group
or to any of the spec... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 1,198 | [
"now"
] | void | true | 3 | 7.44 | apache/kafka | 31,560 | javadoc | false |
isSuperContainer | function isSuperContainer(node: Node) {
const kind = node.kind;
return kind === SyntaxKind.ClassDeclaration
|| kind === SyntaxKind.Constructor
|| kind === SyntaxKind.MethodDeclaration
|| kind === SyntaxKind.GetAccessor
|| kind === SyntaxKind.SetAcces... | Hooks node substitutions.
@param hint The context for the emitter.
@param node The node to substitute. | typescript | src/compiler/transformers/es2018.ts | 1,452 | [
"node"
] | false | 5 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
flattenDepth | function flattenDepth(array, depth) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
depth = depth === undefined ? 1 : toInteger(depth);
return baseFlatten(array, depth);
} | Recursively flatten `array` up to `depth` times.
@static
@memberOf _
@since 4.4.0
@category Array
@param {Array} array The array to flatten.
@param {number} [depth=1] The maximum recursion depth.
@returns {Array} Returns the new flattened array.
@example
var array = [1, [2, [3, [4]], 5]];
_.flattenDepth(array, 1);
// =... | javascript | lodash.js | 7,472 | [
"array",
"depth"
] | false | 4 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
getActualIndentationForListItem | function getActualIndentationForListItem(node: Node, sourceFile: SourceFile, options: EditorSettings, listIndentsChild: boolean): number {
if (node.parent && node.parent.kind === SyntaxKind.VariableDeclarationList) {
// VariableDeclarationList has no wrapping tokens
return Value.Unkno... | @param assumeNewLineBeforeCloseBrace
`false` when called on text from a real source file.
`true` when we need to assume `position` is on a newline.
This is useful for codefixes. Consider
```
function f() {
|}
```
with `position` at `|`.
When inserting some text after an open brace, we would like to get inden... | typescript | src/services/formatting/smartIndenter.ts | 552 | [
"node",
"sourceFile",
"options",
"listIndentsChild"
] | true | 7 | 8.48 | microsoft/TypeScript | 107,154 | jsdoc | false | |
delete | def delete(key: str, team_name: str | None = None, session: Session | None = None) -> int:
"""
Delete an Airflow Variable for a given key.
:param key: Variable Keys
:param team_name: Team name associated to the task trying to delete the variable (if any)
:param session: optional... | Delete an Airflow Variable for a given key.
:param key: Variable Keys
:param team_name: Team name associated to the task trying to delete the variable (if any)
:param session: optional session, use if provided or create a new one | python | airflow-core/src/airflow/models/variable.py | 398 | [
"key",
"team_name",
"session"
] | int | true | 7 | 7.04 | apache/airflow | 43,597 | sphinx | false |
apply | public static <T, R> R apply(final Function<T, R> function, final T object) {
return function != null ? function.apply(object) : null;
} | Applies the {@link Function} on the object if the function is not {@code null}. Otherwise, does nothing and returns {@code null}.
@param function the function to apply.
@param object the object to apply the function.
@param <T> the type of the argument the function applies.
@param <R> the type of the result... | java | src/main/java/org/apache/commons/lang3/function/Functions.java | 41 | [
"function",
"object"
] | R | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false |
constrainToRange | public static double constrainToRange(double value, double min, double max) {
// avoid auto-boxing by not using Preconditions.checkArgument(); see Guava issue 3984
// Reject NaN by testing for the good case (min <= max) instead of the bad (min > max).
if (min <= max) {
return Math.min(Math.max(value, ... | Returns the value nearest to {@code value} which is within the closed range {@code [min..max]}.
<p>If {@code value} is within the range {@code [min..max]}, {@code value} is returned
unchanged. If {@code value} is less than {@code min}, {@code min} is returned, and if {@code
value} is greater than {@code max}, {@code ma... | java | android/guava/src/com/google/common/primitives/Doubles.java | 255 | [
"value",
"min",
"max"
] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
shapeValue | function shapeValue(value: unknown): unknown {
if (value === true || !isObject(value)) return value
// Check if it's a nested query (has arguments or selection keys)
if ('arguments' in value || 'selection' in value) {
const args = value.arguments as Obj | undefined
const selection = value.selection as Ob... | Shapes a value that could be a nested query, a simple selection, or a boolean. | typescript | packages/sqlcommenter-query-insights/src/shape/shape.ts | 33 | [
"value"
] | true | 8 | 6 | prisma/prisma | 44,834 | jsdoc | false | |
parseBooleanLenient | @SuppressForbidden(reason = "allow lenient parsing of booleans")
public static boolean parseBooleanLenient(String value, boolean defaultValue) {
if (value == null) {
return defaultValue;
}
return Boolean.parseBoolean(value);
} | Wrapper around Boolean.parseBoolean for lenient parsing of booleans.
Note: Lenient parsing is highly discouraged and should only be used if absolutely necessary. | java | libs/core/src/main/java/org/elasticsearch/core/Booleans.java | 104 | [
"value",
"defaultValue"
] | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
read_table | def read_table(
self,
table_name: str,
index_col: str | list[str] | None = None,
coerce_float: bool = True,
parse_dates=None,
columns=None,
schema: str | None = None,
chunksize: int | None = None,
dtype_backend: DtypeBackend | Literal["numpy"] = "n... | Read SQL database table into a DataFrame.
Parameters
----------
table_name : str
Name of SQL table in database.
index_col : string, optional, default: None
Column to set as index.
coerce_float : bool, default True
Attempts to convert values of non-string, non-numeric objects
(like decimal.Decimal) to f... | python | pandas/io/sql.py | 1,683 | [
"self",
"table_name",
"index_col",
"coerce_float",
"parse_dates",
"columns",
"schema",
"chunksize",
"dtype_backend"
] | DataFrame | Iterator[DataFrame] | true | 2 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
getResolvedFactoryMethod | public @Nullable Method getResolvedFactoryMethod() {
Method factoryMethod = this.factoryMethodToIntrospect;
if (factoryMethod == null &&
getInstanceSupplier() instanceof InstanceSupplier<?> instanceSupplier) {
factoryMethod = instanceSupplier.getFactoryMethod();
}
return factoryMethod;
} | Return the resolved factory method as a Java Method object, if available.
@return the factory method, or {@code null} if not found or not resolved yet | java | spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java | 435 | [] | Method | true | 3 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
toString | @Deprecated
@InlineMe(
replacement = "Files.asCharSource(file, charset).read()",
imports = "com.google.common.io.Files")
public static String toString(File file, Charset charset) throws IOException {
return asCharSource(file, charset).read();
} | Reads all characters from a file into a {@link String}, using the given character set.
@param file the file to read from
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@return a string containing all the characters from the file
@throws IOEx... | java | android/guava/src/com/google/common/io/Files.java | 250 | [
"file",
"charset"
] | String | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false |
_clean_args | def _clean_args(*args):
"""
Helper function for delegating arguments to Python string
functions.
Many of the Python string operations that have optional arguments
do not use 'None' to indicate a default value. In these cases,
we need to remove all None arguments, and those following them.
... | Helper function for delegating arguments to Python string
functions.
Many of the Python string operations that have optional arguments
do not use 'None' to indicate a default value. In these cases,
we need to remove all None arguments, and those following them. | python | numpy/_core/strings.py | 127 | [] | false | 3 | 6.24 | numpy/numpy | 31,054 | unknown | false | |
open_maybe_zipped | def open_maybe_zipped(fileloc, mode="r"):
"""
Open the given file.
If the path contains a folder with a .zip suffix, then the folder
is treated as a zip archive, opening the file inside the archive.
:return: a file object, as in `open`, or as in `ZipFile.open`.
"""
_, archive, filename = Z... | Open the given file.
If the path contains a folder with a .zip suffix, then the folder
is treated as a zip archive, opening the file inside the archive.
:return: a file object, as in `open`, or as in `ZipFile.open`. | python | airflow-core/src/airflow/utils/file.py | 152 | [
"fileloc",
"mode"
] | false | 3 | 6.08 | apache/airflow | 43,597 | unknown | false | |
iterrows | def iterrows(self) -> Iterable[tuple[Hashable, Series]]:
"""
Iterate over DataFrame rows as (index, Series) pairs.
Yields
------
index : label or tuple of label
The index of the row. A tuple for a `MultiIndex`.
data : Series
The data of the row as... | Iterate over DataFrame rows as (index, Series) pairs.
Yields
------
index : label or tuple of label
The index of the row. A tuple for a `MultiIndex`.
data : Series
The data of the row as a Series.
See Also
--------
DataFrame.itertuples : Iterate over DataFrame rows as namedtuples of the values.
DataFrame.item... | python | pandas/core/frame.py | 1,545 | [
"self"
] | Iterable[tuple[Hashable, Series]] | true | 3 | 8.48 | pandas-dev/pandas | 47,362 | unknown | false |
moveToEnd | static void moveToEnd(ConfigurableEnvironment environment) {
MutablePropertySources propertySources = environment.getPropertySources();
PropertySource<?> propertySource = propertySources.remove(NAME);
if (propertySource != null) {
propertySources.addLast(propertySource);
}
} | Moves the {@link ApplicationInfoPropertySource} to the end of the environment's
property sources.
@param environment the environment | java | core/spring-boot/src/main/java/org/springframework/boot/ApplicationInfoPropertySource.java | 78 | [
"environment"
] | void | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
rejectRecordBatch | private <K, V> Set<Long> rejectRecordBatch(final ShareInFlightBatch<K, V> inFlightBatch,
final RecordBatch currentBatch) {
// Rewind the acquiredRecordIterator to the start, so we are in a known state
acquiredRecordIterator = acquiredRecordList.listIterator();
... | The {@link RecordBatch batch} of {@link Record records} is converted to a {@link List list} of
{@link ConsumerRecord consumer records} and returned. {@link BufferSupplier Decompression} and
{@link Deserializer deserialization} of the {@link Record record's} key and value are performed in
this step.
@param deserializers... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareCompletedFetch.java | 282 | [
"inFlightBatch",
"currentBatch"
] | true | 5 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
binarize | def binarize(X, *, threshold=0.0, copy=True):
"""Boolean thresholding of array-like or scipy.sparse matrix.
Read more in the :ref:`User Guide <preprocessing_binarization>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data to binarize, element ... | Boolean thresholding of array-like or scipy.sparse matrix.
Read more in the :ref:`User Guide <preprocessing_binarization>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data to binarize, element by element.
scipy.sparse matrices should be in CSR or CSC format to a... | python | sklearn/preprocessing/_data.py | 2,219 | [
"X",
"threshold",
"copy"
] | false | 4 | 7.52 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
adaptBeanInstance | @SuppressWarnings("unchecked")
<T> T adaptBeanInstance(String name, Object bean, @Nullable Class<?> requiredType) {
// Check if required type matches the type of the actual bean instance.
if (requiredType != null && !requiredType.isInstance(bean)) {
try {
Object convertedBean = getTypeConverter().convertIfN... | Return an instance, which may be shared or independent, of the specified bean.
@param name the name of the bean to retrieve
@param requiredType the required type of the bean to retrieve
@param args arguments to use when creating a bean instance using explicit arguments
(only applied when creating a new instance as oppo... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 402 | [
"name",
"bean",
"requiredType"
] | T | true | 6 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
append | AnsiString append(String text, Code... codes) {
if (codes.length == 0 || !isAnsiSupported()) {
this.value.append(text);
return this;
}
Ansi ansi = Ansi.ansi();
for (Code code : codes) {
ansi = applyCode(ansi, code);
}
this.value.append(ansi.a(text).reset().toString());
return this;
} | Append text with the given ANSI codes.
@param text the text to append
@param codes the ANSI codes
@return this string | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java | 49 | [
"text"
] | AnsiString | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
markinnerspaces | def markinnerspaces(line):
"""
The function replace all spaces in the input variable line which are
surrounded with quotation marks, with the triplet "@_@".
For instance, for the input "a 'b c'" the function returns "a 'b@_@c'"
Parameters
----------
line : str
Returns
-------
... | The function replace all spaces in the input variable line which are
surrounded with quotation marks, with the triplet "@_@".
For instance, for the input "a 'b c'" the function returns "a 'b@_@c'"
Parameters
----------
line : str
Returns
-------
str | python | numpy/f2py/crackfortran.py | 1,625 | [
"line"
] | false | 9 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
delete_objects | def delete_objects(self, bucket: str, keys: str | list) -> None:
"""
Delete keys from the bucket.
.. seealso::
- :external+boto3:py:meth:`S3.Client.delete_objects`
:param bucket: Name of the bucket in which you are going to delete object(s)
:param keys: The key(s) t... | Delete keys from the bucket.
.. seealso::
- :external+boto3:py:meth:`S3.Client.delete_objects`
:param bucket: Name of the bucket in which you are going to delete object(s)
:param keys: The key(s) to delete from S3 bucket.
When ``keys`` is a string, it's supposed to be the key name of
the single object to... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 1,489 | [
"self",
"bucket",
"keys"
] | None | true | 5 | 7.04 | apache/airflow | 43,597 | sphinx | false |
getOffsetFromSpec | private static long getOffsetFromSpec(OffsetSpec offsetSpec) {
if (offsetSpec instanceof TimestampSpec) {
return ((TimestampSpec) offsetSpec).timestamp();
} else if (offsetSpec instanceof OffsetSpec.EarliestSpec) {
return ListOffsetsRequest.EARLIEST_TIMESTAMP;
} else if (... | Forcefully terminates an ongoing transaction for a given transactional ID.
<p>
This API is intended for well-formed but long-running transactions that are known to the
transaction coordinator. It is primarily designed for supporting 2PC (two-phase commit) workflows,
where a coordinator may need to unilaterally terminat... | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 5,141 | [
"offsetSpec"
] | true | 7 | 7.44 | apache/kafka | 31,560 | javadoc | false | |
entrySpliterator | @Override
@GwtIncompatible("Spliterator")
Spliterator<Entry<K, V>> entrySpliterator() {
return CollectSpliterators.flatMap(
asMap().entrySet().spliterator(),
keyToValueCollectionEntry -> {
K key = keyToValueCollectionEntry.getKey();
Collection<V> valueCollection = keyToValueC... | Returns an immutable collection of all key-value pairs in the multimap. | java | guava/src/com/google/common/collect/ImmutableMultimap.java | 680 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
getPage | public int getPage() {
this.newPageSet = false;
if (this.page >= getPageCount()) {
this.page = getPageCount() - 1;
}
return this.page;
} | Return the current page number.
Page numbering starts with 0. | java | spring-beans/src/main/java/org/springframework/beans/support/PagedListHolder.java | 189 | [] | true | 2 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false | |
updateFetchPositions | private boolean updateFetchPositions(final Timer timer) {
// If any partitions have been truncated due to a leader change, we need to validate the offsets
offsetFetcher.validatePositionsIfNeeded();
cachedSubscriptionHasAllFetchPositions = subscriptions.hasAllFetchPositions();
if (cached... | Set the fetch position to the committed position (if there is one)
or reset it using the offset reset policy the user has configured.
@throws org.apache.kafka.common.errors.AuthenticationException if authentication fails. See the exception for more details
@throws NoOffsetForPartitionException If no offset is stored fo... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java | 1,205 | [
"timer"
] | true | 4 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
mark_compile_region | def mark_compile_region(fn=None, options: Optional[NestedCompileRegionOptions] = None):
"""
This wrapper instructs torch.compile to compile the wrapped region once and
reuse the compiled artifact, instead of the usual way of aggressively
inlining the function.
Under the hood, it tells TorchDynamo t... | This wrapper instructs torch.compile to compile the wrapped region once and
reuse the compiled artifact, instead of the usual way of aggressively
inlining the function.
Under the hood, it tells TorchDynamo to use InvokeSubgraph HOP for the
region. For PyTorch eager, this is a no-op.
Args:
fn: The function to wrap... | python | torch/_higher_order_ops/invoke_subgraph.py | 196 | [
"fn",
"options"
] | true | 4 | 6.88 | pytorch/pytorch | 96,034 | google | false | |
_maybe_cache | def _maybe_cache(
arg: ArrayConvertible,
format: str | None,
cache: bool,
convert_listlike: Callable,
) -> Series:
"""
Create a cache of unique dates from an array of dates
Parameters
----------
arg : listlike, tuple, 1-d array, Series
format : string
Strftime format to ... | Create a cache of unique dates from an array of dates
Parameters
----------
arg : listlike, tuple, 1-d array, Series
format : string
Strftime format to parse time
cache : bool
True attempts to create a cache of converted values
convert_listlike : function
Conversion function to apply on dates
Returns
----... | python | pandas/core/tools/datetimes.py | 216 | [
"arg",
"format",
"cache",
"convert_listlike"
] | Series | true | 6 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
optDouble | public double optDouble(int index, double fallback) {
Object object = opt(index);
Double result = JSON.toDouble(object);
return result != null ? result : fallback;
} | Returns the value at {@code index} if it exists and is a double or can be coerced
to a double. Returns {@code fallback} otherwise.
@param index the index to get the value from
@param fallback the fallback value
@return the value at {@code index} of {@code fallback} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 392 | [
"index",
"fallback"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
invocableClone | @Override
public MethodInvocation invocableClone() {
@Nullable Object[] cloneArguments = this.arguments;
if (this.arguments.length > 0) {
// Build an independent copy of the arguments array.
cloneArguments = this.arguments.clone();
}
return invocableClone(cloneArguments);
} | This implementation returns a shallow copy of this invocation object,
including an independent copy of the original arguments array.
<p>We want a shallow copy in this case: We want to use the same interceptor
chain and other object references, but we want an independent value for the
current interceptor index.
@see jav... | java | spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java | 202 | [] | MethodInvocation | true | 2 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
_nanquantile_1d | def _nanquantile_1d(
values: np.ndarray,
mask: npt.NDArray[np.bool_],
qs: npt.NDArray[np.float64],
na_value: Scalar,
interpolation: str,
) -> Scalar | np.ndarray:
"""
Wrapper for np.quantile that skips missing values, specialized to
1-dimensional case.
Parameters
----------
... | Wrapper for np.quantile that skips missing values, specialized to
1-dimensional case.
Parameters
----------
values : array over which to find quantiles
mask : ndarray[bool]
locations in values that should be considered missing
qs : np.ndarray[float64] of quantile indices to find
na_value : scalar
value to retu... | python | pandas/core/array_algos/quantile.py | 111 | [
"values",
"mask",
"qs",
"na_value",
"interpolation"
] | Scalar | np.ndarray | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
of | public static <L, R> ImmutablePair<L, R> of(final L left, final R right) {
return left != null || right != null ? new ImmutablePair<>(left, right) : nullPair();
} | Creates an immutable pair of two objects inferring the generic types.
@param <L> the left element type.
@param <R> the right element type.
@param left the left element, may be null.
@param right the right element, may be null.
@return an immutable formed from the two parameters, not null. | java | src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java | 105 | [
"left",
"right"
] | true | 3 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
nextBatch | T nextBatch() throws IOException; | Get the next record batch from the underlying input stream.
@return The next record batch or null if there is none
@throws IOException for any IO errors | java | clients/src/main/java/org/apache/kafka/common/record/LogInputStream.java | 42 | [] | T | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
getResourceDescription | private String getResourceDescription(@Nullable Resource resource) {
if (resource instanceof OriginTrackedResource originTrackedResource) {
return getResourceDescription(originTrackedResource.getResource());
}
if (resource == null) {
return "unknown resource [?]";
}
if (resource instanceof ClassPathReso... | Return the location of the property within the source (if known).
@return the location or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java | 105 | [
"resource"
] | String | true | 4 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
cellSpliterator | @Override
Spliterator<Cell<R, C, @Nullable V>> cellSpliterator() {
return CollectSpliterators.indexed(
size(), Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.DISTINCT, this::getCell);
} | Returns an unmodifiable set of all row key / column key / value triplets. Changes to the table
will update the returned set.
<p>The returned set's iterator traverses the mappings with the first row key, the mappings with
the second row key, and so on.
<p>The value in the returned cells may change if the table subsequen... | java | guava/src/com/google/common/collect/ArrayTable.java | 563 | [] | true | 1 | 7.04 | google/guava | 51,352 | javadoc | false | |
unescapeCsv | public static final String unescapeCsv(final String input) {
return UNESCAPE_CSV.translate(input);
} | Returns a {@link String} value for an unescaped CSV column.
<p>If the value is enclosed in double quotes, and contains a comma, newline
or double quote, then quotes are removed.
</p>
<p>Any double quote escaped characters (a pair of double quotes) are unescaped
to just one double quote.</p>
<p>If the value is not... | java | src/main/java/org/apache/commons/lang3/StringEscapeUtils.java | 680 | [
"input"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
is_monitoring_in_job_override | def is_monitoring_in_job_override(self, config_key: str, job_override: dict | None) -> bool:
"""
Check if monitoring is enabled for the job.
Note: This is not compatible with application defaults:
https://docs.aws.amazon.com/emr/latest/EMR-Serverless-UserGuide/default-configs.html
... | Check if monitoring is enabled for the job.
Note: This is not compatible with application defaults:
https://docs.aws.amazon.com/emr/latest/EMR-Serverless-UserGuide/default-configs.html
This is used to determine what extra links should be shown. | python | providers/amazon/src/airflow/providers/amazon/aws/operators/emr.py | 1,333 | [
"self",
"config_key",
"job_override"
] | bool | true | 5 | 6.4 | apache/airflow | 43,597 | unknown | false |
createLookupPromise | function createLookupPromise(family, hostname, all, hints, dnsOrder) {
return new Promise((resolve, reject) => {
if (!hostname) {
reject(new ERR_INVALID_ARG_VALUE('hostname', hostname,
'must be a non-empty string'));
return;
}
const matchedFamily = isIP(... | Creates a promise that resolves with the IP address of the given hostname.
@param {0 | 4 | 6} family - The IP address family (4 or 6, or 0 for both).
@param {string} hostname - The hostname to resolve.
@param {boolean} all - Whether to resolve with all IP addresses for the hostname.
@param {number} hints - One or more ... | javascript | lib/internal/dns/promises.js | 134 | [
"family",
"hostname",
"all",
"hints",
"dnsOrder"
] | false | 11 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
_parse_yaml_file | def _parse_yaml_file(file_path: str) -> tuple[dict[str, list[str]], list[FileSyntaxError]]:
"""
Parse a file in the YAML format.
:param file_path: The location of the file that will be processed.
:return: Tuple with mapping of key and list of values and list of syntax errors
"""
with open(file_... | Parse a file in the YAML format.
:param file_path: The location of the file that will be processed.
:return: Tuple with mapping of key and list of values and list of syntax errors | python | airflow-core/src/airflow/secrets/local_filesystem.py | 112 | [
"file_path"
] | tuple[dict[str, list[str]], list[FileSyntaxError]] | true | 4 | 8.08 | apache/airflow | 43,597 | sphinx | false |
validate_args_and_kwargs | def validate_args_and_kwargs(
fname, args, kwargs, max_fname_arg_count, compat_args
) -> None:
"""
Checks whether parameters passed to the *args and **kwargs argument in a
function `fname` are valid parameters as specified in `*compat_args`
and whether or not they are set to their default values.
... | Checks whether parameters passed to the *args and **kwargs argument in a
function `fname` are valid parameters as specified in `*compat_args`
and whether or not they are set to their default values.
Parameters
----------
fname: str
The name of the function being passed the `**kwargs` parameter
args: tuple
The ... | python | pandas/util/_validators.py | 170 | [
"fname",
"args",
"kwargs",
"max_fname_arg_count",
"compat_args"
] | None | true | 3 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
tap | function tap(value, interceptor) {
interceptor(value);
return value;
} | This method invokes `interceptor` and returns `value`. The interceptor
is invoked with one argument; (value). The purpose of this method is to
"tap into" a method chain sequence in order to modify intermediate results.
@static
@memberOf _
@since 0.1.0
@category Seq
@param {*} value The value to provide to `interceptor`... | javascript | lodash.js | 8,869 | [
"value",
"interceptor"
] | false | 1 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
shift | public static void shift(final boolean[] array, int startIndexInclusive, int endIndexExclusive, int offset) {
if (array == null || startIndexInclusive >= array.length - 1 || endIndexExclusive <= 0) {
return;
}
startIndexInclusive = max0(startIndexInclusive);
endIndexExclusive... | Shifts the order of a series of elements in the given boolean array.
<p>There is no special handling for multi-dimensional arrays. This method
does nothing for {@code null} or empty input arrays.</p>
@param array
the array to shift, may be {@code null}.
@param startIndexInclusive
the starting inde... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,814 | [
"array",
"startIndexInclusive",
"endIndexExclusive",
"offset"
] | void | true | 10 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
extractProject | private void extractProject(ProjectGenerationResponse entity, @Nullable String output, boolean overwrite)
throws IOException {
File outputDirectory = (output != null) ? new File(output) : new File(System.getProperty("user.dir"));
if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
byte[] content ... | Detect if the project should be extracted.
@param request the generation request
@param response the generation response
@return if the project should be extracted | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java | 95 | [
"entity",
"output",
"overwrite"
] | void | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
formatDurationHMS | public static String formatDurationHMS(final long durationMillis) {
return formatDuration(durationMillis, "HH:mm:ss.SSS");
} | Formats the time gap as a string.
<p>The format used is ISO 8601-like: {@code HH:mm:ss.SSS}.</p>
@param durationMillis the duration to format
@return the formatted duration, not null
@throws IllegalArgumentException if durationMillis is negative | java | src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java | 398 | [
"durationMillis"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
printSimple | private static String printSimple(Duration duration, DurationFormat.@Nullable Unit unit) {
unit = (unit == null ? DurationFormat.Unit.MILLIS : unit);
return unit.print(duration);
} | 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 | 160 | [
"duration",
"unit"
] | String | true | 2 | 7.68 | spring-projects/spring-framework | 59,386 | javadoc | false |
CONST | public static double CONST(final double v) {
return v;
} | Returns the provided value unchanged. This can prevent javac from inlining a constant field, e.g.,
<pre>
public final static double MAGIC_DOUBLE = ObjectUtils.CONST(1.0);
</pre>
This way any jars that refer to this field do not have to recompile themselves if the field's value changes at some future date.
@param v the ... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 386 | [
"v"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
read | @Override
public int read(byte[] b, int off, int len) throws IOException {
// Obey InputStream contract.
checkPositionIndexes(off, off + len, b.length);
if (len == 0) {
return 0;
}
// The rest of this method implements the process described by the CharsetEncoder javadoc.
int totalBytesR... | Creates a new input stream that will encode the characters from {@code reader} into bytes using
the given character set encoder.
@param reader input source
@param encoder character set encoder used for encoding chars to bytes
@param bufferSize size of internal input and output buffers
@throws IllegalArgumentException i... | java | android/guava/src/com/google/common/io/ReaderInputStream.java | 129 | [
"b",
"off",
"len"
] | true | 15 | 6.48 | google/guava | 51,352 | javadoc | false | |
isLeavingGroup | @Override
public boolean isLeavingGroup() {
CloseOptions.GroupMembershipOperation leaveGroupOperation = leaveGroupOperation();
if (REMAIN_IN_GROUP == leaveGroupOperation && groupInstanceId.isEmpty()) {
return false;
}
MemberState state = state();
boolean isLeavin... | Log partitions being revoked that were already paused, since the pause flag will be
effectively lost. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMembershipManager.java | 421 | [] | true | 7 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
optimizedText | XContentString optimizedText() throws IOException; | Returns an instance of {@link Map} holding parsed map.
Serves as a replacement for the "map", "mapOrdered" and "mapStrings" methods above.
@param mapFactory factory for creating new {@link Map} objects
@param mapValueParser parser for parsing a single map value
@param <T> map value type
@return {@link Map} object | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParser.java | 112 | [] | XContentString | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false |
getAllNamedFields | static std::set<const FieldDecl *>
getAllNamedFields(const CXXRecordDecl *Record) {
std::set<const FieldDecl *> Result;
for (const auto *Field : Record->fields()) {
// Static data members are not in this range.
if (Field->isUnnamedBitField())
continue;
Result.insert(Field);
}
return Result;
} | Finds all the named non-static fields of \p Record. | cpp | clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp | 24 | [] | true | 2 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false | |
asByteArray | byte[] asByteArray() {
ByteBuffer buffer = ByteBuffer.allocate(MINIMUM_SIZE);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(SIGNATURE);
buffer.putShort(this.versionMadeBy);
buffer.putShort(this.versionNeededToExtract);
buffer.putShort(this.generalPurposeBitFlag);
buffer.putShort(this.compressionMet... | 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/ZipCentralDirectoryFileHeaderRecord.java | 164 | [] | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
unicodeWords | function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
} | Splits a Unicode `string` into an array of its words.
@private
@param {string} The string to inspect.
@returns {Array} Returns the words of `string`. | javascript | lodash.js | 1,413 | [
"string"
] | false | 2 | 6.16 | lodash/lodash | 61,490 | jsdoc | false | |
countTrue | public static int countTrue(boolean... values) {
int count = 0;
for (boolean value : values) {
if (value) {
count++;
}
}
return count;
} | Returns the number of {@code values} that are {@code true}.
@since 16.0 | java | android/guava/src/com/google/common/primitives/Booleans.java | 524 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.