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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
createNetlifyUrl | function createNetlifyUrl(config: ImageLoaderConfig, path?: string) {
// Note: `path` can be undefined, in which case we use a fake one to construct a `URL` instance.
const url = new URL(path ?? 'https://a/');
url.pathname = '/.netlify/images';
if (!isAbsoluteUrl(config.src) && !config.src.startsWith('/')) {
... | Function that generates an ImageLoader for Netlify and turns it into an Angular provider.
@param path optional URL of the desired Netlify site. Defaults to the current site.
@returns Set of providers to configure the Netlify loader.
@publicApi | typescript | packages/common/src/directives/ng_optimized_image/image_loaders/netlify_loader.ts | 79 | [
"config",
"path?"
] | false | 10 | 7.28 | angular/angular | 99,544 | jsdoc | false | |
add_suffix | def add_suffix(self, suffix: str, axis: Axis | None = None) -> Self:
"""
Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add ... | Suffix labels with string `suffix`.
For Series, the row labels are suffixed.
For DataFrame, the column labels are suffixed.
Parameters
----------
suffix : str
The string to add after each label.
axis : {0 or 'index', 1 or 'columns', None}, default None
Axis to add suffix on
.. versionadded:: 2.0.0
Retur... | python | pandas/core/generic.py | 4,774 | [
"self",
"suffix",
"axis"
] | Self | true | 2 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
transformedBeanName | protected String transformedBeanName(String name) {
return canonicalName(BeanFactoryUtils.transformedBeanName(name));
} | Return the bean name, stripping out the factory dereference prefix if necessary,
and resolving aliases to canonical names.
@param name the user-specified name
@return the transformed bean name | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,271 | [
"name"
] | String | true | 1 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false |
idxmin | def idxmin(
self, axis: Axis = 0, skipna: bool = True, numeric_only: bool = False
) -> Series:
"""
Return index of first occurrence of minimum over requested axis.
NA/null values are excluded.
Parameters
----------
axis : {{0 or 'index', 1 or 'columns'}}, de... | Return index of first occurrence of minimum over requested axis.
NA/null values are excluded.
Parameters
----------
axis : {{0 or 'index', 1 or 'columns'}}, default 0
The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
skipna : bool, default True
Exclude NA/null values. If the entire D... | python | pandas/core/frame.py | 14,096 | [
"self",
"axis",
"skipna",
"numeric_only"
] | Series | true | 8 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
append | def append(self, other):
"""
Append a collection of Index options together.
The `append` method is used to combine multiple `Index` objects into a single
`Index`. This is particularly useful when dealing with multi-level indexing
(MultiIndex) where you might need to concatenate ... | Append a collection of Index options together.
The `append` method is used to combine multiple `Index` objects into a single
`Index`. This is particularly useful when dealing with multi-level indexing
(MultiIndex) where you might need to concatenate different levels of indices.
The method handles the alignment of the ... | python | pandas/core/indexes/multi.py | 2,377 | [
"self",
"other"
] | false | 7 | 7.44 | pandas-dev/pandas | 47,362 | numpy | false | |
label_ranking_average_precision_score | def label_ranking_average_precision_score(y_true, y_score, *, sample_weight=None):
"""Compute ranking-based average precision.
Label ranking average precision (LRAP) is the average over each ground
truth label assigned to each sample, of the ratio of true vs. total
labels with lower score.
This me... | Compute ranking-based average precision.
Label ranking average precision (LRAP) is the average over each ground
truth label assigned to each sample, of the ratio of true vs. total
labels with lower score.
This metric is used in multilabel ranking problem, where the goal
is to give better rank to the labels associated... | python | sklearn/metrics/_ranking.py | 1,320 | [
"y_true",
"y_score",
"sample_weight"
] | false | 13 | 7.12 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
setupWebStorage | function setupWebStorage() {
if (getEmbedderOptions().noBrowserGlobals ||
!getOptionValue('--experimental-webstorage')) {
return;
}
// https://html.spec.whatwg.org/multipage/webstorage.html#webstorage
exposeLazyInterfaces(globalThis, 'internal/webstorage', ['Storage']);
defineReplaceableLazyAttribu... | Patch the process object with legacy properties and normalizations.
Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.
Replace `process.argv[1]` with the resolved absolute file path of the entry point, if found.
@param {boolean} expandArgv1 - Whether to replac... | javascript | lib/internal/process/pre_execution.js | 399 | [] | false | 3 | 6.96 | nodejs/node | 114,839 | jsdoc | false | |
min | def min(
self,
axis: Axis | None = 0,
skipna: bool = True,
numeric_only: bool = False,
**kwargs,
):
"""
Return the minimum of the values over the requested axis.
If you want the *index* of the minimum, use ``idxmin``.
This is the equivalent of... | Return the minimum of the values over the requested axis.
If you want the *index* of the minimum, use ``idxmin``.
This is the equivalent of the ``numpy.ndarray`` method ``argmin``.
Parameters
----------
axis : {index (0)}
Axis for the function to be applied on.
For `Series` this parameter is unused and defaul... | python | pandas/core/series.py | 7,467 | [
"self",
"axis",
"skipna",
"numeric_only"
] | true | 1 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false | |
reset | public StrTokenizer reset(final String input) {
reset();
if (input != null) {
this.chars = input.toCharArray();
} else {
this.chars = null;
}
return this;
} | Reset this tokenizer, giving it a new input string to parse.
In this manner you can re-use a tokenizer with the same settings
on multiple input lines.
@param input the new string to tokenize, null sets no text to parse.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 884 | [
"input"
] | StrTokenizer | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
min | @ParametricNullness
public static <T extends @Nullable Object> T min(
@ParametricNullness T a, @ParametricNullness T b, Comparator<? super T> comparator) {
return (comparator.compare(a, b) <= 0) ? a : b;
} | Returns the minimum of the two values, according to the given comparator. If the values compare
as equal, the first is returned.
<p>The recommended solution for finding the {@code minimum} of some values depends on the type
of your data and the number of elements you have. Read more in the Guava User Guide article on
<... | java | android/guava/src/com/google/common/collect/Comparators.java | 241 | [
"a",
"b",
"comparator"
] | T | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false |
synchronizedSortedSetMultimap | @J2ktIncompatible // Synchronized
public static <K extends @Nullable Object, V extends @Nullable Object>
SortedSetMultimap<K, V> synchronizedSortedSetMultimap(SortedSetMultimap<K, V> multimap) {
return Synchronized.sortedSetMultimap(multimap, null);
} | Returns a synchronized (thread-safe) {@code SortedSetMultimap} backed by the specified
multimap.
<p>You must follow the warnings described in {@link #synchronizedMultimap}.
<p>The returned multimap will be serializable if the specified multimap is serializable.
@param multimap the multimap to be wrapped
@return a synch... | java | android/guava/src/com/google/common/collect/Multimaps.java | 950 | [
"multimap"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
_find_insertion_index_for_version | def _find_insertion_index_for_version(content: list[str], version: str) -> tuple[int, bool]:
"""Finds insertion index for the specified version from the .rst changelog content.
:param content: changelog split into separate lines
:param version: version to look for
:return: A 2-tuple. The first item in... | Finds insertion index for the specified version from the .rst changelog content.
:param content: changelog split into separate lines
:param version: version to look for
:return: A 2-tuple. The first item indicates the insertion index, while the
second is a boolean indicating whether to append (False) or insert (T... | python | dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py | 987 | [
"content",
"version"
] | tuple[int, bool] | true | 8 | 7.92 | apache/airflow | 43,597 | sphinx | false |
nullToEmpty | public static short[] nullToEmpty(final short[] array) {
return isEmpty(array) ? EMPTY_SHORT_ARRAY : array;
} | Defensive programming technique to change a {@code null}
reference to an empty one.
<p>
This method returns an empty array for a {@code null} input array.
</p>
<p>
As a memory optimizing technique an empty array passed in will be overridden with
the empty {@code public static} references in this class.
</p>
@param arra... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,584 | [
"array"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
getThreadNamePrefix | private static String getThreadNamePrefix() {
String name = Thread.currentThread().getName();
int numberSeparator = name.lastIndexOf('-');
return (numberSeparator >= 0 ? name.substring(0, numberSeparator) : name);
} | Considers all beans as eligible for metadata caching
if the factory's configuration has been marked as frozen.
@see #freezeConfiguration() | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 1,233 | [] | String | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
cov | def cov(
self,
other: Series,
min_periods: int | None = None,
ddof: int | None = 1,
) -> float:
"""
Compute covariance with Series, excluding missing values.
The two `Series` objects are not required to be the same length and
will be aligned internall... | Compute covariance with Series, excluding missing values.
The two `Series` objects are not required to be the same length and
will be aligned internally before the covariance is calculated.
Parameters
----------
other : Series
Series with which to compute the covariance.
min_periods : int, optional
Minimum nu... | python | pandas/core/series.py | 2,767 | [
"self",
"other",
"min_periods",
"ddof"
] | float | true | 2 | 8 | pandas-dev/pandas | 47,362 | numpy | false |
isBefore | public boolean isBefore(final T element) {
if (element == null) {
return false;
}
return comparator.compare(element, maximum) > 0;
} | Checks whether this range is before the specified element.
@param element the element to check for, null returns false.
@return true if this range is entirely before the specified element. | java | src/main/java/org/apache/commons/lang3/Range.java | 448 | [
"element"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
popPrompt | public void popPrompt() {
if (!this.prompts.isEmpty()) {
this.prompts.pop();
}
} | Pop a previously pushed prompt, returning to the previous value.
@see #pushPrompt(String) | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ShellPrompts.java | 47 | [] | void | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
getParameterNames | @Override
public @Nullable String @Nullable [] getParameterNames(Method method) {
this.argumentTypes = method.getParameterTypes();
this.numberOfRemainingUnboundArguments = this.argumentTypes.length;
this.parameterNameBindings = new String[this.numberOfRemainingUnboundArguments];
int minimumNumberUnboundArgs =... | Deduce the parameter names for an advice method.
<p>See the {@link AspectJAdviceParameterNameDiscoverer class-level javadoc}
for this class for details on the algorithm used.
@param method the target {@link Method}
@return the parameter names | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 220 | [
"method"
] | true | 11 | 7.36 | spring-projects/spring-framework | 59,386 | javadoc | false | |
shouldExtract | private boolean shouldExtract(ProjectGenerationRequest request, ProjectGenerationResponse response) {
if (request.isExtract()) {
return true;
}
// explicit name hasn't been provided for an archive and there is no extension
return isZipArchive(response) && request.getOutput() != null && !request.getOutput().c... | 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 | 75 | [
"request",
"response"
] | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
transposeHalfByte | public static void transposeHalfByte(int[] q, byte[] quantQueryByte) {
if (quantQueryByte.length * Byte.SIZE < 4 * q.length) {
throw new IllegalArgumentException("packed array is too small: " + quantQueryByte.length * Byte.SIZE + " < " + 4 * q.length);
}
IMPL.transposeHalfByte(q, qua... | The idea here is to organize the query vector bits such that the first bit
of every dimension is in the first set dimensions bits, or (dimensions/8) bytes. The second,
third, and fourth bits are in the second, third, and fourth set of dimensions bits,
respectively. This allows for direct bitwise comparisons with the st... | java | libs/simdvec/src/main/java/org/elasticsearch/simdvec/ESVectorUtil.java | 414 | [
"q",
"quantQueryByte"
] | void | true | 2 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
getActive | public static @Nullable CloudPlatform getActive(@Nullable Environment environment) {
if (environment != null) {
for (CloudPlatform cloudPlatform : values()) {
if (cloudPlatform.isActive(environment)) {
return cloudPlatform;
}
}
}
return null;
} | Returns the active {@link CloudPlatform} or {@code null} if one is not active.
@param environment the environment
@return the {@link CloudPlatform} or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudPlatform.java | 244 | [
"environment"
] | CloudPlatform | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
hasAtLeastOneGeoipProcessor | @SuppressWarnings("unchecked")
private static boolean hasAtLeastOneGeoipProcessor(
Map<String, Object> processor,
boolean downloadDatabaseOnPipelineCreation,
Map<String, PipelineConfiguration> pipelineConfigById,
Map<String, Boolean> pipelineHasGeoProcessorById
) {
if (pr... | Check if a processor config is a geoip processor or contains at least a geoip processor.
@param processor Processor config.
@param downloadDatabaseOnPipelineCreation Should the download_database_on_pipeline_creation of the geoip processor be true or false.
@param pipelineConfigById A Map of pipeline id to PipelineConfi... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java | 372 | [
"processor",
"downloadDatabaseOnPipelineCreation",
"pipelineConfigById",
"pipelineHasGeoProcessorById"
] | true | 6 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false | |
checkNotNull | @CanIgnoreReturnValue
public static <T> T checkNotNull(@Nullable T reference) {
if (reference == null) {
throw new NullPointerException();
}
return reference;
} | Ensures that an object reference passed as a parameter to the calling method is not null.
@param reference an object reference
@return the non-null reference that was validated
@throws NullPointerException if {@code reference} is null
@see Verify#verifyNotNull Verify.verifyNotNull() | java | android/guava/src/com/google/common/base/Preconditions.java | 899 | [
"reference"
] | T | true | 2 | 7.28 | google/guava | 51,352 | javadoc | false |
nonInternalValues | public Map<String, ?> nonInternalValues() {
Map<String, Object> nonInternalConfigs = new RecordingMap<>();
values.forEach((key, value) -> {
ConfigDef.ConfigKey configKey = definition.configKeys().get(key);
if (configKey == null || !configKey.internalConfig) {
nonI... | If at least one key with {@code prefix} exists, all prefixed values will be parsed and put into map.
If no value with {@code prefix} exists all unprefixed values will be returned.
<p>
This is useful if one wants to allow prefixed configs to override default ones, but wants to use either
only prefixed configs or only re... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 360 | [] | true | 3 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
__hash__ | def __hash__(self) -> int:
"""
Computes the hash value for the wrapped VariableTracker.
For unrealized LazyVariableTrackers, uses the hash of the original value
to avoid realizing the tracker and inserting unnecessary guards.
For all other cases, delegates to... | Computes the hash value for the wrapped VariableTracker.
For unrealized LazyVariableTrackers, uses the hash of the original value
to avoid realizing the tracker and inserting unnecessary guards.
For all other cases, delegates to the VariableTracker's get_python_hash method.
Returns:
The hash value of the underlyi... | python | torch/_dynamo/variables/dicts.py | 126 | [
"self"
] | int | true | 4 | 7.44 | pytorch/pytorch | 96,034 | unknown | false |
cutlass_key | def cutlass_key() -> bytes:
"""
Compute a key representing the state of the CUTLASS library.
Note: OSS and fbcode will have different keys.
"""
if config.is_fbcode():
with (
importlib.resources.path(
"cutlass_library", "src_hash.txt"
) as resource_pat... | Compute a key representing the state of the CUTLASS library.
Note: OSS and fbcode will have different keys. | python | torch/_inductor/codecache.py | 3,801 | [] | bytes | true | 2 | 7.04 | pytorch/pytorch | 96,034 | unknown | false |
recordsTime | boolean recordsTime() {
return recordsWrite() || recordsAccess();
} | Creates a new, empty map with the specified strategy, initial capacity and concurrency level. | java | android/guava/src/com/google/common/cache/LocalCache.java | 360 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
get | @SuppressWarnings("unchecked")
@Override
public @Nullable V get(@Nullable Object key) {
Object result = get(hashTable, alternatingKeysAndValues, size, 0, key);
/*
* We can't simply cast the result of `RegularImmutableMap.get` to V because of a bug in our
* nullness checker (resulting from https://... | Returns a hash table for the specified keys and values, and ensures that neither keys nor
values are null. This method may update {@code alternatingKeysAndValues} if there are duplicate
keys. If so, the return value will indicate how many entries are still valid, and will also
include a {@link Builder.DuplicateKey} in ... | java | android/guava/src/com/google/common/collect/RegularImmutableMap.java | 305 | [
"key"
] | V | true | 2 | 8.24 | google/guava | 51,352 | javadoc | false |
store | @Override
public void store(Writer writer, String comments) throws IOException {
StringWriter stringWriter = new StringWriter();
super.store(stringWriter, (this.omitComments ? null : comments));
String contents = stringWriter.toString();
for (String line : contents.split(EOL)) {
if (!(this.omitComments && l... | Construct a new {@code SortedProperties} instance with properties populated
from the supplied {@link Properties} object and honoring the supplied
{@code omitComments} flag.
<p>Default properties from the supplied {@code Properties} object will
not be copied.
@param properties the {@code Properties} object from which to... | java | spring-context-indexer/src/main/java/org/springframework/context/index/processor/SortedProperties.java | 99 | [
"writer",
"comments"
] | void | true | 4 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
safe_sqr | def safe_sqr(X, *, copy=True):
"""Element wise squaring of array-likes and sparse matrices.
Parameters
----------
X : {array-like, ndarray, sparse matrix}
copy : bool, default=True
Whether to create a copy of X and operate on it or to perform
inplace computation (default behaviour)... | Element wise squaring of array-likes and sparse matrices.
Parameters
----------
X : {array-like, ndarray, sparse matrix}
copy : bool, default=True
Whether to create a copy of X and operate on it or to perform
inplace computation (default behaviour).
Returns
-------
X ** 2 : element wise square
Return th... | python | sklearn/utils/extmath.py | 1,377 | [
"X",
"copy"
] | false | 6 | 7.52 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
infer_dtype_from_object | def infer_dtype_from_object(dtype) -> type:
"""
Get a numpy dtype.type-style object for a dtype object.
This methods also includes handling of the datetime64[ns] and
datetime64[ns, TZ] objects.
If no dtype can be found, we return ``object``.
Parameters
----------
dtype : dtype, type
... | Get a numpy dtype.type-style object for a dtype object.
This methods also includes handling of the datetime64[ns] and
datetime64[ns, TZ] objects.
If no dtype can be found, we return ``object``.
Parameters
----------
dtype : dtype, type
The dtype object whose numpy dtype.type-style
object we want to extract.
... | python | pandas/core/dtypes/common.py | 1,703 | [
"dtype"
] | type | true | 10 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
end | void end(@Nullable Series series) {
if (series != null) {
this.activeSeries.pop();
append(series.closeChar);
}
} | End an active {@link Series} (JSON object or array).
@param series the series type being ended (must match {@link #start(Series)})
@see #start(Series) | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java | 179 | [
"series"
] | void | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
wrap | public static String wrap(final String str, final int wrapLength) {
return wrap(str, wrapLength, null, false);
} | Wraps a single line of text, identifying words by {@code ' '}.
<p>New lines will be separated by the system property line separator.
Very long words, such as URLs will <em>not</em> be wrapped.</p>
<p>Leading spaces on a new line are stripped.
Trailing spaces are not stripped.</p>
<table border="1">
<caption>Examples</... | java | src/main/java/org/apache/commons/lang3/text/WordUtils.java | 459 | [
"str",
"wrapLength"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
field | public XContentBuilder field(String name, Long value) throws IOException {
return (value == null) ? nullField(name) : field(name, value.longValue());
} | @return the value of the "human readable" flag. When the value is equal to true,
some types of values are written in a format easier to read for a human. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 585 | [
"name",
"value"
] | XContentBuilder | true | 2 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
doXContentBody | @Override
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
super.doXContentBody(builder, params);
if (normalizationFactor > 0) {
boolean hasValue = (Double.isInfinite(normalizedValue()) || Double.isNaN(normalizedValue())) == false;
... | Returns the normalized value. If no normalised factor has been specified
this method will return {@link #value()}
@return the normalized value | java | modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/Derivative.java | 81 | [
"builder",
"params"
] | XContentBuilder | true | 6 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
lazyLoadCp | function lazyLoadCp() {
if (cpFn === undefined) {
({ cpFn } = require('internal/fs/cp/cp'));
cpFn = require('util').callbackify(cpFn);
({ cpSyncFn } = require('internal/fs/cp/cp-sync'));
}
} | Synchronously truncates the file descriptor.
@param {number} fd
@param {number} [len]
@returns {void} | javascript | lib/fs.js | 1,102 | [] | false | 2 | 6.88 | nodejs/node | 114,839 | jsdoc | false | |
_flop_count | def _flop_count(idx_contraction, inner, num_terms, size_dictionary):
"""
Computes the number of FLOPS in the contraction.
Parameters
----------
idx_contraction : iterable
The indices involved in the contraction
inner : bool
Does this contraction require an inner product?
num... | Computes the number of FLOPS in the contraction.
Parameters
----------
idx_contraction : iterable
The indices involved in the contraction
inner : bool
Does this contraction require an inner product?
num_terms : int
The number of terms in a contraction
size_dictionary : dict
The size of each of the indi... | python | numpy/_core/einsumfunc.py | 23 | [
"idx_contraction",
"inner",
"num_terms",
"size_dictionary"
] | false | 2 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
leaveFromCurrentSegment | function leaveFromCurrentSegment(analyzer, node) {
const state = CodePath.getState(analyzer.codePath);
const currentSegments = state.currentSegments;
for (let i = 0; i < currentSegments.length; ++i) {
const currentSegment = currentSegments[i];
if (currentSegment.reachable) {
analyzer.emitter.emit('... | Updates the current segment with empty.
This is called at the last of functions or the program.
@param {CodePathAnalyzer} analyzer The instance.
@param {ASTNode} node The current AST node.
@returns {void} | javascript | packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js | 227 | [
"analyzer",
"node"
] | false | 3 | 6.08 | facebook/react | 241,750 | jsdoc | false | |
mergeInvalidArgumentTypeErrors | function mergeInvalidArgumentTypeErrors(errorList: NonUnionError[]) {
const invalidArgsError = new Map<string, InvalidArgumentTypeError>()
const result: NonUnionError[] = []
for (const error of errorList) {
if (error.kind !== 'InvalidArgumentType') {
result.push(error)
continue
}
const k... | Iterates over provided error list and merges all InvalidArgumentType
with matching selectionPath and argumentPath into one. For example,
if the list has an error, saying that `where.arg` does not match `Int`
and another, saying that `where.arg` does not match IntFilter, resulting
list will contain a single error for `w... | typescript | packages/client/src/runtime/core/errorRendering/applyUnionError.ts | 54 | [
"errorList"
] | false | 4 | 6.8 | prisma/prisma | 44,834 | jsdoc | false | |
lazyLoadStreams | function lazyLoadStreams() {
if (!ReadStream) {
({ ReadStream, WriteStream } = require('internal/fs/streams'));
FileReadStream = ReadStream;
FileWriteStream = WriteStream;
}
} | Synchronously copies `src` to `dest`. `src` can be a file, directory, or
symlink. The contents of directories will be copied recursively.
@param {string | URL} src
@param {string | URL} dest
@param {object} [options]
@returns {void} | javascript | lib/fs.js | 3,127 | [] | false | 2 | 7.44 | nodejs/node | 114,839 | jsdoc | false | |
divergingEpoch | public static Optional<FetchResponseData.EpochEndOffset> divergingEpoch(FetchResponseData.PartitionData partitionResponse) {
return partitionResponse.divergingEpoch().epoch() < 0 ? Optional.empty()
: Optional.of(partitionResponse.divergingEpoch());
} | Convenience method to find the size of a response.
@param version The version of the response to use.
@param partIterator The partition iterator.
@return The response size in bytes. | java | clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java | 179 | [
"partitionResponse"
] | true | 2 | 8 | apache/kafka | 31,560 | javadoc | false | |
registerAnnotationConfigProcessors | public static Set<BeanDefinitionHolder> registerAnnotationConfigProcessors(
BeanDefinitionRegistry registry, @Nullable Object source) {
DefaultListableBeanFactory beanFactory = unwrapDefaultListableBeanFactory(registry);
if (beanFactory != null) {
if (!(beanFactory.getDependencyComparator() instanceof Annota... | Register all relevant annotation post processors in the given registry.
@param registry the registry to operate on
@param source the configuration source element (already extracted)
that this registration was triggered from. May be {@code null}.
@return a Set of BeanDefinitionHolders, containing all bean definitions
th... | java | spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java | 143 | [
"registry",
"source"
] | true | 13 | 7.52 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toByteArray | public static byte[] toByteArray(InputStream in) throws IOException {
checkNotNull(in);
return toByteArrayInternal(in, new ArrayDeque<byte[]>(TO_BYTE_ARRAY_DEQUE_SIZE), 0);
} | Reads all bytes from an input stream into a byte array. Does not close the stream.
<p><b>Java 9+ users:</b> use {@code in#readAllBytes()} instead.
@param in the input stream to read from
@return a byte array containing all the bytes from the stream
@throws IOException if an I/O error occurs | java | android/guava/src/com/google/common/io/ByteStreams.java | 240 | [
"in"
] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
min | public static <T extends Comparable<? super T>> T min(T a, T b) {
return (a.compareTo(b) <= 0) ? a : b;
} | Returns the minimum of the two values. If the values compare as 0, the first is returned.
<p>The recommended solution for finding the {@code minimum} of some values depends on the type
of your data and the number of elements you have. Read more in the Guava User Guide article on
<a href="https://github.com/google/guava... | java | android/guava/src/com/google/common/collect/Comparators.java | 222 | [
"a",
"b"
] | T | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false |
record | def record(
self,
custom_params_encoder: Callable[_P, object] | None = None,
custom_result_encoder: Callable[_P, Callable[[_R], _EncodedR]] | None = None,
) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]:
"""Record a function call result with custom encoding.
This is a de... | Record a function call result with custom encoding.
This is a decorator that wraps a function to enable memoization
with custom encoding/decoding logic.
Args:
custom_params_encoder: Optional encoder for function parameters.
If None, parameters are pickled directly.
custom_result_enco... | python | torch/_inductor/runtime/caching/interfaces.py | 425 | [
"self",
"custom_params_encoder",
"custom_result_encoder"
] | Callable[[Callable[_P, _R]], Callable[_P, _R]] | true | 6 | 9.12 | pytorch/pytorch | 96,034 | google | false |
get_dag_prefix | def get_dag_prefix(performance_dag_conf: dict[str, str]) -> str:
"""
Return DAG prefix.
Returns prefix that will be assigned to DAGs created with given performance DAG configuration.
:param performance_dag_conf: dict with environment variables as keys and their values as values
:return: final for... | Return DAG prefix.
Returns prefix that will be assigned to DAGs created with given performance DAG configuration.
:param performance_dag_conf: dict with environment variables as keys and their values as values
:return: final form of prefix after substituting inappropriate characters
:rtype: str | python | performance/src/performance_dags/performance_dag/performance_dag_utils.py | 449 | [
"performance_dag_conf"
] | str | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
det | def det(a):
"""
Compute the determinant of an array.
Parameters
----------
a : (..., M, M) array_like
Input array to compute determinants for.
Returns
-------
det : (...) array_like
Determinant of `a`.
See Also
--------
slogdet : Another way to represent th... | Compute the determinant of an array.
Parameters
----------
a : (..., M, M) array_like
Input array to compute determinants for.
Returns
-------
det : (...) array_like
Determinant of `a`.
See Also
--------
slogdet : Another way to represent the determinant, more suitable
for large matrices where underflow/ov... | python | numpy/linalg/_linalg.py | 2,357 | [
"a"
] | false | 2 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
applyNonNull | public static <T, U, R, E1 extends Throwable, E2 extends Throwable> R applyNonNull(final T value1,
final FailableFunction<? super T, ? extends U, E1> mapper1, final FailableFunction<? super U, ? extends R, E2> mapper2) throws E1, E2 {
return applyNonNull(applyNonNull(value1, mapper1), mapper2);
... | Applies values to a chain of functions, where a {@code null} can short-circuit each step. A function is only applied if the previous value is not
{@code null}, otherwise this method returns {@code null}.
<pre>{@code
Failable.applyNonNull(" a ", String::toUpperCase, String::trim) = "A"
Failable.applyNonNull(null, String... | java | src/main/java/org/apache/commons/lang3/function/Failable.java | 238 | [
"value1",
"mapper1",
"mapper2"
] | R | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
makeHeartbeatRequestAndHandleResponse | private NetworkClientDelegate.UnsentRequest makeHeartbeatRequestAndHandleResponse(final long currentTimeMs) {
NetworkClientDelegate.UnsentRequest request = makeHeartbeatRequest(currentTimeMs);
return request.whenComplete((response, exception) -> {
long completionTimeMs = request.handler().co... | A heartbeat should be sent without waiting for the heartbeat interval to expire if:
- the member is leaving the group
or
- the member is joining the group or acknowledging the assignment and for both cases there is no heartbeat request
in flight.
@return true if a heartbeat should be sent before the interval expires,... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsGroupHeartbeatRequestManager.java | 494 | [
"currentTimeMs"
] | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
_use_interchange_protocol | def _use_interchange_protocol(X):
"""Use interchange protocol for non-pandas dataframes that follow the protocol.
Note: at this point we chose not to use the interchange API on pandas dataframe
to ensure strict behavioral backward compatibility with older versions of
scikit-learn.
"""
return no... | Use interchange protocol for non-pandas dataframes that follow the protocol.
Note: at this point we chose not to use the interchange API on pandas dataframe
to ensure strict behavioral backward compatibility with older versions of
scikit-learn. | python | sklearn/utils/validation.py | 308 | [
"X"
] | false | 2 | 6.08 | scikit-learn/scikit-learn | 64,340 | unknown | false | |
markCoordinatorUnknown | public void markCoordinatorUnknown(final String cause, final long currentTimeMs) {
if (coordinator != null || timeMarkedUnknownMs == -1) {
timeMarkedUnknownMs = currentTimeMs;
totalDisconnectedMin = 0;
}
if (coordinator != null) {
log.info(
"G... | Mark the coordinator as "unknown" (i.e. {@code null}) when a disconnect is detected. This detection can occur
in one of two paths:
<ol>
<li>The coordinator was discovered, but then later disconnected</li>
<li>The coordinator has not yet been discovered and/or connected</li>
</ol>
@param cause String exp... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CoordinatorRequestManager.java | 161 | [
"cause",
"currentTimeMs"
] | void | true | 5 | 6.24 | apache/kafka | 31,560 | javadoc | false |
throttle | function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' i... | Creates a throttled function that only invokes `func` at most once per
every `wait` milliseconds. The throttled function comes with a `cancel`
method to cancel delayed `func` invocations and a `flush` method to
immediately invoke them. Provide `options` to indicate whether `func`
should be invoked on the leading and/or... | javascript | lodash.js | 11,004 | [
"func",
"wait",
"options"
] | false | 5 | 7.2 | lodash/lodash | 61,490 | jsdoc | false | |
withDefaultPort | public HostAndPort withDefaultPort(int defaultPort) {
checkArgument(isValidPort(defaultPort));
if (hasPort()) {
return this;
}
return new HostAndPort(host, defaultPort, hasBracketlessColons);
} | Provide a default port if the parsed string contained only a host.
<p>You can chain this after {@link #fromString(String)} to include a port in case the port was
omitted from the input string. If a port was already provided, then this method is a no-op.
@param defaultPort a port number, from [0..65535]
@return a HostAn... | java | android/guava/src/com/google/common/net/HostAndPort.java | 249 | [
"defaultPort"
] | HostAndPort | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false |
toStringTrueFalse | public static String toStringTrueFalse(final Boolean bool) {
return toString(bool, TRUE, FALSE, null);
} | Converts a Boolean to a String returning {@code 'true'},
{@code 'false'}, or {@code null}.
<pre>
BooleanUtils.toStringTrueFalse(Boolean.TRUE) = "true"
BooleanUtils.toStringTrueFalse(Boolean.FALSE) = "false"
BooleanUtils.toStringTrueFalse(null) = null;
</pre>
@param bool the Boolean to check
@return {@c... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 1,106 | [
"bool"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
getClass | public static Class<?> getClass(final ClassLoader classLoader, final String className, final boolean initialize) throws ClassNotFoundException {
// This method was re-written to avoid recursion and stack overflows found by fuzz testing.
String next = className;
int lastDotIndex = -1;
do ... | Gets the class represented by {@code className} using the {@code classLoader}. This implementation supports the
syntaxes "{@code java.util.Map.Entry[]}", "{@code java.util.Map$Entry[]}", "{@code [Ljava.util.Map.Entry;}", and
"{@code [Ljava.util.Map$Entry;}".
<p>
The provided class name is normalized by removing all whi... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 585 | [
"classLoader",
"className",
"initialize"
] | true | 4 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
isCompatible | public boolean isCompatible(BloomFilter<T> that) {
checkNotNull(that);
return this != that
&& this.numHashFunctions == that.numHashFunctions
&& this.bitSize() == that.bitSize()
&& this.strategy.equals(that.strategy)
&& this.funnel.equals(that.funnel);
} | Determines whether a given Bloom filter is compatible with this Bloom filter. For two Bloom
filters to be compatible, they must:
<ul>
<li>not be the same instance
<li>have the same number of hash functions
<li>have the same bit size
<li>have the same strategy
<li>have equal funnels
</ul>
@param that The Bloom... | java | android/guava/src/com/google/common/hash/BloomFilter.java | 244 | [
"that"
] | true | 5 | 6.72 | google/guava | 51,352 | javadoc | false | |
fill | function fill(array, value, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
start = 0;
end = length;
}
return baseFill(array, value, start,... | Fills elements of `array` with `value` from `start` up to, but not
including, `end`.
**Note:** This method mutates `array`.
@static
@memberOf _
@since 3.2.0
@category Array
@param {Array} array The array to fill.
@param {*} value The value to fill `array` with.
@param {number} [start=0] The start position.
@param {numb... | javascript | lodash.js | 7,305 | [
"array",
"value",
"start",
"end"
] | false | 6 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
visitNamedExportBindings | function visitNamedExportBindings(node: NamedExportBindings, allowEmpty: boolean): VisitResult<NamedExportBindings> | undefined {
return isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node, allowEmpty);
} | Visits named exports, eliding it if it does not contain an export specifier that
resolves to a value.
@param node The named exports node. | typescript | src/compiler/transformers/ts.ts | 2,392 | [
"node",
"allowEmpty"
] | true | 2 | 6.48 | microsoft/TypeScript | 107,154 | jsdoc | false | |
baseKeysIn | function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
... | The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
@private
@param {Object} object The object to query.
@returns {Array} Returns the array of property names. | javascript | lodash.js | 3,544 | [
"object"
] | false | 5 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
of | static SslOptions of(@Nullable Set<String> ciphers, @Nullable Set<String> enabledProtocols) {
return of(toArray(ciphers), toArray(enabledProtocols));
} | Factory method to create a new {@link SslOptions} instance.
@param ciphers the ciphers
@param enabledProtocols the enabled protocols
@return a new {@link SslOptions} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslOptions.java | 105 | [
"ciphers",
"enabledProtocols"
] | SslOptions | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
getPatternForStyle | static String getPatternForStyle(final Integer dateStyle, final Integer timeStyle, final Locale locale) {
final Locale safeLocale = LocaleUtils.toLocale(locale);
final ArrayKey key = new ArrayKey(dateStyle, timeStyle, safeLocale);
return dateTimeInstanceCache.computeIfAbsent(key, k -> {
... | Gets a date/time format for the specified styles and locale.
@param dateStyle date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in format.
@param timeStyle time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in format.
@param locale The non-null locale of the desired format.
@return a loc... | java | src/main/java/org/apache/commons/lang3/time/AbstractFormatCache.java | 104 | [
"dateStyle",
"timeStyle",
"locale"
] | String | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
ifftshift | def ifftshift(x, axes=None):
"""
The inverse of `fftshift`. Although identical for even-length `x`, the
functions differ by one sample for odd-length `x`.
Parameters
----------
x : array_like
Input array.
axes : int or shape tuple, optional
Axes over which to calculate. Def... | The inverse of `fftshift`. Although identical for even-length `x`, the
functions differ by one sample for odd-length `x`.
Parameters
----------
x : array_like
Input array.
axes : int or shape tuple, optional
Axes over which to calculate. Defaults to None, which shifts all axes.
Returns
-------
y : ndarray
... | python | numpy/fft/_helper.py | 78 | [
"x",
"axes"
] | false | 4 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
commitSync | @Override
public Map<TopicIdPartition, Optional<KafkaException>> commitSync() {
return delegate.commitSync();
} | Commit the acknowledgements for the records returned. If the consumer is using explicit acknowledgement,
the acknowledgements to commit have been indicated using {@link #acknowledge(ConsumerRecord)} or
{@link #acknowledge(ConsumerRecord, AcknowledgeType)}. If the consumer is using implicit acknowledgement,
all the reco... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaShareConsumer.java | 632 | [] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
sortedLastIndexOf | function sortedLastIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value, true) - 1;
if (eq(array[index], value)) {
return index;
}
}
return -1;
} | This method is like `_.lastIndexOf` except that it performs a binary
search on a sorted `array`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@returns {number} Returns the index of the matched value, else `-1`.
@example
_.sortedLas... | javascript | lodash.js | 8,174 | [
"array",
"value"
] | false | 4 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
unmodifiableMap | private static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V> unmodifiableMap(
Map<K, ? extends V> map) {
if (map instanceof SortedMap) {
return Collections.unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
} else {
return Collections.unmodifiableMap(map);
}
} | Computes the difference between two sorted maps, using the comparator of the left map, or
{@code Ordering.natural()} if the left map uses the natural ordering of its elements. This
difference is an immutable snapshot of the state of the maps at the time this method is called.
It will never change, even if the maps chan... | java | android/guava/src/com/google/common/collect/Maps.java | 581 | [
"map"
] | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false | |
predict_proba | def predict_proba(self, X):
"""Probability estimates.
The returned estimates for all classes are ordered by label of classes.
Note that in the multilabel case, each sample can have any number of
labels. This returns the marginal probability that the given sample has
the label i... | Probability estimates.
The returned estimates for all classes are ordered by label of classes.
Note that in the multilabel case, each sample can have any number of
labels. This returns the marginal probability that the given sample has
the label in question. For example, it is entirely consistent that two
labels both... | python | sklearn/multiclass.py | 523 | [
"self",
"X"
] | false | 3 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
socket | int socket(int domain, int type, int protocol); | Open a file descriptor to connect to a socket.
@param domain The socket protocol family, eg AF_UNIX
@param type The socket type, eg SOCK_DGRAM
@param protocol The protocol for the given protocl family, normally 0
@return an open file descriptor, or -1 on failure with errno set
@see <a href="https://man7.org/linux/man-p... | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/lib/PosixCLibrary.java | 109 | [
"domain",
"type",
"protocol"
] | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false | |
truePredicate | @SuppressWarnings("unchecked")
static <T, U, E extends Throwable> FailableBiPredicate<T, U, E> truePredicate() {
return TRUE;
} | Gets the TRUE singleton.
@param <T> Consumed type 1.
@param <U> Consumed type 2.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailableBiPredicate.java | 63 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
isAssignable | public static boolean isAssignable(Class<?> cls, final Class<?> toClass, final boolean autoboxing) {
if (toClass == null) {
return false;
}
// have to check for null, as isAssignableFrom doesn't
if (cls == null) {
return !toClass.isPrimitive();
}
/... | Tests whether one {@link Class} can be assigned to a variable of another {@link Class}.
<p>
Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this method takes into account widenings of
primitive classes and {@code null}s.
</p>
<p>
Primitive widenings allow an int to be assigned to a long, float or dou... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 1,321 | [
"cls",
"toClass",
"autoboxing"
] | true | 31 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
lastIndexOf | public static int lastIndexOf(final short[] array, final short valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
} | Finds the last index of the given value within the array.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.
</p>
@param array the array to traverse backwards looking for the object, may be {@code null}.
@param valueToFind the object to find.
@return the last index of th... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,175 | [
"array",
"valueToFind"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
to_dict | def to_dict(self, *, prune_empty: bool = False, validate: bool = True) -> dict[str, Any]:
"""
Convert Connection to json-serializable dictionary.
:param prune_empty: Whether or not remove empty values.
:param validate: Validate dictionary is JSON-serializable
:meta private:
... | Convert Connection to json-serializable dictionary.
:param prune_empty: Whether or not remove empty values.
:param validate: Validate dictionary is JSON-serializable
:meta private: | python | airflow-core/src/airflow/models/connection.py | 544 | [
"self",
"prune_empty",
"validate"
] | dict[str, Any] | true | 5 | 6.24 | apache/airflow | 43,597 | sphinx | false |
is_dtype | def is_dtype(cls, dtype: object) -> bool:
"""
Check if we match 'dtype'.
Parameters
----------
dtype : object
The object to check.
Returns
-------
bool
Notes
-----
The default implementation is True if
1. ``c... | Check if we match 'dtype'.
Parameters
----------
dtype : object
The object to check.
Returns
-------
bool
Notes
-----
The default implementation is True if
1. ``cls.construct_from_string(dtype)`` is an instance
of ``cls``.
2. ``dtype`` is an object and is an instance of ``cls``
3. ``dtype`` has a ``dtype`` a... | python | pandas/core/dtypes/base.py | 300 | [
"cls",
"dtype"
] | bool | true | 5 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
__init__ | def __init__(
self,
values: list[T],
update_op: Callable[[T, T], T],
summary_op: Callable[[T, T], T],
identity_element: T,
):
"""
Initialize a segment tree with the given values and operations.
Args:
values: list of initial values
... | Initialize a segment tree with the given values and operations.
Args:
values: list of initial values
update_op: Function to apply when updating a value (e.g., addition)
summary_op: Function to summarize two values (e.g., min, max, sum)
identity_element: Identity element for the summary_op (e.g., 0 for ... | python | torch/_inductor/codegen/segmented_tree.py | 13 | [
"self",
"values",
"update_op",
"summary_op",
"identity_element"
] | true | 3 | 6.88 | pytorch/pytorch | 96,034 | google | false | |
findSystemLayerModules | private static Set<Module> findSystemLayerModules() {
var systemModulesDescriptors = ModuleFinder.ofSystem()
.findAll()
.stream()
.map(ModuleReference::descriptor)
.collect(Collectors.toUnmodifiableSet());
return Stream.concat(
// entitlements ... | This class contains all the entitlements by type, plus the {@link FileAccessTree} for the special case of filesystem entitlements.
<p>
We use layers when computing {@link ModuleEntitlements}; first, we check whether the module we are building it for is in the
server layer ({@link PolicyManager#SERVER_LAYER_MODULES}) (*... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java | 193 | [] | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false | |
doDifference | private static <K extends @Nullable Object, V extends @Nullable Object> void doDifference(
Map<? extends K, ? extends V> left,
Map<? extends K, ? extends V> right,
Equivalence<? super @NonNull V> valueEquivalence,
Map<K, V> onlyOnLeft,
Map<K, V> onlyOnRight,
Map<K, V> onBoth,
M... | Computes the difference between two sorted maps, using the comparator of the left map, or
{@code Ordering.natural()} if the left map uses the natural ordering of its elements. This
difference is an immutable snapshot of the state of the maps at the time this method is called.
It will never change, even if the maps chan... | java | android/guava/src/com/google/common/collect/Maps.java | 547 | [
"left",
"right",
"valueEquivalence",
"onlyOnLeft",
"onlyOnRight",
"onBoth",
"differences"
] | void | true | 3 | 8.24 | google/guava | 51,352 | javadoc | false |
isNamedBeanAnAdvisorOrAdvice | private boolean isNamedBeanAnAdvisorOrAdvice(String beanName) {
Assert.state(this.beanFactory != null, "No BeanFactory set");
Class<?> namedBeanClass = this.beanFactory.getType(beanName);
if (namedBeanClass != null) {
return (Advisor.class.isAssignableFrom(namedBeanClass) || Advice.class.isAssignableFrom(named... | Look at bean factory metadata to work out whether this bean name,
which concludes the interceptorNames list, is an Advisor or Advice,
or may be a target.
@param beanName bean name to check
@return {@code true} if it's an Advisor or Advice | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java | 388 | [
"beanName"
] | true | 4 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
is_default_pool | def is_default_pool(id: int, session: Session = NEW_SESSION) -> bool:
"""
Check id if is the default_pool.
:param id: pool id
:param session: SQLAlchemy ORM Session
:return: True if id is default_pool, otherwise False
"""
return exists_query(
Pool.id ... | Check id if is the default_pool.
:param id: pool id
:param session: SQLAlchemy ORM Session
:return: True if id is default_pool, otherwise False | python | airflow-core/src/airflow/models/pool.py | 101 | [
"id",
"session"
] | bool | true | 1 | 7.04 | apache/airflow | 43,597 | sphinx | false |
predictBeanType | default @Nullable Class<?> predictBeanType(Class<?> beanClass, String beanName) throws BeansException {
return null;
} | Predict the type of the bean to be eventually returned from this
processor's {@link #postProcessBeforeInstantiation} callback.
<p>The default implementation returns {@code null}.
Specific implementations should try to predict the bean type as
far as known/cached already, without extra processing steps.
@param beanClass... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/SmartInstantiationAwareBeanPostProcessor.java | 50 | [
"beanClass",
"beanName"
] | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false | |
withLowerBounds | public WildcardTypeBuilder withLowerBounds(final Type... bounds) {
this.lowerBounds = bounds;
return this;
} | Specify lower bounds of the wildcard type to build.
@param bounds to set.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 207 | [] | WildcardTypeBuilder | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
throwIfGroupIdNotDefined | private void throwIfGroupIdNotDefined() {
if (groupId.isEmpty())
throw new InvalidGroupIdException("To use the group management or offset commit APIs, you must " +
"provide a valid " + ConsumerConfig.GROUP_ID_CONFIG + " in the consumer configuration.");
} | Release the light lock protecting the consumer from multi-threaded access. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java | 1,274 | [] | void | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
reverse | public static void reverse(TDigestDoubleArray order, int offset, int length) {
for (int i = 0; i < length / 2; i++) {
double t = order.get(offset + i);
order.set(offset + i, order.get(offset + length - i - 1));
order.set(offset + length - i - 1, t);
}
} | Reverses part of an array.
@param order The array containing the data to reverse.
@param offset Where to start reversing.
@param length How many elements to reverse | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/Sort.java | 205 | [
"order",
"offset",
"length"
] | void | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
get_memory_traffic_bytes | def get_memory_traffic_bytes(self):
"""Return the number of bytes read/written by this operator.
Override this method in subclasses for operations with non-standard memory patterns
(e.g., matmul which is compute-bound rather than memory-bound).
The framework will use this value along w... | Return the number of bytes read/written by this operator.
Override this method in subclasses for operations with non-standard memory patterns
(e.g., matmul which is compute-bound rather than memory-bound).
The framework will use this value along with execution time to compute
and report memory bandwidth in GB/s.
Def... | python | benchmarks/operator_benchmark/benchmark_pytorch.py | 121 | [
"self"
] | false | 4 | 7.12 | pytorch/pytorch | 96,034 | unknown | false | |
add | @CanIgnoreReturnValue
@Override
public Builder<E> add(E... elements) {
super.add(elements);
return this;
} | Adds each element of {@code elements} to the {@code ImmutableList}.
@param elements the {@code Iterable} to add to the {@code ImmutableList}
@return this {@code Builder} object
@throws NullPointerException if {@code elements} is null or contains a null element | java | android/guava/src/com/google/common/collect/ImmutableList.java | 800 | [] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
tokenize | protected List<String> tokenize(final char[] srcChars, final int offset, final int count) {
if (ArrayUtils.isEmpty(srcChars)) {
return Collections.emptyList();
}
final StrBuilder buf = new StrBuilder();
final List<String> tokenList = new ArrayList<>();
int pos = offse... | Internal method to performs the tokenization.
<p>
Most users of this class do not need to call this method. This method
will be called automatically by other (public) methods when required.
</p>
<p>
This method exists to allow subclasses to add code before or after the
tokenization. For example, a subclass could alter ... | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 1,079 | [
"srcChars",
"offset",
"count"
] | true | 5 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getTokenList | public List<String> getTokenList() {
checkTokenized();
final List<String> list = new ArrayList<>(tokens.length);
list.addAll(Arrays.asList(tokens));
return list;
} | Gets a copy of the full token list as an independent modifiable list.
@return the tokens as a String array. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 541 | [] | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false | |
getPointcut | @Override
public Pointcut getPointcut() {
synchronized (this.pointcutMonitor) {
if (this.pointcut == null) {
this.pointcut = createPointcut();
if (this.patterns != null) {
this.pointcut.setPatterns(this.patterns);
}
}
return this.pointcut;
}
} | Initialize the singleton Pointcut held within this Advisor. | java | spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java | 120 | [] | Pointcut | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
resolveObject | public @Nullable Object resolveObject(RegisteredBean registeredBean) {
Assert.notNull(registeredBean, "'registeredBean' must not be null");
return resolveValue(registeredBean, getField(registeredBean));
} | Resolve the field value for the specified registered bean.
@param registeredBean the registered bean
@return the resolved field value | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredFieldValueResolver.java | 147 | [
"registeredBean"
] | Object | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
install_handler | static void __attribute__((constructor)) install_handler(void) {
static const std::unordered_map<std::string_view, int> signalMap = {
{"segv", SIGSEGV},
{"ill", SIGILL},
#ifdef SIGBUS
{"bus", SIGBUS},
#endif
#ifdef SIGSTKFLT
{"stkflt", SIGSTKFLT},
#endif
{"abrt", SIGABRT},
{"fpe", ... | A standalone shared library that can be `LD_PRELOAD`d to print symbolized
native stack traces when the process dies due to a signal. By default, this
is enabled for SIGSEGV, SIGILL, SIGBUS, SIGSTKFLT, SIGABRT, and SIGFPE.
Based on glibc's `libSegFault.so`:
https://github.com/lattera/glibc/blob/master/debug/segfault.c
U... | cpp | folly/debugging/symbolizer/tool/LibSegFault.cpp | 41 | [] | true | 6 | 6.56 | facebook/folly | 30,157 | doxygen | false | |
setFuture | @CanIgnoreReturnValue
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
protected boolean setFuture(ListenableFuture<? extends V> future) {
checkNotNull(future);
@RetainedLocalRef Object localValue = value();
if (localValue == null) {
if (future.isDone()) {
... | Sets the result of this {@code Future} to match the supplied input {@code Future} once the
supplied {@code Future} is done, unless this {@code Future} has already been cancelled or set
(including "set asynchronously," defined below).
<p>If the supplied future is {@linkplain #isDone done} when this method is called and ... | java | android/guava/src/com/google/common/util/concurrent/AbstractFuture.java | 551 | [
"future"
] | true | 8 | 8 | google/guava | 51,352 | javadoc | false | |
isFixPossiblyReExportingImportingFile | function isFixPossiblyReExportingImportingFile(fix: ImportFixWithModuleSpecifier, importingFilePath: Path, toPath: (fileName: string) => Path): boolean {
if (
fix.isReExport &&
fix.exportInfo?.moduleFileName &&
isIndexFileName(fix.exportInfo.moduleFileName)
) {
const reExpo... | @returns `Comparison.LessThan` if `a` is better than `b`. | typescript | src/services/codefixes/importFixes.ts | 1,453 | [
"fix",
"importingFilePath",
"toPath"
] | true | 4 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
build | public ConfigurationMetadataRepository build() {
SimpleConfigurationMetadataRepository result = new SimpleConfigurationMetadataRepository();
for (SimpleConfigurationMetadataRepository repository : this.repositories) {
result.include(repository);
}
return result;
} | Build a {@link ConfigurationMetadataRepository} with the current state of this
builder.
@return this builder | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java | 86 | [] | ConfigurationMetadataRepository | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
findCommand | public @Nullable Command findCommand(String name) {
for (Command candidate : this.commands) {
String candidateName = candidate.getName();
if (candidateName.equals(name) || (isOptionCommand(candidate) && ("--" + candidateName).equals(name))) {
return candidate;
}
}
return null;
} | Find a command by name.
@param name the name of the command
@return the command or {@code null} if not found | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java | 151 | [
"name"
] | Command | true | 4 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
_kmeans_plusplus | def _kmeans_plusplus(
X, n_clusters, x_squared_norms, sample_weight, random_state, n_local_trials=None
):
"""Computational component for initialization of n_clusters by
k-means++. Prior validation of data is assumed.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_samples, n_feat... | Computational component for initialization of n_clusters by
k-means++. Prior validation of data is assumed.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_samples, n_features)
The data to pick seeds for.
n_clusters : int
The number of seeds to choose.
sample_weight : ndarray of shape (n_sampl... | python | sklearn/cluster/_kmeans.py | 180 | [
"X",
"n_clusters",
"x_squared_norms",
"sample_weight",
"random_state",
"n_local_trials"
] | false | 7 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
to_iceberg | def to_iceberg(
self,
table_identifier: str,
catalog_name: str | None = None,
*,
catalog_properties: dict[str, Any] | None = None,
location: str | None = None,
append: bool = False,
snapshot_properties: dict[str, str] | None = None,
) -> None:
... | Write a DataFrame to an Apache Iceberg table.
.. versionadded:: 3.0.0
.. warning::
to_iceberg is experimental and may change without warning.
Parameters
----------
table_identifier : str
Table identifier.
catalog_name : str, optional
The name of the catalog.
catalog_properties : dict of {str: str}, optio... | python | pandas/core/frame.py | 3,706 | [
"self",
"table_identifier",
"catalog_name",
"catalog_properties",
"location",
"append",
"snapshot_properties"
] | None | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
isInstanceOf | public static void isInstanceOf(final Class<?> type, final Object obj, final String message, final Object... values) {
// TODO when breaking BC, consider returning obj
if (!type.isInstance(obj)) {
throw new IllegalArgumentException(getMessage(message, values));
}
} | Validate that the argument is an instance of the specified class; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary class
<pre>Validate.isInstanceOf(OkClass.class, object, "Wrong class, object is of class %s",
object.getClass().getName());</pre... | java | src/main/java/org/apache/commons/lang3/Validate.java | 469 | [
"type",
"obj",
"message"
] | void | true | 2 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
escapeXml11 | public static String escapeXml11(final String input) {
return ESCAPE_XML11.translate(input);
} | Escapes the characters in a {@link String} using XML entities.
<p>For example: {@code "bread" & "butter"} =>
{@code "bread" & "butter"}.
</p>
<p>XML 1.1 can represent certain control characters, but it cannot represent
the null byte or unpaired Unicode surrogate code points, even after escapi... | java | src/main/java/org/apache/commons/lang3/StringEscapeUtils.java | 655 | [
"input"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
unmodifiableMultimap | public static <K extends @Nullable Object, V extends @Nullable Object>
Multimap<K, V> unmodifiableMultimap(Multimap<K, V> delegate) {
if (delegate instanceof UnmodifiableMultimap || delegate instanceof ImmutableMultimap) {
return delegate;
}
return new UnmodifiableMultimap<>(delegate);
} | Returns an unmodifiable view of the specified multimap. Query operations on the returned
multimap "read through" to the specified multimap, and attempts to modify the returned
multimap, either directly or through the multimap's views, result in an {@code
UnsupportedOperationException}.
<p>The returned multimap will be ... | java | android/guava/src/com/google/common/collect/Multimaps.java | 654 | [
"delegate"
] | true | 3 | 7.44 | google/guava | 51,352 | javadoc | false | |
create_model | def create_model(self, config: dict):
"""
Create a model in Amazon SageMaker.
In the request, you name the model and describe a primary container. For
the primary container, you specify the Docker image that contains
inference code, artifacts (from prior training), and a custom
... | Create a model in Amazon SageMaker.
In the request, you name the model and describe a primary container. For
the primary container, you specify the Docker image that contains
inference code, artifacts (from prior training), and a custom
environment map that the inference code uses when you deploy the model
for predict... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 457 | [
"self",
"config"
] | true | 1 | 6.56 | apache/airflow | 43,597 | sphinx | false | |
readFully | default void readFully(ByteBuffer dst, long pos) throws IOException {
do {
int count = read(dst, pos);
if (count <= 0) {
throw new EOFException();
}
pos += count;
}
while (dst.hasRemaining());
} | Fully read a sequence of bytes from this channel into the given buffer, starting at
the given block position and filling {@link ByteBuffer#remaining() remaining} bytes
in the buffer.
@param dst the buffer into which bytes are to be transferred
@param pos the position within the block at which the transfer is to begin
@... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/DataBlock.java | 62 | [
"dst",
"pos"
] | void | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
canOptimiseForSingleAcknowledgeType | private boolean canOptimiseForSingleAcknowledgeType(AcknowledgementBatch acknowledgementBatch) {
if (acknowledgementBatch == null || acknowledgementBatch.acknowledgeTypes().size() == 1) return false;
int firstAcknowledgeType = acknowledgementBatch.acknowledgeTypes().get(0);
for (int i = 1; i < a... | @return Returns true if the array of acknowledge types in the share fetch batch contains a single acknowledge type
and the array size can be reduced to 1.
Returns false when the array has more than one acknowledge type or is already optimised. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/Acknowledgements.java | 307 | [
"acknowledgementBatch"
] | true | 5 | 7.04 | 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.