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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
translate | public final String translate(final CharSequence input) {
if (input == null) {
return null;
}
try {
final StringWriter writer = new StringWriter(input.length() * 2);
translate(input, writer);
return writer.toString();
} catch (final IOExcep... | Helper for non-Writer usage.
@param input CharSequence to be translated.
@return String output of translation. | java | src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java | 67 | [
"input"
] | String | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
shortArrayToInt | public static int shortArrayToInt(final short[] src, final int srcPos, final int dstInit, final int dstPos, final int nShorts) {
if (src.length == 0 && srcPos == 0 || 0 == nShorts) {
return dstInit;
}
if ((nShorts - 1) * Short.SIZE + dstPos >= Integer.SIZE) {
throw new Il... | Converts an array of short into an int using the default (little-endian, LSB0) byte and bit ordering.
@param src the short array to convert.
@param srcPos the position in {@code src}, in short unit, from where to start the conversion.
@param dstInit initial value of the destination int.
@param dstPos the position... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 1,226 | [
"src",
"srcPos",
"dstInit",
"dstPos",
"nShorts"
] | true | 6 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
sortlevel | def sortlevel(
self,
level=None,
ascending: bool | list[bool] = True,
sort_remaining=None,
na_position: NaPosition = "first",
) -> tuple[Self, np.ndarray]:
"""
For internal compatibility with the Index API.
Sort the Index. This is for compat with Mult... | For internal compatibility with the Index API.
Sort the Index. This is for compat with MultiIndex
Parameters
----------
ascending : bool, default True
False to sort in descending order
na_position : {'first' or 'last'}, default 'first'
Argument 'first' puts NaNs at the beginning, 'last' puts NaNs at
the e... | python | pandas/core/indexes/base.py | 2,158 | [
"self",
"level",
"ascending",
"sort_remaining",
"na_position"
] | tuple[Self, np.ndarray] | true | 5 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
_merge | def _merge(self, args=None, kwargs=None, options=None, force=False):
"""Merge partial args/kwargs/options with existing ones.
If the signature is immutable and ``force`` is False, the existing
args/kwargs will be returned as-is and only the options will be merged.
Stamped headers are c... | Merge partial args/kwargs/options with existing ones.
If the signature is immutable and ``force`` is False, the existing
args/kwargs will be returned as-is and only the options will be merged.
Stamped headers are considered immutable and will not be merged regardless.
Arguments:
args (Tuple): Partial args to be ... | python | celery/canvas.py | 402 | [
"self",
"args",
"kwargs",
"options",
"force"
] | false | 11 | 7.44 | celery/celery | 27,741 | google | false | |
upgradedb | def upgradedb(
*,
to_revision: str | None = None,
from_revision: str | None = None,
show_sql_only: bool = False,
session: Session = NEW_SESSION,
):
"""
Upgrades the DB.
:param to_revision: Optional Alembic revision ID to upgrade *to*.
If omitted, upgrades to latest revision.
... | Upgrades the DB.
:param to_revision: Optional Alembic revision ID to upgrade *to*.
If omitted, upgrades to latest revision.
:param from_revision: Optional Alembic revision ID to upgrade *from*.
Not compatible with ``sql_only=False``.
:param show_sql_only: if True, migration statements will be printed but not e... | python | airflow-core/src/airflow/utils/db.py | 1,065 | [
"to_revision",
"from_revision",
"show_sql_only",
"session"
] | true | 17 | 6.48 | apache/airflow | 43,597 | sphinx | false | |
getReader | @Override
public Reader getReader(Object templateSource, String encoding) throws IOException {
Resource resource = (Resource) templateSource;
try {
return new InputStreamReader(resource.getInputStream(), encoding);
}
catch (IOException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Could not find... | Create a new {@code SpringTemplateLoader}.
@param resourceLoader the Spring ResourceLoader to use
@param templateLoaderPath the template loader path to use | java | spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java | 79 | [
"templateSource",
"encoding"
] | Reader | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
listTopics | @Override
public Map<String, List<PartitionInfo>> listTopics(Duration timeout) {
return delegate.listTopics(timeout);
} | Get metadata about partitions for all topics that the user is authorized to view. This method will issue a
remote call to the server.
@param timeout The maximum time this operation will block to fetch topic metadata
@return The map of topics and its partitions
@throws org.apache.kafka.common.errors.WakeupException if {... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 1,483 | [
"timeout"
] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
isSimpleBindingOrAssignmentElement | function isSimpleBindingOrAssignmentElement(element: BindingOrAssignmentElement): boolean {
const target = getTargetOfBindingOrAssignmentElement(element);
if (!target || isOmittedExpression(target)) return true;
const propertyName = tryGetPropertyNameOfBindingOrAssignmentElement(element);
if (proper... | Flattens an ArrayBindingOrAssignmentPattern into zero or more bindings or assignments.
@param flattenContext Options used to control flattening.
@param parent The parent element of the pattern.
@param pattern The ArrayBindingOrAssignmentPattern to flatten.
@param value The current RHS value to assign to the elemen... | typescript | src/compiler/transformers/destructuring.ts | 522 | [
"element"
] | true | 8 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
including | public ErrorAttributeOptions including(Include... includes) {
EnumSet<Include> updated = copyIncludes();
updated.addAll(Arrays.asList(includes));
return new ErrorAttributeOptions(Collections.unmodifiableSet(updated));
} | Return an {@code ErrorAttributeOptions} that includes the specified attribute
{@link Include} options.
@param includes error attributes to include
@return an {@code ErrorAttributeOptions} | java | core/spring-boot/src/main/java/org/springframework/boot/web/error/ErrorAttributeOptions.java | 67 | [] | ErrorAttributeOptions | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
writeStatement | function writeStatement(statement: Statement): void {
if (statement) {
if (!statements) {
statements = [statement];
}
else {
statements.push(statement);
}
}
} | Writes a statement to the current label's statement list.
@param statement A statement to write. | typescript | src/compiler/transformers/generators.ts | 3,078 | [
"statement"
] | true | 4 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
pyarrow_array_to_numpy_and_mask | def pyarrow_array_to_numpy_and_mask(
arr, dtype: np.dtype
) -> tuple[np.ndarray, np.ndarray]:
"""
Convert a primitive pyarrow.Array to a numpy array and boolean mask based
on the buffers of the Array.
At the moment pyarrow.BooleanArray is not supported.
Parameters
----------
arr : pyar... | Convert a primitive pyarrow.Array to a numpy array and boolean mask based
on the buffers of the Array.
At the moment pyarrow.BooleanArray is not supported.
Parameters
----------
arr : pyarrow.Array
dtype : numpy.dtype
Returns
-------
(data, mask)
Tuple of two numpy arrays with the raw data (with specified dtype)... | python | pandas/core/arrays/arrow/_arrow_utils.py | 7 | [
"arr",
"dtype"
] | tuple[np.ndarray, np.ndarray] | true | 4 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
replaceIn | public boolean replaceIn(final StrBuilder source) {
if (source == null) {
return false;
}
return substitute(source, 0, source.length());
} | Replaces all the occurrences of variables within the given source
builder with their matching values from the resolver.
@param source the builder to replace in, updated, null returns zero.
@return true if altered. | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 729 | [
"source"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
standardLastEntry | protected @Nullable Entry<E> standardLastEntry() {
Iterator<Entry<E>> entryIterator = descendingMultiset().entrySet().iterator();
if (!entryIterator.hasNext()) {
return null;
}
Entry<E> entry = entryIterator.next();
return Multisets.immutableEntry(entry.getElement(), entry.getCount());
} | A sensible definition of {@link #lastEntry()} in terms of {@code
descendingMultiset().entrySet().iterator()}.
<p>If you override {@link #descendingMultiset} or {@link #entrySet()}, you may wish to override
{@link #firstEntry()} to forward to this implementation. | java | android/guava/src/com/google/common/collect/ForwardingSortedMultiset.java | 143 | [] | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false | |
applyRules | @Deprecated
protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
return printer.format(calendar, buf);
} | Performs the formatting by applying the rules to the specified calendar.
@param calendar the calendar to format.
@param buf the buffer to format into.
@return the specified string buffer.
@deprecated Use {@link #format(Calendar, Appendable)} | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 378 | [
"calendar",
"buf"
] | StringBuffer | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
partial_fit | def partial_fit(self, X, y, classes=None):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Subset of the training data.
y : array-like of shape (n_samples,)
Sub... | Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Subset of the training data.
y : array-like of shape (n_samples,)
Subset of the target values.
classes : ndarray of shape (n_classes,)
Classes across all calls to par... | python | sklearn/linear_model/_passive_aggressive.py | 249 | [
"self",
"X",
"y",
"classes"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
parse | static @Nullable PrivateKey parse(@Nullable String text, @Nullable String password) {
if (text == null) {
return null;
}
try {
for (PemParser pemParser : PEM_PARSERS) {
PrivateKey privateKey = pemParser.parse(text, password);
if (privateKey != null) {
return privateKey;
}
}
}
catch (... | Parse a private key from the specified string, using the provided password for
decryption if necessary.
@param text the text to parse
@param password the password used to decrypt an encrypted private key
@return the parsed private key | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemPrivateKeyParser.java | 205 | [
"text",
"password"
] | PrivateKey | true | 4 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
booleanValue | boolean booleanValue() throws IOException; | @return true iff the current value is either boolean (<code>true</code> or <code>false</code>) or one of "false", "true". | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParser.java | 175 | [] | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false | |
findSingleMainClass | public static @Nullable String findSingleMainClass(JarFile jarFile, @Nullable String classesLocation,
@Nullable String annotationName) throws IOException {
SingleMainClassCallback callback = new SingleMainClassCallback(annotationName);
MainClassFinder.doWithMainClasses(jarFile, classesLocation, callback);
retu... | Find a single main class in a given jar file. A main class annotated with an
annotation with the given {@code annotationName} will be preferred over a main
class with no such annotation.
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@param annotationName the... | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 203 | [
"jarFile",
"classesLocation",
"annotationName"
] | String | true | 1 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
isParameterNameStart | function isParameterNameStart() {
// Be permissive about await and yield by calling isBindingIdentifier instead of isIdentifier; disallowing
// them during a speculative parse leads to many more follow-on errors than allowing the function to parse then later
// complaining about the use of th... | 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,019 | [] | false | 3 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
splitByWholeSeparatorPreserveAllTokens | public static String[] splitByWholeSeparatorPreserveAllTokens(final String str, final String separator, final int max) {
return splitByWholeSeparatorWorker(str, separator, max, true);
} | Splits the provided text into an array, separator string specified. Returns a maximum of {@code max} substrings.
<p>
The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For more control over the
split use the StrTokenizer class.
</p>
<p>
A {@code n... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,339 | [
"str",
"separator",
"max"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
parseValue | Object parseValue(ConfigKey key, Object value, boolean isSet) {
Object parsedValue;
if (isSet) {
parsedValue = parseType(key.name, value, key.type);
// props map doesn't contain setting, the key is required because no default value specified - its an error
} else if (NO_DEFAU... | Parse and validate configs against this configuration definition. The input is a map of configs. It is expected
that the keys of the map are strings, but the values can either be strings or they may already be of the
appropriate type (int, string, etc). This will work equally well with either java.util.Properties insta... | java | clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java | 531 | [
"key",
"value",
"isSet"
] | Object | true | 7 | 8.4 | apache/kafka | 31,560 | javadoc | false |
close | @Override
public void close() throws IOException {
State prevState = state;
if (state == State.CLOSING) return;
state = State.CLOSING;
sslEngine.closeOutbound();
try {
if (prevState != State.NOT_INITIALIZED && isConnected()) {
if (!flush(netWriteBu... | Sends an SSL close message and closes socketChannel. | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 177 | [] | void | true | 9 | 6.88 | apache/kafka | 31,560 | javadoc | false |
removeRequest | @Override
void removeRequest() {
if (!unsentOffsetFetchRequests().remove(this)) {
log.warn("OffsetFetch request to remove not found in the outbound buffer: {}", this);
}
} | Handle failed responses. This will retry if the error is retriable, or complete the
result future exceptionally in the case of non-recoverable or unexpected errors. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 1,105 | [] | void | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false |
pathChecks | private static Stream<InstrumentationService.InstrumentationInfo> pathChecks() {
var pathClasses = StreamSupport.stream(FileSystems.getDefault().getRootDirectories().spliterator(), false)
.map(Path::getClass)
.distinct();
return pathClasses.flatMap(pathClass -> {
Inst... | Initializes the dynamic (agent-based) instrumentation:
<ol>
<li>
Finds the version-specific subclass of {@link EntitlementChecker} to use
</li>
<li>
Builds the set of methods to instrument using {@link InstrumentationService#lookupMethods}
</li>
<li>
Augment this set “dynamically” using {@link InstrumentationService#lo... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/DynamicInstrumentation.java | 224 | [] | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
_unsafe_acquire_flock_with_timeout | def _unsafe_acquire_flock_with_timeout(
flock: BaseFileLock,
timeout: float | None,
) -> None:
"""Acquire a FileLock with timeout without automatic release (unsafe).
This function acquires a file lock with timeout support but does NOT automatically
release it. The caller is responsible for releasin... | Acquire a FileLock with timeout without automatic release (unsafe).
This function acquires a file lock with timeout support but does NOT automatically
release it. The caller is responsible for releasing the lock explicitly.
Use this only when you need manual control over lock lifetime.
Args:
flock: The FileLock o... | python | torch/_inductor/runtime/caching/locks.py | 158 | [
"flock",
"timeout"
] | None | true | 2 | 8 | pytorch/pytorch | 96,034 | google | false |
set_deterministic_debug_mode | def set_deterministic_debug_mode(debug_mode: builtins.int | str) -> None:
r"""Sets the debug mode for deterministic operations.
.. note:: This is an alternative interface for
:func:`torch.use_deterministic_algorithms`. Refer to that function's
documentation for details about affected operations... | r"""Sets the debug mode for deterministic operations.
.. note:: This is an alternative interface for
:func:`torch.use_deterministic_algorithms`. Refer to that function's
documentation for details about affected operations.
Args:
debug_mode(str or int): If "default" or 0, don't error or warn on
non... | python | torch/__init__.py | 1,534 | [
"debug_mode"
] | None | true | 11 | 6.4 | pytorch/pytorch | 96,034 | google | false |
allNull | public static boolean allNull(final Object... values) {
return !anyNotNull(values);
} | Tests if all values in the given array are {@code null}.
<p>
If all the values are {@code null} or the array is {@code null} or empty, then {@code true} is returned, otherwise {@code false} is returned.
</p>
<pre>
ObjectUtils.allNull(*) = false
ObjectUtils.allNull(*, null) = false
ObjectUtils.al... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 168 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
validate_release_date | def validate_release_date(ctx: click.core.Context, param: click.core.Option, value: str) -> str:
"""
Validate that the date follows YYYY-MM-DD[_NN] format.
:param ctx: Click context
:param param: Click parameter
:param value: The value to validate
:return: The validated value
:raises click.... | Validate that the date follows YYYY-MM-DD[_NN] format.
:param ctx: Click context
:param param: Click parameter
:param value: The value to validate
:return: The validated value
:raises click.BadParameter: If the value doesn't match the required format | python | dev/breeze/src/airflow_breeze/utils/click_validators.py | 25 | [
"ctx",
"param",
"value"
] | str | true | 3 | 7.44 | apache/airflow | 43,597 | sphinx | false |
strip_newsgroup_footer | def strip_newsgroup_footer(text):
"""
Given text in "news" format, attempt to remove a signature block.
As a rough heuristic, we assume that signatures are set apart by either
a blank line or a line made of hyphens, and that it is the last such line
in the file (disregarding blank lines at the end)... | Given text in "news" format, attempt to remove a signature block.
As a rough heuristic, we assume that signatures are set apart by either
a blank line or a line made of hyphens, and that it is the last such line
in the file (disregarding blank lines at the end).
Parameters
----------
text : str
The text from whic... | python | sklearn/datasets/_twenty_newsgroups.py | 137 | [
"text"
] | false | 5 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
parseAssertsTypePredicate | function parseAssertsTypePredicate(): TypeNode {
const pos = getNodePos();
const assertsModifier = parseExpectedToken(SyntaxKind.AssertsKeyword);
const parameterName = token() === SyntaxKind.ThisKeyword ? parseThisTypeNode() : parseIdentifier();
const type = parseOptional(SyntaxKind.... | 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,932 | [] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
readFirstLine | @Deprecated
@InlineMe(
replacement = "Files.asCharSource(file, charset).readFirstLine()",
imports = "com.google.common.io.Files")
public
static @Nullable String readFirstLine(File file, Charset charset) throws IOException {
return asCharSource(file, charset).readFirstLine();
} | Reads the first line from a file. The line does not include line-termination characters, but
does include other leading and trailing whitespace.
@param file the file to read from
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@return the fir... | java | android/guava/src/com/google/common/io/Files.java | 518 | [
"file",
"charset"
] | String | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false |
getParentPath | private static @Nullable Path getParentPath(Path path) {
Path parent = path.getParent();
// Paths that have a parent:
if (parent != null) {
// "/foo" ("/")
// "foo/bar" ("foo")
// "C:\foo" ("C:\")
// "\foo" ("\" - current drive for process on Windows)
// "C:foo" ("C:" - workin... | Returns a path to the parent directory of the given path. If the path actually has a parent
path, this is simple. Otherwise, we need to do some trickier things. Returns null if the path
is a root or is the empty path. | java | android/guava/src/com/google/common/io/MoreFiles.java | 712 | [
"path"
] | Path | true | 3 | 6 | google/guava | 51,352 | javadoc | false |
removeIfEmpty | void removeIfEmpty() {
if (ancestor != null) {
ancestor.removeIfEmpty();
} else if (delegate.isEmpty()) {
map.remove(key);
}
} | If collection is empty, remove it from {@code AbstractMapBasedMultimap.this.map}. For
subcollections, check whether the ancestor collection is empty. | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 369 | [] | void | true | 3 | 6.24 | google/guava | 51,352 | javadoc | false |
exponentialMapToSE3Inv | static void exponentialMapToSE3Inv(const Mat& twist, Mat& R1, Mat& t1)
{
//see Exponential Map in http://ethaneade.com/lie.pdf
/*
\begin{align*}
\boldsymbol{\delta} &= \left( \mathbf{u}, \boldsymbol{\omega} \right ) \in se(3) \\
\mathbf{u}, \boldsymbol{\omega} &\in \mathbb{R}^3 \\
\theta &= \sqr... | @brief The exponential map from se(3) to SE(3).
@param twist A twist (v, w) represents the velocity of a rigid body as an angular velocity
around an axis and a linear velocity along this axis.
@param R1 Resultant rotation matrix from the twist.
@param t1 Resultant translation vector from the twist. | cpp | modules/calib3d/src/solvepnp.cpp | 659 | [] | true | 4 | 6.96 | opencv/opencv | 85,374 | doxygen | false | |
of | public static ErrorAttributeOptions of(Collection<Include> includes) {
return new ErrorAttributeOptions(
(includes.isEmpty()) ? Collections.emptySet() : Collections.unmodifiableSet(EnumSet.copyOf(includes)));
} | Create an {@code ErrorAttributeOptions} that includes the specified attribute
{@link Include} options.
@param includes error attributes to include
@return an {@code ErrorAttributeOptions} | java | core/spring-boot/src/main/java/org/springframework/boot/web/error/ErrorAttributeOptions.java | 126 | [
"includes"
] | ErrorAttributeOptions | true | 2 | 7.2 | spring-projects/spring-boot | 79,428 | javadoc | false |
_loss_grad_lbfgs | def _loss_grad_lbfgs(self, transformation, X, same_class_mask, sign=1.0):
"""Compute the loss and the loss gradient w.r.t. `transformation`.
Parameters
----------
transformation : ndarray of shape (n_components * n_features,)
The raveled linear transformation on which to com... | Compute the loss and the loss gradient w.r.t. `transformation`.
Parameters
----------
transformation : ndarray of shape (n_components * n_features,)
The raveled linear transformation on which to compute loss and
evaluate gradient.
X : ndarray of shape (n_samples, n_features)
The training samples.
same_cl... | python | sklearn/neighbors/_nca.py | 452 | [
"self",
"transformation",
"X",
"same_class_mask",
"sign"
] | false | 4 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
parenthesizeBranchOfConditionalExpression | function parenthesizeBranchOfConditionalExpression(branch: Expression): Expression {
// per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions
// so in case when comma expression is introduced as a part of previous transformations
// if shoul... | Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended
order of operations.
@param binaryOperator The operator for the BinaryExpression.
@param operand The operand for the BinaryExpression.
@param isLeftSideOfBinary A value indicating whether the operand is the left side... | typescript | src/compiler/factory/parenthesizerRules.ts | 334 | [
"branch"
] | true | 2 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
make_response | def make_response(*args: t.Any) -> Response:
"""Sometimes it is necessary to set additional headers in a view. Because
views do not have to return response objects but can return a value that
is converted into a response object by Flask itself, it becomes tricky to
add headers to it. This function can... | Sometimes it is necessary to set additional headers in a view. Because
views do not have to return response objects but can return a value that
is converted into a response object by Flask itself, it becomes tricky to
add headers to it. This function can be called instead of using a return
and you will get a response... | python | src/flask/helpers.py | 138 | [] | Response | true | 3 | 6.72 | pallets/flask | 70,946 | unknown | false |
pop | def pop() -> None:
"""
Pop the key_stack and append an exception table entry if possible.
"""
nonlocal nexti
if key_stack:
key = key_stack.pop()
if nexti <= key[1]:
exn_tab.append(
ExceptionTableEntry(max(key[0], nexti),... | Pop the key_stack and append an exception table entry if possible. | python | torch/_dynamo/bytecode_transformation.py | 1,021 | [] | None | true | 3 | 6.88 | pytorch/pytorch | 96,034 | unknown | false |
reject | function reject(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, negate(getIteratee(predicate, 3)));
} | The opposite of `_.filter`; this method returns the elements of `collection`
that `predicate` does **not** return truthy for.
@static
@memberOf _
@since 0.1.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration... | javascript | lodash.js | 9,854 | [
"collection",
"predicate"
] | false | 2 | 6.96 | lodash/lodash | 61,490 | jsdoc | false | |
getObjectType | @Override
public @Nullable Class<?> getObjectType() {
synchronized (this) {
if (this.singletonInstance != null) {
return this.singletonInstance.getClass();
}
}
try {
// This might be incomplete since it potentially misses introduced interfaces
// from Advisors that will be lazily retrieved via se... | Return the type of the proxy. Will check the singleton instance if
already created, else fall back to the proxy interface (in case of just
a single one), the target bean type, or the TargetSource's target class.
@see org.springframework.aop.framework.AopProxy#getProxyClass | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java | 264 | [] | true | 5 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false | |
description | public KafkaFuture<UserScramCredentialsDescription> description(String userName) {
final KafkaFutureImpl<UserScramCredentialsDescription> retval = new KafkaFutureImpl<>();
dataFuture.whenComplete((data, throwable) -> {
if (throwable != null) {
retval.completeExceptionally(thr... | @param userName the name of the user description being requested
@return a future indicating the description results for the given user. The future will complete exceptionally if
the future returned by {@link #users()} completes exceptionally. Note that if the given user does not exist in
the list of described users t... | java | clients/src/main/java/org/apache/kafka/clients/admin/DescribeUserScramCredentialsResult.java | 114 | [
"userName"
] | true | 4 | 7.6 | apache/kafka | 31,560 | javadoc | false | |
VerticalDelimiter | function VerticalDelimiter() {
const store = useContext(StoreContext);
const {ownerID, inspectedElementIndex} = useContext(TreeStateContext);
const {lineHeight} = useContext(SettingsContext);
if (ownerID != null || inspectedElementIndex == null) {
return null;
}
const element = store.getElementAtIndex... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/Components/Tree.js | 568 | [] | false | 5 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
describeShareGroups | default DescribeShareGroupsResult describeShareGroups(Collection<String> groupIds) {
return describeShareGroups(groupIds, new DescribeShareGroupsOptions());
} | Describe some share groups in the cluster, with the default options.
<p>
This is a convenience method for {@link #describeShareGroups(Collection, DescribeShareGroupsOptions)}
with default options. See the overload for more details.
@param groupIds The IDs of the groups to describe.
@return The DescribeShareGroupsResult... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,941 | [
"groupIds"
] | DescribeShareGroupsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
_is_strictly_monotonic_decreasing | def _is_strictly_monotonic_decreasing(self) -> bool:
"""
Return if the index is strictly monotonic decreasing
(only decreasing) values.
Examples
--------
>>> Index([3, 2, 1])._is_strictly_monotonic_decreasing
True
>>> Index([3, 2, 2])._is_strictly_monoton... | Return if the index is strictly monotonic decreasing
(only decreasing) values.
Examples
--------
>>> Index([3, 2, 1])._is_strictly_monotonic_decreasing
True
>>> Index([3, 2, 2])._is_strictly_monotonic_decreasing
False
>>> Index([3, 1, 2])._is_strictly_monotonic_decreasing
False | python | pandas/core/indexes/base.py | 2,442 | [
"self"
] | bool | true | 2 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
queued_slots | def queued_slots(self, session: Session = NEW_SESSION) -> int:
"""
Get the number of slots used by queued tasks at the moment.
:param session: SQLAlchemy ORM Session
:return: the used number of slots
"""
from airflow.models.taskinstance import TaskInstance # Avoid circu... | Get the number of slots used by queued tasks at the moment.
:param session: SQLAlchemy ORM Session
:return: the used number of slots | python | airflow-core/src/airflow/models/pool.py | 291 | [
"self",
"session"
] | int | true | 2 | 8.08 | apache/airflow | 43,597 | sphinx | false |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ConfigurationProperty other = (ConfigurationProperty) obj;
boolean result = true;
result = result && ObjectUtils.nullSafeEquals(this.name, other.name);
... | Return the value of the configuration property.
@return the configuration property value | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java | 93 | [
"obj"
] | true | 6 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false | |
of | public static <E extends Throwable> Duration of(final FailableRunnable<E> runnable) throws E {
return of(start -> runnable.run());
} | Runs the lambda and returns the duration of its execution.
@param <E> The type of exception throw by the lambda.
@param runnable What to execute.
@return The Duration of execution.
@throws E thrown by the lambda.
@see StopWatch
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/time/DurationUtils.java | 183 | [
"runnable"
] | Duration | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
StringifiedBackend | inline std::string StringifiedBackend(Context& ctx) {
return ctx.options().backend == Backend::UPB ? "upb" : "cpp";
} | This Context object will be used throughout hpb generation.
It is a thin wrapper around an io::Printer and can be easily extended
to support more options.
Expected usage is:
SomeGenerationFunc(..., Context& context) {
context.Emit({{"some_key", some_computed_val}}, R"cc(
// hpb gencode ...
)cc);
} | cpp | hpb_generator/context.h | 110 | [] | true | 2 | 6.32 | protocolbuffers/protobuf | 69,904 | doxygen | false | |
maxBy | function maxBy(array, iteratee) {
return (array && array.length)
? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
: undefined;
} | This method is like `_.max` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the criterion by which
the value is ranked. The iteratee is invoked with one argument: (value).
@static
@memberOf _
@since 4.0.0
@category Math
@param {Array} array The array to iterate over.
@param {F... | javascript | lodash.js | 16,444 | [
"array",
"iteratee"
] | false | 3 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
_get_no_sort_one_missing_indexer | def _get_no_sort_one_missing_indexer(
n: int, left_missing: bool
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]:
"""
Return join indexers where all of one side is selected without sorting
and none of the other side is selected.
Parameters
----------
n : int
Length of indexer... | Return join indexers where all of one side is selected without sorting
and none of the other side is selected.
Parameters
----------
n : int
Length of indexers to create.
left_missing : bool
If True, the left indexer will contain only -1's.
If False, the right indexer will contain only -1's.
Returns
-----... | python | pandas/core/reshape/merge.py | 2,694 | [
"n",
"left_missing"
] | tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]] | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
subscribe | @Override
public void subscribe(Collection<String> topics, ConsumerRebalanceListener listener) {
if (listener == null)
throw new IllegalArgumentException("RebalanceListener cannot be null");
subscribeInternal(topics, Optional.of(listener));
} | This method signals the background thread to {@link CreateFetchRequestsEvent create fetch requests} for the
pre-fetch case, i.e. right before {@link #poll(Duration)} exits. In the pre-fetch case, the application thread
will not wait for confirmation of the request creation before continuing.
<p/>
At the point this meth... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 2,026 | [
"topics",
"listener"
] | void | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false |
close | @Override
public void close() throws Exception {
AtomicReference<Throwable> firstException = new AtomicReference<>();
if (instance instanceof AutoCloseable) {
Utils.closeQuietly((AutoCloseable) instance, instance.getClass().getSimpleName(), firstException);
}
pluginMetric... | Wrap a list of instances into Plugins.
@param instances the instances to wrap
@param metrics the metrics
@param key the value for the <code>config</code> tag
@return the list of plugins | java | clients/src/main/java/org/apache/kafka/common/internals/Plugin.java | 122 | [] | void | true | 3 | 8.24 | apache/kafka | 31,560 | javadoc | false |
sem | def sem(self, ddof: int = 1, numeric_only: bool = False):
"""
Calculate the rolling standard error of mean.
Parameters
----------
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations
is ``N - ddof``, where ``N`` represents the... | Calculate the rolling standard error of mean.
Parameters
----------
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations
is ``N - ddof``, where ``N`` represents the number of elements.
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
------... | python | pandas/core/window/rolling.py | 2,914 | [
"self",
"ddof",
"numeric_only"
] | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false | |
readLines | public static List<String> readLines(File file, Charset charset) throws IOException {
// don't use asCharSource(file, charset).readLines() because that returns
// an immutable list, which would change the behavior of this method
return asCharSource(file, charset)
.readLines(
new LineProc... | Reads all of the lines from a file. The lines do not include line-termination characters, but
do include other leading and trailing whitespace.
<p>This method returns a mutable {@code List}. For an {@code ImmutableList}, use {@code
Files.asCharSource(file, charset).readLines()}.
<p><b>{@link java.nio.file.Path} equival... | java | android/guava/src/com/google/common/io/Files.java | 543 | [
"file",
"charset"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
showUsage | protected void showUsage() {
Log.infoPrint("usage: " + this.name);
for (Command command : this.commands) {
if (isOptionCommand(command)) {
Log.infoPrint("[--" + command.getName() + "] ");
}
}
Log.info("");
Log.info(" <command> [<args>]");
Log.info("");
Log.info("Available commands are:");
... | Subclass hook called after a command has run.
@param command the command that has run | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java | 268 | [] | void | true | 6 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
_log_inference_graph | def _log_inference_graph(
fw_module: torch.fx.GraphModule,
aot_config: AOTConfig,
) -> Optional[str]:
"""
Log the inference graph to the structured logger.
Return a str representation of the graph.
"""
if aot_config.enable_log:
trace_structured(
"artifact",
me... | Log the inference graph to the structured logger.
Return a str representation of the graph. | python | torch/_functorch/_aot_autograd/graph_compile.py | 363 | [
"fw_module",
"aot_config"
] | Optional[str] | true | 3 | 6 | pytorch/pytorch | 96,034 | unknown | false |
iterator | @Override
public Iterator<Record> iterator() {
return iterator(BufferSupplier.NO_CACHING);
} | Get an iterator for the nested entries contained within this batch. Note that
if the batch is not compressed, then this method will return an iterator over the
shallow record only (i.e. this object).
@return An iterator over the records contained within this batch | java | clients/src/main/java/org/apache/kafka/common/record/AbstractLegacyRecordBatch.java | 229 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
getResources | Resource[] getResources(String location, ResourceType type) {
validatePattern(location, type);
String directoryPath = location.substring(0, location.indexOf("*/"));
String fileName = location.substring(location.lastIndexOf("/") + 1);
Resource resource = getResource(directoryPath);
if (!resource.exists()) {
... | Get a multiple resources from a location pattern.
@param location the location pattern
@param type the type of resource to return
@return the resources
@see #isPattern(String) | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/LocationResourceLoader.java | 94 | [
"location",
"type"
] | true | 6 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
head | def head(self, n: int = 5) -> NDFrameT:
"""
Return first n rows of each group.
Similar to ``.apply(lambda x: x.head(n))``, but it returns a subset of rows
from the original DataFrame with original index and order preserved
(``as_index`` flag is ignored).
Parameters
... | Return first n rows of each group.
Similar to ``.apply(lambda x: x.head(n))``, but it returns a subset of rows
from the original DataFrame with original index and order preserved
(``as_index`` flag is ignored).
Parameters
----------
n : int
If positive: number of entries to include from start of each group.
I... | python | pandas/core/groupby/groupby.py | 5,446 | [
"self",
"n"
] | NDFrameT | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false |
read_fwf | def read_fwf(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
*,
colspecs: Sequence[tuple[int, int]] | str | None = "infer",
widths: Sequence[int] | None = None,
infer_nrows: int = 100,
iterator: bool = False,
chunksize: int | None = None,
**kwds: Unpack[_read_s... | r"""
Read a table of fixed-width formatted lines into DataFrame.
Also supports optionally iterating or breaking of the file
into chunks.
Additional help can be found in the `online docs for IO Tools
<https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html>`_.
Parameters
----------
filepath_or_buffer : str, p... | python | pandas/io/parsers/readers.py | 1,479 | [
"filepath_or_buffer",
"colspecs",
"widths",
"infer_nrows",
"iterator",
"chunksize"
] | DataFrame | TextFileReader | true | 17 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
init_PPC_64Bit | private static void init_PPC_64Bit() {
addProcessors(new Processor(Processor.Arch.BIT_64, Processor.Type.PPC), "ppc64", "power64", "powerpc64", "power_pc64", "power_rs64");
} | Gets a {@link Processor} object the given value {@link String}. The {@link String} must be like a value returned by the {@code "os.arch"} system
property.
@param value A {@link String} like a value returned by the {@code os.arch} System Property.
@return A {@link Processor} when it exists, else {@code null}. | java | src/main/java/org/apache/commons/lang3/ArchUtils.java | 119 | [] | void | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
enterIf | public boolean enterIf(Guard guard) {
if (guard.monitor != this) {
throw new IllegalMonitorStateException();
}
ReentrantLock lock = this.lock;
lock.lock();
boolean satisfied = false;
try {
return satisfied = guard.isSatisfied();
} finally {
if (!satisfied) {
lock.u... | Enters this monitor if the guard is satisfied. Blocks indefinitely acquiring the lock, but does
not wait for the guard to be satisfied.
@return whether the monitor was entered, which guarantees that the guard is now satisfied | java | android/guava/src/com/google/common/util/concurrent/Monitor.java | 681 | [
"guard"
] | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false | |
_addListener | function _addListener(target, type, listener, prepend) {
let m;
let events;
let existing;
checkListener(listener);
events = target._events;
if (events === undefined) {
events = target._events = { __proto__: null };
target._eventsCount = 0;
} else {
// To avoid recursion in the case that type... | Synchronously calls each of the listeners registered
for the event.
@param {string | symbol} type
@param {...any} [args]
@returns {boolean} | javascript | lib/events.js | 536 | [
"target",
"type",
"listener",
"prepend"
] | false | 14 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
maybe_mangle_lambdas | def maybe_mangle_lambdas(agg_spec: Any) -> Any:
"""
Make new lambdas with unique names.
Parameters
----------
agg_spec : Any
An argument to GroupBy.agg.
Non-dict-like `agg_spec` are pass through as is.
For dict-like `agg_spec` a new spec is returned
with name-mangled... | Make new lambdas with unique names.
Parameters
----------
agg_spec : Any
An argument to GroupBy.agg.
Non-dict-like `agg_spec` are pass through as is.
For dict-like `agg_spec` a new spec is returned
with name-mangled lambdas.
Returns
-------
mangled : Any
Same type as the input.
Examples
--------
... | python | pandas/core/apply.py | 2,049 | [
"agg_spec"
] | Any | true | 9 | 8 | pandas-dev/pandas | 47,362 | numpy | false |
toString | @Override
public String toString() {
String text = String.valueOf(getElement());
int n = getCount();
return (n == 1) ? text : (text + " x " + n);
} | Returns a string representation of this multiset entry. The string representation consists of
the associated element if the associated count is one, and otherwise the associated element
followed by the characters " x " (space, x and space) followed by the count. Elements and
counts are converted to strings as by {@code... | java | android/guava/src/com/google/common/collect/Multisets.java | 857 | [] | String | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false |
of | static SslBundle of(@Nullable SslStoreBundle stores, @Nullable SslBundleKey key, @Nullable SslOptions options) {
return of(stores, key, options, null);
} | Factory method to create a new {@link SslBundle} instance.
@param stores the stores or {@code null}
@param key the key or {@code null}
@param options the options or {@code null}
@return a new {@link SslBundle} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslBundle.java | 119 | [
"stores",
"key",
"options"
] | SslBundle | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_fargate_profile_state | def get_fargate_profile_state(self, clusterName: str, fargateProfileName: str) -> FargateProfileStates:
"""
Return the current status of a given AWS Fargate profile.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.describe_fargate_profile`
:param clusterName: The name of... | Return the current status of a given AWS Fargate profile.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.describe_fargate_profile`
:param clusterName: The name of the Amazon EKS Cluster associated with the Fargate profile.
:param fargateProfileName: The name of the Fargate profile to check.
:return: Returns t... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 412 | [
"self",
"clusterName",
"fargateProfileName"
] | FargateProfileStates | true | 2 | 7.6 | apache/airflow | 43,597 | sphinx | false |
equals | @Override
public boolean equals(final Object obj) {
return obj instanceof StrBuilder && equals((StrBuilder) obj);
} | Checks the contents of this builder against another to see if they
contain the same character content.
@param obj the object to check, null returns false
@return true if the builders contain the same characters in the same order | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,855 | [
"obj"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
index_labels_to_array | def index_labels_to_array(
labels: np.ndarray | Iterable, dtype: NpDtype | None = None
) -> np.ndarray:
"""
Transform label or iterable of labels to array, for use in Index.
Parameters
----------
dtype : dtype
If specified, use as dtype of the resulting array, otherwise infer.
Retu... | Transform label or iterable of labels to array, for use in Index.
Parameters
----------
dtype : dtype
If specified, use as dtype of the resulting array, otherwise infer.
Returns
-------
array | python | pandas/core/common.py | 268 | [
"labels",
"dtype"
] | np.ndarray | true | 3 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
requestOffsetReset | public void requestOffsetReset(TopicPartition partition) {
requestOffsetReset(partition, defaultResetStrategy);
} | Unset the preferred read replica. This causes the fetcher to go back to the leader for fetches.
@param tp The topic partition
@return the removed preferred read replica if set, Empty otherwise. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 796 | [
"partition"
] | void | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
getPropertyNameKeyEnd | private int getPropertyNameKeyEnd(String propertyName, int startIndex) {
int unclosedPrefixes = 0;
int length = propertyName.length();
for (int i = startIndex; i < length; i++) {
switch (propertyName.charAt(i)) {
case PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR -> {
// The property name contains opening... | Parse the given property name into the corresponding property name tokens.
@param propertyName the property name to parse
@return representation of the parsed property tokens | java | spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java | 978 | [
"propertyName",
"startIndex"
] | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false | |
expandProfiles | private List<String> expandProfiles(@Nullable List<String> profiles) {
Deque<String> stack = new ArrayDeque<>();
asReversedList(profiles).forEach(stack::push);
Set<String> expandedProfiles = new LinkedHashSet<>();
while (!stack.isEmpty()) {
String current = stack.pop();
if (expandedProfiles.add(current)) ... | Create a new {@link Profiles} instance based on the {@link Environment} and
{@link Binder}.
@param environment the source environment
@param binder the binder for profile properties
@param additionalProfiles any additional active profiles | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java | 139 | [
"profiles"
] | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
items | public ConditionMessage items(Object @Nullable ... items) {
return items(Style.NORMAL, items);
} | Indicate the items. For example
{@code didNotFind("bean", "beans").items("x", "y")} results in the message "did
not find beans x, y".
@param items the items (may be {@code null})
@return a built {@link ConditionMessage} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | 348 | [] | ConditionMessage | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
flatten_structured_array | def flatten_structured_array(a):
"""
Flatten a structured array.
The data type of the output is chosen such that it can represent all of the
(nested) fields.
Parameters
----------
a : structured array
Returns
-------
output : masked array or ndarray
A flattened masked ... | Flatten a structured array.
The data type of the output is chosen such that it can represent all of the
(nested) fields.
Parameters
----------
a : structured array
Returns
-------
output : masked array or ndarray
A flattened masked array if the input is a masked array, otherwise a
standard ndarray.
Examples... | python | numpy/ma/core.py | 2,548 | [
"a"
] | false | 7 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
wasLastAddedBucketPositive | boolean wasLastAddedBucketPositive() {
return positiveBuckets.numBuckets > 0;
} | @return true, if the last bucket added successfully via {@link #tryAddBucket(long, long, boolean)} was a positive one. | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/FixedCapacityExponentialHistogram.java | 221 | [] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
assign | @Override
public void assign(Collection<TopicPartition> partitions) {
acquireAndEnsureOpen();
try {
if (partitions == null) {
throw new IllegalArgumentException("Topic partition collection to assign to cannot be null");
} else if (partitions.isEmpty()) {
... | Internal helper method for {@link #subscribe(Pattern)} and
{@link #subscribe(Pattern, ConsumerRebalanceListener)}
<p>
Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
The pattern matching will be done periodically against all topics existing at the time of check.
This can be co... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java | 592 | [
"partitions"
] | void | true | 7 | 6.4 | apache/kafka | 31,560 | javadoc | false |
collectPutRequests | private void collectPutRequests(Collection<CacheOperationContext> contexts,
@Nullable Object result, Collection<CachePutRequest> putRequests) {
for (CacheOperationContext context : contexts) {
if (isConditionPassing(context, result)) {
putRequests.add(new CachePutRequest(context));
}
}
} | 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 | 723 | [
"contexts",
"result",
"putRequests"
] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
registerBean | public <T> void registerBean(@Nullable String beanName, Class<T> beanClass,
@Nullable Supplier<T> supplier, BeanDefinitionCustomizer... customizers) {
ClassDerivedBeanDefinition beanDefinition = new ClassDerivedBeanDefinition(beanClass);
if (supplier != null) {
beanDefinition.setInstanceSupplier(supplier);
... | Register a bean from the given bean class, using the given supplier for
obtaining a new instance (typically declared as a lambda expression or
method reference), optionally customizing its bean definition metadata
(again typically declared as a lambda expression).
<p>This method can be overridden to adapt the registrat... | java | spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java | 581 | [
"beanName",
"beanClass",
"supplier"
] | void | true | 3 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
addPropertyEditorRegistrar | @Override
public void addPropertyEditorRegistrar(PropertyEditorRegistrar registrar) {
Assert.notNull(registrar, "PropertyEditorRegistrar must not be null");
if (registrar.overridesDefaultEditors()) {
this.defaultEditorRegistrars.add(registrar);
}
else {
this.propertyEditorRegistrars.add(registrar);
}
... | Internal extended variant of {@link #isTypeMatch(String, ResolvableType)}
to check whether the bean with the given name matches the specified type. Allow
additional constraints to be applied to ensure that beans are not created early.
@param name the name of the bean to query
@param typeToMatch the type to match agains... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 876 | [
"registrar"
] | void | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
append | public StrBuilder append(final StrBuilder str, final int startIndex, final int length) {
if (str == null) {
return appendNull();
}
if (startIndex < 0 || startIndex > str.length()) {
throw new StringIndexOutOfBoundsException("startIndex must be valid");
}
i... | Appends part of a string builder to this string builder.
Appending null will call {@link #appendNull()}.
@param str the string to append
@param startIndex the start index, inclusive, must be valid
@param length the length to append, must be valid
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 598 | [
"str",
"startIndex",
"length"
] | StrBuilder | true | 7 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
get_file_metadata_async | async def get_file_metadata_async(
self, client: AioBaseClient, bucket_name: str, key: str | None = None
) -> AsyncIterator[Any]:
"""
Get a list of files that a key matching a wildcard expression exists in a bucket asynchronously.
:param client: aiobotocore client
:param buc... | Get a list of files that a key matching a wildcard expression exists in a bucket asynchronously.
:param client: aiobotocore client
:param bucket_name: the name of the bucket
:param key: the path to the key | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 504 | [
"self",
"client",
"bucket_name",
"key"
] | AsyncIterator[Any] | true | 6 | 7.04 | apache/airflow | 43,597 | sphinx | false |
prettyPrintException | static String prettyPrintException(Throwable throwable) {
if (throwable == null)
return "Null exception.";
if (throwable.getMessage() != null) {
return throwable.getClass().getSimpleName() + ": " + throwable.getMessage();
}
return throwable.getClass().getSimpleNam... | Pretty-print an exception.
@param throwable The exception.
@return A compact human-readable string. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 506 | [
"throwable"
] | String | true | 3 | 7.92 | apache/kafka | 31,560 | javadoc | false |
putIfAbsent | @SuppressWarnings("unchecked")
<RESPONSE> RESPONSE putIfAbsent(ProjectId projectId, String ip, String databasePath, Function<String, RESPONSE> retrieveFunction) {
// can't use cache.computeIfAbsent due to the elevated permissions for the jackson (run via the cache loader)
CacheKey cacheKey = new Cac... | Internal-only sentinel object for recording that a result from the geoip database was null (i.e. there was no result). By caching
this no-result we can distinguish between something not being in the cache because we haven't searched for that data yet, versus
something not being in the cache because the data doesn't exi... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpCache.java | 63 | [
"projectId",
"ip",
"databasePath",
"retrieveFunction"
] | RESPONSE | true | 4 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
exclusiveBetween | @SuppressWarnings("boxing")
public static void exclusiveBetween(final double start, final double end, final double value) {
// TODO when breaking BC, consider returning value
if (value <= start || value >= end) {
throw new IllegalArgumentException(String.format(DEFAULT_EXCLUSIVE_BETWEEN_... | Validate that the specified primitive value falls between the two
exclusive values specified; otherwise, throws an exception.
<pre>Validate.exclusiveBetween(0.1, 2.1, 1.1);</pre>
@param start the exclusive start value.
@param end the exclusive end value.
@param value the value to validate.
@throws IllegalArgumentExce... | java | src/main/java/org/apache/commons/lang3/Validate.java | 92 | [
"start",
"end",
"value"
] | void | true | 3 | 6.4 | apache/commons-lang | 2,896 | javadoc | false |
isStartOfExpression | function isStartOfExpression(): boolean {
if (isStartOfLeftHandSideExpression()) {
return true;
}
switch (token()) {
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.Exclamatio... | 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,995 | [] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | true | |
read_view_information_from_args | def read_view_information_from_args(
mutable_arg_names: list[str],
mutable_arg_types: list[torch.Type],
kwargs: dict[str, Any],
all_bases: list[Tensor],
):
"""
This reads the view information added by `write_view_information_to_args` from kwargs, pop them,
and returns a dict arg_name -> View... | This reads the view information added by `write_view_information_to_args` from kwargs, pop them,
and returns a dict arg_name -> ViewInfo | [ViewInfo](if the input is list). that maps each mutable arg
to its view information.
mutable_arg_names: mutable custom operator arg names.
mutable_arg_types: mutable custom operato... | python | torch/_higher_order_ops/auto_functionalize.py | 249 | [
"mutable_arg_names",
"mutable_arg_types",
"kwargs",
"all_bases"
] | true | 12 | 6.32 | pytorch/pytorch | 96,034 | unknown | false | |
readMetadata | ConfigurationMetadata readMetadata(TypeElement typeElement) {
return readMetadata(SOURCE_METADATA_PATH.apply(typeElement, this.typeUtils));
} | Read the existing {@link ConfigurationMetadata} for the specified type or
{@code null} if it is not available yet.
@param typeElement the type to read metadata for
@return the metadata for the given type or {@code null} | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java | 84 | [
"typeElement"
] | ConfigurationMetadata | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
registerStateListener | public void registerStateListener(MemberStateListener listener) {
Objects.requireNonNull(listener, "State updates listener cannot be null");
for (MemberStateListener registeredListener : stateUpdatesListeners) {
if (registeredListener == listener) {
throw new IllegalArgumentE... | Register a new listener that will be invoked whenever the member state changes, or a new
member ID or epoch is received.
@param listener Listener to invoke. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 371 | [
"listener"
] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
outsideOf | public static JavaUnicodeEscaper outsideOf(final int codePointLow, final int codePointHigh) {
return new JavaUnicodeEscaper(codePointLow, codePointHigh, false);
} | Constructs a {@link JavaUnicodeEscaper} outside of the specified values (exclusive).
@param codePointLow
below which to escape.
@param codePointHigh
above which to escape.
@return the newly created {@link UnicodeEscaper} instance. | java | src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java | 74 | [
"codePointLow",
"codePointHigh"
] | JavaUnicodeEscaper | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
toChar | public static char toChar(final Character ch) {
return Objects.requireNonNull(ch, "ch").charValue();
} | Converts the Character to a char throwing an exception for {@code null}.
<pre>
CharUtils.toChar(' ') = ' '
CharUtils.toChar('A') = 'A'
CharUtils.toChar(null) throws IllegalArgumentException
</pre>
@param ch the character to convert
@return the char value of the Character
@throws NullPointerException if the Cha... | java | src/main/java/org/apache/commons/lang3/CharUtils.java | 279 | [
"ch"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
fit | public long fit(final long element) {
return super.fit(element).longValue();
} | Fits the given value into this range by returning the given value or, if out of bounds, the range minimum if
below, or the range maximum if above.
<pre>{@code
LongRange range = LongRange.of(16, 64);
range.fit(-9) --> 16
range.fit(0) --> 16
range.fit(15) --> 16
range.fit(16) --> 16
range.fit(17) --> 17
...
range.f... | java | src/main/java/org/apache/commons/lang3/LongRange.java | 107 | [
"element"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
processBuilder | public ProcessBuilder processBuilder(String... arguments) {
ProcessBuilder processBuilder = new ProcessBuilder(toString());
processBuilder.command().addAll(Arrays.asList(arguments));
return processBuilder;
} | Create a new {@link ProcessBuilder} that will run with the Java executable.
@param arguments the command arguments
@return a {@link ProcessBuilder} | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java | 55 | [] | ProcessBuilder | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
getJaroWinklerDistance | @Deprecated
public static double getJaroWinklerDistance(final CharSequence first, final CharSequence second) {
final double DEFAULT_SCALING_FACTOR = 0.1;
if (first == null || second == null) {
throw new IllegalArgumentException("Strings must not be null");
}
final int[]... | Gets the Jaro Winkler Distance which indicates the similarity score between two Strings.
<p>
The Jaro measure is the weighted sum of percentage of matched characters from each file and transposed characters. Winkler increased this measure for
matching initial characters.
</p>
<p>
This implementation is based on the Jar... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 2,235 | [
"first",
"second"
] | true | 5 | 7.44 | apache/commons-lang | 2,896 | javadoc | false | |
wrapCollection | @Override
Collection<V> wrapCollection(@ParametricNullness K key, Collection<V> collection) {
if (collection instanceof NavigableSet) {
return new WrappedNavigableSet(key, (NavigableSet<V>) collection, null);
} else {
return new WrappedSortedSet(key, (SortedSet<V>) collection, null);
}
} | Creates a new multimap that uses the provided map.
@param map place to store the mapping from each key to its corresponding values | java | android/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java | 69 | [
"key",
"collection"
] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
fromroots | def fromroots(cls, roots, domain=[], window=None, symbol='x'):
"""Return series instance that has the specified roots.
Returns a series representing the product
``(x - r[0])*(x - r[1])*...*(x - r[n-1])``, where ``r`` is a
list of roots.
Parameters
----------
roo... | Return series instance that has the specified roots.
Returns a series representing the product
``(x - r[0])*(x - r[1])*...*(x - r[n-1])``, where ``r`` is a
list of roots.
Parameters
----------
roots : array_like
List of roots.
domain : {[], None, array_like}, optional
Domain for the resulting series. If None ... | python | numpy/polynomial/_polybase.py | 1,037 | [
"cls",
"roots",
"domain",
"window",
"symbol"
] | false | 5 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
mean | def mean(self, *, skipna: bool = True, axis: int | 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 to be... | 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/indexes/datetimelike.py | 94 | [
"self",
"skipna",
"axis"
] | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false | |
should_we_run_the_build | def should_we_run_the_build(build_ci_params: BuildCiParams) -> bool:
"""
Check if we should run the build based on what files have been modified since last build and answer from
the user.
* If build is needed, the user is asked for confirmation
* If the branch is not rebased it warns the user to re... | Check if we should run the build based on what files have been modified since last build and answer from
the user.
* If build is needed, the user is asked for confirmation
* If the branch is not rebased it warns the user to rebase (to make sure latest remote cache is useful)
* Builds Image/Skips/Quits depending on the... | python | dev/breeze/src/airflow_breeze/commands/ci_image_commands.py | 719 | [
"build_ci_params"
] | bool | true | 7 | 6.96 | apache/airflow | 43,597 | sphinx | false |
toString | @Override
public String toString() {
if (toString == null) {
toString = "[" + minimum + ".." + maximum + "]";
}
return toString;
} | Gets the range as a {@link String}.
<p>The format of the String is '[<em>min</em>..<em>max</em>]'.</p>
@return the {@link String} representation of this range. | java | src/main/java/org/apache/commons/lang3/Range.java | 537 | [] | String | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
get_indexer_for | def get_indexer_for(self, target) -> npt.NDArray[np.intp]:
"""
Guaranteed return of an indexer even when non-unique.
This dispatches to get_indexer or get_indexer_non_unique
as appropriate.
Parameters
----------
target : Index
An iterable containing ... | Guaranteed return of an indexer even when non-unique.
This dispatches to get_indexer or get_indexer_non_unique
as appropriate.
Parameters
----------
target : Index
An iterable containing the values to be used for computing indexer.
Returns
-------
np.ndarray[np.intp]
List of indices.
See Also
--------
Index... | python | pandas/core/indexes/base.py | 6,162 | [
"self",
"target"
] | npt.NDArray[np.intp] | true | 2 | 7.84 | 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.