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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
readContext | function readContext(Context: ReactContext<mixed>) {
const dispatcher = SharedInternals.H;
if (dispatcher === null) {
// This wasn't being minified but we're going to retire this package anyway.
// eslint-disable-next-line react-internal/prod-error-codes
throw new Error(
'react-cache: read and pre... | 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-cache/src/ReactCacheOld.js | 50 | [] | false | 2 | 6.4 | facebook/react | 241,750 | jsdoc | false | |
CONST_SHORT | public static short CONST_SHORT(final int v) {
if (v < Short.MIN_VALUE || v > Short.MAX_VALUE) {
throw new IllegalArgumentException("Supplied value must be a valid byte literal between -32768 and 32767: [" + v + "]");
}
return (short) v;
} | Returns the provided value unchanged. This can prevent javac from inlining a constant field, e.g.,
<pre>
public final static short MAGIC_SHORT = ObjectUtils.CONST_SHORT(127);
</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 ... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 511 | [
"v"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
_check_X_y | def _check_X_y(self, X, y=None, should_be_fitted=True):
"""Validate X and y and make extra check.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data set.
`X` is checked only if `check_X` is not `None` (default is None).
y : arr... | Validate X and y and make extra check.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data set.
`X` is checked only if `check_X` is not `None` (default is None).
y : array-like of shape (n_samples), default=None
The corresponding target, by default `None`.
`y` is checked only... | python | sklearn/utils/_mocking.py | 157 | [
"self",
"X",
"y",
"should_be_fitted"
] | false | 11 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
filled | def filled(self, fill_value=None):
"""
Return a copy of self, with masked values filled with a given value.
**However**, if there are no masked values to fill, self will be
returned instead as an ndarray.
Parameters
----------
fill_value : array_like, optional
... | Return a copy of self, with masked values filled with a given value.
**However**, if there are no masked values to fill, self will be
returned instead as an ndarray.
Parameters
----------
fill_value : array_like, optional
The value to use for invalid entries. Can be scalar or non-scalar.
If non-scalar, the res... | python | numpy/ma/core.py | 3,856 | [
"self",
"fill_value"
] | false | 11 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
forUriStringOrNull | private static @Nullable InetAddress forUriStringOrNull(String hostAddr, boolean parseScope) {
checkNotNull(hostAddr);
// Decide if this should be an IPv6 or IPv4 address.
String ipString;
int expectBytes;
if (hostAddr.startsWith("[") && hostAddr.endsWith("]")) {
ipString = hostAddr.substring... | Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL, encoded in
the format specified by RFC 3986 section 3.2.2.
<p>This method is similar to {@link InetAddresses#forString(String)}, however, it requires that
IPv6 addresses are surrounded by square brackets.
<p>This method is the inverse o... | java | android/guava/src/com/google/common/net/InetAddresses.java | 617 | [
"hostAddr",
"parseScope"
] | InetAddress | true | 7 | 7.76 | google/guava | 51,352 | javadoc | false |
findAnnotation | private static <A extends Annotation> @Nullable A findAnnotation(@Nullable Object instance, Class<?> type,
@Nullable Method factory, Class<A> annotationType) {
MergedAnnotation<A> annotation = MergedAnnotation.missing();
if (factory != null) {
annotation = findMergedAnnotation(factory, annotationType);
}
... | 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 | 267 | [
"instance",
"type",
"factory",
"annotationType"
] | A | true | 6 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
codegen_additional_funcs | def codegen_additional_funcs(self) -> None:
"""
Generate thread-safe lazy singleton pattern for MPS shader libraries with RAII cleanup.
The generated code will look like:
```
AOTIMetalKernelFunctionHandle get_mps_lib_0_handle() {
static auto kernel_handle = []() {
... | Generate thread-safe lazy singleton pattern for MPS shader libraries with RAII cleanup.
The generated code will look like:
```
AOTIMetalKernelFunctionHandle get_mps_lib_0_handle() {
static auto kernel_handle = []() {
AOTIMetalShaderLibraryHandle lib_handle = nullptr;
AOTIMetalKernelFunctionHandle k... | python | torch/_inductor/codegen/cpp_wrapper_mps.py | 226 | [
"self"
] | None | true | 6 | 6.4 | pytorch/pytorch | 96,034 | unknown | false |
hessian | def hessian(func, argnums=0):
"""
Computes the Hessian of ``func`` with respect to the arg(s) at index
``argnum`` via a forward-over-reverse strategy.
The forward-over-reverse strategy (composing ``jacfwd(jacrev(func))``) is
a good default for good performance. It is possible to compute Hessians
... | Computes the Hessian of ``func`` with respect to the arg(s) at index
``argnum`` via a forward-over-reverse strategy.
The forward-over-reverse strategy (composing ``jacfwd(jacrev(func))``) is
a good default for good performance. It is possible to compute Hessians
through other compositions of :func:`jacfwd` and :func:`... | python | torch/_functorch/eager_transforms.py | 1,312 | [
"func",
"argnums"
] | false | 1 | 7.52 | pytorch/pytorch | 96,034 | google | false | |
of | public static <R> InvocationResult<R> of(@Nullable R value) {
return new InvocationResult<>(value);
} | Create a new {@link InvocationResult} instance with the specified value.
@param value the value (may be {@code null})
@param <R> the result type
@return an {@link InvocationResult} | java | core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java | 432 | [
"value"
] | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false | |
size | @Override
public int size() {
return totalSize;
} | Creates the collection of values for an explicitly provided key. By default, it simply calls
{@link #createCollection()}, which is the correct behavior for most implementations. The {@link
LinkedHashMultimap} class overrides it.
@param key key to associate with values in the collection
@return an empty collection of va... | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 175 | [] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
isCancelled | @Override
public boolean isCancelled() {
if (isDependant) {
// Having isCancelled() for a dependent future just return
// CompletableFuture.isCancelled() would break the historical KafkaFuture behaviour because
// CompletableFuture#isCancelled() just checks for the except... | Returns true if this CompletableFuture was cancelled before it completed normally. | java | clients/src/main/java/org/apache/kafka/common/internals/KafkaFutureImpl.java | 212 | [] | true | 4 | 6.24 | apache/kafka | 31,560 | javadoc | false | |
remove | @Deprecated
public static String remove(final String str, final String remove) {
return Strings.CS.remove(str, remove);
} | Removes all occurrences of a substring from within the source string.
<p>
A {@code null} source string will return {@code null}. An empty ("") source string will return the empty string. A {@code null} remove string will return
the source string. An empty ("") remove string will return the source string.
</p>
<pre>
Str... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,709 | [
"str",
"remove"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
cat_safe | def cat_safe(list_of_columns: list[npt.NDArray[np.object_]], sep: str):
"""
Auxiliary function for :meth:`str.cat`.
Same signature as cat_core, but handles TypeErrors in concatenation, which
happen if the arrays in list_of columns have the wrong dtypes or content.
Parameters
----------
lis... | Auxiliary function for :meth:`str.cat`.
Same signature as cat_core, but handles TypeErrors in concatenation, which
happen if the arrays in list_of columns have the wrong dtypes or content.
Parameters
----------
list_of_columns : list of numpy arrays
List of arrays to be concatenated with sep;
these arrays may... | python | pandas/core/strings/accessor.py | 3,861 | [
"list_of_columns",
"sep"
] | true | 3 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false | |
_parse_subtype | def _parse_subtype(dtype: str) -> tuple[str, bool]:
"""
Parse a string to get the subtype
Parameters
----------
dtype : str
A string like
* Sparse[subtype]
* Sparse[subtype, fill_value]
Returns
-------
subtype : str
... | Parse a string to get the subtype
Parameters
----------
dtype : str
A string like
* Sparse[subtype]
* Sparse[subtype, fill_value]
Returns
-------
subtype : str
Raises
------
ValueError
When the subtype cannot be extracted. | python | pandas/core/dtypes/dtypes.py | 1,979 | [
"dtype"
] | tuple[str, bool] | true | 4 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
remove | boolean remove(K key); | Manually invalidate a key, clearing its entry from the cache.
@param key the key to remove
@return true if the key existed in the cache and the entry was removed or false if it was not present | java | clients/src/main/java/org/apache/kafka/common/cache/Cache.java | 44 | [
"key"
] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
chop | public static String chop(final String str) {
if (str == null) {
return null;
}
final int strLen = str.length();
if (strLen < 2) {
return EMPTY;
}
final int lastIdx = strLen - 1;
final String ret = str.substring(0, lastIdx);
final c... | Removes the last character from a String.
<p>
If the String ends in {@code \r\n}, then remove both of them.
</p>
<pre>
StringUtils.chop(null) = null
StringUtils.chop("") = ""
StringUtils.chop("abc \r") = "abc "
StringUtils.chop("abc\n") = "abc"
StringUtils.chop("abc\r\n") = "abc"
Stri... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 752 | [
"str"
] | String | true | 5 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
_reductions | def _reductions(
func: Callable,
values: np.ndarray,
mask: npt.NDArray[np.bool_],
*,
skipna: bool = True,
min_count: int = 0,
axis: AxisInt | None = None,
**kwargs,
):
"""
Sum, mean or product for 1D masked array.
Parameters
----------
func : np.sum or np.prod
va... | Sum, mean or product for 1D masked array.
Parameters
----------
func : np.sum or np.prod
values : np.ndarray
Numpy array with the values (can be of any dtype that support the
operation).
mask : np.ndarray[bool]
Boolean numpy array (True values indicate missing values).
skipna : bool, default True
Wheth... | python | pandas/core/array_algos/masked_reductions.py | 26 | [
"func",
"values",
"mask",
"skipna",
"min_count",
"axis"
] | true | 10 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false | |
buildEnabled | private static void buildEnabled(StringBuilder sb, Object[] elements) {
boolean writingAnsi = false;
boolean containsEncoding = false;
for (Object element : elements) {
if (element instanceof AnsiElement) {
containsEncoding = true;
if (!writingAnsi) {
sb.append(ENCODE_START);
writingAnsi = tr... | Create a new ANSI string from the specified elements. Any {@link AnsiElement}s will
be encoded as required.
@param elements the elements to encode
@return a string of the encoded elements | java | core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java | 109 | [
"sb",
"elements"
] | void | true | 6 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
isNative | function isNative(value) {
if (isMaskable(value)) {
throw new Error(CORE_ERROR_TEXT);
}
return baseIsNative(value);
} | Checks if `value` is a pristine native function.
**Note:** This method can't reliably detect native functions in the presence
of the core-js package because core-js circumvents this kind of detection.
Despite multiple requests, the core-js maintainer has made it clear: any
attempt to fix the detection will be obstructe... | javascript | lodash.js | 12,032 | [
"value"
] | false | 2 | 7.2 | lodash/lodash | 61,490 | jsdoc | false | |
identity | def identity(cls, domain=None, window=None, symbol='x'):
"""Identity function.
If ``p`` is the returned series, then ``p(x) == x`` for all
values of x.
Parameters
----------
domain : {None, array_like}, optional
If given, the array must be of the form ``[beg... | Identity function.
If ``p`` is the returned series, then ``p(x) == x`` for all
values of x.
Parameters
----------
domain : {None, array_like}, optional
If given, the array must be of the form ``[beg, end]``, where
``beg`` and ``end`` are the endpoints of the domain. If None is
given then the class domain ... | python | numpy/polynomial/_polybase.py | 1,080 | [
"cls",
"domain",
"window",
"symbol"
] | false | 3 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
clone | public static <T> T[] clone(final T[] array) {
return array != null ? array.clone() : null;
} | Shallow clones an array or returns {@code null}.
<p>
The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays.
</p>
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param <T> the component type of the array.
@param array the array to shallow clo... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1,561 | [
"array"
] | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false | |
do_teardown_appcontext | def do_teardown_appcontext(
self, ctx: AppContext, exc: BaseException | None = None
) -> None:
"""Called right before the application context is popped. Called by
:meth:`.AppContext.pop`.
This calls all functions decorated with :meth:`teardown_appcontext`.
Then the :data:`ap... | Called right before the application context is popped. Called by
:meth:`.AppContext.pop`.
This calls all functions decorated with :meth:`teardown_appcontext`.
Then the :data:`appcontext_tearing_down` signal is sent.
:param exc: An unhandled exception raised while the context was active.
Passed to each teardown fu... | python | src/flask/app.py | 1,432 | [
"self",
"ctx",
"exc"
] | None | true | 2 | 6.4 | pallets/flask | 70,946 | sphinx | false |
_color_brew | def _color_brew(n):
"""Generate n colors with equally spaced hues.
Parameters
----------
n : int
The number of colors required.
Returns
-------
color_list : list, length n
List of n tuples of form (R, G, B) being the components of each color.
"""
color_list = []
... | Generate n colors with equally spaced hues.
Parameters
----------
n : int
The number of colors required.
Returns
-------
color_list : list, length n
List of n tuples of form (R, G, B) being the components of each color. | python | sklearn/tree/_export.py | 31 | [
"n"
] | false | 2 | 6.24 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_unpack_zerodim_and_defer | def _unpack_zerodim_and_defer(method: F, name: str) -> F:
"""
Boilerplate for pandas conventions in arithmetic and comparison methods.
Ensure method returns NotImplemented when operating against "senior"
classes. Ensure zero-dimensional ndarrays are always unpacked.
Parameters
----------
... | Boilerplate for pandas conventions in arithmetic and comparison methods.
Ensure method returns NotImplemented when operating against "senior"
classes. Ensure zero-dimensional ndarrays are always unpacked.
Parameters
----------
method : binary method
name : str
Returns
-------
method | python | pandas/core/ops/common.py | 49 | [
"method",
"name"
] | F | true | 6 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
optBoolean | public boolean optBoolean(int index, boolean fallback) {
Object object = opt(index);
Boolean result = JSON.toBoolean(object);
return result != null ? result : fallback;
} | Returns the value at {@code index} if it exists and is a boolean or can be coerced
to a boolean. 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 | 352 | [
"index",
"fallback"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
safe_mask | def safe_mask(X, mask):
"""Return a mask which is safe to use on X.
Parameters
----------
X : {array-like, sparse matrix}
Data on which to apply mask.
mask : array-like
Mask to be used on X.
Returns
-------
mask : ndarray
Array that is safe to use on X.
Ex... | Return a mask which is safe to use on X.
Parameters
----------
X : {array-like, sparse matrix}
Data on which to apply mask.
mask : array-like
Mask to be used on X.
Returns
-------
mask : ndarray
Array that is safe to use on X.
Examples
--------
>>> from sklearn.utils import safe_mask
>>> from scipy.spar... | python | sklearn/utils/_mask.py | 77 | [
"X",
"mask"
] | false | 3 | 7.68 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
initialize | def initialize():
"""Initialize Airflow with all the settings from this file."""
configure_vars()
prepare_syspath_for_config_and_plugins()
policy_mgr = get_policy_plugin_manager()
# Load policy plugins _before_ importing airflow_local_settings, as Pluggy uses LIFO and we want anything
# in airfl... | Initialize Airflow with all the settings from this file. | python | airflow-core/src/airflow/settings.py | 723 | [] | false | 3 | 6.4 | apache/airflow | 43,597 | unknown | false | |
appendLeaderChangeMessage | public void appendLeaderChangeMessage(long timestamp, LeaderChangeMessage leaderChangeMessage) {
if (partitionLeaderEpoch == RecordBatch.NO_PARTITION_LEADER_EPOCH) {
throw new IllegalArgumentException("Partition leader epoch must be valid, but get " + partitionLeaderEpoch);
}
appendC... | Append a control record at the next sequential offset.
@param timestamp The record timestamp
@param type The control record type (cannot be UNKNOWN)
@param value The control record value | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java | 630 | [
"timestamp",
"leaderChangeMessage"
] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
maintenance | private void maintenance() {
if (length == elements.length) {
dedupAndCoalesce(true);
} else if (forceCopyElements) {
this.elements = Arrays.copyOf(elements, elements.length);
// we don't currently need to copy the counts array, because we don't use it directly
// in built IS... | Check if we need to do deduplication and coalescing, and if so, do it. | java | android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 508 | [] | void | true | 3 | 7.2 | google/guava | 51,352 | javadoc | false |
predict | def predict(self, X, check_input=True):
"""Predict class or regression value for X.
For a classification model, the predicted class for each sample in X is
returned. For a regression model, the predicted value based on X is
returned.
Parameters
----------
X : {a... | Predict class or regression value for X.
For a classification model, the predicted class for each sample in X is
returned. For a regression model, the predicted value based on X is
returned.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The input samples. Internally, it wi... | python | sklearn/tree/_classes.py | 509 | [
"self",
"X",
"check_input"
] | false | 8 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
buffer | public ByteBuffer buffer() {
return this.buffer;
} | Get the underlying buffer backing this record instance.
@return the buffer | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 270 | [] | ByteBuffer | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
correlate | def correlate(a, v, mode='valid', propagate_mask=True):
"""
Cross-correlation of two 1-dimensional sequences.
Parameters
----------
a, v : array_like
Input sequences.
mode : {'valid', 'same', 'full'}, optional
Refer to the `np.convolve` docstring. Note that the default
... | Cross-correlation of two 1-dimensional sequences.
Parameters
----------
a, v : array_like
Input sequences.
mode : {'valid', 'same', 'full'}, optional
Refer to the `np.convolve` docstring. Note that the default
is 'valid', unlike `convolve`, which uses 'full'.
propagate_mask : bool
If True, then a resu... | python | numpy/ma/core.py | 8,300 | [
"a",
"v",
"mode",
"propagate_mask"
] | false | 1 | 6 | numpy/numpy | 31,054 | numpy | false | |
create_asset | def create_asset(
self,
*,
scheme: str | None = None,
uri: str | None = None,
name: str | None = None,
group: str | None = None,
asset_kwargs: dict | None = None,
asset_extra: dict[str, JsonValue] | None = None,
) -> Asset | None:
"""
C... | Create an asset instance using the provided parameters.
This method attempts to create an asset instance using the given parameters.
It first checks if a URI or a name is provided and falls back to using the default asset factory
with the given URI or name if no other information is available.
If a scheme is provided... | python | airflow-core/src/airflow/lineage/hook.py | 148 | [
"self",
"scheme",
"uri",
"name",
"group",
"asset_kwargs",
"asset_extra"
] | Asset | None | true | 10 | 6 | apache/airflow | 43,597 | unknown | false |
resolveFactoryMethodIfPossible | public void resolveFactoryMethodIfPossible(RootBeanDefinition mbd) {
Class<?> factoryClass;
boolean isStatic;
if (mbd.getFactoryBeanName() != null) {
factoryClass = this.beanFactory.getType(mbd.getFactoryBeanName());
isStatic = false;
}
else {
factoryClass = mbd.getBeanClass();
isStatic = true;
... | Resolve the factory method in the specified bean definition, if possible.
{@link RootBeanDefinition#getResolvedFactoryMethod()} can be checked for the result.
@param mbd the bean definition to check | java | spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java | 330 | [
"mbd"
] | void | true | 7 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
isParsableDecimal | private static boolean isParsableDecimal(final String str, final int beginIdx) {
// See https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-NonZeroDigit
int decimalPoints = 0;
boolean asciiNumeric = true;
for (int i = beginIdx; i < str.length(); i++) {
final char... | Tests whether a number string is parsable as a decimal number or integer.
<ul>
<li>At most one decimal point is allowed.</li>
<li>No signs, exponents or type qualifiers are allowed.</li>
<li>Only ASCII digits are allowed if a decimal point is present.</li>
</ul>
@param str the String to test.
@param beginIdx the i... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 752 | [
"str",
"beginIdx"
] | true | 9 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
microsFrac | public double microsFrac() {
return ((double) nanos()) / C1;
} | @return the number of {@link #timeUnit()} units this value contains | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 170 | [] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
recordIfFinished | function recordIfFinished() {
if (state.keydown === EventPhase.Finished && state.input === EventPhase.Finished && state.render === EventPhase.Finished) {
performance.mark('inputlatency/end');
performance.measure('keydown', 'keydown/start', 'keydown/end');
performance.measure('input', 'input/start', 'input/e... | Record the input latency sample if input handling and rendering are finished.
The challenge here is that we want to record the latency in such a way that it includes
also the layout and painting work the browser does during the animation frame task.
Simply scheduling a new task (via `setTimeout`) from the animation fra... | typescript | src/vs/base/browser/performance.ts | 158 | [] | false | 4 | 6.08 | microsoft/vscode | 179,840 | jsdoc | false | |
apply | @Override
public Value apply(XContentParser parser, Context context) {
try {
return parse(parser, context);
} catch (IOException e) {
throw new XContentParseException(parser.getTokenLocation(), "[" + name + "] failed to parse object", e);
}
} | Parses a Value from the given {@link XContentParser}
@param parser the parser to build a value from
@param value the value to fill from the parser
@param context a context that is passed along to all declared field parsers
@return the parsed value
@throws IOException if an IOException occurs. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java | 383 | [
"parser",
"context"
] | Value | true | 2 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false |
optimalNumOfBits | @VisibleForTesting
static long optimalNumOfBits(long n, double p) {
if (p == 0) {
p = Double.MIN_VALUE;
}
return (long) (-n * Math.log(p) / SQUARED_LOG_TWO);
} | Computes m (total bits of Bloom filter) which is expected to achieve, for the specified
expected insertions, the required false positive probability.
<p>See http://en.wikipedia.org/wiki/Bloom_filter#Probability_of_false_positives for the
formula.
@param n expected insertions (must be positive)
@param p false positive r... | java | android/guava/src/com/google/common/hash/BloomFilter.java | 538 | [
"n",
"p"
] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
reset | public StrTokenizer reset() {
tokenPos = 0;
tokens = null;
return this;
} | Resets this tokenizer, forgetting all parsing and iteration already completed.
<p>
This method allows the same tokenizer to be reused for the same String.
</p>
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 856 | [] | StrTokenizer | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
requestOffsetReset | public synchronized void requestOffsetReset(TopicPartition partition, AutoOffsetResetStrategy offsetResetStrategy) {
assignedState(partition).reset(offsetResetStrategy);
} | Unset the preferred read replica. This causes the fetcher to go back to the leader for fetches.
@param tp The topic partition
@return the removed preferred read replica if set, Empty otherwise. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 785 | [
"partition",
"offsetResetStrategy"
] | void | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
describe_instances | def describe_instances(self, filters: list | None = None, instance_ids: list | None = None):
"""
Describe EC2 instances, optionally applying filters and selective instance ids.
:param filters: List of filters to specify instances to describe
:param instance_ids: List of instance IDs to ... | Describe EC2 instances, optionally applying filters and selective instance ids.
:param filters: List of filters to specify instances to describe
:param instance_ids: List of instance IDs to describe
:return: Response from EC2 describe_instances API | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/ec2.py | 134 | [
"self",
"filters",
"instance_ids"
] | true | 3 | 7.76 | apache/airflow | 43,597 | sphinx | false | |
withChildren | ConfigDataEnvironmentContributor withChildren(ImportPhase importPhase,
List<ConfigDataEnvironmentContributor> children) {
Map<ImportPhase, List<ConfigDataEnvironmentContributor>> updatedChildren = new LinkedHashMap<>(this.children);
updatedChildren.put(importPhase, children);
if (importPhase == ImportPhase.AFT... | Create a new {@link ConfigDataEnvironmentContributor} instance with a new set of
children for the given phase.
@param importPhase the import phase
@param children the new children
@return a new contributor instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java | 271 | [
"importPhase",
"children"
] | ConfigDataEnvironmentContributor | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
available_if | def available_if(check):
"""An attribute that is available only if check returns a truthy value.
Parameters
----------
check : callable
When passed the object with the decorated method, this should return
a truthy value if the attribute is available, and either return False
or r... | An attribute that is available only if check returns a truthy value.
Parameters
----------
check : callable
When passed the object with the decorated method, this should return
a truthy value if the attribute is available, and either return False
or raise an AttributeError if not available.
Returns
------... | python | sklearn/utils/_available_if.py | 57 | [
"check"
] | false | 1 | 6.16 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
refreshOffsets | private void refreshOffsets(final Map<TopicPartition, OffsetAndMetadata> offsets,
final Throwable error,
final CompletableFuture<Void> result) {
if (error == null) {
// Ensure we only set positions for the partitions that still require... | Use the given committed offsets to update positions for partitions that still require it.
@param offsets Committed offsets to use to update positions for initializing partitions.
@param error Error received in response to the OffsetFetch request. Will be null if the request was successful.
@param result Future to co... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java | 410 | [
"offsets",
"error",
"result"
] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
changeColor | function changeColor(colorType: 'foreground' | 'background' | 'underline', color?: RGBA | string | undefined): void {
if (colorType === 'foreground') {
customFgColor = color;
} else if (colorType === 'background') {
customBgColor = color;
} else if (colorType === 'underline') {
customUnderlineColor = col... | Change the foreground or background color by clearing the current color
and adding the new one.
@param colorType If `'foreground'`, will change the foreground color, if
`'background'`, will change the background color, and if `'underline'`
will set the underline color.
@param color Color to change to. If `undefined` o... | typescript | extensions/notebook-renderers/src/ansi.ts | 114 | [
"colorType",
"color?"
] | true | 7 | 6.88 | microsoft/vscode | 179,840 | jsdoc | false | |
check_key_length | def check_key_length(columns: Index, key, value: DataFrame) -> None:
"""
Checks if a key used as indexer has the same length as the columns it is
associated with.
Parameters
----------
columns : Index The columns of the DataFrame to index.
key : A list-like of keys to index with.
value ... | Checks if a key used as indexer has the same length as the columns it is
associated with.
Parameters
----------
columns : Index The columns of the DataFrame to index.
key : A list-like of keys to index with.
value : DataFrame The value to set for the keys.
Raises
------
ValueError: If the length of key is not equal t... | python | pandas/core/indexers/utils.py | 373 | [
"columns",
"key",
"value"
] | None | true | 5 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
addAndGet | public byte addAndGet(final byte operand) {
this.value += operand;
return value;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately after the addition operation. This method is not thread safe.
@param operand the quantity to add, not null.
@return the value associated with this instance after adding the operand.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 111 | [
"operand"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
refreshTimeout | function refreshTimeout () {
// If the fastNowTimeout is already set and the Timer has the refresh()-
// method available, call it to refresh the timer.
// Some timer objects returned by setTimeout may not have a .refresh()
// method (e.g. mocked timers in tests).
if (fastNowTimeout?.refresh) {
fastNowTim... | The onTick function processes the fastTimers array.
@returns {void} | javascript | deps/undici/src/lib/util/timers.js | 190 | [] | false | 3 | 6.8 | nodejs/node | 114,839 | jsdoc | false | |
getSession | public synchronized Session getSession() {
if (this.session == null) {
this.session = Session.getInstance(this.javaMailProperties);
}
return this.session;
} | Return the JavaMail {@code Session},
lazily initializing it if it hasn't been specified explicitly. | java | spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java | 153 | [] | Session | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
getOriginalBeanName | public static String getOriginalBeanName(@Nullable String targetBeanName) {
Assert.isTrue(isScopedTarget(targetBeanName), () -> "bean name '" +
targetBeanName + "' does not refer to the target of a scoped proxy");
return targetBeanName.substring(TARGET_NAME_PREFIX_LENGTH);
} | Get the original bean name for the provided {@linkplain #getTargetBeanName
target bean name}.
@param targetBeanName the target bean name for the scoped proxy
@return the original bean name
@throws IllegalArgumentException if the supplied bean name does not refer
to the target of a scoped proxy
@since 5.1.10
@see #getTa... | java | spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java | 128 | [
"targetBeanName"
] | String | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
opj_uint_subs | static INLINE OPJ_UINT32 opj_uint_subs(OPJ_UINT32 a, OPJ_UINT32 b)
{
return (a >= b) ? a - b : 0;
} | Get the saturated difference of two unsigned integers
@return Returns saturated sum of a-b | cpp | 3rdparty/openjpeg/openjp2/opj_intmath.h | 102 | [
"a",
"b"
] | true | 2 | 6.16 | opencv/opencv | 85,374 | doxygen | false | |
iterable | def iterable(y):
"""
Check whether or not an object can be iterated over.
Parameters
----------
y : object
Input object.
Returns
-------
b : bool
Return ``True`` if the object has an iterator method or is a
sequence and ``False`` otherwise.
Examples
--------... | Check whether or not an object can be iterated over.
Parameters
----------
y : object
Input object.
Returns
-------
b : bool
Return ``True`` if the object has an iterator method or is a
sequence and ``False`` otherwise.
Examples
--------
>>> import numpy as np
>>> np.iterable([1, 2, 3])
True
>>> np.iterable(2... | python | numpy/lib/_function_base_impl.py | 364 | [
"y"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
processName | @Nullable String processName(MemberPath path, String existingName); | Return a new name for the JSON member or {@code null} if the member should be
filtered entirely.
@param path the path of the member
@param existingName the existing and possibly already processed name.
@return the new name | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 951 | [
"path",
"existingName"
] | String | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
min | public static float min(final float... array) {
// Validates input
validateArray(array);
// Finds and returns min
float min = array[0];
for (int i = 1; i < array.length; i++) {
if (Float.isNaN(array[i])) {
return Float.NaN;
}
if... | Returns the minimum value in an array.
@param array an array, must not be null or empty.
@return the minimum value in the array.
@throws NullPointerException if {@code array} is {@code null}.
@throws IllegalArgumentException if {@code array} is empty.
@see IEEE754rUtils#min(float[]) IEEE754rUtils for a version of t... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,187 | [] | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
of | public static OriginTrackedWritableResource of(WritableResource resource, Origin origin) {
return (OriginTrackedWritableResource) of((Resource) resource, origin);
} | Return a new {@link OriginProvider origin tracked} version the given
{@link WritableResource}.
@param resource the tracked resource
@param origin the origin of the resource
@return an {@link OriginTrackedWritableResource} instance | java | core/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedResource.java | 172 | [
"resource",
"origin"
] | OriginTrackedWritableResource | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
at_time | def at_time(self, time, asof: bool = False, axis: Axis | None = None) -> Self:
"""
Select values at particular time of day (e.g., 9:30AM).
Parameters
----------
time : datetime.time or str
The values to select.
asof : bool, default False
This para... | Select values at particular time of day (e.g., 9:30AM).
Parameters
----------
time : datetime.time or str
The values to select.
asof : bool, default False
This parameter is currently not supported.
axis : {0 or 'index', 1 or 'columns'}, default 0
For `Series` this parameter is unused and defaults to 0.
Re... | python | pandas/core/generic.py | 8,557 | [
"self",
"time",
"asof",
"axis"
] | Self | true | 3 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
getExclusions | protected Set<String> getExclusions(AnnotationMetadata metadata, @Nullable AnnotationAttributes attributes) {
Set<String> excluded = new LinkedHashSet<>();
if (attributes != null) {
excluded.addAll(asList(attributes, "exclude"));
excluded.addAll(asList(attributes, "excludeName"));
}
excluded.addAll(getExc... | Return any exclusions that limit the candidate configurations.
@param metadata the source metadata
@param attributes the {@link #getAttributes(AnnotationMetadata) annotation
attributes}
@return exclusions or an empty set | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java | 247 | [
"metadata",
"attributes"
] | true | 2 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false | |
find_pickleable_exception | def find_pickleable_exception(exc, loads=pickle.loads,
dumps=pickle.dumps):
"""Find first pickleable exception base class.
With an exception instance, iterate over its super classes (by MRO)
and find the first super exception that's pickleable. It does
not go below :exc:`... | Find first pickleable exception base class.
With an exception instance, iterate over its super classes (by MRO)
and find the first super exception that's pickleable. It does
not go below :exc:`Exception` (i.e., it skips :exc:`Exception`,
:class:`BaseException` and :class:`object`). If that happens
you should use :ex... | python | celery/utils/serialization.py | 38 | [
"exc",
"loads",
"dumps"
] | false | 3 | 6.8 | celery/celery | 27,741 | google | false | |
open | public static FileRecords open(File file, boolean mutable) throws IOException {
return open(file, mutable, false, 0, false);
} | 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 | 461 | [
"file",
"mutable"
] | FileRecords | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
setCurrentProxy | static @Nullable Object setCurrentProxy(@Nullable Object proxy) {
Object old = currentProxy.get();
if (proxy != null) {
currentProxy.set(proxy);
}
else {
currentProxy.remove();
}
return old;
} | Make the given proxy available via the {@code currentProxy()} method.
<p>Note that the caller should be careful to keep the old value as appropriate.
@param proxy the proxy to expose (or {@code null} to reset it)
@return the old proxy, which may be {@code null} if none was bound
@see #currentProxy() | java | spring-aop/src/main/java/org/springframework/aop/framework/AopContext.java | 84 | [
"proxy"
] | Object | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
isPlainObject | function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return ... | Checks if `value` is a plain object, that is, an object created by the
`Object` constructor or one with a `[[Prototype]]` of `null`.
@static
@memberOf _
@since 0.8.0
@category Lang
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is a plain object, else `false`.
@example
function Foo() ... | javascript | lodash.js | 12,143 | [
"value"
] | false | 7 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
getBaseName | private String getBaseName(ZipContent.Entry contentEntry) {
String name = contentEntry.getName();
if (!name.startsWith(META_INF_VERSIONS)) {
return name;
}
int versionNumberStartIndex = META_INF_VERSIONS.length();
int versionNumberEndIndex = (versionNumberStartIndex != -1) ? name.indexOf('/', versionNumber... | Creates a new {@link NestedJarFile} instance to read from the specific
{@code File}.
@param file the jar file to be opened for reading
@param nestedEntryName the nested entry name to open
@param version the release version to use when opening a multi-release jar
@param onlyNestedJars if <em>only</em> nested jars should... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java | 205 | [
"contentEntry"
] | String | true | 7 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
getOriginalPropertyValue | public PropertyValue getOriginalPropertyValue() {
PropertyValue original = this;
Object source = getSource();
while (source instanceof PropertyValue pv && source != original) {
original = pv;
source = original.getSource();
}
return original;
} | Return the original PropertyValue instance for this value holder.
@return the original PropertyValue (either a source of this
value holder or this value holder itself). | java | spring-beans/src/main/java/org/springframework/beans/PropertyValue.java | 131 | [] | PropertyValue | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
attemptToConvertStringToEnum | private Object attemptToConvertStringToEnum(Class<?> requiredType, String trimmedValue, Object currentConvertedValue) {
Object convertedValue = currentConvertedValue;
if (Enum.class == requiredType && this.targetObject != null) {
// target type is declared as raw enum, treat the trimmed value as <enum.fqn>.FIEL... | Convert the value to the required type (if necessary from a String),
for the specified property.
@param propertyName name of the property
@param oldValue the previous value, if available (may be {@code null})
@param newValue the proposed new value
@param requiredType the type we must convert to
(or {@code null} if not ... | java | spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java | 286 | [
"requiredType",
"trimmedValue",
"currentConvertedValue"
] | Object | true | 11 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
exclusiveBetween | public static <T> void exclusiveBetween(final T start, final T end, final Comparable<T> value, final String message, final Object... values) {
// TODO when breaking BC, consider returning value
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
throw new IllegalArgumentException... | Validate that the specified argument object fall between the two
exclusive values specified; otherwise, throws an exception with the
specified message.
<pre>Validate.exclusiveBetween(0, 2, 1, "Not in boundaries");</pre>
@param <T> the type of the argument object.
@param start the exclusive start value, not null.
@para... | java | src/main/java/org/apache/commons/lang3/Validate.java | 200 | [
"start",
"end",
"value",
"message"
] | void | true | 3 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
applyEmptySelectionErrorGlobalOmit | function applyEmptySelectionErrorGlobalOmit(error: EmptySelectionError, argsTree: ArgumentsRenderingTree) {
const suggestedOmitConfig = new SuggestionObjectValue()
for (const field of error.outputType.fields) {
if (!field.isRelation) {
suggestedOmitConfig.addField(field.name, 'false')
}
}
const o... | Given the validation error and arguments rendering tree, applies corresponding
formatting to an error tree and adds all relevant messages.
@param error
@param args | typescript | packages/client/src/runtime/core/errorRendering/applyValidationError.ts | 239 | [
"error",
"argsTree"
] | false | 5 | 6.08 | prisma/prisma | 44,834 | jsdoc | false | |
getObject | @SuppressWarnings("unchecked")
default <S> @Nullable S getObject(Class<S> type) throws Exception{
Class<?> objectType = getObjectType();
return (objectType != null && type.isAssignableFrom(objectType) ? (S) getObject() : null);
} | Return an instance of the given type, if supported by this factory.
<p>By default, this supports the primary type exposed by the factory, as
indicated by {@link #getObjectType()} and returned by {@link #getObject()}.
Specific factories may support additional types for dependency injection.
@param type the requested typ... | java | spring-beans/src/main/java/org/springframework/beans/factory/SmartFactoryBean.java | 67 | [
"type"
] | S | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
performRequestAsync | private void performRequestAsync(
final NodeTuple<Iterator<Node>> tuple,
final InternalRequest request,
final FailureTrackingResponseListener listener
) {
request.cancellable.runIfNotCancelled(() -> {
final RequestContext context = request.createContextForNextAttempt(tupl... | Sends a request to the Elasticsearch cluster that the client points to.
The request is executed asynchronously and the provided
{@link ResponseListener} gets notified upon request completion or
failure. Selects a host out of the provided ones in a round-robin
fashion. Failing hosts are marked dead and retried after a c... | java | client/rest/src/main/java/org/elasticsearch/client/RestClient.java | 390 | [
"tuple",
"request",
"listener"
] | void | true | 7 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
byteToBinary | public static boolean[] byteToBinary(final byte src, final int srcPos, final boolean[] dst, final int dstPos, final int nBools) {
if (0 == nBools) {
return dst;
}
if (nBools - 1 + srcPos >= Byte.SIZE) {
throw new IllegalArgumentException("nBools - 1 + srcPos >= 8");
... | Converts a byte into an array of boolean using the default (little-endian, LSB0) byte and bit ordering.
@param src the byte to convert.
@param srcPos the position in {@code src}, in bits, from where to start the conversion.
@param dst the destination array.
@param dstPos the position in {@code dst} where to copy ... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 498 | [
"src",
"srcPos",
"dst",
"dstPos",
"nBools"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
list_processing_jobs | def list_processing_jobs(self, **kwargs) -> list[dict]:
"""
Call boto3's `list_processing_jobs`.
All arguments should be provided via kwargs. Note that boto3 expects
these in CamelCase, for example:
.. code-block:: python
list_processing_jobs(NameContains="myjob", ... | Call boto3's `list_processing_jobs`.
All arguments should be provided via kwargs. Note that boto3 expects
these in CamelCase, for example:
.. code-block:: python
list_processing_jobs(NameContains="myjob", StatusEquals="Failed")
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.list_processing_jobs`
... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 918 | [
"self"
] | list[dict] | true | 1 | 6.24 | apache/airflow | 43,597 | sphinx | false |
clearCache | static void clearCache() {
locationCache.clear();
pathCache.clear();
} | Create a new {@link NestedLocation} from the given URI.
@param uri the nested URI
@return a new {@link NestedLocation} instance
@throws IllegalArgumentException if the URI is not valid | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java | 129 | [] | void | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
visitorWithUnusedExpressionResult | function visitorWithUnusedExpressionResult(node: Node): VisitResult<Node | undefined> {
return shouldVisitNode(node) ? visitorWorker(node, /*expressionResultIsUnused*/ true) : node;
} | Restores the `HierarchyFacts` for this node's ancestor after visiting this node's
subtree, propagating specific facts from the subtree.
@param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree.
@param excludeFacts The existing `HierarchyFacts` of the subtree that should not be ... | typescript | src/compiler/transformers/es2015.ts | 605 | [
"node"
] | true | 2 | 6.16 | microsoft/TypeScript | 107,154 | jsdoc | false | |
typeHasArrowFunctionBlockingParseError | function typeHasArrowFunctionBlockingParseError(node: TypeNode): boolean {
switch (node.kind) {
case SyntaxKind.TypeReference:
return nodeIsMissing((node as TypeReferenceNode).typeName);
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructorType: {
... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 3,809 | [
"node"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
doSend | private void doSend(ClientRequest clientRequest, boolean isInternalRequest, long now) {
ensureActive();
String nodeId = clientRequest.destination();
if (!isInternalRequest) {
// If this request came from outside the NetworkClient, validate
// that we can send data. If th... | Queue up the given request for sending. Requests can only be sent out to ready nodes.
@param request The request
@param now The current timestamp | java | clients/src/main/java/org/apache/kafka/clients/NetworkClient.java | 551 | [
"clientRequest",
"isInternalRequest",
"now"
] | void | true | 11 | 7.2 | apache/kafka | 31,560 | javadoc | false |
addContextValue | @Override
public ContextedRuntimeException addContextValue(final String label, final Object value) {
exceptionContext.addContextValue(label, value);
return this;
} | Adds information helpful to a developer in diagnosing and correcting the problem.
For the information to be meaningful, the value passed should have a reasonable
toString() implementation.
Different values can be added with the same label multiple times.
<p>
Note: This exception is only serializable if the object added... | java | src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java | 167 | [
"label",
"value"
] | ContextedRuntimeException | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
record | public void record(double value, long timeMs, boolean checkQuotas) {
if (shouldRecord()) {
recordInternal(value, timeMs, checkQuotas);
}
} | Record a value at a known time. This method is slightly faster than {@link #record(double)} since it will reuse
the time stamp.
@param value The value we are recording
@param timeMs The current POSIX time in milliseconds
@param checkQuotas Indicate if quota must be enforced or not
@throws QuotaViolationException if rec... | java | clients/src/main/java/org/apache/kafka/common/metrics/Sensor.java | 224 | [
"value",
"timeMs",
"checkQuotas"
] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
_masked_arith_op | def _masked_arith_op(x: np.ndarray, y, op) -> np.ndarray:
"""
If the given arithmetic operation fails, attempt it again on
only the non-null elements of the input array(s).
Parameters
----------
x : np.ndarray
y : np.ndarray, Series, Index
op : binary operator
"""
# For Series `... | If the given arithmetic operation fails, attempt it again on
only the non-null elements of the input array(s).
Parameters
----------
x : np.ndarray
y : np.ndarray, Series, Index
op : binary operator | python | pandas/core/ops/array_ops.py | 135 | [
"x",
"y",
"op"
] | np.ndarray | true | 9 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
getInterceptorsAndDynamicInterceptionAdvice | public List<Object> getInterceptorsAndDynamicInterceptionAdvice(Method method, @Nullable Class<?> targetClass) {
List<Object> cachedInterceptors;
if (this.methodCache != null) {
// Method-specific cache for method-specific pointcuts
MethodCacheKey cacheKey = new MethodCacheKey(method);
cachedInterceptors =... | Determine a list of {@link org.aopalliance.intercept.MethodInterceptor} objects
for the given method, based on this configuration.
@param method the proxied method
@param targetClass the target class
@return a List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers) | java | spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java | 516 | [
"method",
"targetClass"
] | true | 4 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_isolation_key | def _isolation_key(ischema: IsolationSchema = _DEFAULT_ISOLATION_SCHEMA) -> str:
"""Generate a unique key for the given isolation schema.
Args:
ischema: Schema specifying which context forms to include.
Defaults to including all runtime and compile context.
Returns:
A 32-ch... | Generate a unique key for the given isolation schema.
Args:
ischema: Schema specifying which context forms to include.
Defaults to including all runtime and compile context.
Returns:
A 32-character hexadecimal string that uniquely identifies
the context specified by the isolation schema. | python | torch/_inductor/runtime/caching/context.py | 279 | [
"ischema"
] | str | true | 1 | 6.24 | pytorch/pytorch | 96,034 | google | false |
maybeRecordDeprecatedPartitionLead | @Deprecated // To be removed in Kafka 5.0 release.
private void maybeRecordDeprecatedPartitionLead(String name, TopicPartition tp, double lead) {
if (shouldReportDeprecatedMetric(tp.topic())) {
Sensor deprecatedRecordsLead = new SensorBuilder(metrics, deprecatedMetricName(name), () -> topicParti... | This method is called by the {@link Fetch fetch} logic before it requests fetches in order to update the
internal set of metrics that are tracked.
@param subscription {@link SubscriptionState} that contains the set of assigned partitions
@see SubscriptionState#assignmentId() | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchMetricsManager.java | 236 | [
"name",
"tp",
"lead"
] | void | true | 2 | 6.24 | apache/kafka | 31,560 | javadoc | false |
getLast | @ParametricNullness
public static <T extends @Nullable Object> T getLast(
Iterator<? extends T> iterator, @ParametricNullness T defaultValue) {
return iterator.hasNext() ? getLast(iterator) : defaultValue;
} | Advances {@code iterator} to the end, returning the last element or {@code defaultValue} if the
iterator is empty.
@param defaultValue the default value to return if the iterator is empty
@return the last element of {@code iterator}
@since 3.0 | java | android/guava/src/com/google/common/collect/Iterators.java | 921 | [
"iterator",
"defaultValue"
] | T | true | 2 | 7.6 | google/guava | 51,352 | javadoc | false |
forwardCurrentToHead | function forwardCurrentToHead(analyzer, node) {
const codePath = analyzer.codePath;
const state = CodePath.getState(codePath);
const currentSegments = state.currentSegments;
const headSegments = state.headSegments;
const end = Math.max(currentSegments.length, headSegments.length);
let i, currentSegment, hea... | Updates the current segment with the head segment.
This is similar to local branches and tracking branches of git.
To separate the current and the head is in order to not make useless segments.
In this process, both "onCodePathSegmentStart" and "onCodePathSegmentEnd"
events are fired.
@param {CodePathAnalyzer} analyzer... | javascript | packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js | 183 | [
"analyzer",
"node"
] | false | 9 | 6.08 | facebook/react | 241,750 | jsdoc | false | |
prepareMethodOverrides | public void prepareMethodOverrides() throws BeanDefinitionValidationException {
// Check that lookup methods exist and determine their overloaded status.
if (hasMethodOverrides()) {
getMethodOverrides().getOverrides().forEach(this::prepareMethodOverride);
}
} | Validate and prepare the method overrides defined for this bean.
Checks for existence of a method with the specified name.
@throws BeanDefinitionValidationException in case of validation failure | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java | 1,251 | [] | void | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
equals | @Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof AnnotationMethodMatcher otherMm &&
this.annotationType.equals(otherMm.annotationType) &&
this.checkInherited == otherMm.checkInherited));
} | Create a new AnnotationClassFilter for the given annotation type.
@param annotationType the annotation type to look for
@param checkInherited whether to also check the superclasses and
interfaces as well as meta-annotations for the annotation type
(i.e. whether to use {@link AnnotatedElementUtils#hasAnnotation}
semanti... | java | spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java | 91 | [
"other"
] | true | 4 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
timestampType | public TimestampType timestampType() {
return timestampType(magic(), wrapperRecordTimestampType, attributes());
} | Get the timestamp type of the record.
@return The timestamp type or {@link TimestampType#NO_TIMESTAMP_TYPE} if the magic is 0. | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 235 | [] | TimestampType | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
forward | def forward(self, x: Tensor) -> Tensor:
r"""
Args:
x (Tensor): Tensor of dimension (batch_size, num_features, input_length).
Returns:
Tensor: Predictor tensor of dimension (batch_size, number_of_classes, input_length).
"""
x = self.acoustic_model(x)
... | r"""
Args:
x (Tensor): Tensor of dimension (batch_size, num_features, input_length).
Returns:
Tensor: Predictor tensor of dimension (batch_size, number_of_classes, input_length). | python | benchmarks/functional_autograd_benchmark/torchaudio_models.py | 104 | [
"self",
"x"
] | Tensor | true | 1 | 6.08 | pytorch/pytorch | 96,034 | google | false |
sourceMapCacheToObject | function sourceMapCacheToObject() {
const moduleSourceMapCache = getModuleSourceMapCache();
if (moduleSourceMapCache.size === 0) {
return undefined;
}
const obj = { __proto__: null };
for (const { 0: k, 1: v } of moduleSourceMapCache) {
obj[k] = {
__proto__: null,
lineLengths: v.lineLengt... | Read source map from file.
@param {string} mapURL - file url of the source map
@returns {object} deserialized source map JSON object | javascript | lib/internal/source_map/source_map_cache.js | 343 | [] | false | 2 | 7.12 | nodejs/node | 114,839 | jsdoc | false | |
registerRuntimeHintsIfNecessary | private void registerRuntimeHintsIfNecessary(RegisteredBean registeredBean, Executable constructorOrFactoryMethod) {
if (registeredBean.getBeanFactory() instanceof DefaultListableBeanFactory dlbf) {
RuntimeHints runtimeHints = this.generationContext.getRuntimeHints();
ProxyRuntimeHintsRegistrar registrar = new ... | 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 | 153 | [
"registeredBean",
"constructorOrFactoryMethod"
] | void | true | 2 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
findPrismaClientDir | async function findPrismaClientDir(baseDir: string) {
const resolveOpts = { basedir: baseDir, preserveSymlinks: true }
const cliDir = await resolvePkg('prisma', resolveOpts)
const clientDir = await resolvePkg('@prisma/client', resolveOpts)
const resolvedClientDir = clientDir && (await fs.realpath(clientDir))
... | Tries to find a `@prisma/client` that is next to the `prisma` CLI
@param baseDir from where to start looking from
@returns `@prisma/client` location | typescript | packages/client-generator-js/src/resolvePrismaClient.ts | 36 | [
"baseDir"
] | false | 6 | 6.8 | prisma/prisma | 44,834 | jsdoc | true | |
writeTo | long writeTo(TransferableChannel channel) throws IOException; | Write some as-yet unwritten bytes from this send to the provided channel. It may take multiple calls for the send
to be completely written
@param channel The Channel to write to
@return The number of bytes written
@throws IOException If the write fails | java | clients/src/main/java/org/apache/kafka/common/network/Send.java | 38 | [
"channel"
] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
shouldBlock | @Override
public boolean shouldBlock() {
return !isDone();
} | Convert from a request future of one type to another type
@param adapter The adapter which does the conversion
@param <S> The type of the future adapted to
@return The new future | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestFuture.java | 251 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
format | @Deprecated
@Override
public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
return printer.format(calendar, buf);
} | Formats a {@link Calendar} object into the supplied {@link StringBuffer}.
@param calendar the calendar to format.
@param buf the buffer to format into.
@return the specified string buffer.
@deprecated Use {{@link #format(Calendar, Appendable)}. | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 432 | [
"calendar",
"buf"
] | StringBuffer | true | 1 | 6.4 | apache/commons-lang | 2,896 | javadoc | false |
_get_loc_single_level_index | def _get_loc_single_level_index(self, level_index: Index, key: Hashable) -> int:
"""
If key is NA value, location of index unify as -1.
Parameters
----------
level_index: Index
key : label
Returns
-------
loc : int
If key is NA value,... | If key is NA value, location of index unify as -1.
Parameters
----------
level_index: Index
key : label
Returns
-------
loc : int
If key is NA value, loc is -1
Else, location of key in index.
See Also
--------
Index.get_loc : The get_loc method for (single-level) index. | python | pandas/core/indexes/multi.py | 3,242 | [
"self",
"level_index",
"key"
] | int | true | 4 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
registerDisposableBeanIfNecessary | protected void registerDisposableBeanIfNecessary(String beanName, Object bean, RootBeanDefinition mbd) {
if (!mbd.isPrototype() && requiresDestruction(bean, mbd)) {
if (mbd.isSingleton()) {
// Register a DisposableBean implementation that performs all destruction
// work for the given bean: DestructionAwar... | Add the given bean to the list of disposable beans in this factory,
registering its DisposableBean interface and/or the given destroy method
to be called on factory shutdown (if applicable). Only applies to singletons.
@param beanName the name of the bean
@param bean the bean instance
@param mbd the bean definition for... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,922 | [
"beanName",
"bean",
"mbd"
] | void | true | 5 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
prettyPrint | public XContentBuilder prettyPrint() {
generator.usePrettyPrint();
return this;
} | @return the output stream to which the built object is being written. Note that is dangerous to modify the stream. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 290 | [] | XContentBuilder | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
anyMatches | protected final boolean anyMatches(ConditionContext context, AnnotatedTypeMetadata metadata,
Condition... conditions) {
for (Condition condition : conditions) {
if (matches(context, metadata, condition)) {
return true;
}
}
return false;
} | Return true if any of the specified conditions match.
@param context the context
@param metadata the annotation meta-data
@param conditions conditions to test
@return {@code true} if any condition matches. | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java | 124 | [
"context",
"metadata"
] | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
merge | @SuppressWarnings({"rawtypes", "unchecked"})
private void merge(Map<String, Object> output, Map<String, Object> map) {
map.forEach((key, value) -> {
Object existing = output.get(key);
if (value instanceof Map valueMap && existing instanceof Map existingMap) {
Map<String, Object> result = new LinkedHashMap<... | Template method that subclasses may override to construct the object
returned by this factory.
<p>Invoked lazily the first time {@link #getObject()} is invoked in
case of a shared singleton; else, on each {@link #getObject()} call.
<p>The default implementation returns the merged {@code Map} instance.
@return the objec... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java | 127 | [
"output",
"map"
] | void | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
setDelimiterMatcher | public StrTokenizer setDelimiterMatcher(final StrMatcher delim) {
if (delim == null) {
this.delimMatcher = StrMatcher.noneMatcher();
} else {
this.delimMatcher = delim;
}
return this;
} | Sets the field delimiter matcher.
<p>
The delimiter is used to separate one token from another.
</p>
@param delim the delimiter matcher to use.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 924 | [
"delim"
] | StrTokenizer | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
defineInternal | public ConfigDef defineInternal(final String name, final Type type, final Object defaultValue, final Importance importance) {
return define(new ConfigKey(name, type, defaultValue, null, importance, "", "", -1, Width.NONE, name, Collections.emptyList(), null, true, null));
} | Define a new internal configuration. Internal configuration won't show up in the docs and aren't
intended for general use.
@param name The name of the config parameter
@param type The type of the config
@param defaultValue The default value to use if this config isn't present
@param impor... | java | clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java | 454 | [
"name",
"type",
"defaultValue",
"importance"
] | ConfigDef | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.