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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
firstIndex | @Override
int firstIndex() {
return (firstEntry == ENDPOINT) ? -1 : firstEntry;
} | Pointer to the last node in the linked list, or {@code ENDPOINT} if there are no entries. | java | android/guava/src/com/google/common/collect/ObjectCountLinkedHashMap.java | 105 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
saturatedCast | public static int saturatedCast(long value) {
if (value <= 0) {
return 0;
} else if (value >= (1L << 32)) {
return -1;
} else {
return (int) value;
}
} | Returns the {@code int} value that, when treated as unsigned, is nearest in value to {@code
value}.
@param value any {@code long} value
@return {@code 2^32 - 1} if {@code value >= 2^32}, {@code 0} if {@code value <= 0}, and {@code
value} cast to {@code int} otherwise
@since 21.0 | java | android/guava/src/com/google/common/primitives/UnsignedInts.java | 107 | [
"value"
] | true | 3 | 7.92 | google/guava | 51,352 | javadoc | false | |
droplevel | def droplevel(self, level: IndexLabel = 0):
"""
Return index with requested level(s) removed.
If resulting index has only 1 level left, the result will be
of Index type, not MultiIndex. The original index is not modified inplace.
Parameters
----------
level : in... | Return index with requested level(s) removed.
If resulting index has only 1 level left, the result will be
of Index type, not MultiIndex. The original index is not modified inplace.
Parameters
----------
level : int, str, or list-like, default 0
If a string is given, must be the name of a level
If list-like, ... | python | pandas/core/indexes/base.py | 2,246 | [
"self",
"level"
] | true | 2 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false | |
astype | def astype(self, dtype: Dtype, copy: bool = True):
"""
Create an Index with values cast to dtypes.
The class of a new Index is determined by dtype. When conversion is
impossible, a TypeError exception is raised.
Parameters
----------
dtype : numpy dtype or panda... | Create an Index with values cast to dtypes.
The class of a new Index is determined by dtype. When conversion is
impossible, a TypeError exception is raised.
Parameters
----------
dtype : numpy dtype or pandas type
Note that any signed integer `dtype` is treated as ``'int64'``,
and any unsigned integer `dtype`... | python | pandas/core/indexes/base.py | 1,112 | [
"self",
"dtype",
"copy"
] | true | 10 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false | |
predict | def predict(self, X):
"""Perform classification on an array of test vectors `X`.
The predicted class `C` for each sample in `X` is returned.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Input data.
Returns
-... | Perform classification on an array of test vectors `X`.
The predicted class `C` for each sample in `X` is returned.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Input data.
Returns
-------
y_pred : ndarray of shape (n_samples,)
The predicted classes. | python | sklearn/neighbors/_nearest_centroid.py | 275 | [
"self",
"X"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
parse_time_delta | def parse_time_delta(time_str: str):
"""
Parse a time string e.g. (2h13m) into a timedelta object.
:param time_str: A string identifying a duration. (eg. 2h13m)
:return datetime.timedelta: A datetime.timedelta object or "@once"
"""
if (parts := RE_TIME_DELTA.match(time_str)) is None:
m... | Parse a time string e.g. (2h13m) into a timedelta object.
:param time_str: A string identifying a duration. (eg. 2h13m)
:return datetime.timedelta: A datetime.timedelta object or "@once" | python | dev/airflow_perf/dags/elastic_dag.py | 34 | [
"time_str"
] | true | 2 | 6.88 | apache/airflow | 43,597 | sphinx | false | |
getEntityTransformer | private EntryTransformer getEntityTransformer() {
if (getLayout() instanceof RepackagingLayout repackagingLayout) {
return new RepackagingEntryTransformer(repackagingLayout);
}
return EntryTransformer.NONE;
} | Writes a signature file if necessary for the given {@code writtenLibraries}.
@param writtenLibraries the libraries
@param writer the writer to use to write the signature file if necessary
@throws IOException if a failure occurs when writing the signature file | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java | 275 | [] | EntryTransformer | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
mean | def mean(self, *, skipna: bool = True, axis: AxisInt | None = 0):
"""
Return the mean value of the Array.
Parameters
----------
skipna : bool, default True
Whether to ignore any NaT elements.
axis : int, optional, default 0
Axis for the function t... | Return the mean value of the Array.
Parameters
----------
skipna : bool, default True
Whether to ignore any NaT elements.
axis : int, optional, default 0
Axis for the function to be applied on.
Returns
-------
scalar
Timestamp or Timedelta.
See Also
--------
numpy.ndarray.mean : Returns the average of ar... | python | pandas/core/arrays/datetimelike.py | 1,618 | [
"self",
"skipna",
"axis"
] | true | 2 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false | |
secondary_training_status_message | def secondary_training_status_message(
job_description: dict[str, list[Any]], prev_description: dict | None
) -> str:
"""
Format string containing start time and the secondary training job status message.
:param job_description: Returned response from DescribeTrainingJob call
:param prev_descriptio... | Format string containing start time and the secondary training job status message.
:param job_description: Returned response from DescribeTrainingJob call
:param prev_description: Previous job description from DescribeTrainingJob call
:return: Job status string to be printed. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 109 | [
"job_description",
"prev_description"
] | str | true | 6 | 7.28 | apache/airflow | 43,597 | sphinx | false |
nextWord | function nextWord(word: string, start: number): number {
for (let i = start; i < word.length; i++) {
if (isWordSeparator(word.charCodeAt(i)) ||
(i > 0 && isWordSeparator(word.charCodeAt(i - 1)))) {
return i;
}
}
return word.length;
} | Gets alternative codes to the character code passed in. This comes in the
form of an array of character codes, all of which must match _in order_ to
successfully match.
@param code The character code to check. | typescript | src/vs/base/common/filters.ts | 412 | [
"word",
"start"
] | true | 5 | 7.04 | microsoft/vscode | 179,840 | jsdoc | false | |
reverse | private static CharSequence reverse(CharSequence s) {
return new StringBuilder(s).reverse();
} | Parses a trie node and returns the number of characters consumed.
@param stack The prefixes that precede the characters represented by this node. Each entry of
the stack is in reverse order.
@param encoded The serialized trie.
@param start An index in the encoded serialized trie to begin reading characters from.
@p... | java | android/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java | 116 | [
"s"
] | CharSequence | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false |
pollResponseReceivedDuringReauthentication | default Optional<NetworkReceive> pollResponseReceivedDuringReauthentication() {
return Optional.empty();
} | Return the next (always non-null but possibly empty) client-side
{@link NetworkReceive} response that arrived during re-authentication that
is unrelated to re-authentication, if any. These correspond to requests sent
prior to the beginning of re-authentication; the requests were made when the
channel was successfully a... | java | clients/src/main/java/org/apache/kafka/common/network/Authenticator.java | 152 | [] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
getGeoIpTaskState | @Nullable
static GeoIpTaskState getGeoIpTaskState(ProjectMetadata projectMetadata, String taskId) {
PersistentTasksCustomMetadata.PersistentTask<?> task = getTaskWithId(projectMetadata, taskId);
return (task == null) ? null : (GeoIpTaskState) task.getState();
} | Retrieves the geoip downloader's task state from the project metadata. This may return null in some circumstances,
for example if the geoip downloader task hasn't been created yet (which it wouldn't be if it's disabled).
@param projectMetadata the project metatdata to read the task state from.
@param taskId the task ID... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpTaskState.java | 251 | [
"projectMetadata",
"taskId"
] | GeoIpTaskState | true | 2 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false |
pickBy | function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = getIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate... | Creates an object composed of the `object` properties `predicate` returns
truthy for. The predicate is invoked with two arguments: (value, key).
@static
@memberOf _
@since 4.0.0
@category Object
@param {Object} object The source object.
@param {Function} [predicate=_.identity] The function invoked per property.
@return... | javascript | lodash.js | 13,688 | [
"object",
"predicate"
] | false | 2 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
_check_label_or_level_ambiguity | def _check_label_or_level_ambiguity(self, key: Level, axis: Axis = 0) -> None:
"""
Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key : Hashable
... | Check whether `key` is ambiguous.
By ambiguous, we mean that it matches both a level of the input
`axis` and a label of the other axis.
Parameters
----------
key : Hashable
Label or level name.
axis : int, default 0
Axis that levels are associated with (0 for index, 1 for columns).
Raises
------
ValueError: ... | python | pandas/core/generic.py | 1,691 | [
"self",
"key",
"axis"
] | None | true | 7 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
stack | def stack(
frame: DataFrame, level=-1, dropna: bool = True, sort: bool = True
) -> Series | DataFrame:
"""
Convert DataFrame to Series with multi-level Index. Columns become the
second level of the resulting hierarchical index
Returns
-------
stacked : Series or DataFrame
"""
def s... | Convert DataFrame to Series with multi-level Index. Columns become the
second level of the resulting hierarchical index
Returns
-------
stacked : Series or DataFrame | python | pandas/core/reshape/reshape.py | 658 | [
"frame",
"level",
"dropna",
"sort"
] | Series | DataFrame | true | 11 | 6.32 | pandas-dev/pandas | 47,362 | unknown | false |
poly2leg | def poly2leg(pol):
"""
Convert a polynomial to a Legendre series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Legendre series, ordered
from lowest to hi... | Convert a polynomial to a Legendre series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Legendre series, ordered
from lowest to highest degree.
Parameters
----------
pol : arra... | python | numpy/polynomial/legendre.py | 98 | [
"pol"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
acquire | @CanIgnoreReturnValue
public double acquire() {
return acquire(1);
} | Acquires a single permit from this {@code RateLimiter}, blocking until the request can be
granted. Tells the amount of time slept, if any.
<p>This method is equivalent to {@code acquire(1)}.
@return time spent sleeping to enforce rate, in seconds; 0.0 if not rate-limited
@since 16.0 (present in 13.0 with {@code void} r... | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 289 | [] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
isTrue | public static void isTrue(final boolean expression, final String message, final Object... values) {
if (!expression) {
throw new IllegalArgumentException(getMessage(message, values));
}
} | Validate that the argument condition is {@code true}; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary boolean expression, such as validating a
primitive number or using your own custom validation expression.
<pre>{@code
Validate.isTrue(i >= min... | java | src/main/java/org/apache/commons/lang3/Validate.java | 572 | [
"expression",
"message"
] | void | true | 2 | 6.24 | apache/commons-lang | 2,896 | javadoc | false |
main | public static void main(String[] args) throws Exception {
int requiredArgs = 6;
Assert.state(args.length >= requiredArgs, () -> "Usage: " + SpringApplicationAotProcessor.class.getName()
+ " <applicationMainClass> <sourceOutput> <resourceOutput> <classOutput> <groupId> <artifactId> <originalArgs...>");
Class<?... | Create a new processor for the specified application and settings.
@param application the application main class
@param settings the general AOT processor settings
@param applicationArgs the arguments to provide to the main method | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplicationAotProcessor.java | 82 | [
"args"
] | void | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
translate | @SuppressWarnings("resource") // Caller closes writer
public final void translate(final CharSequence input, final Writer writer) throws IOException {
Objects.requireNonNull(writer, "writer");
if (input == null) {
return;
}
int pos = 0;
final int len = input.length... | Translate an input onto a Writer. This is intentionally final as its algorithm is
tightly coupled with the abstract method of this class.
@param input CharSequence that is being translated.
@param writer Writer to translate the text to.
@throws IOException if and only if the Writer produces an IOException. | java | src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java | 103 | [
"input",
"writer"
] | void | true | 8 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
printBanner | private void printBanner() {
String version = getClass().getPackage().getImplementationVersion();
version = (version != null) ? " (v" + version + ")" : "";
System.out.println(ansi("Spring Boot", Code.BOLD).append(version, Code.FAINT));
System.out.println(ansi("Hit TAB to complete. Type 'help' and hit RETURN for... | Run the shell until the user exists.
@throws Exception on error | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java | 142 | [] | void | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
slice | Records slice(int position, int size); | Return a slice of records from this instance, which is a view into this set starting from the given position
and with the given size limit.
If the size is beyond the end of the records, the end will be based on the size of the records at the time of the read.
If this records set is already sliced, the position will be ... | java | clients/src/main/java/org/apache/kafka/common/record/Records.java | 107 | [
"position",
"size"
] | Records | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
equals | private static boolean equals(final WildcardType wildcardType, final Type type) {
if (type instanceof WildcardType) {
final WildcardType other = (WildcardType) type;
return equals(getImplicitLowerBounds(wildcardType), getImplicitLowerBounds(other))
&& equals(getImplic... | Tests whether {@code wildcardType} equals {@code type}.
@param wildcardType LHS.
@param type RHS.
@return Whether {@code wildcardType} equals {@code type}. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 528 | [
"wildcardType",
"type"
] | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
to_period | def to_period(
self,
freq: Frequency | None = None,
axis: Axis = 0,
copy: bool | lib.NoDefault = lib.no_default,
) -> DataFrame:
"""
Convert DataFrame from DatetimeIndex to PeriodIndex.
Convert DataFrame from DatetimeIndex to PeriodIndex with desired
... | Convert DataFrame from DatetimeIndex to PeriodIndex.
Convert DataFrame from DatetimeIndex to PeriodIndex with desired
frequency (inferred from index if not passed). Either index of columns can be
converted, depending on `axis` argument.
Parameters
----------
freq : str, default
Frequency of the PeriodIndex.
axis ... | python | pandas/core/frame.py | 14,705 | [
"self",
"freq",
"axis",
"copy"
] | DataFrame | true | 2 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false |
span | @Override
public Range<K> span() {
Entry<Cut<K>, RangeMapEntry<K, V>> firstEntry = entriesByLowerBound.firstEntry();
Entry<Cut<K>, RangeMapEntry<K, V>> lastEntry = entriesByLowerBound.lastEntry();
// Either both are null or neither is, but we check both to satisfy the nullness checker.
if (firstEntry ... | Returns the range that spans the given range and entry, if the entry can be coalesced. | java | android/guava/src/com/google/common/collect/TreeRangeMap.java | 194 | [] | true | 3 | 7.2 | google/guava | 51,352 | javadoc | false | |
_infer_tz_from_endpoints | def _infer_tz_from_endpoints(
start: Timestamp, end: Timestamp, tz: tzinfo | None
) -> tzinfo | None:
"""
If a timezone is not explicitly given via `tz`, see if one can
be inferred from the `start` and `end` endpoints. If more than one
of these inputs provides a timezone, require that they all agre... | If a timezone is not explicitly given via `tz`, see if one can
be inferred from the `start` and `end` endpoints. If more than one
of these inputs provides a timezone, require that they all agree.
Parameters
----------
start : Timestamp
end : Timestamp
tz : tzinfo or None
Returns
-------
tz : tzinfo or None
Raises
-... | python | pandas/core/arrays/datetimes.py | 2,847 | [
"start",
"end",
"tz"
] | tzinfo | None | true | 5 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
isUnbindableBean | private boolean isUnbindableBean(ConfigurationPropertyName name, Bindable<?> target, Context context) {
for (ConfigurationPropertySource source : context.getSources()) {
if (source.containsDescendantOf(name) == ConfigurationPropertyState.PRESENT) {
// We know there are properties to bind so we can't bypass any... | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param h... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 525 | [
"name",
"target",
"context"
] | true | 4 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
writeFileSync | function writeFileSync(path, data, options) {
options = getOptions(options, {
encoding: 'utf8',
mode: 0o666,
flag: 'w',
flush: false,
});
const flush = options.flush ?? false;
validateBoolean(flush, 'options.flush');
const flag = options.flag || 'w';
// C++ fast path for string data and ... | Synchronously writes data to the file.
@param {string | Buffer | URL | number} path
@param {string | Buffer | TypedArray | DataView} data
@param {{
encoding?: string | null;
mode?: number;
flag?: string;
flush?: boolean;
} | string} [options]
@returns {void} | javascript | lib/fs.js | 2,372 | [
"path",
"data",
"options"
] | false | 12 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
findCustomEditor | @Override
public @Nullable PropertyEditor findCustomEditor(@Nullable Class<?> requiredType, @Nullable String propertyPath) {
Class<?> requiredTypeToUse = requiredType;
if (propertyPath != null) {
if (this.customEditorsForPath != null) {
// Check property-specific editor first.
PropertyEditor editor = ge... | Copy the default editors registered in this instance to the given target registry.
@param target the target registry to copy to | java | spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java | 324 | [
"requiredType",
"propertyPath"
] | PropertyEditor | true | 8 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
uuidToByteArray | public static byte[] uuidToByteArray(final UUID src, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {
return dst;
}
if (nBytes > 16) {
throw new IllegalArgumentException("nBytes > 16");
}
longToByteArray(src.getMostSignificantBits... | Converts UUID into an array of byte using the default (little-endian, LSB0) byte and bit ordering.
@param src the UUID to convert.
@param dst the destination array.
@param dstPos the position in {@code dst} where to copy the result.
@param nBytes the number of bytes to copy to {@code dst}, must be smaller or equa... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 1,374 | [
"src",
"dst",
"dstPos",
"nBytes"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
writeTokenText | function writeTokenText(token: SyntaxKind, writer: (s: string) => void, pos?: number): number {
const tokenString = tokenToString(token)!;
writer(tokenString);
return pos! < 0 ? pos! : pos! + tokenString.length;
} | Emits a list without brackets or raising events.
NOTE: You probably don't want to call this directly and should be using `emitList` or `emitExpressionList` instead. | typescript | src/compiler/emitter.ts | 4,934 | [
"token",
"writer",
"pos?"
] | true | 2 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
createJarFileForLocalFile | private JarFile createJarFileForLocalFile(URL url, Runtime.Version version, Consumer<JarFile> closeAction)
throws IOException {
String path = UrlDecoder.decode(url.getPath());
return new UrlJarFile(new File(path), version, closeAction);
} | Create a new {@link UrlJarFile} or {@link UrlNestedJarFile} instance.
@param jarFileUrl the jar file URL
@param closeAction the action to call when the file is closed
@return a new {@link JarFile} instance
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java | 77 | [
"url",
"version",
"closeAction"
] | JarFile | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
stream | public Stream<T> stream() {
return stream;
} | Converts the FailableStream into an equivalent stream.
@return A stream, which will return the same elements, which this FailableStream would return. | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 476 | [] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
mid | public static String mid(final String str, int pos, final int len) {
if (str == null) {
return null;
}
if (len < 0 || pos > str.length()) {
return EMPTY;
}
if (pos < 0) {
pos = 0;
}
if (str.length() <= pos + len) {
r... | Gets {@code len} characters from the middle of a String.
<p>
If {@code len} characters are not available, the remainder of the String will be returned without an exception. If the String is {@code null},
{@code null} will be returned. An empty String is returned if len is negative or exceeds the length of {@code str}.
... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,330 | [
"str",
"pos",
"len"
] | String | true | 6 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
copyOrNull | private static String @Nullable [] copyOrNull(String @Nullable [] state) {
if (state == null) {
return null;
}
return copy(state);
} | Copy the contents of this message to the given target message.
@param target the {@code MailMessage} to copy to | java | spring-context-support/src/main/java/org/springframework/mail/SimpleMailMessage.java | 243 | [
"state"
] | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
compareTo | @Override
public int compareTo(final MutableFloat other) {
return Float.compare(this.value, other.value);
} | Compares this mutable to another in ascending order.
@param other the other mutable to compare to, not null.
@return negative if this is less, zero if equal, positive if greater. | java | src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java | 138 | [
"other"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
maybeCompleteLeaveInProgress | private boolean maybeCompleteLeaveInProgress() {
if (leaveGroupInProgress.isPresent()) {
leaveGroupInProgress.get().complete(null);
leaveGroupInProgress = Optional.empty();
return true;
}
return false;
} | Complete the leave in progress (if any). This is expected to be used to complete the leave
in progress when a member receives the response to the leave heartbeat. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 851 | [] | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
davies_bouldin_score | def davies_bouldin_score(X, labels):
"""Compute the Davies-Bouldin score.
The score is defined as the average similarity measure of each cluster with
its most similar cluster, where similarity is the ratio of within-cluster
distances to between-cluster distances. Thus, clusters which are farther
ap... | Compute the Davies-Bouldin score.
The score is defined as the average similarity measure of each cluster with
its most similar cluster, where similarity is the ratio of within-cluster
distances to between-cluster distances. Thus, clusters which are farther
apart and less dispersed will result in a better score.
The m... | python | sklearn/metrics/cluster/_unsupervised.py | 413 | [
"X",
"labels"
] | false | 4 | 7.12 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
mode | def mode(self, dropna: bool = True) -> Series:
"""
Return the mode(s) of the Series.
The mode is the value that appears most often. There can be multiple modes.
Always returns Series even if only one value is returned.
Parameters
----------
dropna : bool, defau... | Return the mode(s) of the Series.
The mode is the value that appears most often. There can be multiple modes.
Always returns Series even if only one value is returned.
Parameters
----------
dropna : bool, default True
Don't consider counts of NaN/NaT.
Returns
-------
Series
Modes of the Series in sorted ord... | python | pandas/core/series.py | 2,085 | [
"self",
"dropna"
] | Series | true | 3 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
instantiate | private Object instantiate(String beanName, RootBeanDefinition mbd,
@Nullable Object factoryBean, Method factoryMethod, @Nullable Object[] args) {
try {
return this.beanFactory.getInstantiationStrategy().instantiate(
mbd, beanName, this.beanFactory, factoryBean, factoryMethod, args);
}
catch (Throwabl... | Instantiate the bean using a named factory method. The method may be static, if the
bean definition parameter specifies a class, rather than a "factory-bean", or
an instance variable on a factory object itself configured using Dependency Injection.
<p>Implementation requires iterating over the static or instance method... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java | 649 | [
"beanName",
"mbd",
"factoryBean",
"factoryMethod",
"args"
] | Object | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
is_python_scalar | def is_python_scalar(x: object) -> TypeIs[complex]: # numpydoc ignore=PR01,RT01
"""Return True if `x` is a Python scalar, False otherwise."""
# isinstance(x, float) returns True for np.float64
# isinstance(x, complex) returns True for np.complex128
# bool is a subclass of int
return isinstance(x, i... | Return True if `x` is a Python scalar, False otherwise. | python | sklearn/externals/array_api_extra/_lib/_utils/_helpers.py | 148 | [
"x"
] | TypeIs[complex] | true | 2 | 6 | scikit-learn/scikit-learn | 64,340 | unknown | false |
describe_cluster_snapshots | def describe_cluster_snapshots(self, cluster_identifier: str) -> list[str] | None:
"""
List snapshots for a cluster.
.. seealso::
- :external+boto3:py:meth:`Redshift.Client.describe_cluster_snapshots`
:param cluster_identifier: unique identifier of a cluster
"""
... | List snapshots for a cluster.
.. seealso::
- :external+boto3:py:meth:`Redshift.Client.describe_cluster_snapshots`
:param cluster_identifier: unique identifier of a cluster | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_cluster.py | 124 | [
"self",
"cluster_identifier"
] | list[str] | None | true | 2 | 6.08 | apache/airflow | 43,597 | sphinx | false |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SharePartitionOffsetInfo that = (SharePartitionOffsetInfo) o;
return startOffset == that.startOffset &&
Objects.equals(leaderEpoch, that.lead... | Get the lag for the partition.
@return The lag of the partition. | java | clients/src/main/java/org/apache/kafka/clients/admin/SharePartitionOffsetInfo.java | 75 | [
"o"
] | true | 6 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
getTypeOnlyPromotionFix | function getTypeOnlyPromotionFix(sourceFile: SourceFile, symbolToken: Identifier, symbolName: string, program: Program): FixPromoteTypeOnlyImport | undefined {
const checker = program.getTypeChecker();
const symbol = checker.resolveName(symbolName, symbolToken, SymbolFlags.Value, /*excludeGlobals*/ true);
... | @param forceImportKeyword Indicates that the user has already typed `import`, so the result must start with `import`.
(In other words, do not allow `const x = require("...")` for JS files.)
@internal | typescript | src/services/codefixes/importFixes.ts | 1,588 | [
"sourceFile",
"symbolToken",
"symbolName",
"program"
] | true | 4 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
insertInSequenceOrder | private void insertInSequenceOrder(Deque<ProducerBatch> deque, ProducerBatch batch) {
// When we are re-enqueueing and have enabled idempotence, the re-enqueued batch must always have a sequence.
if (batch.baseSequence() == RecordBatch.NO_SEQUENCE)
throw new IllegalStateException("Trying to ... | Split the big batch that has been rejected and reenqueue the split batches in to the accumulator.
@return the number of split batches. | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java | 552 | [
"deque",
"batch"
] | void | true | 10 | 7.2 | apache/kafka | 31,560 | javadoc | false |
uncompletedEvents | public List<CompletableEvent<?>> uncompletedEvents() {
// The following code does not use the Java Collections Streams API to reduce overhead in the critical
// path of the ConsumerNetworkThread loop.
List<CompletableEvent<?>> events = new ArrayList<>();
for (CompletableEvent<?> event :... | It is possible for the {@link AsyncKafkaConsumer#close() consumer to close} before completing the processing of
all the events in the queue. In this case, we need to
{@link CompletableFuture#completeExceptionally(Throwable) expire} any remaining events.
<p/>
Check each of the {@link #add(CompletableEvent) previously-ad... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/CompletableEventReaper.java | 163 | [] | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
_from_sequence | def _from_sequence(
cls, scalars, *, dtype: Dtype | None = None, copy: bool = False
) -> Self:
"""
Construct a new ExtensionArray from a sequence of scalars.
Parameters
----------
scalars : Sequence
Each element will be an instance of the scalar type for ... | Construct a new ExtensionArray from a sequence of scalars.
Parameters
----------
scalars : Sequence
Each element will be an instance of the scalar type for this
array, ``cls.dtype.type`` or be converted into this type in this method.
dtype : dtype, optional
Construct for this particular dtype. This should ... | python | pandas/core/arrays/base.py | 282 | [
"cls",
"scalars",
"dtype",
"copy"
] | Self | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
getMergedBeanDefinition | @Override
public BeanDefinition getMergedBeanDefinition(String name) throws BeansException {
String beanName = transformedBeanName(name);
// Efficiently check whether bean definition exists in this factory.
if (getParentBeanFactory() instanceof ConfigurableBeanFactory parent && !containsBeanDefinition(beanName))... | Return a 'merged' BeanDefinition for the given bean name,
merging a child bean definition with its parent if necessary.
<p>This {@code getMergedBeanDefinition} considers bean definition
in ancestors as well.
@param name the name of the bean to retrieve the merged definition for
(may be an alias)
@return a (potentially ... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,139 | [
"name"
] | BeanDefinition | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
initializeBucketTreeMapsIfNeeded | private void initializeBucketTreeMapsIfNeeded() {
if (negativeBuckets == null) {
negativeBuckets = new TreeMap<>();
positiveBuckets = new TreeMap<>();
// copy existing buckets to the maps
if (result != null) {
BucketIterator it = result.negativeBuc... | Sets the given bucket of the negative buckets. If the bucket already exists, it will be replaced.
Buckets may be set in arbitrary order. However, for best performance and minimal allocations,
buckets should be set in order of increasing index and all negative buckets should be set before positive buckets.
@param index ... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramBuilder.java | 186 | [] | void | true | 5 | 8.4 | elastic/elasticsearch | 75,680 | javadoc | false |
checkDependencies | protected void checkDependencies(
String beanName, AbstractBeanDefinition mbd, PropertyDescriptor[] pds, @Nullable PropertyValues pvs)
throws UnsatisfiedDependencyException {
int dependencyCheck = mbd.getDependencyCheck();
for (PropertyDescriptor pd : pds) {
if (pd.getWriteMethod() != null && (pvs == null... | Perform a dependency check that all properties exposed have been set,
if desired. Dependency checks can be objects (collaborating beans),
simple (primitives and String), or all (both).
@param beanName the name of the bean
@param mbd the merged bean definition the bean was created with
@param pds the relevant property d... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,634 | [
"beanName",
"mbd",
"pds",
"pvs"
] | void | true | 9 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
originals | public Map<String, Object> originals() {
Map<String, Object> copy = new RecordingMap<>();
copy.putAll(originals);
return copy;
} | Called directly after user configs got parsed (and thus default values got set).
This allows to change default values for "secondary defaults" if required.
@param parsedValues unmodifiable map of current configuration
@return a map of updates that should be applied to the configuration (will be validated to prevent bad... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 243 | [] | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
replace | public String replace(final char[] source) {
if (source == null) {
return null;
}
final StrBuilder buf = new StrBuilder(source.length).append(source);
substitute(buf, 0, source.length);
return buf.toString();
} | Replaces all the occurrences of variables with their matching values
from the resolver using the given source array as a template.
The array is not altered by this method.
@param source the character array to replace in, not altered, null returns null.
@return the result of the replace operation. | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 511 | [
"source"
] | String | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
notEmpty | public static <T extends Map<?, ?>> T notEmpty(final T map) {
return notEmpty(map, DEFAULT_NOT_EMPTY_MAP_EX_MESSAGE);
} | <p>Validates that the specified argument map is neither {@code null}
nor a size of zero (no elements); otherwise throwing an exception.
<pre>Validate.notEmpty(myMap);</pre>
<p>The message in the exception is "The validated map is
empty".
@param <T> the map type.
@param map the map to check, validated not nul... | java | src/main/java/org/apache/commons/lang3/Validate.java | 847 | [
"map"
] | T | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
get_git_version | def get_git_version(self) -> str:
"""
Return a version to identify the state of the underlying git repo.
The version will indicate whether the head of the current git-backed working directory
is tied to a release tag or not. It will indicate the former with a 'release:{version}'
... | Return a version to identify the state of the underlying git repo.
The version will indicate whether the head of the current git-backed working directory
is tied to a release tag or not. It will indicate the former with a 'release:{version}'
prefix and the latter with a '.dev0' suffix. Following the prefix will be a s... | python | airflow-core/hatch_build.py | 74 | [
"self"
] | str | true | 3 | 6.88 | apache/airflow | 43,597 | unknown | false |
lastIndexOf | static int lastIndexOf(final CharSequence cs, final CharSequence searchChar, int start) {
if (searchChar == null || cs == null) {
return NOT_FOUND;
}
if (searchChar instanceof String) {
if (cs instanceof String) {
return ((String) cs).lastIndexOf((String) ... | Used by the lastIndexOf(CharSequence methods) as a green implementation of lastIndexOf
@param cs the {@link CharSequence} to be processed.
@param searchChar the {@link CharSequence} to find.
@param start the start index.
@return the index where the search sequence was found. | java | src/main/java/org/apache/commons/lang3/CharSequenceUtils.java | 148 | [
"cs",
"searchChar",
"start"
] | true | 21 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
getObject | @Override
public @Nullable Object getObject() throws BeansException {
BeanWrapper target = this.targetBeanWrapper;
if (target != null) {
if (logger.isWarnEnabled() && this.targetBeanName != null &&
this.beanFactory instanceof ConfigurableBeanFactory cbf &&
cbf.isCurrentlyInCreation(this.targetBeanName... | The bean name of this PropertyPathFactoryBean will be interpreted
as "beanName.property" pattern, if neither "targetObject" nor
"targetBeanName" nor "propertyPath" have been specified.
This allows for concise bean definitions with just an id/name. | java | spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java | 199 | [] | Object | true | 6 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
compression | public abstract double compression(); | Returns the current compression factor.
@return The compression factor originally used to set up the TDigest. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/TDigest.java | 168 | [] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
inclusiveBetween | public static void inclusiveBetween(final double start, final double end, final double value, final String message) {
// TODO when breaking BC, consider returning value
if (value < start || value > end) {
throw new IllegalArgumentException(message);
}
} | Validate that the specified primitive value falls between the two
inclusive values specified; otherwise, throws an exception with the
specified message.
<pre>Validate.inclusiveBetween(0.1, 2.1, 1.1, "Not in range");</pre>
@param start the inclusive start value.
@param end the inclusive end value.
@param value the val... | java | src/main/java/org/apache/commons/lang3/Validate.java | 291 | [
"start",
"end",
"value",
"message"
] | void | true | 3 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
createDelegationToken | default CreateDelegationTokenResult createDelegationToken() {
return createDelegationToken(new CreateDelegationTokenOptions());
} | Create a Delegation Token.
<p>
This is a convenience method for {@link #createDelegationToken(CreateDelegationTokenOptions)} with default options.
See the overload for more details.
@return The CreateDelegationTokenResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 713 | [] | CreateDelegationTokenResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
toUnsentRequest | public NetworkClientDelegate.UnsentRequest toUnsentRequest() {
Map<String, Uuid> topicIds = metadata.topicIds();
boolean canUseTopicIds = true;
List<OffsetFetchRequestData.OffsetFetchRequestTopics> topics = new ArrayList<>();
Map<String, List<TopicPartition>> tps = reques... | Future with the result of the request. This can be reset using {@link #resetFuture()}
to get a new result when the request is retried. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 1,006 | [] | true | 4 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
all | public KafkaFuture<Map<TopicPartition, ListOffsetsResultInfo>> all() {
return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture<?>[0]))
.thenApply(v -> {
Map<TopicPartition, ListOffsetsResultInfo> offsets = new HashMap<>(futures.size());
for (Map.... | Return a future which succeeds only if offsets for all specified partitions have been successfully
retrieved. | java | clients/src/main/java/org/apache/kafka/clients/admin/ListOffsetsResult.java | 54 | [] | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
trimToSize | public void trimToSize() {
if (needsAllocArrays()) {
return;
}
Map<K, V> delegate = delegateOrNull();
if (delegate != null) {
Map<K, V> newDelegate = createHashFloodingResistantDelegate(size());
newDelegate.putAll(delegate);
this.table = newDelegate;
return;
}
int s... | Ensures that this {@code CompactHashMap} has the smallest representation in memory, given its
current size. | java | android/guava/src/com/google/common/collect/CompactHashMap.java | 950 | [] | void | true | 5 | 6.24 | google/guava | 51,352 | javadoc | false |
list_options | def list_options() -> list[str]:
r"""Returns a dictionary describing the optimizations and debug configurations
that are available to `torch.compile()`.
The options are documented in `torch._inductor.config`.
Example::
>>> torch._inductor.list_options()
"""
from torch._inductor impor... | r"""Returns a dictionary describing the optimizations and debug configurations
that are available to `torch.compile()`.
The options are documented in `torch._inductor.config`.
Example::
>>> torch._inductor.list_options() | python | torch/_inductor/__init__.py | 381 | [] | list[str] | true | 1 | 6.48 | pytorch/pytorch | 96,034 | unknown | false |
_decode_relation | def _decode_relation(self, s):
'''(INTERNAL) Decodes a relation line.
The relation declaration is a line with the format ``@RELATION
<relation-name>``, where ``relation-name`` is a string. The string must
start with alphabetic character and must be quoted if the name includes
sp... | (INTERNAL) Decodes a relation line.
The relation declaration is a line with the format ``@RELATION
<relation-name>``, where ``relation-name`` is a string. The string must
start with alphabetic character and must be quoted if the name includes
spaces, otherwise this method will raise a `BadRelationFormat` exception.
T... | python | sklearn/externals/_arff.py | 690 | [
"self",
"s"
] | false | 2 | 7.12 | scikit-learn/scikit-learn | 64,340 | sphinx | false | |
supportsSourceType | @Override
public boolean supportsSourceType(@Nullable Class<?> sourceType) {
return (sourceType != null && sourceType.isInstance(this.source));
} | Create a SourceFilteringListener for the given event source,
expecting subclasses to override the {@link #onApplicationEventInternal}
method (instead of specifying a delegate listener).
@param source the event source that this listener filters for,
only processing events from this source | java | spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java | 82 | [
"sourceType"
] | true | 2 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
resolveAutowireCandidates | @SuppressWarnings("unchecked")
public static <T> Map<String, T> resolveAutowireCandidates(ConfigurableListableBeanFactory lbf, Class<T> type,
boolean includeNonSingletons, boolean allowEagerInit) {
Map<String, T> candidates = new LinkedHashMap<>();
for (String beanName : BeanFactoryUtils.beanNamesForTypeInclud... | Resolve a map of all beans of the given type, also picking up beans defined in
ancestor bean factories, with the specific condition that each bean actually
has autowire candidate status. This matches simple injection point resolution
as implemented by this {@link AutowireCandidateResolver} strategy, including
beans whi... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleAutowireCandidateResolver.java | 96 | [
"lbf",
"type",
"includeNonSingletons",
"allowEagerInit"
] | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_decode8Bits | private int _decode8Bits() throws IOException {
if (_inputPtr >= _inputEnd) {
loadMoreGuaranteed();
}
return _inputBuffer[_inputPtr++] & 0xFF;
} | Method used to decode explicit length of a variable-length value
(or, for indefinite/chunked, indicate that one is not known).
Note that long (64-bit) length is only allowed if it fits in
32-bit signed int, for now; expectation being that longer values
are always encoded as chunks. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/cbor/ESCborParser.java | 138 | [] | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false | |
_parse_thead_tbody_tfoot | def _parse_thead_tbody_tfoot(self, table_html):
"""
Given a table, return parsed header, body, and foot.
Parameters
----------
table_html : node-like
Returns
-------
tuple of (header, body, footer), each a list of list-of-text rows.
Notes
... | Given a table, return parsed header, body, and foot.
Parameters
----------
table_html : node-like
Returns
-------
tuple of (header, body, footer), each a list of list-of-text rows.
Notes
-----
Header and body are lists-of-lists. Top level list is a list of
rows. Each row is a list of str text.
Logic: Use <thead>, <... | python | pandas/io/html.py | 413 | [
"self",
"table_html"
] | false | 4 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false | |
callExpressionVisitor | function callExpressionVisitor(node: Node): VisitResult<Node | undefined> {
if (node.kind === SyntaxKind.SuperKeyword) {
return visitSuperKeyword(node as SuperExpression, /*isExpressionOfCall*/ true);
}
return visitor(node);
} | Restores the `HierarchyFacts` for this node's ancestor after visiting this node's
subtree, propagating specific facts from the subtree.
@param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree.
@param excludeFacts The existing `HierarchyFacts` of the subtree that should not be ... | typescript | src/compiler/transformers/es2015.ts | 626 | [
"node"
] | true | 2 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
appendFixedWidthPadLeft | public StrBuilder appendFixedWidthPadLeft(final Object obj, final int width, final char padChar) {
if (width > 0) {
ensureCapacity(size + width);
String str = ObjectUtils.toString(obj, this::getNullText);
if (str == null) {
str = StringUtils.EMPTY;
... | Appends an object to the builder padding on the left to a fixed width.
The {@code toString} of the object is used.
If the object is larger than the length, the left-hand side side is lost.
If the object is null, the null text value is used.
@param obj the object to append, null uses null text
@param width the fixed f... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 861 | [
"obj",
"width",
"padChar"
] | StrBuilder | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
process | private void process(TypeDescriptor descriptor, TypeMirror type) {
if (type.getKind() == TypeKind.DECLARED) {
DeclaredType declaredType = (DeclaredType) type;
DeclaredType freshType = (DeclaredType) this.env.getElementUtils()
.getTypeElement(this.types.asElement(type).toString())
.asType();
List<? ex... | Return the {@link PrimitiveType} of the specified type or {@code null} if the type
does not represent a valid wrapper type.
@param typeMirror a type
@return the primitive type or {@code null} if the type is not a wrapper type | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | 235 | [
"descriptor",
"type"
] | void | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
_open_openml_url | def _open_openml_url(
url: str, data_home: Optional[str], n_retries: int = 3, delay: float = 1.0
):
"""
Returns a resource from OpenML.org. Caches it to data_home if required.
Parameters
----------
url : str
OpenML URL that will be downloaded and cached locally. The path component
... | Returns a resource from OpenML.org. Caches it to data_home if required.
Parameters
----------
url : str
OpenML URL that will be downloaded and cached locally. The path component
of the URL is used to replicate the tree structure as sub-folders of the local
cache folder.
data_home : str
Directory to wh... | python | sklearn/datasets/_openml.py | 124 | [
"url",
"data_home",
"n_retries",
"delay"
] | true | 7 | 6.96 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
addAndGet | public long addAndGet(final Number operand) {
this.value += operand.longValue();
return value;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately after the addition operation. This method is not thread safe.
@param operand the quantity to add, not null.
@throws NullPointerException if {@code operand} is null.
@return the value associated wi... | java | src/main/java/org/apache/commons/lang3/mutable/MutableLong.java | 125 | [
"operand"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
__bolt_hugify_self | void __bolt_hugify_self() {
// clang-format off
#if defined(__x86_64__)
__asm__ __volatile__(SAVE_ALL "call __bolt_hugify_self_impl\n" RESTORE_ALL
"jmp __bolt_hugify_start_program\n"
:::);
#elif defined(__aarch64__) || defined(__arm64__)
__asm__ __vo... | This is hooking ELF's entry, it needs to save all machine state. | cpp | bolt/runtime/hugify.cpp | 172 | [] | true | 2 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false | |
tryAcquire | @SuppressWarnings("GoodTime") // should accept a java.time.Duration
public boolean tryAcquire(int permits, long timeout, TimeUnit unit) {
long timeoutMicros = max(unit.toMicros(timeout), 0);
checkPermits(permits);
long microsToWait;
synchronized (mutex()) {
long nowMicros = stopwatch.readMicros(... | Acquires the given number of permits from this {@code RateLimiter} if it can be obtained
without exceeding the specified {@code timeout}, or returns {@code false} immediately (without
waiting) if the permits would not have been granted before the timeout expired.
@param permits the number of permits to acquire
@param t... | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 411 | [
"permits",
"timeout",
"unit"
] | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false | |
capacity | public int capacity() {
return buffer.length;
} | Gets the current size of the internal character array buffer.
@return the capacity | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,574 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
startswith | def startswith(a, prefix, start=0, end=None):
"""
Returns a boolean array which is `True` where the string element
in ``a`` starts with ``prefix``, otherwise `False`.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
prefix : array-like, with ``Strin... | Returns a boolean array which is `True` where the string element
in ``a`` starts with ``prefix``, otherwise `False`.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
prefix : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
start, end : array_like, with any int... | python | numpy/_core/strings.py | 450 | [
"a",
"prefix",
"start",
"end"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
is_wsl2 | def is_wsl2() -> bool:
"""
Check if the current platform is WSL2. This method will exit with error printing appropriate
message if WSL1 is detected as WSL1 is not supported.
:return: True if the current platform is WSL2, False otherwise (unless it's WSL1 then it exits).
"""
if not sys.platform.... | Check if the current platform is WSL2. This method will exit with error printing appropriate
message if WSL1 is detected as WSL1 is not supported.
:return: True if the current platform is WSL2, False otherwise (unless it's WSL1 then it exits). | python | dev/breeze/src/airflow_breeze/utils/platforms.py | 57 | [] | bool | true | 9 | 8.4 | apache/airflow | 43,597 | unknown | false |
ABSL_LOCKS_EXCLUDED | ABSL_LOCKS_EXCLUDED(reader_mu_) {
grpc::internal::MutexLock l(&reader_mu_);
if (GPR_UNLIKELY(backlog_.send_initial_metadata_wanted)) {
reader->SendInitialMetadata();
}
if (GPR_UNLIKELY(backlog_.read_wanted != nullptr)) {
reader->Read(backlog_.read_wanted);
}
if (GPR_UNLIKELY(backlog... | The following notifications are exactly like ServerBidiReactor. | cpp | include/grpcpp/support/server_callback.h | 558 | [] | true | 4 | 6.08 | grpc/grpc | 44,113 | doxygen | false | |
getSiblingNode | function getSiblingNode(node: ?(Node | Element)) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
} | Get the next sibling within a container. This will walk up the
DOM if a node's siblings have been exhausted.
@param {DOMElement|DOMTextNode} node
@return {?DOMElement|DOMTextNode} | javascript | packages/react-dom-bindings/src/client/getNodeForCharacterOffset.js | 32 | [] | false | 3 | 6.8 | facebook/react | 241,750 | jsdoc | false | |
_get_exc_class_and_code | def _get_exc_class_and_code(
exc_class_or_code: type[Exception] | int,
) -> tuple[type[Exception], int | None]:
"""Get the exception class being handled. For HTTP status codes
or ``HTTPException`` subclasses, return both the exception and
status code.
:param exc_class_or_cod... | Get the exception class being handled. For HTTP status codes
or ``HTTPException`` subclasses, return both the exception and
status code.
:param exc_class_or_code: Any exception class, or an HTTP status
code as an integer. | python | src/flask/sansio/scaffold.py | 657 | [
"exc_class_or_code"
] | tuple[type[Exception], int | None] | true | 7 | 6.72 | pallets/flask | 70,946 | sphinx | false |
map | def map(
f: Callable[[pytree.PyTree, tuple[pytree.PyTree, ...]], pytree.PyTree],
xs: Union[pytree.PyTree, torch.Tensor],
*args: TypeVarTuple,
):
r"""
Performs a map of f with xs. Intuitively, you can think of the semantic being:
out = []
for idx in len(xs.size(0)):
xs_sliced = xs.se... | r"""
Performs a map of f with xs. Intuitively, you can think of the semantic being:
out = []
for idx in len(xs.size(0)):
xs_sliced = xs.select(0, idx)
out.append(f(xs_sliced, *args))
torch.stack(out)
.. warning::
`torch._higher_order_ops.map` is a prototype feature in PyTorch. It currently
does not su... | python | torch/_higher_order_ops/map.py | 47 | [
"f",
"xs"
] | true | 4 | 9.6 | pytorch/pytorch | 96,034 | google | false | |
leaveGroup | public CompletableFuture<Void> leaveGroup() {
return leaveGroup(false);
} | Leaves the group.
<p>
This method does the following:
<ol>
<li>Transitions member state to {@link MemberState#PREPARE_LEAVING}.</li>
<li>Requests the invocation of the revocation callback or lost callback.</li>
<li>Once the callback completes, it clears the current and target assignment, unsubscribes from
... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 916 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
from | public static SpringApplication.Augmented from(ThrowingConsumer<String[]> main) {
Assert.notNull(main, "'main' must not be null");
return new Augmented(main, Collections.emptySet(), Collections.emptySet());
} | Create an application from an existing {@code main} method that can run with
additional {@code @Configuration} or bean classes. This method can be helpful when
writing a test harness that needs to start an application with additional
configuration.
@param main the main method entry point that runs the {@link SpringAppl... | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 1,432 | [
"main"
] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
shouldVisitNode | function shouldVisitNode(node: Node): boolean {
return (node.transformFlags & TransformFlags.ContainsES2015) !== 0
|| convertedLoopState !== undefined
|| (hierarchyFacts & HierarchyFacts.ConstructorWithSuperCall && isOrMayContainReturnCompletion(node))
|| (isIterationStat... | Restores the `HierarchyFacts` for this node's ancestor after visiting this node's
subtree, propagating specific facts from the subtree.
@param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree.
@param excludeFacts The existing `HierarchyFacts` of the subtree that should not be ... | typescript | src/compiler/transformers/es2015.ts | 593 | [
"node"
] | true | 7 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
nodes | public Map<Integer, Node> nodes() {
return nodes;
} | @return The voter nodes in the Raft cluster, or an empty map if KIP-853 is not enabled. | java | clients/src/main/java/org/apache/kafka/clients/admin/QuorumInfo.java | 76 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
split_and_set_ranges | def split_and_set_ranges(
self, lengths: Sequence[Sequence[sympy.Expr]]
) -> list[list[sympy.Expr]]:
"""
Split and set iteration ranges for the kernel based on the provided lengths.
This method maps the kernel's tiling structure to the node's iteration space,
handling both p... | Split and set iteration ranges for the kernel based on the provided lengths.
This method maps the kernel's tiling structure to the node's iteration space,
handling both pointwise and reduction dimensions appropriately.
Args:
lengths: A sequence of sequences of symbolic expressions representing
the siz... | python | torch/_inductor/codegen/simd.py | 868 | [
"self",
"lengths"
] | list[list[sympy.Expr]] | true | 4 | 7.92 | pytorch/pytorch | 96,034 | google | false |
trimmedEndIndex | function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {}
return index;
} | Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
character of `string`.
@private
@param {string} string The string to inspect.
@returns {number} Returns the index of the last non-whitespace character. | javascript | lodash.js | 1,364 | [
"string"
] | false | 3 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
getResult | public static <T> T getResult(Future<T> future) {
try {
return future.get();
} catch (ExecutionException e) {
if (e.getCause() instanceof IllegalStateException)
throw (IllegalStateException) e.getCause();
throw maybeWrapAsKafkaException(e.getCause());
... | Update subscription state and metadata using the provided committed offsets:
<li>Update partition offsets with the committed offsets</li>
<li>Update the metadata with any newer leader epoch discovered in the committed offsets
metadata</li>
</p>
This will ignore any partition included in the <code>offsetsAndMetadata</co... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerUtils.java | 237 | [
"future"
] | T | true | 4 | 6.24 | apache/kafka | 31,560 | javadoc | false |
check_for_prefix_async | async def check_for_prefix_async(
self,
client: AioBaseClient,
prefix: str,
delimiter: str,
bucket_name: str | None = None,
) -> bool:
"""
Check that a prefix exists in a bucket.
:param bucket_name: the name of the bucket
:param prefix: a key ... | Check that a prefix exists in a bucket.
:param bucket_name: the name of the bucket
:param prefix: a key prefix
:param delimiter: the delimiter marks key hierarchy.
:return: False if the prefix does not exist in the bucket and True if it does. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 596 | [
"self",
"client",
"prefix",
"delimiter",
"bucket_name"
] | bool | true | 2 | 8.24 | apache/airflow | 43,597 | sphinx | false |
values | @Override
public ImmutableCollection<V> values() {
ImmutableCollection<V> result = values;
return (result == null) ? values = createValues() : result;
} | Returns an immutable collection of the values in this map, in the same order that they appear
in {@link #entrySet}. | java | android/guava/src/com/google/common/collect/ImmutableMap.java | 984 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
initials | public static String initials(final String str, final char... delimiters) {
if (StringUtils.isEmpty(str)) {
return str;
}
if (delimiters != null && delimiters.length == 0) {
return StringUtils.EMPTY;
}
final int strLen = str.length();
final char[] ... | Extracts the initial characters from each word in the String.
<p>All first characters after the defined delimiters are returned as a new string.
Their case is not changed.</p>
<p>If the delimiters array is null, then Whitespace is used.
Whitespace is defined by {@link Character#isWhitespace(char)}.
A {@code null} input... | java | src/main/java/org/apache/commons/lang3/text/WordUtils.java | 260 | [
"str"
] | String | true | 7 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
escape | protected abstract char @Nullable [] escape(char c); | Returns the escaped form of the given character, or {@code null} if this character does not
need to be escaped. If an empty array is returned, this effectively strips the input character
from the resulting text.
<p>If the character does not need to be escaped, this method should return {@code null}, rather
than a one-c... | java | android/guava/src/com/google/common/escape/CharEscaper.java | 83 | [
"c"
] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
assert_all_finite | def assert_all_finite(
X,
*,
allow_nan=False,
estimator_name=None,
input_name="",
):
"""Throw a ValueError if X contains NaN or infinity.
Parameters
----------
X : {ndarray, sparse matrix}
The input data.
allow_nan : bool, default=False
If True, do not throw err... | Throw a ValueError if X contains NaN or infinity.
Parameters
----------
X : {ndarray, sparse matrix}
The input data.
allow_nan : bool, default=False
If True, do not throw error when `X` contains NaN.
estimator_name : str, default=None
The estimator name, used to construct the error message.
input_name :... | python | sklearn/utils/validation.py | 185 | [
"X",
"allow_nan",
"estimator_name",
"input_name"
] | false | 2 | 7.52 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
generate | def generate( # type: ignore[override]
self,
**kwargs,
) -> ROCmTemplateCaller:
"""
Generates the ROCm template caller object for the given GEMM template and operation. This ROCmTemplateCaller
may be used to call and benchmark the generated ROCm kernel in a standalone manner... | Generates the ROCm template caller object for the given GEMM template and operation. This ROCmTemplateCaller
may be used to call and benchmark the generated ROCm kernel in a standalone manner to enable Autotuning.
Args:
kwargs: Additional keyword arguments.
Returns:
A ROCmTemplateCaller object representing th... | python | torch/_inductor/codegen/rocm/rocm_template.py | 59 | [
"self"
] | ROCmTemplateCaller | true | 3 | 7.52 | pytorch/pytorch | 96,034 | google | false |
loadBeanDefinitions | public int loadBeanDefinitions(Resource resource, @Nullable String prefix) throws BeanDefinitionStoreException {
return loadBeanDefinitions(new EncodedResource(resource), prefix);
} | Load bean definitions from the specified properties file.
@param resource the resource descriptor for the properties file
@param prefix a filter within the keys in the map: for example, 'beans.'
(can be empty or {@code null})
@return the number of bean definitions found
@throws BeanDefinitionStoreException in case of l... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java | 226 | [
"resource",
"prefix"
] | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false | |
setupStacktracePrinterOnSigint | function setupStacktracePrinterOnSigint() {
if (!getOptionValue('--trace-sigint')) {
return;
}
require('internal/util/trace_sigint').setTraceSigInt(true);
} | 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 | 425 | [] | false | 2 | 6.8 | nodejs/node | 114,839 | jsdoc | false | |
doStart | @Override
protected void doStart() {
if (enabled) {
this.services = createApmServices();
}
} | This class is used to make all OpenTelemetry services visible at once | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracer.java | 126 | [] | void | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
pop | def pop(self, item: Hashable) -> Series:
"""
Return item and drop it from DataFrame. Raise KeyError if not found.
Parameters
----------
item : label
Label of column to be popped.
Returns
-------
Series
Series representing the item... | Return item and drop it from DataFrame. Raise KeyError if not found.
Parameters
----------
item : label
Label of column to be popped.
Returns
-------
Series
Series representing the item that is dropped.
See Also
--------
DataFrame.drop: Drop specified labels from rows or columns.
DataFrame.drop_duplicates: R... | python | pandas/core/frame.py | 6,289 | [
"self",
"item"
] | Series | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.