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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
toChar | public static char toChar(final String str, final char defaultValue) {
return StringUtils.isEmpty(str) ? defaultValue : str.charAt(0);
} | Converts the String to a char using the first character, defaulting
the value on empty Strings.
<pre>
CharUtils.toChar(null, 'X') = 'X'
CharUtils.toChar("", 'X') = 'X'
CharUtils.toChar("A", 'X') = 'A'
CharUtils.toChar("BA", 'X') = 'B'
</pre>
@param str the character to convert
@param defaultValue the value... | java | src/main/java/org/apache/commons/lang3/CharUtils.java | 336 | [
"str",
"defaultValue"
] | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false | |
transformAsync | public static <I extends @Nullable Object, O extends @Nullable Object>
ListenableFuture<O> transformAsync(
ListenableFuture<I> input,
AsyncFunction<? super I, ? extends O> function,
Executor executor) {
return AbstractTransformFuture.createAsync(input, function, executor);
} | Returns a new {@code Future} whose result is asynchronously derived from the result of the
given {@code Future}. If the given {@code Future} fails, the returned {@code Future} fails with
the same exception (and the function is not invoked).
<p>More precisely, the returned {@code Future} takes its result from a {@code F... | java | android/guava/src/com/google/common/util/concurrent/Futures.java | 451 | [
"input",
"function",
"executor"
] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
polysub | def polysub(c1, c2):
"""
Subtract one polynomial from another.
Returns the difference of two polynomials `c1` - `c2`. The arguments
are sequences of coefficients from lowest order term to highest, i.e.,
[1,2,3] represents the polynomial ``1 + 2*x + 3*x**2``.
Parameters
----------
c1, ... | Subtract one polynomial from another.
Returns the difference of two polynomials `c1` - `c2`. The arguments
are sequences of coefficients from lowest order term to highest, i.e.,
[1,2,3] represents the polynomial ``1 + 2*x + 3*x**2``.
Parameters
----------
c1, c2 : array_like
1-D arrays of polynomial coefficients... | python | numpy/polynomial/polynomial.py | 251 | [
"c1",
"c2"
] | false | 1 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
getClassPathIndex | ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException {
if (!archive.isExploded()) {
return null; // Regular archives already have a defined order
}
String location = getClassPathIndexFileLocation(archive);
return ClassPathIndexFile.loadIfPossible(archive.getRootDirectory(), location);
} | Returns if the launcher is running in an exploded mode. If this method returns
{@code true} then only regular JARs are supported and the additional URL and
ClassLoader support infrastructure can be optimized.
@return if the jar is exploded. | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/Launcher.java | 130 | [
"archive"
] | ClassPathIndexFile | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
badPositionIndexes | private static String badPositionIndexes(int start, int end, int size) {
if (start < 0 || start > size) {
return badPositionIndex(start, size, "start index");
}
if (end < 0 || end > size) {
return badPositionIndex(end, size, "end index");
}
// end < start
return lenientFormat("end in... | Ensures that {@code start} and {@code end} specify valid <i>positions</i> in an array, list or
string of size {@code size}, and are in order. A position index may range from zero to {@code
size}, inclusive.
@param start a user-supplied index identifying a starting position in an array, list or string
@param end a user-... | java | android/guava/src/com/google/common/base/Preconditions.java | 1,452 | [
"start",
"end",
"size"
] | String | true | 5 | 6.72 | google/guava | 51,352 | javadoc | false |
sort | public static byte[] sort(final byte[] array) {
if (array != null) {
Arrays.sort(array);
}
return array;
} | Sorts the given array into ascending order and returns it.
@param array the array to sort (may be null).
@return the given array.
@see Arrays#sort(byte[]) | java | src/main/java/org/apache/commons/lang3/ArraySorter.java | 37 | [
"array"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
isNewDocument | private boolean isNewDocument(CharacterReader reader) throws IOException {
if (reader.isSameLastLineCommentPrefix()) {
return false;
}
boolean result = reader.getLocation().getColumn() == 0;
result = result && readAndExpect(reader, reader::isHyphenCharacter);
result = result && readAndExpect(reader, reader... | Load {@code .properties} data and return a map of {@code String} ->
{@link OriginTrackedValue}.
@param expandLists if list {@code name[]=a,b,c} shortcuts should be expanded
@return the loaded properties
@throws IOException on read error | java | core/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java | 165 | [
"reader"
] | true | 7 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false | |
computeIndentLevel | function computeIndentLevel(content: string, options: FormattingOptions): number {
let i = 0;
let nChars = 0;
const tabSize = options.tabSize || 4;
while (i < content.length) {
const ch = content.charAt(i);
if (ch === ' ') {
nChars++;
} else if (ch === '\t') {
nChars += tabSize;
} else {
break;
}... | Creates a formatted string out of the object passed as argument, using the given formatting options
@param any The object to stringify and format
@param options The formatting options to use | typescript | src/vs/base/common/jsonFormatter.ts | 226 | [
"content",
"options"
] | true | 7 | 6.24 | microsoft/vscode | 179,840 | jsdoc | false | |
set_codes | def set_codes(
self, codes, *, level=None, verify_integrity: bool = True
) -> MultiIndex:
"""
Set new codes on MultiIndex. Defaults to returning new index.
Parameters
----------
codes : sequence or list of sequence
New codes to apply.
level : int,... | Set new codes on MultiIndex. Defaults to returning new index.
Parameters
----------
codes : sequence or list of sequence
New codes to apply.
level : int, level name, or sequence of int/level names (default None)
Level(s) to set (None for all levels).
verify_integrity : bool, default True
If True, checks th... | python | pandas/core/indexes/multi.py | 1,174 | [
"self",
"codes",
"level",
"verify_integrity"
] | MultiIndex | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
toPrimitive | public static byte[] toPrimitive(final Byte[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_BYTE_ARRAY;
}
final byte[] result = new byte[array.length];
for (int i = 0; i < array.length; i++) {
result... | Converts an array of object Bytes to primitives.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array a {@link Byte} array, may be {@code null}.
@return a {@code byte} array, {@code null} if null array input.
@throws NullPointerException if an array element is {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,859 | [
"array"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
mean | @Deprecated
// com.google.common.math.DoubleUtils
@GwtIncompatible
public static double mean(double... values) {
checkArgument(values.length > 0, "Cannot take mean of 0 values");
long count = 1;
double mean = checkFinite(values[0]);
for (int index = 1; index < values.length; ++index) {
check... | Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of
{@code values}.
<p>If these values are a sample drawn from a population, this is also an unbiased estimator of
the arithmetic mean of the population.
@param values a nonempty series of values
@throws IllegalArgumentException if {@... | java | android/guava/src/com/google/common/math/DoubleMath.java | 408 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
clearByte | public byte clearByte(final byte holder) {
return (byte) clear(holder);
} | Clears the bits.
@param holder the byte data containing the bits we're
interested in
@return the value of holder with the specified bits cleared
(set to {@code 0}) | java | src/main/java/org/apache/commons/lang3/BitField.java | 111 | [
"holder"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
floatValue | @Override
public float floatValue() {
if (value >= 0) {
return (float) value;
}
// The top bit is set, which means that the float value is going to come from the top 24 bits.
// So we can ignore the bottom 8, except for rounding. See doubleValue() for more.
return (float) ((value >>> 1) | (v... | Returns the value of this {@code UnsignedLong} as a {@code float}, analogous to a widening
primitive conversion from {@code long} to {@code float}, and correctly rounded. | java | android/guava/src/com/google/common/primitives/UnsignedLong.java | 195 | [] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
deepEmpty | private static boolean deepEmpty(final String[] strings) {
return Streams.of(strings).allMatch(StringUtils::isEmpty);
} | Determines whether or not all the Strings in an array are
empty or not.
@param strings String[] whose elements are being checked for emptiness
@return whether or not the String is empty | java | src/main/java/org/apache/commons/lang3/CharSetUtils.java | 105 | [
"strings"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
completeOnTimeout | @Override
public CompletableFuture<T> completeOnTimeout(T value, long timeout, TimeUnit unit) {
throw erroneousCompletionException();
} | Completes this future exceptionally. For internal use by the Kafka clients, not by user code.
@param throwable the exception.
@return {@code true} if this invocation caused this CompletableFuture
to transition to a completed state, else {@code false} | java | clients/src/main/java/org/apache/kafka/common/internals/KafkaCompletableFuture.java | 87 | [
"value",
"timeout",
"unit"
] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
lowerCase | public static String lowerCase(final String str) {
if (str == null) {
return null;
}
return str.toLowerCase();
} | Converts a String to lower case as per {@link String#toLowerCase()}.
<p>
A {@code null} input String returns {@code null}.
</p>
<pre>
StringUtils.lowerCase(null) = null
StringUtils.lowerCase("") = ""
StringUtils.lowerCase("aBc") = "abc"
</pre>
<p>
<strong>Note:</strong> As described in the documentation for {@link ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,219 | [
"str"
] | String | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
determineHandlingOrder | private Collection<SelectionKey> determineHandlingOrder(Set<SelectionKey> selectionKeys) {
//it is possible that the iteration order over selectionKeys is the same every invocation.
//this may cause starvation of reads when memory is low. to address this we shuffle the keys if memory is low.
if ... | handle any ready I/O on a set of selection keys
@param selectionKeys set of keys to handle
@param isImmediatelyConnected true if running over a set of keys for just-connected sockets
@param currentTimeNanos time at which set of keys was determined | java | clients/src/main/java/org/apache/kafka/common/network/Selector.java | 665 | [
"selectionKeys"
] | true | 3 | 6.08 | apache/kafka | 31,560 | javadoc | false | |
strftime | def strftime(self, date_format) -> Index:
"""
Convert to Index using specified date_format.
Return an Index of formatted strings specified by date_format, which
supports the same string format as the python standard library. Details
of the string format can be found in `python s... | Convert to Index using specified date_format.
Return an Index of formatted strings specified by date_format, which
supports the same string format as the python standard library. Details
of the string format can be found in `python string format
doc <https://docs.python.org/3/library/datetime.html#strftime-and-strptim... | python | pandas/core/indexes/datetimes.py | 282 | [
"self",
"date_format"
] | Index | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
getShortCommitId | public @Nullable String getShortCommitId() {
String shortId = get("commit.id.abbrev");
if (shortId != null) {
return shortId;
}
String id = getCommitId();
if (id == null) {
return null;
}
return (id.length() > 7) ? id.substring(0, 7) : id;
} | Return the abbreviated id of the commit or {@code null}.
@return the short commit id | java | core/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java | 71 | [] | String | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
reformat | public String reformat(final String input) throws ParseException {
return format(parseObject(input));
} | Utility method to parse and then reformat a String.
@param input String to reformat
@return A reformatted String
@throws ParseException thrown by parseObject(String) call | java | src/main/java/org/apache/commons/lang3/text/CompositeFormat.java | 114 | [
"input"
] | String | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
resolveAndInvoke | public void resolveAndInvoke(RegisteredBean registeredBean, Object instance) {
Assert.notNull(registeredBean, "'registeredBean' must not be null");
Assert.notNull(instance, "'instance' must not be null");
Method method = getMethod(registeredBean);
AutowiredArguments resolved = resolveArguments(registeredBean, m... | Resolve the method arguments for the specified registered bean and invoke
the method using reflection.
@param registeredBean the registered bean
@param instance the bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredMethodArgumentsResolver.java | 145 | [
"registeredBean",
"instance"
] | void | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
getMapData | function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
} | Gets the data for `map`.
@private
@param {Object} map The map to query.
@param {string} key The reference key.
@returns {*} Returns the map data. | javascript | lodash.js | 6,040 | [
"map",
"key"
] | false | 3 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
remove | @Nullable Object remove(String name); | Remove the object with the given {@code name} from the underlying scope.
<p>Returns {@code null} if no object was found; otherwise
returns the removed {@code Object}.
<p>Note that an implementation should also remove a registered destruction
callback for the specified object, if any. It does, however, <i>not</i>
need t... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/Scope.java | 93 | [
"name"
] | Object | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
dtypes | def dtypes(self) -> Series:
"""
Return the dtype object of each child field of the struct.
Returns
-------
pandas.Series
The data type of each child field.
See Also
--------
Series.dtype: Return the dtype object of the underlying data.
... | Return the dtype object of each child field of the struct.
Returns
-------
pandas.Series
The data type of each child field.
See Also
--------
Series.dtype: Return the dtype object of the underlying data.
Examples
--------
>>> import pyarrow as pa
>>> s = pd.Series(
... [
... {"version": 1, "project":... | python | pandas/core/arrays/arrow/accessors.py | 260 | [
"self"
] | Series | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
getObjectFromFactoryBean | protected Object getObjectFromFactoryBean(FactoryBean<?> factory, @Nullable Class<?> requiredType,
String beanName, boolean shouldPostProcess) {
if (factory.isSingleton() && containsSingleton(beanName)) {
Boolean lockFlag = isCurrentThreadAllowedToHoldSingletonLock();
boolean locked;
if (lockFlag == null... | Obtain an object to expose from the given FactoryBean.
@param factory the FactoryBean instance
@param beanName the name of the bean
@param shouldPostProcess whether the bean is subject to post-processing
@return the object obtained from the FactoryBean
@throws BeanCreationException if FactoryBean object creation failed... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java | 119 | [
"factory",
"requiredType",
"beanName",
"shouldPostProcess"
] | Object | true | 14 | 7.52 | spring-projects/spring-framework | 59,386 | javadoc | false |
maybe_mark_dynamic | def maybe_mark_dynamic(t: Any, index: Union[int, list[Any], tuple[Any]]) -> None:
"""
Mark a tensor as having a dynamic dim, but don't enforce it (i.e., if this
dimension ends up getting specialized, don't error).
"""
if is_traceable_wrapper_subclass(t):
# default behavior: mirror maybe_mark... | Mark a tensor as having a dynamic dim, but don't enforce it (i.e., if this
dimension ends up getting specialized, don't error). | python | torch/_dynamo/decorators.py | 723 | [
"t",
"index"
] | None | true | 5 | 6 | pytorch/pytorch | 96,034 | unknown | false |
explode | def explode(self, ignore_index: bool = False) -> Series:
"""
Transform each element of a list-like to a row.
Parameters
----------
ignore_index : bool, default False
If True, the resulting index will be labeled 0, 1, …, n - 1.
Returns
-------
... | Transform each element of a list-like to a row.
Parameters
----------
ignore_index : bool, default False
If True, the resulting index will be labeled 0, 1, …, n - 1.
Returns
-------
Series
Exploded lists to rows; index will be duplicated for these rows.
See Also
--------
Series.str.split : Split string value... | python | pandas/core/series.py | 4,278 | [
"self",
"ignore_index"
] | Series | true | 8 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
putmask_without_repeat | def putmask_without_repeat(
values: np.ndarray, mask: npt.NDArray[np.bool_], new: Any
) -> None:
"""
np.putmask will truncate or repeat if `new` is a listlike with
len(new) != len(values). We require an exact match.
Parameters
----------
values : np.ndarray
mask : np.ndarray[bool]
... | np.putmask will truncate or repeat if `new` is a listlike with
len(new) != len(values). We require an exact match.
Parameters
----------
values : np.ndarray
mask : np.ndarray[bool]
new : Any | python | pandas/core/array_algos/putmask.py | 63 | [
"values",
"mask",
"new"
] | None | true | 10 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
clear | public FluentBitSet clear(final int fromIndex, final int toIndex) {
bitSet.clear(fromIndex, toIndex);
return this;
} | Sets the bits from the specified {@code fromIndex} (inclusive) to the specified {@code toIndex} (exclusive) to
{@code false}.
@param fromIndex index of the first bit to be cleared.
@param toIndex index after the last bit to be cleared.
@throws IndexOutOfBoundsException if {@code fromIndex} is negative, or {@code toInde... | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 179 | [
"fromIndex",
"toIndex"
] | FluentBitSet | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
createWithExpectedSize | public static <K extends @Nullable Object, V extends @Nullable Object>
CompactHashMap<K, V> createWithExpectedSize(int expectedSize) {
return new CompactHashMap<>(expectedSize);
} | Creates a {@code CompactHashMap} instance, with a high enough "initial capacity" that it
<i>should</i> hold {@code expectedSize} elements without growth.
@param expectedSize the number of elements you expect to add to the returned set
@return a new, empty {@code CompactHashMap} with enough capacity to hold {@code expec... | java | android/guava/src/com/google/common/collect/CompactHashMap.java | 107 | [
"expectedSize"
] | true | 1 | 6 | google/guava | 51,352 | javadoc | false | |
size | public long size() throws IOException {
Optional<Long> sizeIfKnown = sizeIfKnown();
if (sizeIfKnown.isPresent()) {
return sizeIfKnown.get();
}
Closer closer = Closer.create();
try {
InputStream in = closer.register(openStream());
return countBySkipping(in);
} catch (IOExceptio... | Returns the size of this source in bytes, even if doing so requires opening and traversing an
entire stream. To avoid a potentially expensive operation, see {@link #sizeIfKnown}.
<p>The default implementation calls {@link #sizeIfKnown} and returns the value if present. If
absent, it will fall back to a heavyweight oper... | java | android/guava/src/com/google/common/io/ByteSource.java | 204 | [] | true | 4 | 6.88 | google/guava | 51,352 | javadoc | false | |
create | static Archive create(File target) throws Exception {
if (!target.exists()) {
throw new IllegalStateException("Unable to determine code source archive from " + target);
}
return (target.isDirectory() ? new ExplodedArchive(target) : new JarFileArchive(target));
} | Factory method to create an {@link Archive} from the given {@link File} target.
@param target a target {@link File} used to create the archive. May be a directory
or a jar file.
@return a new {@link Archive} instance.
@throws Exception if the archive cannot be created | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/Archive.java | 124 | [
"target"
] | Archive | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
isTypeMemberStart | function isTypeMemberStart(): boolean {
// Return true if we have the start of a signature member
if (
token() === SyntaxKind.OpenParenToken ||
token() === SyntaxKind.LessThanToken ||
token() === SyntaxKind.GetKeyword ||
token() === SyntaxKind.SetKey... | 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 | 4,292 | [] | true | 14 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
distance | public static int distance(final Class<?> child, final Class<?> parent) {
if (child == null || parent == null) {
return -1;
}
if (child.equals(parent)) {
return 0;
}
final Class<?> cParent = child.getSuperclass();
int d = BooleanUtils.toInteger(par... | Returns the number of inheritance hops between two classes.
@param child the child class, may be {@code null}
@param parent the parent class, may be {@code null}
@return the number of generations between the child and parent; 0 if the same class;
-1 if the classes are not related as child and parent (includes where eit... | java | src/main/java/org/apache/commons/lang3/reflect/InheritanceUtils.java | 37 | [
"child",
"parent"
] | true | 6 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
createAsyncCaffeineCache | protected AsyncCache<Object, Object> createAsyncCaffeineCache(String name) {
return (this.cacheLoader != null ? this.cacheBuilder.buildAsync(this.cacheLoader) :
this.cacheBuilder.buildAsync());
} | Build a common Caffeine AsyncCache instance for the specified cache name,
using the common Caffeine configuration specified on this cache manager.
@param name the name of the cache
@return the Caffeine AsyncCache instance
@since 6.1
@see #createCaffeineCache | java | spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java | 405 | [
"name"
] | true | 2 | 7.36 | spring-projects/spring-framework | 59,386 | javadoc | false | |
parse_s3_url | def parse_s3_url(s3url: str) -> tuple[str, str]:
"""
Parse the S3 Url into a bucket name and key.
See https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html
for valid url formats.
:param s3url: The S3 Url to parse.
:return: the parsed bucket name... | Parse the S3 Url into a bucket name and key.
See https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html
for valid url formats.
:param s3url: The S3 Url to parse.
:return: the parsed bucket name and key | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 223 | [
"s3url"
] | tuple[str, str] | true | 8 | 7.76 | apache/airflow | 43,597 | sphinx | false |
predict | def predict(self, X, copy=True):
"""Predict targets of given samples.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Samples.
copy : bool, default=True
Whether to copy `X` or perform in-place normalization.
Returns
... | Predict targets of given samples.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Samples.
copy : bool, default=True
Whether to copy `X` or perform in-place normalization.
Returns
-------
y_pred : ndarray of shape (n_samples,) or (n_samples, n_targets)
Returns predicted values.
Not... | python | sklearn/cross_decomposition/_pls.py | 451 | [
"self",
"X",
"copy"
] | false | 2 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
collectElementsAnnotatedOrMetaAnnotatedWith | private boolean collectElementsAnnotatedOrMetaAnnotatedWith(TypeElement annotationType, LinkedList<Element> stack) {
Element element = stack.peekLast();
for (AnnotationMirror annotation : this.elements.getAllAnnotationMirrors(element)) {
Element annotationElement = annotation.getAnnotationType().asElement();
... | Collect the annotations that are annotated or meta-annotated with the specified
{@link TypeElement annotation}.
@param element the element to inspect
@param annotationType the annotation to discover
@return the annotations that are annotated or meta-annotated with this annotation | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 295 | [
"annotationType",
"stack"
] | true | 4 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
multiply | def multiply(a, i):
"""
Return (a * i), that is string multiple concatenation,
element-wise.
Values in ``i`` of less than 0 are treated as 0 (which yields an
empty string).
Parameters
----------
a : array_like, with `np.bytes_` or `np.str_` dtype
i : array_like, with any integer d... | Return (a * i), that is string multiple concatenation,
element-wise.
Values in ``i`` of less than 0 are treated as 0 (which yields an
empty string).
Parameters
----------
a : array_like, with `np.bytes_` or `np.str_` dtype
i : array_like, with any integer dtype
Returns
-------
out : ndarray
Output array of str ... | python | numpy/_core/defchararray.py | 267 | [
"a",
"i"
] | false | 1 | 6 | numpy/numpy | 31,054 | numpy | false | |
isCancelledError | function isCancelledError(error: unknown): error is {
cancelled: boolean;
} {
return typeof error === 'object' && error !== null && 'cancelled' in error && error.cancelled === true;
} | Checks if an error is a cancelled request error.
Used to avoid logging cancelled request errors.
@param {unknown} error - Error to check
@returns {boolean} True if the error is a cancelled request error | typescript | packages/grafana-prometheus/src/language_provider.ts | 401 | [
"error"
] | false | 4 | 6.24 | grafana/grafana | 71,362 | jsdoc | false | |
applyAsDouble | double applyAsDouble(double operand) throws E; | Applies this operator to the given operand.
@param operand the operand
@return the operator result
@throws E Thrown when a consumer fails. | java | src/main/java/org/apache/commons/lang3/function/FailableDoubleUnaryOperator.java | 78 | [
"operand"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
loadBuiltinWithHooks | function loadBuiltinWithHooks(id, url, format) {
if (loadHooks.length) {
url ??= `node:${id}`;
// TODO(joyeecheung): do we really want to invoke the load hook for the builtins?
const loadResult = loadWithHooks(url, format || 'builtin', /* importAttributes */ undefined,
... | Load a specified builtin module, invoking load hooks if necessary.
@param {string} id The module ID (without the node: prefix)
@param {string} url The module URL (with the node: prefix)
@param {string} format Format from resolution.
@returns {any} If there are no load hooks or the load hooks do not override the format ... | javascript | lib/internal/modules/cjs/loader.js | 1,174 | [
"id",
"url",
"format"
] | false | 5 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
cutlass_layout | def cutlass_layout(torch_layout: ir.Layout) -> "Optional[cutlass_lib.LayoutType]": # type: ignore[name-defined] # noqa: F821
"""
Converts an ir.Layout instance into the corresponding cutlass_library.LayoutType enum value
(RowMajor, ColumnMajor, or None if no matching value is found ).
... | Converts an ir.Layout instance into the corresponding cutlass_library.LayoutType enum value
(RowMajor, ColumnMajor, or None if no matching value is found ).
Args:
torch_layout (ir.Layout): The layout that needs to be looked up.
Returns:
cutlass_lib.LayoutType: The converted layout corresponding to the `torch_... | python | torch/_inductor/codegen/cuda/gemm_template.py | 645 | [
"torch_layout"
] | "Optional[cutlass_lib.LayoutType]" | true | 4 | 7.6 | pytorch/pytorch | 96,034 | google | false |
tryAcquire | public boolean tryAcquire(int permits) {
return tryAcquire(permits, 0, MICROSECONDS);
} | Acquires permits from this {@link RateLimiter} if it can be acquired immediately without delay.
<p>This method is equivalent to {@code tryAcquire(permits, 0, anyUnit)}.
@param permits the number of permits to acquire
@return {@code true} if the permits were acquired, {@code false} otherwise
@throws IllegalArgumentExcep... | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 367 | [
"permits"
] | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false | |
equalsIncludingNaN | private static boolean equalsIncludingNaN(double a, double b) {
return (a == b) || (Double.isNaN(a) && Double.isNaN(b));
} | 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 | 183 | [
"a",
"b"
] | true | 3 | 8 | elastic/elasticsearch | 75,680 | javadoc | false | |
register | public static void register(BeanDefinitionRegistry registry) {
Assert.notNull(registry, "'registry' must not be null");
if (!registry.containsBeanDefinition(BEAN_NAME)) {
BeanDefinition definition = BeanDefinitionBuilder
.rootBeanDefinition(ConfigurationPropertiesBindingPostProcessor.class)
.getBeanDefin... | Register a {@link ConfigurationPropertiesBindingPostProcessor} bean if one is not
already registered.
@param registry the bean definition registry
@since 2.2.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java | 114 | [
"registry"
] | void | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
initializeDefaultConditions | function initializeDefaultConditions() {
const userConditions = getOptionValue('--conditions');
const noAddons = getOptionValue('--no-addons');
const addonConditions = noAddons ? [] : ['node-addons'];
const moduleConditions = getOptionValue('--require-module') ? ['module-sync'] : [];
defaultConditions = Objec... | Initializes the default conditions for ESM module loading.
This function is called during pre-execution, before any user code is run.
@returns {void} | javascript | lib/internal/modules/esm/utils.js | 74 | [] | false | 3 | 7.28 | nodejs/node | 114,839 | jsdoc | false | |
usesWriteEntries | boolean usesWriteEntries() {
return usesWriteQueue() || recordsWrite();
} | Creates a new, empty map with the specified strategy, initial capacity and concurrency level. | java | android/guava/src/com/google/common/cache/LocalCache.java | 364 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
addToCentral | private long addToCentral(List<DataBlock> parts, ZipCentralDirectoryFileHeaderRecord originalRecord,
long originalRecordPos, DataBlock name, int offsetToLocalHeader) throws IOException {
ZipCentralDirectoryFileHeaderRecord record = originalRecord.withFileNameLength((short) (name.size() & 0xFFFF))
.withOffsetToL... | Create a new {@link VirtualZipDataBlock} for the given entries.
@param data the source zip data
@param nameOffsetLookups the name offsets to apply
@param centralRecords the records that should be copied to the virtual zip
@param centralRecordPositions the record positions in the data block.
@throws IOException on I/O e... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/VirtualZipDataBlock.java | 73 | [
"parts",
"originalRecord",
"originalRecordPos",
"name",
"offsetToLocalHeader"
] | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false | |
bindExportAssignment | function bindExportAssignment(node: ExportAssignment) {
if (!container.symbol || !container.symbol.exports) {
// Incorrect export assignment in some sort of block construct
bindAnonymousDeclaration(node, SymbolFlags.Value, getDeclarationName(node)!);
}
else {
... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 3,125 | [
"node"
] | false | 6 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
readStaticField | public static Object readStaticField(final Field field) throws IllegalAccessException {
return readStaticField(field, false);
} | Reads an accessible {@code static} {@link Field}.
@param field
to read.
@return the field value.
@throws NullPointerException
if the field is {@code null}.
@throws IllegalArgumentException
if the field is not {@code static}.
@throws IllegalAccessException
if the field is n... | java | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | 520 | [
"field"
] | Object | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
detectBrokenLz4Version | static void detectBrokenLz4Version() {
byte[] source = new byte[]{1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3};
final LZ4Compressor compressor = LZ4Factory.fastestInstance().fastCompressor();
final byte[] compressed = new byte[compressor.maxCompressedLength(source.length)];
final int co... | Checks whether the version of lz4 on the classpath has the fix for reading from ByteBuffers with
non-zero array offsets (see https://github.com/lz4/lz4-java/pull/65) | java | clients/src/main/java/org/apache/kafka/common/compress/Lz4BlockInputStream.java | 283 | [] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
hashCode | @Override
public int hashCode() {
Integer h = this.hash;
if (h == null) {
int result = 31 + ((host == null) ? 0 : host.hashCode());
result = 31 * result + id;
result = 31 * result + port;
result = 31 * result + ((rack == null) ? 0 : rack.hashCode());
... | Returns whether this node is fenced.
<p>
This applies to broker nodes only. For controller quorum nodes, this field
is not relevant and is defined to be {@code false}. | java | clients/src/main/java/org/apache/kafka/common/Node.java | 126 | [] | true | 4 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
createParentDirectory | private void createParentDirectory(File file) {
File parent = file.getParentFile();
if (parent != null) {
parent.mkdirs();
}
} | Write the PID to the specified file.
@param file the PID file
@throws IllegalStateException if no PID is available.
@throws IOException if the file cannot be written | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java | 118 | [
"file"
] | void | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
delete | public StrBuilder delete(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
final int len = endIndex - startIndex;
if (len > 0) {
deleteImpl(startIndex, endIndex, len);
}
return this;
} | Deletes the characters between the two specified indices.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end index, exclusive, must be valid except
that if too large it is treated as end of string
@return {@code this} instance.
@throws IndexOutOfBoundsException if the index is invali... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,663 | [
"startIndex",
"endIndex"
] | StrBuilder | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
ipFloatByte | public static float ipFloatByte(float[] q, byte[] d) {
if (q.length != d.length) {
throw new IllegalArgumentException("vector dimensions incompatible: " + q.length + "!= " + d.length);
}
return IMPL.ipFloatByte(q, d);
} | Compute the inner product of two vectors, where the query vector is a float vector and the document vector is a byte vector.
@param q the query vector
@param d the document vector
@return the inner product of the two vectors | java | libs/simdvec/src/main/java/org/elasticsearch/simdvec/ESVectorUtil.java | 114 | [
"q",
"d"
] | true | 2 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
deleteAll | public StrBuilder deleteAll(final char ch) {
for (int i = 0; i < size; i++) {
if (buffer[i] == ch) {
final int start = i;
while (++i < size) {
if (buffer[i] != ch) {
break;
}
}
... | Deletes the character wherever it occurs in the builder.
@param ch the character to delete
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,678 | [
"ch"
] | StrBuilder | true | 5 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
getFactoryMethodForGenerator | private @Nullable Method getFactoryMethodForGenerator() {
// Avoid unnecessary currentlyInvokedFactoryMethod exposure outside of full configuration classes.
if (this.lookup instanceof FactoryMethodLookup factoryMethodLookup &&
factoryMethodLookup.declaringClass.getName().contains(ClassUtils.CGLIB_CLASS_SEPARATO... | Return a new {@link BeanInstanceSupplier} instance that uses
direct bean name injection shortcuts for specific parameters.
@param beanNames the bean names to use as shortcut (aligned with the
constructor or factory method parameters)
@return a new {@link BeanInstanceSupplier} instance that uses the
given shortcut bean ... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 218 | [] | Method | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
toScaledBigDecimal | public static BigDecimal toScaledBigDecimal(final Double value, final int scale, final RoundingMode roundingMode) {
if (value == null) {
return BigDecimal.ZERO;
}
return toScaledBigDecimal(BigDecimal.valueOf(value), scale, roundingMode);
} | Converts a {@link Double} to a {@link BigDecimal} whose scale is the specified value with a {@link RoundingMode} applied. If the input {@code value} is
{@code null}, we simply return {@code BigDecimal.ZERO}.
@param value the {@link Double} to convert, may be null.
@param scale the number of digits to the ... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,676 | [
"value",
"scale",
"roundingMode"
] | BigDecimal | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
putBytes | @CanIgnoreReturnValue
PrimitiveSink putBytes(byte[] bytes); | Puts an array of bytes into this sink.
@param bytes a byte array
@return this instance | java | android/guava/src/com/google/common/hash/PrimitiveSink.java | 45 | [
"bytes"
] | PrimitiveSink | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false |
newLinkedBlockingQueue | @J2ktIncompatible
@GwtIncompatible // LinkedBlockingQueue
public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(Iterable<? extends E> elements) {
if (elements instanceof Collection) {
return new LinkedBlockingQueue<>((Collection<? extends E>) elements);
}
LinkedBlockingQueue<E> queue = n... | Creates a {@code LinkedBlockingQueue} with a capacity of {@link Integer#MAX_VALUE}, containing
the elements of the specified iterable, in the order they are returned by the iterable's
iterator.
@param elements the elements that the queue should contain, in order
@return a new {@code LinkedBlockingQueue} containing thos... | java | android/guava/src/com/google/common/collect/Queues.java | 186 | [
"elements"
] | true | 2 | 7.28 | google/guava | 51,352 | javadoc | false | |
find_option | def find_option(self, name, namespace=''):
"""Search for option by name.
Example:
>>> from proj.celery import app
>>> app.conf.find_option('disable_rate_limits')
('worker', 'prefetch_multiplier',
<Option: type->bool default->False>))
Arguments:
... | Search for option by name.
Example:
>>> from proj.celery import app
>>> app.conf.find_option('disable_rate_limits')
('worker', 'prefetch_multiplier',
<Option: type->bool default->False>))
Arguments:
name (str): Name of option, cannot be partial.
namespace (str): Preferred name-space (``None``... | python | celery/app/utils.py | 141 | [
"self",
"name",
"namespace"
] | false | 1 | 7.2 | celery/celery | 27,741 | google | false | |
unique_labels | def unique_labels(*ys):
"""Extract an ordered array of unique labels.
We don't allow:
- mix of multilabel and multiclass (single label) targets
- mix of label indicator matrix and anything else,
because there are no explicit labels)
- mix of label indicator matrices of differe... | Extract an ordered array of unique labels.
We don't allow:
- mix of multilabel and multiclass (single label) targets
- mix of label indicator matrix and anything else,
because there are no explicit labels)
- mix of label indicator matrices of different sizes
- mix of string and integer labels
At... | python | sklearn/utils/multiclass.py | 41 | [] | false | 9 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
poly2herme | def poly2herme(pol):
"""
poly2herme(pol)
Convert a polynomial to a Hermite 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 Hermite series, ordered
... | poly2herme(pol)
Convert a polynomial to a Hermite 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 Hermite series, ordered
from lowest to highest degree.
Parameters
------... | python | numpy/polynomial/hermite_e.py | 95 | [
"pol"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
execute_using_pool | def execute_using_pool(self, pool: BasePool, **kwargs):
"""Used by the worker to send this task to the pool.
Arguments:
pool (~celery.concurrency.base.TaskPool): The execution pool
used to execute this request.
Raises:
celery.exceptions.TaskRevokedError:... | Used by the worker to send this task to the pool.
Arguments:
pool (~celery.concurrency.base.TaskPool): The execution pool
used to execute this request.
Raises:
celery.exceptions.TaskRevokedError: if the task was revoked. | python | celery/worker/request.py | 338 | [
"self",
"pool"
] | true | 5 | 6.56 | celery/celery | 27,741 | google | false | |
getAnnotatedMethodsNotCached | private static ImmutableList<Method> getAnnotatedMethodsNotCached(Class<?> clazz) {
Set<? extends Class<?>> supertypes = TypeToken.of(clazz).getTypes().rawTypes();
Map<MethodIdentifier, Method> identifiers = new HashMap<>();
for (Class<?> supertype : supertypes) {
for (Method method : supertype.getDec... | Returns all subscribers for the given listener grouped by the type of event they subscribe to. | java | android/guava/src/com/google/common/eventbus/SubscriberRegistry.java | 193 | [
"clazz"
] | true | 4 | 6 | google/guava | 51,352 | javadoc | false | |
getPriority | protected @Nullable Integer getPriority(Object beanInstance) {
Comparator<Object> comparator = getDependencyComparator();
if (comparator instanceof OrderComparator orderComparator) {
return orderComparator.getPriority(beanInstance);
}
return null;
} | Return the priority assigned for the given bean instance by
the {@code jakarta.annotation.Priority} annotation.
<p>The default implementation delegates to the specified
{@link #setDependencyComparator dependency comparator}, checking its
{@link OrderComparator#getPriority method} if it is an extension of
Spring's commo... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 2,217 | [
"beanInstance"
] | Integer | true | 2 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
accept | @SuppressWarnings("boxing") // boxing unavoidable
public static <T extends Throwable> void accept(final FailableBiConsumer<Long, Integer, T> consumer, final Duration duration)
throws T {
if (consumer != null && duration != null) {
consumer.accept(duration.toMillis(), getNanosOfMilli(... | Accepts the function with the duration as a long milliseconds and int nanoseconds.
@param <T> The function exception.
@param consumer Accepting function.
@param duration The duration to pick apart.
@throws T See the function signature.
@see StopWatch | java | src/main/java/org/apache/commons/lang3/time/DurationUtils.java | 57 | [
"consumer",
"duration"
] | void | true | 3 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
getUserHome | private static Path getUserHome() {
String userHome = System.getProperty("user.home");
if (userHome == null) {
throw new IllegalStateException("user.home system property is required");
}
return PathUtils.get(userHome);
} | Main entry point that activates entitlement checking. Once this method returns,
calls to methods protected by entitlements from classes without a valid
policy will throw {@link org.elasticsearch.entitlement.runtime.api.NotEntitledException}.
@param serverPolicyPatch additional entitlements to patch the embed... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java | 110 | [] | Path | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
replace | public String replace(final String text, String searchString, final String replacement, int max) {
if (StringUtils.isEmpty(text) || StringUtils.isEmpty(searchString) || replacement == null || max == 0) {
return text;
}
if (ignoreCase) {
searchString = searchString.toLower... | Replaces a String with another String inside a larger String, for the first {@code max} values of the search String.
<p>
A {@code null} reference passed to this method is a no-op.
</p>
<p>
Case-sensitive examples
</p>
<pre>
Strings.CS.replace(null, *, *, *) = null
Strings.CS.replace("", *, *, *) = ""
... | java | src/main/java/org/apache/commons/lang3/Strings.java | 1,291 | [
"text",
"searchString",
"replacement",
"max"
] | String | true | 10 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
getMappings | function getMappings(mappings: DMMF.Mappings, datamodel: DMMF.Datamodel): DMMF.Mappings {
const modelOperations = mappings.modelOperations
.filter((mapping) => {
const model = datamodel.models.find((m) => m.name === mapping.model)
if (!model) {
throw new Error(`Mapping without model ${mapping.... | Turns type: string into type: string[] for all args in order to support union input types
@param document | typescript | packages/client-generator-js/src/externalToInternalDmmf.ts | 20 | [
"mappings",
"datamodel"
] | true | 11 | 6.72 | prisma/prisma | 44,834 | jsdoc | false | |
rewriteExprFromNumberToDuration | std::string rewriteExprFromNumberToDuration(
const ast_matchers::MatchFinder::MatchResult &Result, DurationScale Scale,
const Expr *Node) {
const Expr &RootNode = *Node->IgnoreParenImpCasts();
// First check to see if we can undo a complementary function call.
if (std::optional<std::string> MaybeRewrite ... | Returns `true` if `Node` is a value which evaluates to a literal `0`. | cpp | clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp | 222 | [
"Scale"
] | true | 3 | 6 | llvm/llvm-project | 36,021 | doxygen | false | |
copy_fwd_metadata_to_bw_nodes | def copy_fwd_metadata_to_bw_nodes(fx_g: torch.fx.GraphModule) -> None:
"""
Input: `fx_g` which contains the joint fwd+bwd FX graph created by
aot_autograd.
This function walks the graph and copies over metadata from forward nodes
to backward nodes, using the `seq_nr` field as a one-to-many mapping
... | Input: `fx_g` which contains the joint fwd+bwd FX graph created by
aot_autograd.
This function walks the graph and copies over metadata from forward nodes
to backward nodes, using the `seq_nr` field as a one-to-many mapping
from forward node to backward node. This metadata is useful for performance
profiling and debug... | python | torch/_functorch/_aot_autograd/utils.py | 607 | [
"fx_g"
] | None | true | 7 | 6 | pytorch/pytorch | 96,034 | unknown | false |
toBooleanObject | public static Boolean toBooleanObject(final String str, final String trueString, final String falseString, final String nullString) {
if (str == null) {
if (trueString == null) {
return Boolean.TRUE;
}
if (falseString == null) {
return Boolean.... | Converts a String to a Boolean throwing an exception if no match.
<p>NOTE: This method may return {@code null} and may throw a {@link NullPointerException}
if unboxed to a {@code boolean}.</p>
<pre>
BooleanUtils.toBooleanObject("true", "true", "false", "null") = Boolean.TRUE
BooleanUtils.toBooleanObject(null, nul... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 852 | [
"str",
"trueString",
"falseString",
"nullString"
] | Boolean | true | 8 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
build | public @Nullable BeanFactoryInitializationAotContribution build() {
return (!this.classes.isEmpty() ? new AotContribution(this.classes) : null);
} | Scan the given {@code packageNames} and their sub-packages for classes
that uses {@link Reflective}.
<p>This performs a "deep scan" by loading every class in the specified
packages and search for {@link Reflective} on types, constructors, methods,
and fields. Enclosed classes are candidates as well. Classes that fail t... | java | spring-context/src/main/java/org/springframework/context/aot/ReflectiveProcessorAotContributionBuilder.java | 99 | [] | BeanFactoryInitializationAotContribution | true | 2 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false |
startScheduler | protected void startScheduler(final Scheduler scheduler, final int startupDelay) throws SchedulerException {
if (startupDelay <= 0) {
logger.info("Starting Quartz Scheduler now");
scheduler.start();
}
else {
if (logger.isInfoEnabled()) {
logger.info("Will start Quartz Scheduler [" + scheduler.getSche... | Start the Quartz Scheduler, respecting the "startupDelay" setting.
@param scheduler the Scheduler to start
@param startupDelay the number of seconds to wait before starting
the Scheduler asynchronously | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java | 716 | [
"scheduler",
"startupDelay"
] | void | true | 6 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
repeat | function repeat(s: string, count: number): string {
let result = '';
for (let i = 0; i < count; i++) {
result += s;
}
return result;
} | Creates a formatted string out of the object passed as argument, using the given formatting options
@param any The object to stringify and format
@param options The formatting options to use | typescript | src/vs/base/common/jsonFormatter.ts | 218 | [
"s",
"count"
] | true | 2 | 6.24 | microsoft/vscode | 179,840 | jsdoc | false | |
update | private void update(MessageDigest digest, @Nullable Object source) {
if (source != null) {
digest.update(getUpdateSourceBytes(source));
}
} | Return a subdirectory of the application temp.
@param subDir the subdirectory name
@return a subdirectory | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java | 166 | [
"digest",
"source"
] | void | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
process | private void process(final ShareAcknowledgementCommitCallbackRegistrationEvent event) {
if (requestManagers.shareConsumeRequestManager.isEmpty()) {
return;
}
ShareConsumeRequestManager manager = requestManagers.shareConsumeRequestManager.get();
manager.setAcknowledgementComm... | Process event indicating whether the AcknowledgeCommitCallbackHandler is configured by the user.
@param event Event containing a boolean to indicate if the callback handler is configured or not. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 597 | [
"event"
] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
getInputStream | private InputStream getInputStream(ZipContent.Entry contentEntry) throws IOException {
int compression = contentEntry.getCompressionMethod();
if (compression != ZipEntry.STORED && compression != ZipEntry.DEFLATED) {
throw new ZipException("invalid compression method");
}
synchronized (this) {
ensureOpen()... | Return if an entry with the given name exists.
@param name the name to check
@return if the entry exists | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java | 352 | [
"contentEntry"
] | InputStream | true | 5 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
setupDebugEnv | function setupDebugEnv() {
require('internal/util/debuglog').initializeDebugEnv(process.env.NODE_DEBUG);
if (getOptionValue('--expose-internals')) {
require('internal/bootstrap/realm').BuiltinModule.exposeInternals();
}
} | 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 | 444 | [] | false | 2 | 6.8 | nodejs/node | 114,839 | jsdoc | false | |
cacheExpression | function cacheExpression(node: Expression): Identifier {
if (isGeneratedIdentifier(node) || getEmitFlags(node) & EmitFlags.HelperName) {
return node as Identifier;
}
const temp = factory.createTempVariable(hoistVariableDeclaration);
emitAssignment(temp, node, /*locatio... | Visits an ElementAccessExpression that contains a YieldExpression.
@param node The node to visit. | typescript | src/compiler/transformers/generators.ts | 2,088 | [
"node"
] | true | 3 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
to_sql | def to_sql(
self,
frame,
name: str,
if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail",
index: bool = True,
index_label=None,
schema: str | None = None,
chunksize: int | None = None,
dtype: DtypeArg | None = None,
metho... | Write records stored in a DataFrame to a SQL database.
Parameters
----------
frame : DataFrame
name : string
Name of SQL table.
if_exists : {'fail', 'replace', 'append'}, default 'fail'
- fail: If table exists, do nothing.
- replace: If table exists, drop it, recreate it, and insert data.
- append: If ... | python | pandas/io/sql.py | 2,324 | [
"self",
"frame",
"name",
"if_exists",
"index",
"index_label",
"schema",
"chunksize",
"dtype",
"method",
"engine"
] | int | None | true | 13 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
flatten | def flatten(self, order='C'):
"""
Return a flattened copy of the matrix.
All `N` elements of the matrix are placed into a single row.
Parameters
----------
order : {'C', 'F', 'A', 'K'}, optional
'C' means to flatten in row-major (C-style) order. 'F' means to... | Return a flattened copy of the matrix.
All `N` elements of the matrix are placed into a single row.
Parameters
----------
order : {'C', 'F', 'A', 'K'}, optional
'C' means to flatten in row-major (C-style) order. 'F' means to
flatten in column-major (Fortran-style) order. 'A' means to
flatten in column-maj... | python | numpy/matrixlib/defmatrix.py | 382 | [
"self",
"order"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
max | function max(array) {
return (array && array.length)
? baseExtremum(array, identity, baseGt)
: undefined;
} | Computes the maximum value of `array`. If `array` is empty or falsey,
`undefined` is returned.
@static
@since 0.1.0
@memberOf _
@category Math
@param {Array} array The array to iterate over.
@returns {*} Returns the maximum value.
@example
_.max([4, 2, 8, 6]);
// => 8
_.max([]);
// => undefined | javascript | lodash.js | 16,415 | [
"array"
] | false | 3 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
same_two_models | def same_two_models(
gm: torch.fx.GraphModule,
opt_gm: torch.fx.GraphModule,
example_inputs: Sequence[Any],
only_fwd: bool = False,
*,
require_fp64: bool = False,
ignore_non_fp: bool = False,
) -> bool:
"""
Check two models have same accuracy.
require_fp64: if True, raise an err... | Check two models have same accuracy.
require_fp64: if True, raise an error if we unable to calculate the fp64 reference
ignore_non_fp: if True, do not compare outputs which are not floating point. This
is mostly useful for the minifier (which wants to avoid quantizing floating point
error into integer/boolean... | python | torch/_dynamo/debug_utils.py | 396 | [
"gm",
"opt_gm",
"example_inputs",
"only_fwd",
"require_fp64",
"ignore_non_fp"
] | bool | true | 3 | 6.64 | pytorch/pytorch | 96,034 | unknown | false |
getGuardNames | function getGuardNames(child: AngularRoute, type: RouteGuard): string[] {
const guards = child?.[type] || [];
const names = guards.map((g: any) => getClassOrFunctionName(g));
return names || [];
} | Gets the set of currently active Route configuration objects from the router state.
This function synchronously reads the current router state without waiting for navigation events.
@param router - The Angular Router instance
@returns A Set containing all Route configuration objects that are currently active
@example
`... | typescript | devtools/projects/ng-devtools-backend/src/lib/router-tree.ts | 93 | [
"child",
"type"
] | true | 3 | 8.88 | angular/angular | 99,544 | jsdoc | false | |
getParameters | @IgnoreJRERequirement
public final ImmutableList<Parameter> getParameters() {
Type[] parameterTypes = getGenericParameterTypes();
Annotation[][] annotations = getParameterAnnotations();
@Nullable Object[] annotatedTypes =
new Object[parameterTypes.length];
ImmutableList.Builder<Parameter> buil... | Returns all declared parameters of this {@code Invokable}. Note that if this is a constructor
of a non-static inner class, unlike {@link Constructor#getParameterTypes}, the hidden {@code
this} parameter of the enclosing class is excluded from the returned parameters. | java | android/guava/src/com/google/common/reflect/Invokable.java | 270 | [] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
removeElements | public static boolean[] removeElements(final boolean[] array, final boolean... values) {
if (isEmpty(array) || isEmpty(values)) {
return clone(array);
}
final HashMap<Boolean, MutableInt> occurrences = new HashMap<>(2); // only two possible values here
for (final boolean v : ... | Removes occurrences of specified elements, in specified quantities,
from the specified array. All subsequent elements are shifted left.
For any element-to-be-removed specified in greater quantities than
contained in the original array, no change occurs beyond the
removal of the existing matching items.
<p>
This method ... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5,915 | [
"array"
] | true | 6 | 7.44 | apache/commons-lang | 2,896 | javadoc | false | |
advance | final boolean advance() {
checkState(!successorIterator.hasNext());
if (!nodeIterator.hasNext()) {
return false;
}
node = nodeIterator.next();
successorIterator = graph.successors(node).iterator();
return true;
} | Called after {@link #successorIterator} is exhausted. Advances {@link #node} to the next node
and updates {@link #successorIterator} to iterate through the successors of {@link #node}. | java | android/guava/src/com/google/common/graph/EndpointPairIterator.java | 55 | [] | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false | |
shimOrRewriteImportOrRequireCall | function shimOrRewriteImportOrRequireCall(node: CallExpression): CallExpression {
return factory.updateCallExpression(
node,
node.expression,
/*typeArguments*/ undefined,
visitNodes(node.arguments, (arg: Expression) => {
if (arg === node.argu... | Visits the body of a Block to hoist declarations.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 1,192 | [
"node"
] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
index | def index(a, sub, start=0, end=None):
"""
Like `find`, but raises :exc:`ValueError` when the substring is not found.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
sub : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
start, end :... | Like `find`, but raises :exc:`ValueError` when the substring is not found.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
sub : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
start, end : array_like, with any integer dtype, optional
Returns
-------
out : n... | python | numpy/_core/strings.py | 337 | [
"a",
"sub",
"start",
"end"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
forRequiredField | public static AutowiredFieldValueResolver forRequiredField(String fieldName) {
return new AutowiredFieldValueResolver(fieldName, true, null);
} | Create a new {@link AutowiredFieldValueResolver} for the specified field
where injection is required.
@param fieldName the field name
@return a new {@link AutowiredFieldValueResolver} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredFieldValueResolver.java | 88 | [
"fieldName"
] | AutowiredFieldValueResolver | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
remove | boolean remove(K key, long value) {
AtomicLong atomic = map.get(key);
if (atomic == null) {
return false;
}
long oldValue = atomic.get();
if (oldValue != value) {
return false;
}
if (oldValue == 0L || atomic.compareAndSet(oldValue, 0L)) {
// only remove after setting to z... | If {@code (key, value)} is currently in the map, this method removes it and returns true;
otherwise, this method returns false. | java | android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java | 267 | [
"key",
"value"
] | true | 5 | 6 | google/guava | 51,352 | javadoc | false | |
standalone_compile | def standalone_compile(
gm: torch.fx.GraphModule,
example_inputs: list[InputType],
*,
dynamic_shapes: Literal[
"from_example_inputs", "from_tracing_context", "from_graph"
] = "from_graph",
options: Optional[dict[str, Any]] = None,
aot: bool = False, # AOT mode, which uses BundledAOT... | Precompilation API for inductor.
.. code-block:: python
compiled_artifact = torch._inductor.standalone_compile(gm, args)
compiled_artifact.save(path=path, format="binary")
# Later on a new process
loaded = torch._inductor.CompiledArtifact.load(path=path, format="binary")
compiled_out = loaded(*ar... | python | torch/_inductor/__init__.py | 406 | [
"gm",
"example_inputs",
"dynamic_shapes",
"options",
"aot"
] | CompiledArtifact | true | 2 | 7.6 | pytorch/pytorch | 96,034 | google | false |
_define_gemm_instance | def _define_gemm_instance(
self,
op: GemmOperation,
evt_name: Optional[str] = None,
) -> tuple[str, str]:
"""Defines and renders the Cutlass / CUDA C++ code for a given GEMM operation instance.
This function uses the Cutlass library to generate key parts of the codegen proce... | Defines and renders the Cutlass / CUDA C++ code for a given GEMM operation instance.
This function uses the Cutlass library to generate key parts of the codegen process. General Matrix Multiply
forms a core part of a number of scientific applications, so this efficient and adaptable implementation is
crucial.
Args:
... | python | torch/_inductor/codegen/cuda/gemm_template.py | 1,827 | [
"self",
"op",
"evt_name"
] | tuple[str, str] | true | 5 | 7.92 | pytorch/pytorch | 96,034 | google | false |
charsEndIndex | function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
} | Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
that is not found in the character symbols.
@private
@param {Array} strSymbols The string symbols to inspect.
@param {Array} chrSymbols The character symbols to find.
@returns {number} Returns the index of the last unmatched string symbol. | javascript | lodash.js | 1,090 | [
"strSymbols",
"chrSymbols"
] | false | 3 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
filter | public FailableStream<O> filter(final FailablePredicate<O, ?> predicate) {
assertNotTerminated();
stream = stream.filter(Functions.asPredicate(predicate));
return this;
} | Returns a FailableStream consisting of the elements of this stream that match
the given FailablePredicate.
<p>
This is an intermediate operation.
</p>
@param predicate a non-interfering, stateless predicate to apply to each
element to determine if it should be included.
@return the new stream. | java | src/main/java/org/apache/commons/lang3/Streams.java | 335 | [
"predicate"
] | true | 1 | 6.72 | apache/commons-lang | 2,896 | javadoc | false | |
get_indexer_non_unique | def get_indexer_non_unique(
self, target
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]:
"""
Compute indexer and mask for new index given the current index.
The indexer should be then used as an input to ndarray.take to align the
current data to the new index.
... | Compute indexer and mask for new index given the current index.
The indexer should be then used as an input to ndarray.take to align the
current data to the new index.
Parameters
----------
target : Index
An iterable containing the values to be used for computing indexer.
Returns
-------
indexer : np.ndarray[np.... | python | pandas/core/indexes/base.py | 6,070 | [
"self",
"target"
] | tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]] | true | 9 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
generateKey | private Object generateKey(CacheOperationContext context, @Nullable Object result) {
Object key = context.generateKey(result);
if (key == null) {
throw new IllegalArgumentException("""
Null key returned for cache operation [%s]. If you are using named parameters, \
ensure that the compiler uses the '-p... | Collect a {@link CachePutRequest} for every {@link CacheOperation}
using the specified result value.
@param contexts the contexts to handle
@param result the result value
@param putRequests the collection to update | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 742 | [
"context",
"result"
] | Object | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.