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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
above | public static NumericEntityEscaper above(final int codePoint) {
return outsideOf(0, codePoint);
} | Constructs a {@link NumericEntityEscaper} above the specified value (exclusive).
@param codePoint above which to escape.
@return the newly created {@link NumericEntityEscaper} instance. | java | src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java | 39 | [
"codePoint"
] | NumericEntityEscaper | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
handleSpecificExceptionInResponse | public boolean handleSpecificExceptionInResponse(final R response, final long currentTimeMs) {
return false;
} | Error handling specific response exception to a group type.
@param response The heartbeat response
@param currentTimeMs Current time
@return true if the error was handled, else false | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractHeartbeatRequestManager.java | 478 | [
"response",
"currentTimeMs"
] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
subscribeInternal | private void subscribeInternal(Collection<String> topics, Optional<ConsumerRebalanceListener> listener) {
acquireAndEnsureOpen();
try {
throwIfGroupIdNotDefined();
if (topics == null)
throw new IllegalArgumentException("Topic collection to subscribe to cannot be n... | Subscribe to the RE2/J pattern. This will generate an event to update the pattern in the
subscription state, so it's included in the next heartbeat request sent to the broker.
No validation of the pattern is performed by the client (other than null/empty checks). | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 2,155 | [
"topics",
"listener"
] | void | true | 5 | 6 | apache/kafka | 31,560 | javadoc | false |
commitAsync | public CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> commitAsync(final Map<TopicPartition, OffsetAndMetadata> offsets) {
if (offsets.isEmpty()) {
log.debug("Skipping commit of empty offsets");
return CompletableFuture.completedFuture(Map.of());
}
maybeUpdateLa... | Generate a request to commit offsets without retrying, even if it fails with a retriable
error. The generated request will be added to the queue to be sent on the next call to
{@link #poll(long)}.
@param offsets Offsets to commit per partition.
@return Future that will complete when a response is received, successfully... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 401 | [
"offsets"
] | true | 3 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
_validate_broker_urls | def _validate_broker_urls(self, broker_urls: Union[str, List[str]]) -> Set[str]:
"""Validate and split broker URLs.
Args:
broker_urls: Broker URLs, either as a semicolon-separated string
or as a list of strings
Returns:
Set of valid broker URLs
... | Validate and split broker URLs.
Args:
broker_urls: Broker URLs, either as a semicolon-separated string
or as a list of strings
Returns:
Set of valid broker URLs
Raises:
ValueError: If no valid broker URLs are found or if invalid URLs are provided | python | celery/worker/consumer/delayed_delivery.py | 226 | [
"self",
"broker_urls"
] | Set[str] | true | 7 | 7.76 | celery/celery | 27,741 | google | false |
as | public <E extends ZipEntry> E as(BiFunction<Entry, String, E> factory) {
try {
E result = factory.apply(this, getName());
long pos = getCentralDirectoryFileHeaderRecordPos(this.lookupIndex);
this.centralRecord.copyTo(ZipContent.this.data, pos, result);
return result;
}
catch (IOException ex) {
... | Adapt the raw entry into a {@link ZipEntry} or {@link ZipEntry} subclass.
@param <E> the entry type
@param factory the factory used to create the {@link ZipEntry}
@return a fully populated zip entry | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 834 | [
"factory"
] | E | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
factorize_from_iterables | def factorize_from_iterables(iterables) -> tuple[list[np.ndarray], list[Index]]:
"""
A higher-level wrapper over `factorize_from_iterable`.
Parameters
----------
iterables : list-like of list-likes
Returns
-------
codes : list of ndarrays
categories : list of Indexes
Notes
... | A higher-level wrapper over `factorize_from_iterable`.
Parameters
----------
iterables : list-like of list-likes
Returns
-------
codes : list of ndarrays
categories : list of Indexes
Notes
-----
See `factorize_from_iterable` for more info. | python | pandas/core/arrays/categorical.py | 3,157 | [
"iterables"
] | tuple[list[np.ndarray], list[Index]] | true | 2 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
get_instance | def get_instance(self, instance_id: str, filters: list | None = None):
"""
Get EC2 instance by id and return it.
:param instance_id: id of the AWS EC2 instance
:param filters: List of filters to specify instances to get
:return: Instance object
"""
if self._api_t... | Get EC2 instance by id and return it.
:param instance_id: id of the AWS EC2 instance
:param filters: List of filters to specify instances to get
:return: Instance object | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/ec2.py | 84 | [
"self",
"instance_id",
"filters"
] | true | 2 | 8.24 | apache/airflow | 43,597 | sphinx | false | |
translate | public abstract boolean translate(int codePoint, Writer out) throws IOException; | Translate the specified code point into another.
@param codePoint int character input to translate.
@param out Writer to optionally push the translated output to.
@return boolean as to whether translation occurred or not.
@throws IOException if and only if the Writer produces an IOException. | java | src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java | 60 | [
"codePoint",
"out"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
rate_limit | def rate_limit(state, task_name, rate_limit, **kwargs):
"""Tell worker(s) to modify the rate limit for a task by type.
See Also:
:attr:`celery.app.task.Task.rate_limit`.
Arguments:
task_name (str): Type of task to set rate limit for.
rate_limit (int, str): New rate limit.
"""
... | Tell worker(s) to modify the rate limit for a task by type.
See Also:
:attr:`celery.app.task.Task.rate_limit`.
Arguments:
task_name (str): Type of task to set rate limit for.
rate_limit (int, str): New rate limit. | python | celery/worker/control.py | 252 | [
"state",
"task_name",
"rate_limit"
] | false | 2 | 6.24 | celery/celery | 27,741 | google | false | |
getAll | public static Map<String, ConfigurationPropertiesBean> getAll(ApplicationContext applicationContext) {
Assert.notNull(applicationContext, "'applicationContext' must not be null");
if (applicationContext instanceof ConfigurableApplicationContext configurableContext) {
return getAll(configurableContext);
}
Map... | Return all {@link ConfigurationProperties @ConfigurationProperties} beans contained
in the given application context. Both directly annotated beans, as well as beans
that have {@link ConfigurationProperties @ConfigurationProperties} annotated
factory methods are included.
@param applicationContext the source applicatio... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java | 137 | [
"applicationContext"
] | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
partitionChanged | private boolean partitionChanged(String topic,
TopicInfo topicInfo,
BuiltInPartitioner.StickyPartitionInfo partitionInfo,
Deque<ProducerBatch> deque, long nowMs,
Cluster cl... | Check if partition concurrently changed, or we need to complete previously disabled partition change.
@param topic The topic
@param topicInfo The topic info
@param partitionInfo The built-in partitioner's partition info
@param deque The partition queue
@param nowMs The current time, in milliseconds
@param cluster THe c... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java | 232 | [
"topic",
"topicInfo",
"partitionInfo",
"deque",
"nowMs",
"cluster"
] | true | 4 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
sizeInBytes | public static int sizeInBytes(long baseOffset, Iterable<Record> records) {
Iterator<Record> iterator = records.iterator();
if (!iterator.hasNext())
return 0;
int size = RECORD_BATCH_OVERHEAD;
Long baseTimestamp = null;
while (iterator.hasNext()) {
Record ... | Gets the base timestamp of the batch which is used to calculate the record timestamps from the deltas.
@return The base timestamp | java | clients/src/main/java/org/apache/kafka/common/record/DefaultRecordBatch.java | 510 | [
"baseOffset",
"records"
] | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
bindCallExpressionFlow | function bindCallExpressionFlow(node: CallExpression | CallChain) {
if (isOptionalChain(node)) {
bindOptionalChainFlow(node);
}
else {
// If the target of the call expression is a function expression or arrow function we have
// an immediately invoked fu... | 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 | 2,226 | [
"node"
] | false | 11 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
compute_sample_weight | def compute_sample_weight(class_weight, y, *, indices=None):
"""Estimate sample weights by class for unbalanced datasets.
Parameters
----------
class_weight : dict, list of dicts, "balanced", or None
Weights associated with classes in the form `{class_label: weight}`.
If not given, all ... | Estimate sample weights by class for unbalanced datasets.
Parameters
----------
class_weight : dict, list of dicts, "balanced", or None
Weights associated with classes in the form `{class_label: weight}`.
If not given, all classes are supposed to have weight one. For
multi-output problems, a list of dicts ... | python | sklearn/utils/class_weight.py | 114 | [
"class_weight",
"y",
"indices"
] | false | 19 | 6.4 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
send_mass_mail | def send_mass_mail(
datatuple,
*,
fail_silently=False,
auth_user=None,
auth_password=None,
connection=None,
):
"""
Given a datatuple of (subject, message, from_email, recipient_list), send
each message to each recipient list. Return the number of emails sent.
If from_email is No... | Given a datatuple of (subject, message, from_email, recipient_list), send
each message to each recipient list. Return the number of emails sent.
If from_email is None, use the DEFAULT_FROM_EMAIL setting.
If auth_user and auth_password are set, use them to log in.
If auth_user is None, use the EMAIL_HOST_USER setting.
... | python | django/core/mail/__init__.py | 120 | [
"datatuple",
"fail_silently",
"auth_user",
"auth_password",
"connection"
] | false | 2 | 6.08 | django/django | 86,204 | unknown | false | |
ndim | def ndim(self) -> int:
"""
Number of dimensions of the underlying data, by definition 1.
See Also
--------
Series.size: Return the number of elements in the underlying data.
Series.shape: Return a tuple of the shape of the underlying data.
Series.dtype: Return th... | Number of dimensions of the underlying data, by definition 1.
See Also
--------
Series.size: Return the number of elements in the underlying data.
Series.shape: Return a tuple of the shape of the underlying data.
Series.dtype: Return the dtype object of the underlying data.
Series.values: Return Series as ndarray or n... | python | pandas/core/base.py | 368 | [
"self"
] | int | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | unknown | false |
downgrade | def downgrade(*, to_revision, from_revision=None, show_sql_only=False, session: Session = NEW_SESSION):
"""
Downgrade the airflow metastore schema to a prior version.
:param to_revision: The alembic revision to downgrade *to*.
:param show_sql_only: if True, print sql statements but do not run them
... | Downgrade the airflow metastore schema to a prior version.
:param to_revision: The alembic revision to downgrade *to*.
:param show_sql_only: if True, print sql statements but do not run them
:param from_revision: if supplied, alembic revision to dawngrade *from*. This may only
be used in conjunction with ``sql=Tru... | python | airflow-core/src/airflow/utils/db.py | 1,180 | [
"to_revision",
"from_revision",
"show_sql_only",
"session"
] | true | 8 | 6.88 | apache/airflow | 43,597 | sphinx | false | |
getGenericInterfaces | final ImmutableList<TypeToken<? super T>> getGenericInterfaces() {
if (runtimeType instanceof TypeVariable) {
return boundsAsInterfaces(((TypeVariable<?>) runtimeType).getBounds());
}
if (runtimeType instanceof WildcardType) {
return boundsAsInterfaces(((WildcardType) runtimeType).getUpperBounds... | Returns the generic interfaces that this type directly {@code implements}. This method is
similar but different from {@link Class#getGenericInterfaces()}. For example, {@code new
TypeToken<List<String>>() {}.getGenericInterfaces()} will return a list that contains {@code
new TypeToken<Iterable<String>>() {}}; while {@c... | java | android/guava/src/com/google/common/reflect/TypeToken.java | 355 | [] | true | 3 | 6.24 | google/guava | 51,352 | javadoc | false | |
flatten | def flatten(self) -> Series:
"""
Flatten list values.
Returns
-------
pandas.Series
The data from all lists in the series flattened.
See Also
--------
ListAccessor.__getitem__ : Index or slice values in the Series.
Examples
-... | Flatten list values.
Returns
-------
pandas.Series
The data from all lists in the series flattened.
See Also
--------
ListAccessor.__getitem__ : Index or slice values in the Series.
Examples
--------
>>> import pyarrow as pa
>>> s = pd.Series(
... [
... [1, 2, 3],
... [3],
... ],
... ... | python | pandas/core/arrays/arrow/accessors.py | 194 | [
"self"
] | Series | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | unknown | false |
cp | function cp(src, dest, options, callback) {
if (typeof options === 'function') {
callback = options;
options = undefined;
}
callback = makeCallback(callback);
options = validateCpOptions(options);
src = getValidatedPath(src, 'src');
dest = getValidatedPath(dest, 'dest');
lazyLoadCp();
cpFn(src, ... | Asynchronously copies `src` to `dest`. `src` can be a file, directory, or
symlink. The contents of directories will be copied recursively.
@param {string | URL} src
@param {string | URL} dest
@param {object} [options]
@param {(err?: Error) => any} callback
@returns {void} | javascript | lib/fs.js | 3,098 | [
"src",
"dest",
"options",
"callback"
] | false | 2 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
getTempDirectory | private Path getTempDirectory() {
String property = System.getProperty("java.io.tmpdir");
Assert.state(StringUtils.hasLength(property), "No 'java.io.tmpdir' property set");
Path tempDirectory = Paths.get(property);
Assert.state(Files.exists(tempDirectory), () -> "Temp directory '" + tempDirectory + "' does not ... | 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 | 135 | [] | Path | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
identityHashCodeHex | public static String identityHashCodeHex(final Object object) {
return Integer.toHexString(System.identityHashCode(object));
} | Returns the hexadecimal hash code for the given object per {@link System#identityHashCode(Object)}.
<p>
Short hand for {@code Integer.toHexString(System.identityHashCode(object))}.
</p>
@param object object for which the hashCode is to be calculated.
@return Hash code in hexadecimal format.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 774 | [
"object"
] | String | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
putBytes | @CanIgnoreReturnValue
PrimitiveSink putBytes(ByteBuffer bytes); | Puts the remaining bytes of a byte buffer into this sink. {@code bytes.position()} is the first
byte written, {@code bytes.limit() - 1} is the last. The position of the buffer will be equal
to the limit when this method returns.
@param bytes a byte buffer
@return this instance
@since 23.0 | java | android/guava/src/com/google/common/hash/PrimitiveSink.java | 71 | [
"bytes"
] | PrimitiveSink | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false |
symbolFlagsHaveMeaning | function symbolFlagsHaveMeaning(flags: SymbolFlags, meaning: SemanticMeaning): boolean {
return meaning === SemanticMeaning.All ? true :
meaning & SemanticMeaning.Value ? !!(flags & SymbolFlags.Value) :
meaning & SemanticMeaning.Type ? !!(flags & SymbolFlags.Type) :
meaning & SemanticMea... | @param forceImportKeyword Indicates that the user has already typed `import`, so the result must start with `import`.
(In other words, do not allow `const x = require("...")` for JS files.)
@internal | typescript | src/services/codefixes/importFixes.ts | 2,130 | [
"flags",
"meaning"
] | true | 5 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
estimateNNDescentMemory | static long estimateNNDescentMemory(int numVectors, int dims, CuVSMatrix.DataType dataType) {
int elementTypeBytes = switch (dataType) {
case FLOAT -> Float.BYTES;
case INT, UINT -> Integer.BYTES;
case BYTE -> Byte.BYTES;
};
return (long) (GPU_COMPUTATION_MEMO... | Estimates the required GPU memory for building an index using the NN_DESCENT algorithm.
@param numVectors the number of vectors
@param dims the dimensionality of vectors
@param dataType the data type of the vectors
@return the estimated memory in bytes needed for NN_DESCENT | java | libs/gpu-codec/src/main/java/org/elasticsearch/gpu/codec/CuVSResourceManager.java | 74 | [
"numVectors",
"dims",
"dataType"
] | true | 1 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false | |
memoizeWithExpiration | @J2ktIncompatible
@GwtIncompatible // java.time.Duration
@IgnoreJRERequirement
public static <T extends @Nullable Object> Supplier<T> memoizeWithExpiration(
Supplier<T> delegate, Duration duration) {
checkNotNull(delegate);
// The alternative of `duration.compareTo(Duration.ZERO) > 0` causes J2ObjC ... | Returns a supplier that caches the instance supplied by the delegate and removes the cached
value after the specified time has passed. Subsequent calls to {@code get()} return the cached
value if the expiration time has not passed. After the expiration time, a new value is
retrieved, cached, and returned. See: <a
href=... | java | android/guava/src/com/google/common/base/Suppliers.java | 272 | [
"delegate",
"duration"
] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
isAccessible | private static boolean isAccessible(final Class<?> type) {
Class<?> cls = type;
while (cls != null) {
if (!ClassUtils.isPublic(cls)) {
return false;
}
cls = cls.getEnclosingClass();
}
return true;
} | Tests whether the specified class is generally accessible, i.e. is declared in an entirely {@code public} manner.
@param type to check.
@return {@code true} if {@code type} and any enclosing classes are {@code public}.
@throws SecurityException Thrown if a security manager is present and a caller's class loader is not ... | java | src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java | 312 | [
"type"
] | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
update_providers_with_next_version_comment | def update_providers_with_next_version_comment() -> dict[str, dict[str, Any]]:
"""
Scan all provider pyproject.toml files for "# use next version" comments and update the version
of the referenced provider to the current version from that provider's pyproject.toml.
Returns a dictionary with information... | Scan all provider pyproject.toml files for "# use next version" comments and update the version
of the referenced provider to the current version from that provider's pyproject.toml.
Returns a dictionary with information about updated providers. | python | dev/breeze/src/airflow_breeze/utils/packages.py | 1,300 | [] | dict[str, dict[str, Any]] | true | 8 | 6.88 | apache/airflow | 43,597 | unknown | false |
canShortcutWithSource | boolean canShortcutWithSource(ElementType requiredType, ElementType alternativeType) {
if (this.resolved != null) {
return false;
}
for (int i = 0; i < this.size; i++) {
ElementType type = this.type[i];
if (type != requiredType && type != alternativeType) {
return false;
}
if (i > 0 &&... | Returns if the element source can be used as a shortcut for an operation such
as {@code equals} or {@code toString}.
@param requiredType the required type
@param alternativeType and alternative required type
@return {@code true} if all elements match at least one of the types | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 962 | [
"requiredType",
"alternativeType"
] | true | 7 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
xp_assert_close | def xp_assert_close(
actual: Array,
desired: Array,
*,
rtol: float | None = None,
atol: float = 0,
err_msg: str = "",
check_dtype: bool = True,
check_shape: bool = True,
check_scalar: bool = False,
) -> None:
"""
Array-API compatible version of `np.testing.assert_allclose`.
... | Array-API compatible version of `np.testing.assert_allclose`.
Parameters
----------
actual : Array
The array produced by the tested function.
desired : Array
The expected array (typically hardcoded).
rtol : float, optional
Relative tolerance. Default: dtype-dependent.
atol : float, optional
Absolute to... | python | sklearn/externals/array_api_extra/_lib/_testing.py | 213 | [
"actual",
"desired",
"rtol",
"atol",
"err_msg",
"check_dtype",
"check_shape",
"check_scalar"
] | None | true | 5 | 6.32 | scikit-learn/scikit-learn | 64,340 | numpy | false |
createTargetSource | protected TargetSource createTargetSource(Object target) {
if (target instanceof TargetSource targetSource) {
return targetSource;
}
else {
return new SingletonTargetSource(target);
}
} | Determine a TargetSource for the given target (or TargetSource).
@param target the target. If this is an implementation of TargetSource it is
used as our TargetSource; otherwise it is wrapped in a SingletonTargetSource.
@return a TargetSource for this object | java | spring-aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java | 191 | [
"target"
] | TargetSource | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
isTopLevelLogicalExpression | function isTopLevelLogicalExpression(node: Node): boolean {
while (
isParenthesizedExpression(node.parent) ||
isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.ExclamationToken
) {
node = node.parent;
}
return !isStatem... | 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 | 1,464 | [
"node"
] | true | 7 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
matchesNoneOf | public boolean matchesNoneOf(CharSequence sequence) {
return indexIn(sequence) == -1;
} | Returns {@code true} if a character sequence contains no matching BMP characters. Equivalent to
{@code !matchesAnyOf(sequence)}.
<p>The default implementation iterates over the sequence, invoking {@link #matches} for each
character, until this returns {@code true} or the end is reached.
@param sequence the character se... | java | android/guava/src/com/google/common/base/CharMatcher.java | 530 | [
"sequence"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
create | static Archive create(Class<?> target) throws Exception {
return create(target.getProtectionDomain());
} | Factory method to create an appropriate {@link Archive} from the given
{@link Class} target.
@param target a target class that will be used to find the archive code source
@return an 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 | 104 | [
"target"
] | Archive | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (obj instanceof ErrorPage other) {
return ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName())
&& ObjectUtils.nullSafeEquals(this.path, other.path) && this.s... | Return if this error page is a global one (matches all unmatched status and
exception types).
@return if this is a global error page | java | core/spring-boot/src/main/java/org/springframework/boot/web/error/ErrorPage.java | 109 | [
"obj"
] | true | 6 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
drainKeyReferenceQueue | @GuardedBy("this")
void drainKeyReferenceQueue() {
Reference<? extends K> ref;
int i = 0;
while ((ref = keyReferenceQueue.poll()) != null) {
@SuppressWarnings("unchecked")
ReferenceEntry<K, V> entry = (ReferenceEntry<K, V>) ref;
map.reclaimKey(entry);
if (++i == DRA... | Drain the key and value reference queues, cleaning up internal entries containing garbage
collected keys or values. | java | android/guava/src/com/google/common/cache/LocalCache.java | 2,389 | [] | void | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false |
endCodePath | function endCodePath() {
let codePath = analyzer.codePath;
// Mark the current path as the final node.
CodePath.getState(codePath).makeFinal();
// Emits onCodePathSegmentEnd event of the current segments.
leaveFromCurrentSegment(analyzer, node);
// Emits onCodePathEnd event of this code path.... | Ends the code path for the current node.
@returns {void} | javascript | packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js | 655 | [] | false | 1 | 6.08 | facebook/react | 241,750 | jsdoc | false | |
getProvider | public @Nullable TemplateAvailabilityProvider getProvider(String view, Environment environment,
ClassLoader classLoader, ResourceLoader resourceLoader) {
Assert.notNull(view, "'view' must not be null");
Assert.notNull(environment, "'environment' must not be null");
Assert.notNull(classLoader, "'classLoader' mu... | Get the provider that can be used to render the given view.
@param view the view to render
@param environment the environment
@param classLoader the class loader
@param resourceLoader the resource loader
@return a {@link TemplateAvailabilityProvider} or null | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java | 134 | [
"view",
"environment",
"classLoader",
"resourceLoader"
] | TemplateAvailabilityProvider | true | 5 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
check_allowed_values | def check_allowed_values(env_name: str, env_value: str) -> None:
"""
Check if value of provided environment variable is within a specified set of values.
:param env_name: name of the environment variable which is being checked.
:param env_value: value of the variable.
:raises: ... | Check if value of provided environment variable is within a specified set of values.
:param env_name: name of the environment variable which is being checked.
:param env_value: value of the variable.
:raises: ValueError: if env_value is not within a specified set of values | python | performance/src/performance_dags/performance_dag/performance_dag_utils.py | 299 | [
"env_name",
"env_value"
] | None | true | 2 | 6.56 | apache/airflow | 43,597 | sphinx | false |
count | def count(a, sub, start=0, end=None):
"""
Returns an array with the number of non-overlapping occurrences of
substring ``sub`` in the range [``start``, ``end``).
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
sub : array-like, with ``StringDType``... | Returns an array with the number of non-overlapping occurrences of
substring ``sub`` in the range [``start``, ``end``).
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
sub : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
The substring to search for.
start... | python | numpy/_core/strings.py | 405 | [
"a",
"sub",
"start",
"end"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
isQuote | private boolean isQuote(final char[] srcChars, final int pos, final int len, final int quoteStart, final int quoteLen) {
for (int i = 0; i < quoteLen; i++) {
if (pos + i >= len || srcChars[pos + i] != srcChars[quoteStart + i]) {
return false;
}
}
return tr... | Checks if the characters at the index specified match the quote
already matched in readNextToken().
@param srcChars the character array being tokenized.
@param pos the position to check for a quote.
@param len the length of the character array being tokenized.
@param quoteStart the start position of the matched quo... | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 615 | [
"srcChars",
"pos",
"len",
"quoteStart",
"quoteLen"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
rebalanceInProgress | protected synchronized boolean rebalanceInProgress() {
return this.state == MemberState.PREPARING_REBALANCE || this.state == MemberState.COMPLETING_REBALANCE;
} | Get the current generation state if the group is stable, otherwise return null
@return the current generation or null | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 1,053 | [] | true | 2 | 7.52 | apache/kafka | 31,560 | javadoc | false | |
obtainMethodParameter | protected final MethodParameter obtainMethodParameter() {
Assert.state(this.methodParameter != null, "MethodParameter is not available");
return this.methodParameter;
} | Return the wrapped MethodParameter, assuming it is present.
@return the MethodParameter (never {@code null})
@throws IllegalStateException if no MethodParameter is available
@since 5.0 | java | spring-beans/src/main/java/org/springframework/beans/factory/InjectionPoint.java | 113 | [] | MethodParameter | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
diag_indices | def diag_indices(n, ndim=2):
"""
Return the indices to access the main diagonal of an array.
This returns a tuple of indices that can be used to access the main
diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape
(n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for
... | Return the indices to access the main diagonal of an array.
This returns a tuple of indices that can be used to access the main
diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape
(n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for
``a.ndim > 2`` this is the set of indices to access ``a[i... | python | numpy/lib/_index_tricks_impl.py | 927 | [
"n",
"ndim"
] | false | 1 | 6.4 | numpy/numpy | 31,054 | numpy | false | |
selectImports | protected abstract String @Nullable [] selectImports(AdviceMode adviceMode); | Determine which classes should be imported based on the given {@code AdviceMode}.
<p>Returning {@code null} from this method indicates that the {@code AdviceMode}
could not be handled or was unknown and that an {@code IllegalArgumentException}
should be thrown.
@param adviceMode the value of the {@linkplain #getAdviceM... | java | spring-context/src/main/java/org/springframework/context/annotation/AdviceModeImportSelector.java | 96 | [
"adviceMode"
] | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
drain | @CanIgnoreReturnValue
@J2ktIncompatible
@GwtIncompatible // BlockingQueue
@IgnoreJRERequirement // Users will use this only if they're already using Duration
public static <E> int drain(
BlockingQueue<E> q, Collection<? super E> buffer, int numElements, Duration timeout)
throws InterruptedException ... | Drains the queue as {@link BlockingQueue#drainTo(Collection, int)}, but if the requested {@code
numElements} elements are not available, it will wait for them up to the specified timeout.
@param q the blocking queue to be drained
@param buffer where to add the transferred elements
@param numElements the number of eleme... | java | android/guava/src/com/google/common/collect/Queues.java | 292 | [
"q",
"buffer",
"numElements",
"timeout"
] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
add | public void add(TopicIdPartition partition, ShareInFlightBatch<K, V> batch) {
Objects.requireNonNull(batch);
ShareInFlightBatch<K, V> currentBatch = this.batches.get(partition);
if (currentBatch == null) {
this.batches.put(partition, batch);
} else {
// This case ... | Add another {@link ShareInFlightBatch} to this one; all of its records will be added to this object's
{@link #records() records}.
@param partition the topic-partition
@param batch the batch to add; may not be null | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetch.java | 65 | [
"partition",
"batch"
] | void | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false |
createJarFileForStream | private JarFile createJarFileForStream(URL url, Version version, Consumer<JarFile> closeAction) throws IOException {
try (InputStream in = url.openStream()) {
return createJarFileForStream(in, version, closeAction);
}
} | Create a new {@link UrlJarFile} or {@link UrlNestedJarFile} instance.
@param jarFileUrl the jar file URL
@param closeAction the action to call when the file is closed
@return a new {@link JarFile} instance
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java | 89 | [
"url",
"version",
"closeAction"
] | JarFile | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
mapdomain | def mapdomain(x, old, new):
"""
Apply linear map to input points.
The linear map ``offset + scale*x`` that maps the domain `old` to
the domain `new` is applied to the points `x`.
Parameters
----------
x : array_like
Points to be mapped. If `x` is a subtype of ndarray the subtype
... | Apply linear map to input points.
The linear map ``offset + scale*x`` that maps the domain `old` to
the domain `new` is applied to the points `x`.
Parameters
----------
x : array_like
Points to be mapped. If `x` is a subtype of ndarray the subtype
will be preserved.
old, new : array_like
The two domains t... | python | numpy/polynomial/polyutils.py | 288 | [
"x",
"old",
"new"
] | false | 3 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
of | public static <T extends Comparable<? super T>> Range<T> of(final T fromInclusive, final T toInclusive) {
return of(fromInclusive, toInclusive, null);
} | Creates a range with the specified minimum and maximum values (both inclusive).
<p>The range uses the natural ordering of the elements to determine where
values lie in the range.</p>
<p>The arguments may be passed in the order (min,max) or (max,min).
The getMinimum and getMaximum methods will return the correct values.... | java | src/main/java/org/apache/commons/lang3/Range.java | 161 | [
"fromInclusive",
"toInclusive"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
getNewImports | function getNewImports(
moduleSpecifier: string,
quotePreference: QuotePreference,
defaultImport: Import | undefined,
namedImports: readonly Import[] | undefined,
namespaceLikeImport: Import & { importKind: ImportKind.CommonJS | ImportKind.Namespace; } | undefined,
compilerOptions: Compile... | @param forceImportKeyword Indicates that the user has already typed `import`, so the result must start with `import`.
(In other words, do not allow `const x = require("...")` for JS files.)
@internal | typescript | src/services/codefixes/importFixes.ts | 2,037 | [
"moduleSpecifier",
"quotePreference",
"defaultImport",
"namedImports",
"namespaceLikeImport",
"compilerOptions",
"preferences"
] | true | 15 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
readDeclaredStaticField | public static Object readDeclaredStaticField(final Class<?> cls, final String fieldName, final boolean forceAccess) throws IllegalAccessException {
final Field field = getDeclaredField(cls, fieldName, forceAccess);
Validate.notNull(field, "Cannot locate declared field %s.%s", cls.getName(), fieldName);
... | Gets the value of a {@code static} {@link Field} by name. Only the specified class will be considered.
@param cls
the {@link Class} to reflect, must not be {@code null}.
@param fieldName
the field name to obtain.
@param forceAccess
whether to break scope restrictions using the
... | java | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | 354 | [
"cls",
"fieldName",
"forceAccess"
] | Object | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
fromUri | public static NestedLocation fromUri(URI uri) {
if (uri == null || !"nested".equalsIgnoreCase(uri.getScheme())) {
throw new IllegalArgumentException("'uri' must not be null and must use 'nested' scheme");
}
return parse(uri.getSchemeSpecificPart());
} | Create a new {@link NestedLocation} from the given URI.
@param uri the nested URI
@return a new {@link NestedLocation} instance
@throws IllegalArgumentException if the URI is not valid | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java | 87 | [
"uri"
] | NestedLocation | true | 3 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
parse_args | def parse_args() -> argparse.Namespace:
"""
Parse command line arguments.
Returns:
argparse.Namespace: Parsed arguments.
"""
parser = argparse.ArgumentParser(description=" System-level Usage Logger ")
# debug mode used in local to gracefully exit the script when ctrl+c is
# pressed... | Parse command line arguments.
Returns:
argparse.Namespace: Parsed arguments. | python | tools/stats/monitor.py | 101 | [] | argparse.Namespace | true | 1 | 6.4 | pytorch/pytorch | 96,034 | unknown | false |
flatten | @SuppressWarnings("unchecked")
private void flatten(Properties properties, Map<String, Object> input, @Nullable String path) {
input.forEach((key, value) -> {
String name = getPropertyName(path, key);
if (value instanceof Map) {
// Need a compound key
flatten(properties, (Map<String, Object>) value, na... | Create a new {@link CloudFoundryVcapEnvironmentPostProcessor} instance.
@param logFactory the log factory to use
@since 3.0.0 | java | core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java | 193 | [
"properties",
"input",
"path"
] | void | true | 7 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
initialize | public static void initialize(Class<?>... classes) {
for (Class<?> clazz : classes) {
try {
Class.forName(clazz.getName(), true, clazz.getClassLoader());
} catch (ClassNotFoundException e) {
throw new AssertionError(e);
}
}
} | Ensures that the given classes are initialized, as described in <a
href="http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.4.2">JLS Section
12.4.2</a>.
<p>WARNING: Normally it's a smell if a class needs to be explicitly initialized, because static
state hurts system maintainability and testability... | java | android/guava/src/com/google/common/reflect/Reflection.java | 60 | [] | void | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false |
clamp | function clamp(value: number, min = 0, max = 1) {
if (process.env.NODE_ENV !== 'production') {
if (value < min || value > max) {
console.error(`The value provided ${value} is out of range [${min}, ${max}].`);
}
}
return Math.min(Math.max(min, value), max);
} | Returns a number whose value is limited to the given range.
@param value The value to be clamped
@param min The lower boundary of the output range
@param max The upper boundary of the output range
@returns A number in the range [min, max]
@beta | typescript | packages/grafana-data/src/themes/colorManipulator.ts | 15 | [
"value",
"min",
"max"
] | false | 4 | 7.44 | grafana/grafana | 71,362 | jsdoc | false | |
timeToNextPoll | public long timeToNextPoll(long now) {
if (!autoCommitEnabled)
return timeToNextHeartbeat(now);
return Math.min(nextAutoCommitTimer.remainingMs(), timeToNextHeartbeat(now));
} | Return the time to the next needed invocation of {@link ConsumerNetworkClient#poll(Timer)}.
@param now current time in milliseconds
@return the maximum time in milliseconds the caller should wait before the next invocation of poll() | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 584 | [
"now"
] | true | 2 | 7.28 | apache/kafka | 31,560 | javadoc | false | |
equals | public static boolean equals(final Type type1, final Type type2) {
if (Objects.equals(type1, type2)) {
return true;
}
if (type1 instanceof ParameterizedType) {
return equals((ParameterizedType) type1, type2);
}
if (type1 instanceof GenericArrayType) {
... | Tests whether the given types are equal.
@param type1 The first type.
@param type2 The second type.
@return Whether the given types are equal.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 486 | [
"type1",
"type2"
] | true | 5 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
matches | function matches(source) {
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
} | Creates a function that performs a partial deep comparison between a given
object and `source`, returning `true` if the given object has equivalent
property values, else `false`.
**Note:** The created function is equivalent to `_.isMatch` with `source`
partially applied.
Partial comparisons will match empty array and e... | javascript | lodash.js | 15,681 | [
"source"
] | false | 1 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
partitionsToOffsetAndMetadata | public KafkaFuture<Map<TopicPartition, OffsetAndMetadata>> partitionsToOffsetAndMetadata() {
if (futures.size() != 1) {
throw new IllegalStateException("Offsets from multiple consumer groups were requested. " +
"Use partitionsToOffsetAndMetadata(groupId) instead to get future for... | Return a future which yields a map of topic partitions to OffsetAndMetadata objects.
If the group does not have a committed offset for this partition, the corresponding value in the returned map will be null. | java | clients/src/main/java/org/apache/kafka/clients/admin/ListConsumerGroupOffsetsResult.java | 49 | [] | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
from_coo | def from_coo(cls, A, dense_index: bool = False) -> Series:
"""
Create a Series with sparse values from a scipy.sparse.coo_matrix.
This method takes a ``scipy.sparse.coo_matrix`` (coordinate format) as input and
returns a pandas ``Series`` where the non-zero elements are represented as
... | Create a Series with sparse values from a scipy.sparse.coo_matrix.
This method takes a ``scipy.sparse.coo_matrix`` (coordinate format) as input and
returns a pandas ``Series`` where the non-zero elements are represented as
sparse values. The index of the Series can either include only the coordinates
of non-zero eleme... | python | pandas/core/arrays/sparse/accessor.py | 87 | [
"cls",
"A",
"dense_index"
] | Series | true | 1 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
delete | def delete(self, loc) -> Self:
"""
Make new Index with passed location(-s) deleted.
Parameters
----------
loc : int or list of int
Location of item(-s) which will be deleted.
Use a list of locations to delete more than one value at the same time.
... | Make new Index with passed location(-s) deleted.
Parameters
----------
loc : int or list of int
Location of item(-s) which will be deleted.
Use a list of locations to delete more than one value at the same time.
Returns
-------
Index
Will be same type as self, except for RangeIndex.
See Also
--------
num... | python | pandas/core/indexes/datetimelike.py | 1,007 | [
"self",
"loc"
] | Self | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false |
normalizer | public abstract double normalizer(double compression, double n); | Computes the normalizer given compression and number of points.
@param compression The compression parameter for the digest
@param n The number of samples seen so far
@return The normalizing factor for the scale function | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/ScaleFunction.java | 566 | [
"compression",
"n"
] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
infer_objects | def infer_objects(self, copy: bool = True) -> Index:
"""
If we have an object dtype, try to infer a non-object dtype.
Parameters
----------
copy : bool, default True
Whether to make a copy in cases where no inference occurs.
Returns
-------
I... | If we have an object dtype, try to infer a non-object dtype.
Parameters
----------
copy : bool, default True
Whether to make a copy in cases where no inference occurs.
Returns
-------
Index
An Index with a new dtype if the dtype was inferred
or a shallow copy if the dtype could not be inferred.
See Also
... | python | pandas/core/indexes/base.py | 7,181 | [
"self",
"copy"
] | Index | true | 9 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
_ixs | def _ixs(self, i: int, axis: AxisInt = 0) -> Series:
"""
Parameters
----------
i : int
axis : int
Returns
-------
Series
"""
# irow
if axis == 0:
new_mgr = self._mgr.fast_xs(i)
result = self._constructor_sl... | Parameters
----------
i : int
axis : int
Returns
-------
Series | python | pandas/core/frame.py | 4,100 | [
"self",
"i",
"axis"
] | Series | true | 3 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
load | <R extends ConfigDataResource> @Nullable ConfigData load(ConfigDataLoaderContext context, R resource)
throws IOException {
ConfigDataLoader<R> loader = getLoader(context, resource);
this.logger.trace(LogMessage.of(() -> "Loading " + resource + " using loader " + loader.getClass().getName()));
return loader.loa... | Load {@link ConfigData} using the first appropriate {@link ConfigDataLoader}.
@param <R> the resource type
@param context the loader context
@param resource the resource to load
@return the loaded {@link ConfigData}
@throws IOException on IO error | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLoaders.java | 96 | [
"context",
"resource"
] | ConfigData | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
appendExportsOfBindingElement | function appendExportsOfBindingElement(statements: Statement[] | undefined, decl: VariableDeclaration | BindingElement, isForInOrOfInitializer: boolean): Statement[] | undefined {
if (currentModuleInfo.exportEquals) {
return statements;
}
if (isBindingPattern(decl.name)) {
... | Appends the exports of a VariableDeclaration or BindingElement to a statement list,
returning the statement list.
@param statements A statement list to which the down-level export statements are to be
appended. If `statements` is `undefined`, a new array is allocated if statements are
appended.
@param decl The de... | typescript | src/compiler/transformers/module/module.ts | 2,054 | [
"statements",
"decl",
"isForInOrOfInitializer"
] | true | 9 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
refresh | @Override
public void refresh() throws BeansException, IllegalStateException {
this.startupShutdownLock.lock();
try {
this.startupShutdownThread = Thread.currentThread();
StartupStep contextRefresh = this.applicationStartup.start("spring.context.refresh");
// Prepare this context for refreshing.
prep... | Return the list of statically specified ApplicationListeners. | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 579 | [] | void | true | 6 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
writeTo | void writeTo(JSONStringer stringer) throws JSONException {
stringer.object();
for (Map.Entry<String, Object> entry : this.nameValuePairs.entrySet()) {
stringer.key(entry.getKey()).value(entry.getValue());
}
stringer.endObject();
} | Encodes this object as a human-readable JSON string for debugging, such as: <pre>
{
"query": "Pizza",
"locations": [
94043,
90210
]
}</pre>
@param indentSpaces the number of spaces to indent for each level of nesting.
@return a string representation of the object.
@throws JSONException if an... | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 728 | [
"stringer"
] | void | true | 1 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
dtypes | def dtypes(self, *, device=None, kind=None):
"""
The array API data types supported by PyTorch.
Note that this function only returns data types that are defined by
the array API.
Parameters
----------
device : Device, optional
The device to get the d... | The array API data types supported by PyTorch.
Note that this function only returns data types that are defined by
the array API.
Parameters
----------
device : Device, optional
The device to get the data types for.
Unused for PyTorch, as all devices use the same dtypes.
kind : str or tuple of str, optional
... | python | sklearn/externals/array_api_compat/torch/_info.py | 253 | [
"self",
"device",
"kind"
] | false | 2 | 7.12 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
resolveScopeMetadata | @Override
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
ScopeMetadata metadata = new ScopeMetadata();
metadata.setScopeName(BeanDefinition.SCOPE_PROTOTYPE);
if (definition instanceof AnnotatedBeanDefinition annDef) {
Set<String> annTypes = annDef.getMetadata().getAnnotationTypes();
... | Resolve the given annotation type into a named Spring scope.
<p>The default implementation simply checks against registered scopes.
Can be overridden for custom mapping rules, for example, naming conventions.
@param annotationType the JSR-330 annotation type
@return the Spring scope name | java | spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java | 86 | [
"definition"
] | ScopeMetadata | true | 5 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
create_transform_job | def create_transform_job(
self,
config: dict,
wait_for_completion: bool = True,
check_interval: int = 30,
max_ingestion_time: int | None = None,
):
"""
Start a transform job.
A transform job uses a trained model to get inferences on a dataset and
... | Start a transform job.
A transform job uses a trained model to get inferences on a dataset and
saves these results to an Amazon S3 location that you specify.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.create_transform_job`
:param config: the config for transform job
:param wait_for_completion: if t... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 380 | [
"self",
"config",
"wait_for_completion",
"check_interval",
"max_ingestion_time"
] | true | 3 | 7.92 | apache/airflow | 43,597 | sphinx | false | |
countOrNull | Integer countOrNull(); | Get the count if it is efficiently supported by the record format (which is only the case
for magic 2 and higher).
@return The number of records in the batch or null for magic versions 0 and 1. | java | clients/src/main/java/org/apache/kafka/common/record/RecordBatch.java | 196 | [] | Integer | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
to | public <R> R to(R instance, BiFunction<R, ? super T, R> mapper) {
Assert.notNull(instance, "'instance' must not be null");
Assert.notNull(mapper, "'mapper' must not be null");
T value = getValue();
if (value != null && test(value)) {
return mapper.apply(instance, value);
}
return instance;
} | Complete the mapping for any non-filtered value by applying the given function
to an existing instance and returning a new one. For filtered values, the
{@code instance} parameter is returned unchanged. The method is designed to be
used with immutable objects.
@param <R> the result type
@param instance the current inst... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 307 | [
"instance",
"mapper"
] | R | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
check_clusterings | def check_clusterings(labels_true, labels_pred):
"""Check that the labels arrays are 1D and of same dimension.
Parameters
----------
labels_true : array-like of shape (n_samples,)
The true labels.
labels_pred : array-like of shape (n_samples,)
The predicted labels.
"""
labe... | Check that the labels arrays are 1D and of same dimension.
Parameters
----------
labels_true : array-like of shape (n_samples,)
The true labels.
labels_pred : array-like of shape (n_samples,)
The predicted labels. | python | sklearn/metrics/cluster/_supervised.py | 35 | [
"labels_true",
"labels_pred"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
locateParent | private static void locateParent(@Nullable BeanFactory beanFactory, ConditionEvaluationReport report) {
if (beanFactory != null && report.parent == null && beanFactory.containsBean(BEAN_NAME)) {
report.parent = beanFactory.getBean(BEAN_NAME, ConditionEvaluationReport.class);
}
} | Obtain a {@link ConditionEvaluationReport} for the specified bean factory.
@param beanFactory the bean factory
@return an existing or new {@link ConditionEvaluationReport} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | 196 | [
"beanFactory",
"report"
] | void | true | 4 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
getNestedPropertySeparatorIndex | private static int getNestedPropertySeparatorIndex(String propertyPath, boolean last) {
boolean inKey = false;
int length = propertyPath.length();
int i = (last ? length - 1 : 0);
while (last ? i >= 0 : i < length) {
switch (propertyPath.charAt(i)) {
case PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR, Proper... | Determine the first (or last) nested property separator in the
given property path, ignoring dots in keys (like "map[my.key]").
@param propertyPath the property path to check
@param last whether to return the last separator rather than the first
@return the index of the nested property separator, or -1 if none | java | spring-beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java | 88 | [
"propertyPath",
"last"
] | true | 6 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
instantiateUsingFactoryMethod | protected BeanWrapper instantiateUsingFactoryMethod(
String beanName, RootBeanDefinition mbd, @Nullable Object @Nullable [] explicitArgs) {
return new ConstructorResolver(this).instantiateUsingFactoryMethod(beanName, mbd, explicitArgs);
} | Instantiate the bean using a named factory method. The method may be static, if the
mbd parameter specifies a class, rather than a factoryBean, or an instance variable
on a factory object itself configured using Dependency Injection.
@param beanName the name of the bean
@param mbd the bean definition for the bean
@para... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,359 | [
"beanName",
"mbd",
"explicitArgs"
] | BeanWrapper | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
check_ndim | def check_ndim(values, placement: BlockPlacement, ndim: int) -> None:
"""
ndim inference and validation.
Validates that values.ndim and ndim are consistent.
Validates that len(values) and len(placement) are consistent.
Parameters
----------
values : array-like
placement : BlockPlacemen... | ndim inference and validation.
Validates that values.ndim and ndim are consistent.
Validates that len(values) and len(placement) are consistent.
Parameters
----------
values : array-like
placement : BlockPlacement
ndim : int
Raises
------
ValueError : the number of dimensions do not match | python | pandas/core/internals/blocks.py | 2,273 | [
"values",
"placement",
"ndim"
] | None | true | 7 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
dtypes | def dtypes(self, *, device=None, kind=None):
"""
The array API data types supported by NumPy.
Note that this function only returns data types that are defined by
the array API.
Parameters
----------
device : str, optional
The device to get the data t... | The array API data types supported by NumPy.
Note that this function only returns data types that are defined by
the array API.
Parameters
----------
device : str, optional
The device to get the data types for. For NumPy, only ``'cpu'`` is
allowed.
kind : str or tuple of str, optional
The kind of data typ... | python | numpy/_array_api_info.py | 186 | [
"self",
"device",
"kind"
] | false | 12 | 6.96 | numpy/numpy | 31,054 | numpy | false | |
describe_fargate_profile | def describe_fargate_profile(
self, clusterName: str, fargateProfileName: str, verbose: bool = False
) -> dict:
"""
Return descriptive information about an AWS Fargate profile.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.describe_fargate_profile`
:param c... | Return descriptive information about an 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 describe.
:param verbo... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 363 | [
"self",
"clusterName",
"fargateProfileName",
"verbose"
] | dict | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false |
entrySet | @Override
public Set<Entry<K, V>> entrySet() {
Set<Entry<K, V>> result = entrySet;
return (result == null) ? entrySet = new EntrySet() : result;
} | Specifies the delegate maps going in each direction. Called by subclasses during
deserialization. | java | android/guava/src/com/google/common/collect/AbstractBiMap.java | 296 | [] | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false | |
isLiteralZero | bool isLiteralZero(const MatchFinder::MatchResult &Result, const Expr &Node) {
auto ZeroMatcher =
anyOf(integerLiteral(equals(0)), floatLiteral(equals(0.0)));
// Check to see if we're using a zero directly.
if (selectFirst<const clang::Expr>(
"val", match(expr(ignoringImpCasts(ZeroMatcher)).bind(... | Returns `true` if `Node` is a value which evaluates to a literal `0`. | cpp | clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp | 113 | [] | true | 3 | 7.2 | llvm/llvm-project | 36,021 | doxygen | false | |
atleast_1d | def atleast_1d(*arys):
"""
Convert inputs to arrays with at least one dimension.
Scalar inputs are converted to 1-dimensional arrays, whilst
higher-dimensional inputs are preserved.
Parameters
----------
arys1, arys2, ... : array_like
One or more input arrays.
Returns
----... | Convert inputs to arrays with at least one dimension.
Scalar inputs are converted to 1-dimensional arrays, whilst
higher-dimensional inputs are preserved.
Parameters
----------
arys1, arys2, ... : array_like
One or more input arrays.
Returns
-------
ret : ndarray
An array, or tuple of arrays, each with ``a.n... | python | numpy/_core/shape_base.py | 20 | [] | false | 5 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
left | public static <L, R> Pair<L, R> left(final L left) {
return of(left, null);
} | Creates an immutable pair of two objects inferring the generic types.
@param <L> the left element type.
@param <R> the right element type.
@param left the left element, may be null.
@return an immutable formed from the two parameters, not null.
@since 3.11 | java | src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java | 79 | [
"left"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
parsePKCS8 | private static PrivateKey parsePKCS8(BufferedReader bReader) throws IOException, GeneralSecurityException {
StringBuilder sb = new StringBuilder();
String line = bReader.readLine();
while (line != null) {
if (PKCS8_FOOTER.equals(line.trim())) {
break;
}
... | Creates a {@link PrivateKey} from the contents of {@code bReader} that contains an plaintext private key encoded in
PKCS#8
@param bReader the {@link BufferedReader} containing the key file contents
@return {@link PrivateKey}
@throws IOException if the file can't be read
@throws GeneralSecurityException if ... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | 223 | [
"bReader"
] | PrivateKey | true | 5 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false |
get_related_providers | def get_related_providers(
provider_to_check: str,
upstream_dependencies: bool,
downstream_dependencies: bool,
) -> set[str]:
"""
Gets cross dependencies of a provider.
:param provider_to_check: id of the provider to check
:param upstream_dependencies: whether to include providers that depe... | Gets cross dependencies of a provider.
:param provider_to_check: id of the provider to check
:param upstream_dependencies: whether to include providers that depend on it
:param downstream_dependencies: whether to include providers it depends on
:return: set of dependent provider ids | python | dev/breeze/src/airflow_breeze/utils/provider_dependencies.py | 124 | [
"provider_to_check",
"upstream_dependencies",
"downstream_dependencies"
] | set[str] | true | 8 | 7.76 | apache/airflow | 43,597 | sphinx | false |
_kl_divergence | def _kl_divergence(
params,
P,
degrees_of_freedom,
n_samples,
n_components,
skip_num_points=0,
compute_error=True,
):
"""t-SNE objective function: gradient of the KL divergence
of p_ijs and q_ijs and the absolute error.
Parameters
----------
params : ndarray of shape (n_... | t-SNE objective function: gradient of the KL divergence
of p_ijs and q_ijs and the absolute error.
Parameters
----------
params : ndarray of shape (n_params,)
Unraveled embedding.
P : ndarray of shape (n_samples * (n_samples-1) / 2,)
Condensed joint probability matrix.
degrees_of_freedom : int
Degrees of... | python | sklearn/manifold/_t_sne.py | 128 | [
"params",
"P",
"degrees_of_freedom",
"n_samples",
"n_components",
"skip_num_points",
"compute_error"
] | false | 4 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
value | public XContentBuilder value(Short value) throws IOException {
return (value == null) ? nullValue() : value(value.shortValue());
} | @return the value of the "human readable" flag. When the value is equal to true,
some types of values are written in a format easier to read for a human. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 648 | [
"value"
] | XContentBuilder | true | 2 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
CONST | public static byte CONST(final byte v) {
return v;
} | Returns the provided value unchanged. This can prevent javac from inlining a constant field, e.g.,
<pre>
public final static byte MAGIC_BYTE = ObjectUtils.CONST((byte) 127);
</pre>
This way any jars that refer to this field do not have to recompile themselves if the field's value changes at some future date.
@param v t... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 352 | [
"v"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
needsMetadata | synchronized boolean needsMetadata(String topic) {
return subscription.contains(topic) || groupSubscription.contains(topic);
} | Get the subscription topics for which metadata is required. For the leader, this will include
the union of the subscriptions of all group members. For followers, it is just that member's
subscription. This is used when querying topic metadata to detect the metadata changes which would
require rebalancing. The leader fe... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 422 | [
"topic"
] | true | 2 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
toList | public List<String> toList() {
final List<String> list = new ArrayList<>();
forEach(list::add);
return list;
} | Returns a new {@link List} containing the tokenizer elements.
@return a new {@link List}. | java | src/main/java/org/apache/commons/lang3/util/IterableStringTokenizer.java | 100 | [] | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false | |
resetCurrentTokenState | private void resetCurrentTokenState() {
if (_currToken == JsonToken.VALUE_STRING && _tokenIncomplete && stringEnd > 0) {
_inputPtr = stringEnd;
_tokenIncomplete = false;
}
lastOptimisedValue = null;
stringEnd = -1;
} | Resets the current token state before moving to the next. It resets the _inputPtr and the
_tokenIncomplete only if {@link UTF8StreamJsonParser#getText()} or {@link UTF8StreamJsonParser#getValueAsString()}
hasn't run yet. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParser.java | 179 | [] | void | true | 4 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
stripFloatCast | std::optional<std::string>
stripFloatCast(const ast_matchers::MatchFinder::MatchResult &Result,
const Expr &Node) {
if (const Expr *MaybeCastArg = selectFirst<const Expr>(
"cast_arg",
match(expr(anyOf(cxxStaticCastExpr(
hasDestinationType(realFloatingP... | Returns `true` if `Node` is a value which evaluates to a literal `0`. | cpp | clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp | 138 | [] | true | 2 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false | |
topicIds | public List<Uuid> topicIds() {
return data.topics()
.stream()
.map(MetadataRequestTopic::topicId)
.collect(Collectors.toList());
} | @return Builder for metadata request using topic IDs. | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataRequest.java | 111 | [] | true | 1 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
initializeFinalLoggingLevels | private void initializeFinalLoggingLevels(ConfigurableEnvironment environment, LoggingSystem system) {
bindLoggerGroups(environment);
if (this.springBootLogging != null) {
initializeSpringBootLogging(system, this.springBootLogging);
}
setLogLevels(system, environment);
} | Initialize the logging system according to preferences expressed through the
{@link Environment} and the classpath.
@param environment the environment
@param classLoader the classloader | java | core/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java | 360 | [
"environment",
"system"
] | void | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
describe_replication_configs | def describe_replication_configs(self, filters: list[dict] | None = None, **kwargs) -> list[dict]:
"""
Return list of serverless replication configs.
.. seealso::
- :external+boto3:py:meth:`DatabaseMigrationService.Client.describe_replication_configs`
:param filters: List o... | Return list of serverless replication configs.
.. seealso::
- :external+boto3:py:meth:`DatabaseMigrationService.Client.describe_replication_configs`
:param filters: List of filter objects
:return: List of replication tasks | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/dms.py | 227 | [
"self",
"filters"
] | list[dict] | true | 2 | 7.28 | apache/airflow | 43,597 | sphinx | false |
usesAccessQueue | boolean usesAccessQueue() {
return expiresAfterAccess() || evictsBySize();
} | Creates a new, empty map with the specified strategy, initial capacity and concurrency level. | java | android/guava/src/com/google/common/cache/LocalCache.java | 344 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.