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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yield | inline void yield() {
auto fm = FiberManager::getFiberManagerUnsafe();
if (fm) {
fm->yield();
} else {
std::this_thread::yield();
}
} | Returns a refference to a fiber-local context for given Fiber. Should be
always called with the same T for each fiber. Fiber-local context is lazily
default-constructed on first request.
When new task is scheduled via addTask / addTaskRemote from a fiber its
fiber-local context is copied into the new fiber. | cpp | folly/fibers/FiberManagerInternal.h | 720 | [] | true | 3 | 6.72 | facebook/folly | 30,157 | doxygen | false | |
fsync | public static void fsync(final Path fileToSync, final boolean isDir, final boolean metaData) throws IOException {
if (isDir && WINDOWS) {
// opening a directory on Windows fails, directories can not be fsynced there
if (Files.exists(fileToSync) == false) {
// yet do not s... | Ensure that any writes to the given file is written to the storage device that contains it. The {@code isDir} parameter specifies
whether or not the path to sync is a directory. This is needed because we open for read and ignore an {@link IOException} since not
all filesystems and operating systems support fsyncing on ... | java | libs/core/src/main/java/org/elasticsearch/core/IOUtils.java | 288 | [
"fileToSync",
"isDir",
"metaData"
] | void | true | 8 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
forMethod | public static AutowiredMethodArgumentsResolver forMethod(String methodName, Class<?>... parameterTypes) {
return new AutowiredMethodArgumentsResolver(methodName, parameterTypes, false, null);
} | Create a new {@link AutowiredMethodArgumentsResolver} for the specified
method where injection is optional.
@param methodName the method name
@param parameterTypes the factory method parameter types
@return a new {@link AutowiredFieldValueResolver} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredMethodArgumentsResolver.java | 87 | [
"methodName"
] | AutowiredMethodArgumentsResolver | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
convertToCreatableTopic | CreatableTopic convertToCreatableTopic() {
CreatableTopic creatableTopic = new CreatableTopic().
setName(name).
setNumPartitions(numPartitions.orElse(CreateTopicsRequest.NO_NUM_PARTITIONS)).
setReplicationFactor(replicationFactor.orElse(CreateTopicsRequest.NO_REPLICATION_FACT... | The configuration for the new topic or null if no configs ever specified. | java | clients/src/main/java/org/apache/kafka/clients/admin/NewTopic.java | 125 | [] | CreatableTopic | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false |
_split | def _split(self, X):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of features.
... | Generate indices to split data into training and test set.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of features.
Yields
------
train : ndarray
The training set indices for that split.
tes... | python | sklearn/model_selection/_split.py | 1,268 | [
"self",
"X"
] | false | 8 | 6.24 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
escape | private @Nullable String escape(@Nullable String name) {
if (name == null) {
return null;
}
for (String escape : ESCAPED) {
name = name.replace(escape, "\\" + escape);
}
return name;
} | Return a string representation of the path without any escaping.
@return the unescaped string representation | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 842 | [
"name"
] | String | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
find_path_from_directory | def find_path_from_directory(
base_dir_path: str | os.PathLike[str],
ignore_file_name: str,
ignore_file_syntax: str = conf.get_mandatory_value("core", "DAG_IGNORE_FILE_SYNTAX", fallback="glob"),
) -> Generator[str, None, None]:
"""
Recursively search the base path for a list of file paths that shoul... | Recursively search the base path for a list of file paths that should not be ignored.
:param base_dir_path: the base path to be searched
:param ignore_file_name: the file name in which specifies the patterns of files/dirs to be ignored
:param ignore_file_syntax: the syntax of patterns in the ignore file: regexp or glo... | python | airflow-core/src/airflow/utils/file.py | 224 | [
"base_dir_path",
"ignore_file_name",
"ignore_file_syntax"
] | Generator[str, None, None] | true | 4 | 8.08 | apache/airflow | 43,597 | sphinx | false |
visualize_comparison | def visualize_comparison(
profiling_results: dict[str, list[Performance]],
title: Optional[str] = None,
output_path: Optional[str] = None,
) -> None:
"""
Create a single memory_bandwidth comparison plot from profiling results.
Args:
profiling_results: Dict mapping backend names to lists... | Create a single memory_bandwidth comparison plot from profiling results.
Args:
profiling_results: Dict mapping backend names to lists of Performance objects
output_path: Path to save the plot (optional) | python | benchmarks/dynamo/genai_layers/utils.py | 243 | [
"profiling_results",
"title",
"output_path"
] | None | true | 8 | 6.16 | pytorch/pytorch | 96,034 | google | false |
apply_async | def apply_async(self, args=None, kwargs=None, route_name=None, **options):
"""Apply this task asynchronously.
Arguments:
args (Tuple): Partial args to be prepended to the existing args.
kwargs (Dict): Partial kwargs to be merged with existing kwargs.
options (Dict): ... | Apply this task asynchronously.
Arguments:
args (Tuple): Partial args to be prepended to the existing args.
kwargs (Dict): Partial kwargs to be merged with existing kwargs.
options (Dict): Partial options to be merged
with existing options.
Returns:
~@AsyncResult: promise of future evaluation.... | python | celery/canvas.py | 369 | [
"self",
"args",
"kwargs",
"route_name"
] | false | 7 | 6.96 | celery/celery | 27,741 | google | false | |
string_column_to_ndarray | def string_column_to_ndarray(col: Column) -> tuple[np.ndarray, Any]:
"""
Convert a column holding string data to a NumPy array.
Parameters
----------
col : Column
Returns
-------
tuple
Tuple of np.ndarray holding the data and the memory owner object
that keeps the memor... | Convert a column holding string data to a NumPy array.
Parameters
----------
col : Column
Returns
-------
tuple
Tuple of np.ndarray holding the data and the memory owner object
that keeps the memory alive. | python | pandas/core/interchange/from_dataframe.py | 301 | [
"col"
] | tuple[np.ndarray, Any] | true | 10 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
_downsample | def _downsample(self, how, **kwargs):
"""
Downsample the cython defined function.
Parameters
----------
how : string / cython mapped function
**kwargs : kw args passed to how function
"""
ax = self.ax
# Excludes `on` column when provided
... | Downsample the cython defined function.
Parameters
----------
how : string / cython mapped function
**kwargs : kw args passed to how function | python | pandas/core/resample.py | 2,072 | [
"self",
"how"
] | false | 2 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false | |
toHtml | private static String toHtml() {
final StringBuilder b = new StringBuilder();
b.append("<table class=\"data-table\"><tbody>\n");
b.append("<tr>");
b.append("<th>Error</th>\n");
b.append("<th>Code</th>\n");
b.append("<th>Retriable</th>\n");
b.append("<th>Descriptio... | Check if a Throwable is a commonly wrapped exception type (e.g. `CompletionException`) and return
the cause if so. This is useful to handle cases where exceptions may be raised from a future or a
completion stage (as might be the case for requests sent to the controller in `ControllerApis`).
@param t The Throwable to c... | java | clients/src/main/java/org/apache/kafka/common/protocol/Errors.java | 549 | [] | String | true | 4 | 8.08 | apache/kafka | 31,560 | javadoc | false |
_route_params | def _route_params(self, *, params, method, parent, caller):
"""Prepare the given metadata to be passed to the method.
This is used when a router is used as a child object of another router.
The parent router then passes all parameters understood by the child
object to it and delegates t... | Prepare the given metadata to be passed to the method.
This is used when a router is used as a child object of another router.
The parent router then passes all parameters understood by the child
object to it and delegates their validation to the child.
The output of this method can be used directly as the input to t... | python | sklearn/utils/_metadata_requests.py | 1,007 | [
"self",
"params",
"method",
"parent",
"caller"
] | false | 4 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
walk | def walk(self, where: str = "/") -> Iterator[tuple[str, list[str], list[str]]]:
"""
Walk the pytables group hierarchy for pandas objects.
This generator will yield the group path, subgroups and pandas object
names for each group.
Any non-pandas PyTables objects that are not a g... | Walk the pytables group hierarchy for pandas objects.
This generator will yield the group path, subgroups and pandas object
names for each group.
Any non-pandas PyTables objects that are not a group will be ignored.
The `where` group itself is listed first (preorder), then each of its
child groups (following an alph... | python | pandas/io/pytables.py | 1,598 | [
"self",
"where"
] | Iterator[tuple[str, list[str], list[str]]] | true | 7 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
compare | private static int compare(ByteBuffer buffer, DataBlock dataBlock, long pos, int len, CharSequence charSequence,
CompareType compareType) throws IOException {
if (charSequence.isEmpty()) {
return 0;
}
boolean addSlash = compareType == CompareType.MATCHES_ADDING_SLASH && !endsWith(charSequence, '/');
int c... | Returns if the bytes read from a {@link DataBlock} starts with the given
{@link CharSequence}.
@param buffer the buffer to use or {@code null}
@param dataBlock the source data block
@param pos the position in the data block where the string starts
@param len the number of bytes to read from the block
@param charSequenc... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipString.java | 191 | [
"buffer",
"dataBlock",
"pos",
"len",
"charSequence",
"compareType"
] | true | 17 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false | |
createMaybeNavigableKeySet | final Set<K> createMaybeNavigableKeySet() {
if (map instanceof NavigableMap) {
return new NavigableKeySet((NavigableMap<K, Collection<V>>) map);
} else if (map instanceof SortedMap) {
return new SortedKeySet((SortedMap<K, Collection<V>>) map);
} else {
return new KeySet(map);
}
} | List decorator that stays in sync with the multimap values for a key and supports rapid random
access. | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 921 | [] | true | 3 | 7.04 | google/guava | 51,352 | javadoc | false | |
npmLink | function npmLink(text, title) {
return (
'<% if (name == "templateSettings" || !/^(?:methods|properties|seq)$/i.test(category)) {' +
'print(' +
'"[' + text + '](https://www.npmjs.com/package/lodash." + name.toLowerCase() + ' +
'"' + (title == null ? '' : ' \\"' + title + '\\"') + ')"' +
... | Composes a npm link from `text` and optional `title`.
@private
@param {string} text The link text.
@param {string} [title] The link title.
@returns {string} Returns the composed npm link. | javascript | lib/main/build-doc.js | 45 | [
"text",
"title"
] | false | 2 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
generateBitVectors | @SafeVarargs
public static <E extends Enum<E>> long[] generateBitVectors(final Class<E> enumClass, final E... values) {
asEnum(enumClass);
Validate.noNullElements(values);
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
Collections.addAll(condensed, values);
final lon... | Creates a bit vector representation of the given subset of an Enum using as many {@code long}s as needed.
<p>This generates a value that is usable by {@link EnumUtils#processBitVectors}.</p>
<p>Use this method if you have more than 64 values in your Enum.</p>
@param enumClass the class of the enum we are working with, ... | java | src/main/java/org/apache/commons/lang3/EnumUtils.java | 148 | [
"enumClass"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
default_device | def default_device(self) -> L["cpu"]:
"""
The default device used for new Dask arrays.
For Dask, this always returns ``'cpu'``.
See Also
--------
__array_namespace_info__.capabilities,
__array_namespace_info__.default_dtypes,
__array_namespace_info__.dty... | The default device used for new Dask arrays.
For Dask, this always returns ``'cpu'``.
See Also
--------
__array_namespace_info__.capabilities,
__array_namespace_info__.default_dtypes,
__array_namespace_info__.dtypes,
__array_namespace_info__.devices
Returns
-------
device : Device
The default device used for new... | python | sklearn/externals/array_api_compat/dask/array/_info.py | 145 | [
"self"
] | L["cpu"] | true | 1 | 6.48 | scikit-learn/scikit-learn | 64,340 | unknown | false |
printRects | function printRects(rects: SuspenseNode['rects']): string {
if (rects === null) {
return ' rects={null}';
} else {
return ` rects={[${rects.map(rect => `{x:${rect.x},y:${rect.y},width:${rect.width},height:${rect.height}}`).join(', ')}]}`;
}
} | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/utils.js | 57 | [] | false | 3 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
findParentPackageJSON | function findParentPackageJSON(checkPath) {
const enabledPermission = permission.isEnabled();
const rootSeparatorIndex = StringPrototypeIndexOf(checkPath, path.sep);
let separatorIndex;
do {
separatorIndex = StringPrototypeLastIndexOf(checkPath, path.sep);
checkPath = StringPrototypeSlice(checkPath, 0... | Given a file path, walk the filesystem upwards until we find its closest parent
`package.json` file, stopping when:
1. we find a `package.json` file;
2. we find a path that we do not have permission to read;
3. we find a containing `node_modules` directory;
4. or, we reach the filesystem root
@returns {undefined | stri... | javascript | lib/internal/modules/package_json_reader.js | 142 | [
"checkPath"
] | false | 5 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
open | public static FileRecords open(File file,
boolean mutable,
boolean fileAlreadyExists,
int initFileSize,
boolean preallocate) throws IOException {
FileChannel channel = open... | 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 | 444 | [
"file",
"mutable",
"fileAlreadyExists",
"initFileSize",
"preallocate"
] | FileRecords | true | 3 | 8.24 | apache/kafka | 31,560 | javadoc | false |
hierarchy | public static Iterable<Class<?>> hierarchy(final Class<?> type) {
return hierarchy(type, Interfaces.EXCLUDE);
} | Gets an {@link Iterable} that can iterate over a class hierarchy in ascending (subclass to superclass) order,
excluding interfaces.
@param type the type to get the class hierarchy from.
@return Iterable an Iterable over the class hierarchy of the given class.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 1,171 | [
"type"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
check_async_run_results | def check_async_run_results(
results: list[ApplyResult],
success_message: str,
outputs: list[Output],
include_success_outputs: bool,
poll_time_seconds: float = 0.2,
skip_cleanup: bool = False,
summarize_on_ci: SummarizeAfter = SummarizeAfter.NO_SUMMARY,
summary_start_regexp: str | None =... | Check if all async results were success.
Exits with error if:
* exit code 1: some tasks failed
* exit code 2: some tasks were terminated on timeout
:param results: results of parallel runs (expected in the form of Tuple: (return_code, info)
:param outputs: outputs where results are written to
:param success_message:... | python | dev/breeze/src/airflow_breeze/utils/parallel.py | 375 | [
"results",
"success_message",
"outputs",
"include_success_outputs",
"poll_time_seconds",
"skip_cleanup",
"summarize_on_ci",
"summary_start_regexp",
"terminated_on_timeout"
] | true | 3 | 6.4 | apache/airflow | 43,597 | sphinx | false | |
predict | def predict(self, X):
"""Predict the class labels for the provided data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features), \
or (n_queries, n_indexed) if metric == 'precomputed', or None
Test samples. If `None`, predictio... | Predict the class labels for the provided data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features), \
or (n_queries, n_indexed) if metric == 'precomputed', or None
Test samples. If `None`, predictions for all indexed points are
returned; in this case, points are not ... | python | sklearn/neighbors/_classification.py | 245 | [
"self",
"X"
] | false | 14 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getClass | public static Class<?> getClass(final String className, final boolean initialize) throws ClassNotFoundException {
final ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
final ClassLoader loader = contextCL == null ? ClassUtils.class.getClassLoader() : contextCL;
return get... | Gets the class represented by {@code className} using the current thread's context class loader. 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 b... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 648 | [
"className",
"initialize"
] | true | 2 | 7.44 | apache/commons-lang | 2,896 | javadoc | false | |
toString | @Override
public String toString() {
// enclose IPv6 hosts in square brackets for readability
String hostString = host.contains(":") ? "[" + host + "]" : host;
return listener + "://" + hostString + ":" + port;
} | @deprecated Since 4.1. Use {@link #listener()} instead. This function will be removed in 5.0. | java | clients/src/main/java/org/apache/kafka/clients/admin/RaftVoterEndpoint.java | 103 | [] | String | true | 2 | 7.2 | apache/kafka | 31,560 | javadoc | false |
between | public boolean between(final A b, final A c) {
return betweenOrdered(b, c) || betweenOrdered(c, b);
} | Tests if {@code [b <= a <= c]} or {@code [b >= a >= c]} where the {@code a} is object passed to {@link #is}.
@param b the object to compare to the base object
@param c the object to compare to the base object
@return true if the base object is between b and c | java | src/main/java/org/apache/commons/lang3/compare/ComparableUtils.java | 54 | [
"b",
"c"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
remove | function remove(array, predicate) {
var result = [];
if (!(array && array.length)) {
return result;
}
var index = -1,
indexes = [],
length = array.length;
predicate = getIteratee(predicate, 3);
while (++index < length) {
var value = array[index];
... | Removes all elements from `array` that `predicate` returns truthy for
and returns an array of the removed elements. The predicate is invoked
with three arguments: (value, index, array).
**Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
to pull elements from an array by value.
@static
@memberOf _
@s... | javascript | lodash.js | 7,950 | [
"array",
"predicate"
] | false | 5 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
unknownTaggedFields | List<RawTaggedField> unknownTaggedFields(); | Returns a list of tagged fields which this software can't understand.
@return The raw tagged fields. | java | clients/src/main/java/org/apache/kafka/common/protocol/Message.java | 96 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
value | public ByteBuffer value() {
return Utils.sizeDelimited(buffer, valueSizeOffset());
} | A ByteBuffer containing the value of this record
@return the value or null if the value for this record is null | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 250 | [] | ByteBuffer | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
compilePattern | static CommonPattern compilePattern(String pattern) {
Preconditions.checkNotNull(pattern);
return patternCompiler.compile(pattern);
} | Returns the string if it is not empty, or a null string otherwise.
@param string the string to test and possibly return
@return {@code string} if it is not empty; {@code null} otherwise | java | android/guava/src/com/google/common/base/Platform.java | 89 | [
"pattern"
] | CommonPattern | true | 1 | 6.96 | google/guava | 51,352 | javadoc | false |
_gotitem | def _gotitem(
self,
key: IndexLabel,
ndim: int,
subset: DataFrame | Series | None = None,
) -> DataFrame | Series:
"""
Sub-classes to define. Return a sliced object.
Parameters
----------
key : string / list of selections
ndim : {1, 2}... | Sub-classes to define. Return a sliced object.
Parameters
----------
key : string / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset to act on | python | pandas/core/frame.py | 11,333 | [
"self",
"key",
"ndim",
"subset"
] | DataFrame | Series | true | 3 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
toString | @Override
public String toString() {
return name;
} | The string value is overridden to return the standard name.
<p>
For example, {@code "1.5"}.
</p>
@return the name, not null. | java | src/main/java/org/apache/commons/lang3/JavaVersion.java | 413 | [] | String | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
wrapperPlant | function wrapperPlant(value) {
var result,
parent = this;
while (parent instanceof baseLodash) {
var clone = wrapperClone(parent);
clone.__index__ = 0;
clone.__values__ = undefined;
if (result) {
previous.__wrapped__ = clone;
} else {
re... | Creates a clone of the chain sequence planting `value` as the wrapped value.
@name plant
@memberOf _
@since 3.2.0
@category Seq
@param {*} value The value to plant.
@returns {Object} Returns the new `lodash` wrapper instance.
@example
function square(n) {
return n * n;
}
var wrapped = _([1, 2]).map(square);
var other... | javascript | lodash.js | 9,080 | [
"value"
] | false | 4 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
compareTo | @Override
public int compareTo(final Fraction other) {
if (this == other) {
return 0;
}
if (numerator == other.numerator && denominator == other.denominator) {
return 0;
}
// otherwise see which is less
final long first = (long) numerator * (l... | Compares this object to another based on size.
<p>
Note: this class has a natural ordering that is inconsistent with equals, because, for example, equals treats 1/2 and 2/4 as different, whereas compareTo
treats them as equal.
</p>
@param other the object to compare to
@return -1 if this is less, 0 if equal, +1 if grea... | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 588 | [
"other"
] | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
corrwith | def corrwith(
self,
other: DataFrame | Series,
axis: Axis = 0,
drop: bool = False,
method: CorrelationMethod = "pearson",
numeric_only: bool = False,
min_periods: int | None = None,
) -> Series:
"""
Compute pairwise correlation.
Pairwi... | Compute pairwise correlation.
Pairwise correlation is computed between rows or columns of
DataFrame with rows or columns of Series or DataFrame. DataFrames
are first aligned along both axes before computing the
correlations.
Parameters
----------
other : DataFrame, Series
Object with which to compute correlations... | python | pandas/core/frame.py | 12,555 | [
"self",
"other",
"axis",
"drop",
"method",
"numeric_only",
"min_periods"
] | Series | true | 12 | 8.24 | pandas-dev/pandas | 47,362 | numpy | false |
flags | def flags(self) -> Flags:
"""
Get the properties associated with this pandas object.
The available flags are
* :attr:`Flags.allows_duplicate_labels`
See Also
--------
Flags : Flags that apply to pandas objects.
DataFrame.attrs : Global metadata applying... | Get the properties associated with this pandas object.
The available flags are
* :attr:`Flags.allows_duplicate_labels`
See Also
--------
Flags : Flags that apply to pandas objects.
DataFrame.attrs : Global metadata applying to this dataset.
Notes
-----
"Flags" differ from "metadata". Flags reflect properties of the... | python | pandas/core/generic.py | 363 | [
"self"
] | Flags | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
get_rocm_target_archs | def get_rocm_target_archs() -> list[str]:
"""
Get target architectures from environment or config.
Returns: List of architecture strings (e.g., ['gfx90a', 'gfx942'])
"""
# Check PYTORCH_ROCM_ARCH environment variable
env_archs = os.environ.get("PYTORCH_ROCM_ARCH", "").strip()
if env_archs:
... | Get target architectures from environment or config.
Returns: List of architecture strings (e.g., ['gfx90a', 'gfx942']) | python | torch/_inductor/rocm_multiarch_utils.py | 71 | [] | list[str] | true | 6 | 6.88 | pytorch/pytorch | 96,034 | unknown | false |
toByteArray | static byte[] toByteArray(InputStream in, long expectedSize) throws IOException {
checkArgument(expectedSize >= 0, "expectedSize (%s) must be non-negative", expectedSize);
if (expectedSize > MAX_ARRAY_LEN) {
throw new OutOfMemoryError(expectedSize + " bytes is too large to fit in a byte array");
}
... | Reads all bytes from an input stream into a byte array. The given expected size is used to
create an initial byte array, but if the actual number of bytes read from the stream differs,
the correct result will be returned anyway. | java | android/guava/src/com/google/common/io/ByteStreams.java | 250 | [
"in",
"expectedSize"
] | true | 5 | 6 | google/guava | 51,352 | javadoc | false | |
_finalize_columns_and_data | def _finalize_columns_and_data(
content: np.ndarray, # ndim == 2
columns: Index | None,
dtype: DtypeObj | None,
) -> tuple[list[ArrayLike], Index]:
"""
Ensure we have valid columns, cast object dtypes if possible.
"""
contents = list(content.T)
try:
columns = _validate_or_index... | Ensure we have valid columns, cast object dtypes if possible. | python | pandas/core/internals/construction.py | 872 | [
"content",
"columns",
"dtype"
] | tuple[list[ArrayLike], Index] | true | 3 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
merge | static ReleasableExponentialHistogram merge(
int maxBucketCount,
ExponentialHistogramCircuitBreaker breaker,
ExponentialHistogram... histograms
) {
return merge(maxBucketCount, breaker, List.of(histograms).iterator());
} | Merges the provided exponential histograms to a new, single histogram with at most the given amount of buckets.
@param maxBucketCount the maximum number of buckets the result histogram is allowed to have
@param breaker the circuit breaker to use to limit memory allocations
@param histograms the histograms to merge
@ret... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogram.java | 291 | [
"maxBucketCount",
"breaker"
] | ReleasableExponentialHistogram | true | 1 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
equals | static boolean equals(ExponentialHistogram a, ExponentialHistogram b) {
if (a == b) return true;
if (a == null) return false;
if (b == null) return false;
return a.scale() == b.scale()
&& a.sum() == b.sum()
&& equalsIncludingNaN(a.min(), b.min())
&& e... | Value-based equality for exponential histograms.
@param a the first histogram (can be null)
@param b the second histogram (can be null)
@return true, if both histograms are equal | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogram.java | 169 | [
"a",
"b"
] | true | 10 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
hermvander3d | def hermvander3d(x, y, z, deg):
"""Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points ``(x, y, z)``. If `l`, `m`, `n` are the given degrees in `x`, `y`, `z`,
then The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (m+1)(n+... | Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points ``(x, y, z)``. If `l`, `m`, `n` are the given degrees in `x`, `y`, `z`,
then The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (m+1)(n+1)i + (n+1)j + k] = H_i(x)*H_j(y)*H_k(z),
where ``0 <=... | python | numpy/polynomial/hermite.py | 1,244 | [
"x",
"y",
"z",
"deg"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
nextBoolean | @Deprecated
public static boolean nextBoolean() {
return secure().randomBoolean();
} | Generates a random boolean value.
@return the random boolean.
@since 3.5
@deprecated Use {@link #secure()}, {@link #secureStrong()}, or {@link #insecure()}. | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 113 | [] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
set_default_printstyle | def set_default_printstyle(style):
"""
Set the default format for the string representation of polynomials.
Values for ``style`` must be valid inputs to ``__format__``, i.e. 'ascii'
or 'unicode'.
Parameters
----------
style : str
Format string for default printing style. Must be ei... | Set the default format for the string representation of polynomials.
Values for ``style`` must be valid inputs to ``__format__``, i.e. 'ascii'
or 'unicode'.
Parameters
----------
style : str
Format string for default printing style. Must be either 'ascii' or
'unicode'.
Notes
-----
The default format depends ... | python | numpy/polynomial/__init__.py | 135 | [
"style"
] | false | 3 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
geoAzDistanceRads | LatLng geoAzDistanceRads(double az, double distance) {
az = Vec2d.posAngleRads(az);
// from https://www.movable-type.co.uk/scripts/latlong-vectors.html
// N = {0,0,1} – vector representing north pole
// d̂e = N×a – east vector at a
// dn = a×de – north vector at a
// d = ... | Computes the point on the sphere with a specified azimuth and distance from
this point.
@param az The desired azimuth.
@param distance The desired distance.
@return The LatLng point. | java | libs/h3/src/main/java/org/elasticsearch/h3/Vec3d.java | 170 | [
"az",
"distance"
] | LatLng | true | 1 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
_can_add_to_bucket | def _can_add_to_bucket(
self,
bucket_info: CollBucket,
candidate: fx.Node,
) -> bool:
"""
Check if candidate can be added to bucket without breaking comm/compute overlap.
Strategy: Try all timeline positions - combinations of [existing_start, candidate_start]
... | Check if candidate can be added to bucket without breaking comm/compute overlap.
Strategy: Try all timeline positions - combinations of [existing_start, candidate_start]
x [existing_wait, candidate_wait]. For each position, verify:
1. Hiding intervals preserved - for any (start, hiding_compute, wait) interval, no othe... | python | torch/_inductor/fx_passes/overlap_preserving_bucketer.py | 795 | [
"self",
"bucket_info",
"candidate"
] | bool | true | 6 | 6.32 | pytorch/pytorch | 96,034 | unknown | false |
_matchesSubString | function _matchesSubString(word: string, wordToMatchAgainst: string, i: number, j: number): IMatch[] | null {
if (i === word.length) {
return [];
} else if (j === wordToMatchAgainst.length) {
return null;
} else {
if (word[i] === wordToMatchAgainst[j]) {
let result: IMatch[] | null = null;
if (result = _... | @returns A filter which combines the provided set
of filters with an or. The *first* filters that
matches defined the return value of the returned
filter. | typescript | src/vs/base/common/filters.ts | 106 | [
"word",
"wordToMatchAgainst",
"i",
"j"
] | true | 7 | 7.04 | microsoft/vscode | 179,840 | jsdoc | false | |
setIgnoredMatcher | public StrTokenizer setIgnoredMatcher(final StrMatcher ignored) {
if (ignored != null) {
this.ignoredMatcher = ignored;
}
return this;
} | Sets the matcher for characters to ignore.
<p>
These characters are ignored when parsing the String, unless they are
within a quoted region.
</p>
@param ignored the ignored matcher to use, null ignored.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 978 | [
"ignored"
] | StrTokenizer | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
retrieve_configuration_description | def retrieve_configuration_description(
include_airflow: bool = True,
include_providers: bool = True,
selected_provider: str | None = None,
) -> dict[str, dict[str, Any]]:
"""
Read Airflow configuration description from YAML file.
:param include_airflow: Include Airflow configs
:param inclu... | Read Airflow configuration description from YAML file.
:param include_airflow: Include Airflow configs
:param include_providers: Include provider configs
:param selected_provider: If specified, include selected provider only
:return: Python dictionary containing configs & their info | python | airflow-core/src/airflow/configuration.py | 149 | [
"include_airflow",
"include_providers",
"selected_provider"
] | dict[str, dict[str, Any]] | true | 6 | 7.6 | apache/airflow | 43,597 | sphinx | false |
destroy | @Override
public void destroy() throws Exception {
if (isSingleton()) {
destroyInstance(this.singletonInstance);
}
} | Destroy the singleton instance, if any.
@see #destroyInstance(Object) | java | spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java | 191 | [] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
unwatchFile | function unwatchFile(filename, listener) {
filename = getValidatedPath(filename);
filename = pathModule.resolve(filename);
const stat = statWatchers.get(filename);
if (stat === undefined) return;
const watchers = require('internal/fs/watchers');
if (typeof listener === 'function') {
const beforeListene... | Stops watching for changes on `filename`.
@param {string | Buffer | URL} filename
@param {() => any} [listener]
@returns {void} | javascript | lib/fs.js | 2,600 | [
"filename",
"listener"
] | false | 6 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
lookupScope | ApiRequestScope lookupScope(T key); | Define the scope of a given key for lookup. Key lookups are complicated
by the need to accommodate different batching mechanics. For example,
a `Metadata` request supports arbitrary batching of topic partitions in
order to discover partitions leaders. This can be supported by returning
a single scope object for all key... | java | clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminApiLookupStrategy.java | 54 | [
"key"
] | ApiRequestScope | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
appendExportsOfImportEqualsDeclaration | function appendExportsOfImportEqualsDeclaration(statements: Statement[] | undefined, decl: ImportEqualsDeclaration): Statement[] | undefined {
if (moduleInfo.exportEquals) {
return statements;
}
return appendExportsOfDeclaration(statements, decl);
} | Appends the export of an ImportEqualsDeclaration to a statement list, returning the
statement list.
@param statements A statement list to which the down-level export statements are to be
appended. If `statements` is `undefined`, a new array is allocated if statements are
appended.
@param decl The declaration whos... | typescript | src/compiler/transformers/module/system.ts | 1,055 | [
"statements",
"decl"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
from | static SpringConfigurationPropertySource from(PropertySource<?> source) {
Assert.notNull(source, "'source' must not be null");
boolean systemEnvironmentSource = isSystemEnvironmentPropertySource(source);
PropertyMapper[] mappers = (!systemEnvironmentSource) ? DEFAULT_MAPPERS : SYSTEM_ENVIRONMENT_MAPPERS;
return... | Create a new {@link SpringConfigurationPropertySource} for the specified
{@link PropertySource}.
@param source the source Spring {@link PropertySource}
@return a {@link SpringConfigurationPropertySource} or
{@link SpringIterableConfigurationPropertySource} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java | 171 | [
"source"
] | SpringConfigurationPropertySource | true | 3 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false |
nullToEmpty | public static double[] nullToEmpty(final double[] array) {
return isEmpty(array) ? EMPTY_DOUBLE_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,413 | [
"array"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
unmodifiableNavigableSet | public static <E extends @Nullable Object> NavigableSet<E> unmodifiableNavigableSet(
NavigableSet<E> set) {
if (set instanceof ImmutableCollection || set instanceof UnmodifiableNavigableSet) {
return set;
}
return new UnmodifiableNavigableSet<>(set);
} | Returns an unmodifiable view of the specified navigable set. This method allows modules to
provide users with "read-only" access to internal navigable sets. Query operations on the
returned set "read through" to the specified set, and attempts to modify the returned set,
whether direct or via its collection views, resu... | java | android/guava/src/com/google/common/collect/Sets.java | 1,906 | [
"set"
] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
trimToNull | public static String trimToNull(final String str) {
final String ts = trim(str);
return isEmpty(ts) ? null : ts;
} | Removes control characters (char <= 32) from both ends of this String returning {@code null} if the String is empty ("") after the trim or if it is
{@code null}.
<p>
The String is trimmed using {@link String#trim()}. Trim removes start and end characters <= 32. To strip whitespace use {@link #stripToNull(String)}... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,772 | [
"str"
] | String | true | 2 | 7.84 | apache/commons-lang | 2,896 | javadoc | false |
parsePropertyNameWorker | function parsePropertyNameWorker(allowComputedPropertyNames: boolean): PropertyName {
if (token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral || token() === SyntaxKind.BigIntLiteral) {
const node = parseLiteralNode() as StringLiteral | NumericLiteral | BigIntLiteral;
... | 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 | 2,714 | [
"allowComputedPropertyNames"
] | true | 7 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
map | def map(self, func: Callable, subset: Subset | None = None, **kwargs) -> Styler:
"""
Apply a CSS-styling function elementwise.
Updates the HTML representation with the result.
Parameters
----------
func : function
``func`` should take a scalar and return a s... | Apply a CSS-styling function elementwise.
Updates the HTML representation with the result.
Parameters
----------
func : function
``func`` should take a scalar and return a string.
%(subset)s
**kwargs : dict
Pass along to ``func``.
Returns
-------
Styler
Instance of class with CSS-styling function applied... | python | pandas/io/formats/style.py | 2,138 | [
"self",
"func",
"subset"
] | Styler | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
to_dense | def to_dense(self) -> Series:
"""
Convert a Series from sparse values to dense.
Returns
-------
Series:
A Series with the same values, stored as a dense array.
Examples
--------
>>> series = pd.Series(pd.arrays.SparseArray([0, 1, 0]))
... | Convert a Series from sparse values to dense.
Returns
-------
Series:
A Series with the same values, stored as a dense array.
Examples
--------
>>> series = pd.Series(pd.arrays.SparseArray([0, 1, 0]))
>>> series
0 0
1 1
2 0
dtype: Sparse[int64, 0]
>>> series.sparse.to_dense()
0 0
1 1
2 0
dtype:... | python | pandas/core/arrays/sparse/accessor.py | 244 | [
"self"
] | Series | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | unknown | false |
pct_change | def pct_change(
self,
periods: int = 1,
fill_method: None = None,
freq=None,
):
"""
Calculate pct_change of each value to previous entry in group.
Parameters
----------
periods : int, default 1
Periods to shift for calculating perc... | Calculate pct_change of each value to previous entry in group.
Parameters
----------
periods : int, default 1
Periods to shift for calculating percentage change. Comparing with
a period of 1 means adjacent elements are compared, whereas a period
of 2 compares every other element.
fill_method : None
Mu... | python | pandas/core/groupby/groupby.py | 5,350 | [
"self",
"periods",
"fill_method",
"freq"
] | true | 5 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false | |
ping | def ping(self, destination=None, timeout=1.0, **kwargs):
"""Ping all (or specific) workers.
>>> app.control.ping()
[{'celery@node1': {'ok': 'pong'}}, {'celery@node2': {'ok': 'pong'}}]
>>> app.control.ping(destination=['celery@node2'])
[{'celery@node2': {'ok': 'pong'}}]
... | Ping all (or specific) workers.
>>> app.control.ping()
[{'celery@node1': {'ok': 'pong'}}, {'celery@node2': {'ok': 'pong'}}]
>>> app.control.ping(destination=['celery@node2'])
[{'celery@node2': {'ok': 'pong'}}]
Returns:
List[Dict]: List of ``{HOSTNAME: {'ok': 'pong'}}`` dictionaries.
See Also:
:meth:`broadcas... | python | celery/app/control.py | 558 | [
"self",
"destination",
"timeout"
] | false | 1 | 7.04 | celery/celery | 27,741 | unknown | false | |
count | def count(self, axis=None, keepdims=np._NoValue):
"""
Count the non-masked elements of the array along the given axis.
Parameters
----------
axis : None or int or tuple of ints, optional
Axis or axes along which the count is performed.
The default, None, ... | Count the non-masked elements of the array along the given axis.
Parameters
----------
axis : None or int or tuple of ints, optional
Axis or axes along which the count is performed.
The default, None, performs the count over all
the dimensions of the input array. `axis` may be negative, in
which case i... | python | numpy/ma/core.py | 4,593 | [
"self",
"axis",
"keepdims"
] | false | 14 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
parse | @Override
public Date parse(final String source) throws ParseException {
final ParsePosition pp = new ParsePosition(0);
final Date date = parse(source, pp);
if (date == null) {
// Add a note regarding supported date range
if (locale.equals(JAPANESE_IMPERIAL)) {
... | Initializes derived fields from defining fields. This is called from constructor and from readObject (de-serialization)
@param definingCalendar the {@link java.util.Calendar} instance used to initialize this FastDateParser | java | src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 1,020 | [
"source"
] | Date | true | 3 | 6.08 | apache/commons-lang | 2,896 | javadoc | false |
list_nodegroups | def list_nodegroups(
self,
clusterName: str,
verbose: bool = False,
) -> list:
"""
List all Amazon EKS managed node groups associated with the specified cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.list_nodegroups`
:param clusterNa... | List all Amazon EKS managed node groups associated with the specified cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.list_nodegroups`
:param clusterName: The name of the Amazon EKS Cluster containing nodegroups to list.
:param verbose: Provides additional logging if set to True. Defaults to False.
:... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 480 | [
"self",
"clusterName",
"verbose"
] | list | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
check_symmetric | def check_symmetric(array, *, tol=1e-10, raise_warning=True, raise_exception=False):
"""Make sure that array is 2D, square and symmetric.
If the array is not symmetric, then a symmetrized version is returned.
Optionally, a warning or exception is raised if the matrix is not
symmetric.
Parameters
... | Make sure that array is 2D, square and symmetric.
If the array is not symmetric, then a symmetrized version is returned.
Optionally, a warning or exception is raised if the matrix is not
symmetric.
Parameters
----------
array : {ndarray, sparse matrix}
Input object to check / convert. Must be two-dimensional and ... | python | sklearn/utils/validation.py | 1,505 | [
"array",
"tol",
"raise_warning",
"raise_exception"
] | false | 11 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
toString | @Override
public String toString() {
return (this.pid != null) ? String.valueOf(this.pid) : "???";
} | Return the application PID as a {@link Long}.
@return the application PID or {@code null}
@since 3.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java | 96 | [] | String | true | 2 | 8.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
checkWeightWithWeigher | private void checkWeightWithWeigher() {
if (weigher == null) {
checkState(maximumWeight == UNSET_INT, "maximumWeight requires weigher");
} else {
if (strictParsing) {
checkState(maximumWeight != UNSET_INT, "weigher requires maximumWeight");
} else {
if (maximumWeight == UNSET_I... | Builds a cache which does not automatically load values when keys are requested.
<p>Consider {@link #build(CacheLoader)} instead, if it is feasible to implement a {@code
CacheLoader}.
<p>This method does not alter the state of this {@code CacheBuilder} instance, so it can be
invoked again to create multiple independent... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 1,064 | [] | void | true | 4 | 7.92 | google/guava | 51,352 | javadoc | false |
removeAll | @CanIgnoreReturnValue
public static boolean removeAll(Iterable<?> removeFrom, Collection<?> elementsToRemove) {
return (removeFrom instanceof Collection)
? ((Collection<?>) removeFrom).removeAll(checkNotNull(elementsToRemove))
: Iterators.removeAll(removeFrom.iterator(), elementsToRemove);
} | Removes, from an iterable, every element that belongs to the provided collection.
<p>This method calls {@link Collection#removeAll} if {@code iterable} is a collection, and
{@link Iterators#removeAll} otherwise.
@param removeFrom the iterable to (potentially) remove elements from
@param elementsToRemove the elements to... | java | android/guava/src/com/google/common/collect/Iterables.java | 147 | [
"removeFrom",
"elementsToRemove"
] | true | 2 | 7.28 | google/guava | 51,352 | javadoc | false | |
startHeartbeatThreadIfNeeded | private synchronized void startHeartbeatThreadIfNeeded() {
if (heartbeatThread == null) {
heartbeatThread = heartbeatThreadSupplier.orElse(HeartbeatThread::new).get();
heartbeatThread.start();
}
} | Ensure the group is active (i.e., joined and synced)
@param timer Timer bounding how long this method can block
@throws KafkaException if the callback throws exception
@return true iff the group is active | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 424 | [] | void | true | 2 | 7.6 | apache/kafka | 31,560 | javadoc | false |
onSendError | public void onSendError(ProducerRecord<K, V> record, TopicPartition interceptTopicPartition, Exception exception) {
for (Plugin<ProducerInterceptor<K, V>> interceptorPlugin : this.interceptorPlugins) {
try {
Headers headers = record != null ? record.headers() : new RecordHeaders();
... | This method is called when sending the record fails in {@link ProducerInterceptor#onSend
(ProducerRecord)} method. This method calls {@link ProducerInterceptor#onAcknowledgement(RecordMetadata, Exception, Headers)}
method for each interceptor
@param record The record from client
@param interceptTopicPartition The topi... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerInterceptors.java | 113 | [
"record",
"interceptTopicPartition",
"exception"
] | void | true | 8 | 6.4 | apache/kafka | 31,560 | javadoc | false |
putmask | def putmask(self, mask, new) -> list[Block]:
"""
putmask the data to the block; it is possible that we may create a
new dtype of block
Return the resulting block(s).
Parameters
----------
mask : np.ndarray[bool], SparseArray[bool], or BooleanArray
new : ... | putmask the data to the block; it is possible that we may create a
new dtype of block
Return the resulting block(s).
Parameters
----------
mask : np.ndarray[bool], SparseArray[bool], or BooleanArray
new : an ndarray/object
Returns
-------
List[Block] | python | pandas/core/internals/blocks.py | 1,144 | [
"self",
"mask",
"new"
] | list[Block] | true | 10 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
resolve | private List<StandardConfigDataResource> resolve(Set<StandardConfigDataReference> references) {
List<StandardConfigDataResource> resolved = new ArrayList<>();
for (StandardConfigDataReference reference : references) {
resolved.addAll(resolve(reference));
}
if (resolved.isEmpty()) {
resolved.addAll(resolve... | Create a new {@link StandardConfigDataLocationResolver} instance.
@param logFactory the factory for loggers to use
@param binder a binder backed by the initial {@link Environment}
@param resourceLoader a {@link ResourceLoader} used to load resources | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java | 259 | [
"references"
] | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
registerShutdownHookIfNecessary | private void registerShutdownHookIfNecessary(Environment environment, LoggingSystem loggingSystem) {
if (environment.getProperty(REGISTER_SHUTDOWN_HOOK_PROPERTY, Boolean.class, true)) {
Runnable shutdownHandler = loggingSystem.getShutdownHandler();
if (shutdownHandler != null && shutdownHookRegistered.compareAn... | Set logging levels based on relevant {@link Environment} properties.
@param system the logging system
@param environment the environment
@since 2.2.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java | 425 | [
"environment",
"loggingSystem"
] | void | true | 4 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
create | public static NodeApiVersions create(Collection<ApiVersion> overrides) {
List<ApiVersion> apiVersions = new LinkedList<>(overrides);
for (ApiKeys apiKey : ApiKeys.clientApis()) {
boolean exists = false;
for (ApiVersion apiVersion : apiVersions) {
if (apiVersion.ap... | Create a NodeApiVersions object.
@param overrides API versions to override. Any ApiVersion not specified here will be set to the current client
value.
@return A new NodeApiVersions object. | java | clients/src/main/java/org/apache/kafka/clients/NodeApiVersions.java | 72 | [
"overrides"
] | NodeApiVersions | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false |
atMost | public boolean atMost(final JavaVersion requiredVersion) {
return this.value <= requiredVersion.value;
} | Tests whether this version of Java is at most the version of Java passed in.
<p>
For example:
</p>
<pre>
{@code
myVersion.atMost(JavaVersion.JAVA_1_4)
}</pre>
@param requiredVersion the version to check against, not null.
@return true if this version is equal to or greater than the specified version.
@since 3.9 | java | src/main/java/org/apache/commons/lang3/JavaVersion.java | 400 | [
"requiredVersion"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
isEnabled | private static boolean isEnabled() {
if (enabled == Enabled.DETECT) {
if (ansiCapable == null) {
ansiCapable = detectIfAnsiCapable();
}
return ansiCapable;
}
return enabled == Enabled.ALWAYS;
} | 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 | 146 | [] | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
toAddrString | public static String toAddrString(InetAddress ip) {
checkNotNull(ip);
if (ip instanceof Inet4Address) {
// For IPv4, Java's formatting is good enough.
// requireNonNull accommodates Android's @RecentlyNullable annotation on getHostAddress
return requireNonNull(ip.getHostAddress());
}
b... | Returns the string representation of an {@link InetAddress}.
<p>For IPv4 addresses, this is identical to {@link InetAddress#getHostAddress()}, but for IPv6
addresses, the output follows <a href="http://tools.ietf.org/html/rfc5952">RFC 5952</a> section
4. The main difference is that this method uses "::" for zero compre... | java | android/guava/src/com/google/common/net/InetAddresses.java | 466 | [
"ip"
] | String | true | 3 | 8.08 | google/guava | 51,352 | javadoc | false |
southPolarH3Address | public static String southPolarH3Address(int res) {
return h3ToString(southPolarH3(res));
} | Find the h3 address containing the South Pole at the given resolution.
@param res the provided resolution.
@return the h3 address containing the South Pole. | java | libs/h3/src/main/java/org/elasticsearch/h3/H3.java | 573 | [
"res"
] | String | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
builder | public static <O> Builder<O> builder() {
return new Builder<>();
} | Creates a new builder.
@param <O> the wrapped object type.
@return a new builder.
@since 3.18.0 | java | src/main/java/org/apache/commons/lang3/concurrent/locks/LockingVisitors.java | 512 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
underNodeModules | function underNodeModules(url) {
if (url.protocol !== 'file:') { return false; } // We determine module types for other protocols based on MIME header
return StringPrototypeIncludes(url.pathname, '/node_modules/');
} | Determine whether the given file URL is under a `node_modules` folder.
This function assumes that the input has already been verified to be a `file:` URL,
and is a file rather than a folder.
@param {URL} url
@returns {boolean} | javascript | lib/internal/modules/esm/get_format.js | 87 | [
"url"
] | false | 2 | 6.16 | nodejs/node | 114,839 | jsdoc | false | |
_remove_empty_lines | def _remove_empty_lines(self, lines: list[list[T]]) -> list[list[T]]:
"""
Iterate through the lines and remove any that are
either empty or contain only one whitespace value
Parameters
----------
lines : list of list of Scalars
The array of lines that we are ... | Iterate through the lines and remove any that are
either empty or contain only one whitespace value
Parameters
----------
lines : list of list of Scalars
The array of lines that we are to filter.
Returns
-------
filtered_lines : list of list of Scalars
The same array of lines with the "empty" ones removed. | python | pandas/io/parsers/python_parser.py | 1,041 | [
"self",
"lines"
] | list[list[T]] | true | 4 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
create | public static ExponentialHistogramGenerator create(int maxBucketCount, ExponentialHistogramCircuitBreaker circuitBreaker) {
long size = estimateBaseSize(maxBucketCount);
circuitBreaker.adjustBreaker(size);
try {
return new ExponentialHistogramGenerator(maxBucketCount, circuitBreaker)... | Creates a new instance with the specified maximum number of buckets.
@param maxBucketCount the maximum number of buckets for the generated histogram
@param circuitBreaker the circuit breaker to use to limit memory allocations | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramGenerator.java | 63 | [
"maxBucketCount",
"circuitBreaker"
] | ExponentialHistogramGenerator | true | 2 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
create | public static ZeroBucket create(long index, int scale, long count) {
if (index == MINIMAL_EMPTY.index && scale == MINIMAL_EMPTY.scale) {
return minimalWithCount(count);
}
return new ZeroBucket(index, scale, count);
} | Creates a zero bucket from the given threshold represented as exponentially scaled number.
@param index the index of the exponentially scaled number defining the zero threshold
@param scale the corresponding scale for the index
@param count the number of values in the bucket
@return the new {@link ZeroBucket} | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ZeroBucket.java | 142 | [
"index",
"scale",
"count"
] | ZeroBucket | true | 3 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false |
addCopies | @CanIgnoreReturnValue
@Override
public Builder<E> addCopies(E element, int occurrences) {
super.addCopies(element, occurrences);
return this;
} | Adds a number of occurrences of an element to this {@code ImmutableSortedMultiset}.
@param element the element to add
@param occurrences the number of occurrences of the element to add. May be zero, in which
case no change will be made.
@return this {@code Builder} object
@throws NullPointerException if {@code elem... | java | guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 504 | [
"element",
"occurrences"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
generate_value_label | def generate_value_label(self, byteorder: str) -> bytes:
"""
Generate the binary representation of the value labels.
Parameters
----------
byteorder : str
Byte order of the output
Returns
-------
value_label : bytes
Bytes containi... | Generate the binary representation of the value labels.
Parameters
----------
byteorder : str
Byte order of the output
Returns
-------
value_label : bytes
Bytes containing the formatted value label | python | pandas/io/stata.py | 631 | [
"self",
"byteorder"
] | bytes | true | 6 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
split | public static String[] split(final String str, final char separatorChar) {
return splitWorker(str, separatorChar, false);
} | Splits the provided text into an array, separator specified. This is an alternative to using StringTokenizer.
<p>
The separator is not included in the returned String array. Adjacent separators are treated as one separator. For more control over the split use the
StrTokenizer class.
</p>
<p>
A {@code null} input String... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,064 | [
"str",
"separatorChar"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
always | static PropertySourceOptions always(Option... options) {
return always(Options.of(options));
} | Create a new {@link PropertySourceOptions} instance that always returns the
same options regardless of the property source.
@param options the options to return
@return a new {@link PropertySourceOptions} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java | 133 | [] | PropertySourceOptions | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
offsetsForTimes | @Override
public Map<TopicPartition, OffsetAndTimestamp> offsetsForTimes(Map<TopicPartition, Long> timestampsToSearch) {
return delegate.offsetsForTimes(timestampsToSearch);
} | Look up the offsets for the given partitions by timestamp. The returned offset for each partition is the
earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partition.
This is a blocking call. The consumer does not have to be assigned the partitions.
If the message forma... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 1,586 | [
"timestampsToSearch"
] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
english_lower | def english_lower(s):
""" Apply English case rules to convert ASCII strings to all lower case.
This is an internal utility function to replace calls to str.lower() such
that we can avoid changing behavior with changing locales. In particular,
Turkish has distinct dotted and dotless variants of the Lati... | Apply English case rules to convert ASCII strings to all lower case.
This is an internal utility function to replace calls to str.lower() such
that we can avoid changing behavior with changing locales. In particular,
Turkish has distinct dotted and dotless variants of the Latin letter "I" in
both lowercase and upperca... | python | numpy/_core/_string_helpers.py | 16 | [
"s"
] | false | 1 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
replace_by_example | def replace_by_example(
self,
replacement_fn: ReplaceFn,
args: Sequence[Any],
trace_fn: Optional[TraceFn] = None,
run_functional_passes: bool = True,
) -> None:
"""Replace with a graph generated by tracing the replacement_fn.
Args:
run_functional_... | Replace with a graph generated by tracing the replacement_fn.
Args:
run_functional_passes (bool). If we should run passes that
assume functional IR (like DCE, remove_noop_ops), on the
replacement graph. | python | torch/_inductor/pattern_matcher.py | 236 | [
"self",
"replacement_fn",
"args",
"trace_fn",
"run_functional_passes"
] | None | true | 14 | 6.48 | pytorch/pytorch | 96,034 | google | false |
register_module_as_pytree_input_node | def register_module_as_pytree_input_node(cls: type[torch.nn.Module]) -> None:
"""
Registers a module as a valid input type for :func:`torch.export.export`.
Args:
mod: the module instance
serialized_type_name: The serialized name for the module. This is
required if you want to serial... | Registers a module as a valid input type for :func:`torch.export.export`.
Args:
mod: the module instance
serialized_type_name: The serialized name for the module. This is
required if you want to serialize the pytree TreeSpec containing this
module.
Example::
import torch
class Module(torch.... | python | torch/_export/utils.py | 1,430 | [
"cls"
] | None | true | 6 | 6.16 | pytorch/pytorch | 96,034 | google | false |
visitFunctionExpression | function visitFunctionExpression(node: FunctionExpression): Expression {
// Currently, we only support generators that were originally async functions.
if (node.asteriskToken) {
node = setOriginalNode(
setTextRange(
factory.createFunctionExpression(
... | Visits a function expression.
This will be called when one of the following conditions are met:
- The function expression is a generator function.
- The function expression is contained within the body of a generator function.
@param node The node to visit. | typescript | src/compiler/transformers/generators.ts | 601 | [
"node"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | true | |
enableSubstitutionForAsyncMethodsWithSuper | function enableSubstitutionForAsyncMethodsWithSuper() {
if ((enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper) === 0) {
enabledSubstitutions |= ES2017SubstitutionFlags.AsyncMethodsWithSuper;
// We need to enable substitutions for call, property access, and elemen... | Visits an ArrowFunction.
This function will be called when one of the following conditions are met:
- The node is marked async
@param node The node to visit. | typescript | src/compiler/transformers/es2017.ts | 898 | [] | false | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
apply_patch_with_update_mask | def apply_patch_with_update_mask(
model: DeclarativeMeta,
patch_body: BaseModel,
update_mask: list[str] | None,
non_update_fields: set[str] | None = None,
) -> DeclarativeMeta:
"""
Apply a patch to the given model using the provided update mask.
:param model:... | Apply a patch to the given model using the provided update mask.
:param model: The SQLAlchemy model instance to update.
:param patch_body: Pydantic model containing patch data.
:param update_mask: Optional list of fields to update.
:param non_update_fields: Fields that should not be updated.
:return: The updated SQLAl... | python | airflow-core/src/airflow/api_fastapi/core_api/services/public/common.py | 80 | [
"model",
"patch_body",
"update_mask",
"non_update_fields"
] | DeclarativeMeta | true | 6 | 8.08 | apache/airflow | 43,597 | sphinx | false |
poll | @SuppressWarnings("UnusedReturnValue")
ShareCompletedFetch poll() {
lock.lock();
try {
return completedFetches.poll();
} finally {
lock.unlock();
}
} | Returns {@code true} if there are no completed fetches pending to return to the user.
@return {@code true} if the buffer is empty, {@code false} otherwise | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetchBuffer.java | 113 | [] | ShareCompletedFetch | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
getTimeZone | public static TimeZone getTimeZone(final String id) {
final TimeZone tz = getGmtTimeZone(id);
if (tz != null) {
return tz;
}
return TimeZones.getTimeZone(id);
} | Gets a TimeZone, looking first for GMT custom ids, then falling back to Olson ids.
A GMT custom id can be 'Z', or 'UTC', or has an optional prefix of GMT,
followed by sign, hours digit(s), optional colon(':'), and optional minutes digits.
i.e. <em>[GMT] (+|-) Hours [[:] Minutes]</em>
@param id A GMT custom id (or Olson... | java | src/main/java/org/apache/commons/lang3/time/FastTimeZone.java | 75 | [
"id"
] | TimeZone | true | 2 | 7.84 | apache/commons-lang | 2,896 | javadoc | false |
firstInFlightSequence | synchronized int firstInFlightSequence(TopicPartition topicPartition) {
if (!hasInflightBatches(topicPartition))
return RecordBatch.NO_SEQUENCE;
ProducerBatch batch = nextBatchBySequence(topicPartition);
return batch == null ? RecordBatch.NO_SEQUENCE : batch.baseSequence();
} | Returns the first inflight sequence for a given partition. This is the base sequence of an inflight batch with
the lowest sequence number.
@return the lowest inflight sequence if the transaction manager is tracking inflight requests for this partition.
If there are no inflight requests being tracked for this pa... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 712 | [
"topicPartition"
] | true | 3 | 6.72 | 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.