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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_validate_usecols_names | def _validate_usecols_names(self, usecols: SequenceT, names: Sequence) -> SequenceT:
"""
Validates that all usecols are present in a given
list of names. If not, raise a ValueError that
shows what usecols are missing.
Parameters
----------
usecols : iterable of u... | Validates that all usecols are present in a given
list of names. If not, raise a ValueError that
shows what usecols are missing.
Parameters
----------
usecols : iterable of usecols
The columns to validate are present in names.
names : iterable of names
The column names to check against.
Returns
-------
usecol... | python | pandas/io/parsers/base_parser.py | 638 | [
"self",
"usecols",
"names"
] | SequenceT | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
splitByCharacterType | private static String[] splitByCharacterType(final String str, final boolean camelCase) {
if (str == null) {
return null;
}
if (str.isEmpty()) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
final char[] c = str.toCharArray();
final List<String> list = n... | Splits a String by Character type as returned by {@code java.lang.Character.getType(char)}. Groups of contiguous characters of the same type are returned
as complete tokens, with the following exception: if {@code camelCase} is {@code true}, the character of type {@code Character.UPPERCASE_LETTER}, if any,
immediately ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,166 | [
"str",
"camelCase"
] | true | 9 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
current | int current() {
return currentUsages.get();
} | Prepares the database for lookup by incrementing the usage count.
If the usage count is already negative, it indicates that the database is being closed,
and this method will return false to indicate that no lookup should be performed.
@return true if the database is ready for lookup, false if it is being closed | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/DatabaseReaderLazyLoader.java | 112 | [] | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false | |
pandas_validate | def pandas_validate(func_name: str):
"""
Call the numpydoc validation, and add the errors specific to pandas.
Parameters
----------
func_name : str
Name of the object of the docstring to validate.
Returns
-------
dict
Information about the docstring and the errors found... | Call the numpydoc validation, and add the errors specific to pandas.
Parameters
----------
func_name : str
Name of the object of the docstring to validate.
Returns
-------
dict
Information about the docstring and the errors found. | python | scripts/validate_docstrings.py | 233 | [
"func_name"
] | true | 8 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false | |
export_archived_records | def export_archived_records(
export_format: str,
output_path: str,
table_names: list[str] | None = None,
drop_archives: bool = False,
needs_confirm: bool = True,
session: Session = NEW_SESSION,
) -> None:
"""Export archived data to the given output path in the given format."""
archived_t... | Export archived data to the given output path in the given format. | python | airflow-core/src/airflow/utils/db_cleanup.py | 556 | [
"export_format",
"output_path",
"table_names",
"drop_archives",
"needs_confirm",
"session"
] | None | true | 6 | 6 | apache/airflow | 43,597 | unknown | false |
value_counts | def value_counts(self, dropna: bool = True) -> Series:
"""
Return a Series containing counts of unique values.
Parameters
----------
dropna : bool, default True
Don't include counts of NA values.
Returns
-------
Series
"""
if ... | Return a Series containing counts of unique values.
Parameters
----------
dropna : bool, default True
Don't include counts of NA values.
Returns
-------
Series | python | pandas/core/arrays/_mixins.py | 469 | [
"self",
"dropna"
] | Series | true | 4 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
forField | public static AutowiredFieldValueResolver forField(String fieldName) {
return new AutowiredFieldValueResolver(fieldName, false, null);
} | Create a new {@link AutowiredFieldValueResolver} for the specified field
where injection is optional.
@param fieldName the field name
@return a new {@link AutowiredFieldValueResolver} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredFieldValueResolver.java | 78 | [
"fieldName"
] | AutowiredFieldValueResolver | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
positiveBuckets | @Override
public ExponentialHistogram.Buckets positiveBuckets() {
return positiveBuckets;
} | Attempts to add a bucket to the positive or negative range of this histogram.
<br>
Callers must adhere to the following rules:
<ul>
<li>All buckets for the negative values range must be provided before the first one from the positive values range.</li>
<li>For both the negative and positive ranges, buckets must... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/FixedCapacityExponentialHistogram.java | 201 | [] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
keySet | @Override
public Set<K> keySet() {
// does not impact recency ordering
Set<K> ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet());
} | Returns the internal entry for the specified key. The entry may be loading, expired, or
partially collected. | java | android/guava/src/com/google/common/cache/LocalCache.java | 4,178 | [] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
of | public static <L, R> MutablePair<L, R> of(final L left, final R right) {
return new MutablePair<>(left, right);
} | Creates a mutable 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.
@param right the right element, may be null.
@return a mutable pair formed from the two parameters, not null. | java | src/main/java/org/apache/commons/lang3/tuple/MutablePair.java | 68 | [
"left",
"right"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
bench | def bench(ctx, tests, compare, verbose, quick, factor, cpu_affinity,
commits, build_dir):
"""🏋 Run benchmarks.
\b
Examples:
\b
$ spin bench -t bench_lib
$ spin bench -t bench_random.Random
$ spin bench -t Random -t Shuffle
Two benchmark runs can be compared.
By default,... | 🏋 Run benchmarks.
\b
Examples:
\b
$ spin bench -t bench_lib
$ spin bench -t bench_random.Random
$ spin bench -t Random -t Shuffle
Two benchmark runs can be compared.
By default, `HEAD` is compared to `main`.
You can also specify the branches/commits to compare:
\b
$ spin bench --compare
$ spin bench --compare main... | python | .spin/cmds.py | 412 | [
"ctx",
"tests",
"compare",
"verbose",
"quick",
"factor",
"cpu_affinity",
"commits",
"build_dir"
] | false | 12 | 6.72 | numpy/numpy | 31,054 | unknown | false | |
process | private void process(final AsyncPollEvent event) {
// Trigger a reconciliation that can safely commit offsets if needed to rebalance,
// as we're processing before any new fetching starts
requestManagers.consumerMembershipManager.ifPresent(consumerMembershipManager ->
consumerMembers... | Process event indicating whether the AcknowledgeCommitCallbackHandler is configured by the user.
@param event Event containing a boolean to indicate if the callback handler is configured or not. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 714 | [
"event"
] | void | true | 4 | 6.24 | apache/kafka | 31,560 | javadoc | false |
ensureCapacity | public StrBuilder ensureCapacity(final int capacity) {
if (capacity > buffer.length) {
buffer = ArrayUtils.arraycopy(buffer, 0, 0, size, () -> new char[capacity * 2]);
}
return this;
} | Checks the capacity and ensures that it is at least the size specified.
@param capacity the capacity to ensure
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,841 | [
"capacity"
] | StrBuilder | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
writeNativeImageProperties | private void writeNativeImageProperties(List<String> args) {
if (CollectionUtils.isEmpty(args)) {
return;
}
StringBuilder sb = new StringBuilder();
sb.append("Args = ");
sb.append(String.join(String.format(" \\%n"), args));
Path file = getSettings().getResourceOutput().resolve("META-INF/native-image/" +
... | Return the native image arguments to use.
<p>By default, the main class to use, as well as standard application flags
are added.
<p>If the returned list is empty, no {@code native-image.properties} is
contributed.
@param applicationClassName the fully qualified class name of the application
entry point
@return the nati... | java | spring-context/src/main/java/org/springframework/context/aot/ContextAotProcessor.java | 154 | [
"args"
] | void | true | 4 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
setPriority | @CanIgnoreReturnValue
public ThreadFactoryBuilder setPriority(int priority) {
// Thread#setPriority() already checks for validity. These error messages
// are nicer though and will fail-fast.
checkArgument(
priority >= Thread.MIN_PRIORITY,
"Thread priority (%s) must be >= %s",
prio... | Sets the priority for new threads created with this ThreadFactory.
<p><b>Warning:</b> relying on the thread scheduler is <a
href="http://errorprone.info/bugpattern/ThreadPriorityCheck">discouraged</a>.
<p><b>Java 21+ users:</b> use {@link Thread.Builder.OfPlatform#priority(int)} instead.
@param priority the priority fo... | java | android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java | 120 | [
"priority"
] | ThreadFactoryBuilder | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false |
clear | def clear(
self,
task_ids: Collection[str | tuple[str, int]] | None = None,
*,
run_id: str | None = None,
start_date: datetime.datetime | None = None,
end_date: datetime.datetime | None = None,
only_failed: bool = False,
only_running: bool = False,
... | Clear a set of task instances associated with the current dag for a specified date range.
:param task_ids: List of task ids or (``task_id``, ``map_index``) tuples to clear
:param run_id: The run_id for which the tasks should be cleared
:param start_date: The minimum logical_date to clear
:param end_date: The maximum l... | python | airflow-core/src/airflow/serialization/serialized_objects.py | 3,535 | [
"self",
"task_ids",
"run_id",
"start_date",
"end_date",
"only_failed",
"only_running",
"dag_run_state",
"dry_run",
"session",
"exclude_task_ids",
"exclude_run_ids",
"run_on_latest_version"
] | int | Iterable[TaskInstance] | true | 5 | 6.96 | apache/airflow | 43,597 | sphinx | false |
daemon | public Builder daemon(final boolean daemon) {
this.daemon = Boolean.valueOf(daemon);
return this;
} | Sets the daemon flag for the new {@link BasicThreadFactory}. If this
flag is set to <strong>true</strong> the new thread factory will create daemon
threads.
@param daemon the value of the daemon flag
@return a reference to this {@link Builder} | java | src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java | 162 | [
"daemon"
] | Builder | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
targetAssignmentReconciled | private boolean targetAssignmentReconciled() {
return currentAssignment.equals(currentTargetAssignment);
} | @return True if there are no assignments waiting to be resolved from metadata or reconciled. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 746 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
generateConstructorDecorationExpression | function generateConstructorDecorationExpression(node: ClassExpression | ClassDeclaration) {
const allDecorators = getAllDecoratorsOfClass(node, /*useLegacyDecorators*/ true);
const decoratorExpressions = transformAllDecoratorsOfDeclaration(allDecorators);
if (!decoratorExpressions) {
... | Generates a __decorate helper call for a class constructor.
@param node The class node. | typescript | src/compiler/transformers/legacyDecorators.ts | 681 | [
"node"
] | false | 5 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
charBuffer | @Override
public CharBuffer charBuffer() throws IOException {
try {
return CharBuffer.wrap(parser.getTextCharacters(), parser.getTextOffset(), parser.getTextLength());
} catch (IOException e) {
throw handleParserException(e);
}
} | Handle parser exception depending on type.
This converts known exceptions to XContentParseException and rethrows them. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentParser.java | 168 | [] | CharBuffer | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
definePackageIfNecessary | protected final void definePackageIfNecessary(String className) {
if (className.startsWith("java.")) {
return;
}
int lastDot = className.lastIndexOf('.');
if (lastDot >= 0) {
String packageName = className.substring(0, lastDot);
if (getDefinedPackage(packageName) == null) {
try {
definePackage... | Define a package before a {@code findClass} call is made. This is necessary to
ensure that the appropriate manifest for nested JARs is associated with the
package.
@param className the class name being found | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlClassLoader.java | 120 | [
"className"
] | void | true | 5 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
getPackageCanonicalName | public static String getPackageCanonicalName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
return getPackageCanonicalName(object.getClass().getName());
} | Gets the package name from the class name of an {@link Object}.
@param object the class to get the package name for, may be null.
@param valueIfNull the value to return if null.
@return the package name of the object, or the null value.
@since 2.4 | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 744 | [
"object",
"valueIfNull"
] | String | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
runInputLoop | private void runInputLoop() throws Exception {
String line;
while ((line = this.consoleReader.readLine(getPrompt())) != null) {
while (line.endsWith("\\")) {
line = line.substring(0, line.length() - 1);
line += this.consoleReader.readLine("> ");
}
if (StringUtils.hasLength(line)) {
String[] arg... | Run the shell until the user exists.
@throws Exception on error | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java | 149 | [] | void | true | 4 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
log_event_start | def log_event_start(
self,
event_name: str,
time_ns: int,
metadata: dict[str, Any],
log_pt2_compile_event: bool = False,
compile_id: Optional[CompileId] = None,
) -> None:
"""
Logs the start of a single event.
:param str event_name Name of even... | Logs the start of a single event.
:param str event_name Name of event to appear in trace
:param time_ns Timestamp in nanoseconds
:param metadata: Any extra metadata associated with this event
:param log_pt2_compile_event: If True, log to pt2_compile_events
:param compile_id: Explicit compile_id (rather than using the c... | python | torch/_dynamo/utils.py | 1,920 | [
"self",
"event_name",
"time_ns",
"metadata",
"log_pt2_compile_event",
"compile_id"
] | None | true | 3 | 6.56 | pytorch/pytorch | 96,034 | sphinx | false |
show_versions | def show_versions():
"""Print useful debugging information.
.. versionadded:: 0.20
Examples
--------
>>> from sklearn import show_versions
>>> show_versions() # doctest: +SKIP
"""
sys_info = _get_sys_info()
deps_info = _get_deps_info()
print("\nSystem:")
for k, stat in s... | Print useful debugging information.
.. versionadded:: 0.20
Examples
--------
>>> from sklearn import show_versions
>>> show_versions() # doctest: +SKIP | python | sklearn/utils/_show_versions.py | 77 | [] | false | 7 | 7.52 | scikit-learn/scikit-learn | 64,340 | unknown | false | |
onApplicationEventInternal | protected void onApplicationEventInternal(ApplicationEvent event) {
if (this.delegate == null) {
throw new IllegalStateException(
"Must specify a delegate object or override the onApplicationEventInternal method");
}
this.delegate.onApplicationEvent(event);
} | Actually process the event, after having filtered according to the
desired event source already.
<p>The default implementation invokes the specified delegate, if any.
@param event the event to process (matching the specified source) | java | spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java | 104 | [
"event"
] | void | true | 2 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
join | def join(self, sep: str):
"""
Join lists contained as elements in the Series/Index with passed delimiter.
If the elements of a Series are lists themselves, join the content of these
lists using the delimiter passed to the function.
This function is an equivalent to :meth:`str.jo... | Join lists contained as elements in the Series/Index with passed delimiter.
If the elements of a Series are lists themselves, join the content of these
lists using the delimiter passed to the function.
This function is an equivalent to :meth:`str.join`.
Parameters
----------
sep : str
Delimiter to use between lis... | python | pandas/core/strings/accessor.py | 1,152 | [
"self",
"sep"
] | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false | |
nextTokenCanFollowDefaultKeyword | function nextTokenCanFollowDefaultKeyword(): boolean {
nextToken();
return token() === SyntaxKind.ClassKeyword
|| token() === SyntaxKind.FunctionKeyword
|| token() === SyntaxKind.InterfaceKeyword
|| token() === SyntaxKind.AtToken
|| (token() === Synt... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 2,824 | [] | true | 8 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
ceiling | public static Date ceiling(final Object date, final int field) {
Objects.requireNonNull(date, "date");
if (date instanceof Date) {
return ceiling((Date) date, field);
}
if (date instanceof Calendar) {
return ceiling((Calendar) date, field).getTime();
}
... | Gets a date ceiling, leaving the field specified as the most
significant field.
<p>For example, if you had the date-time of 28 Mar 2002
13:45:01.231, if you passed with HOUR, it would return 28 Mar
2002 14:00:00.000. If this was passed with MONTH, it would
return 1 Apr 2002 0:00:00.000.</p>
@param date the date to wo... | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 390 | [
"date",
"field"
] | Date | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
_create_subgraph_for_node | def _create_subgraph_for_node(graph: fx.Graph, node: fx.Node) -> fx.GraphModule:
"""
Create a subgraph that exactly recreates a node's operation.
The subgraph takes only the fx.Node arguments and recreates the operation
with the exact target, args structure, and kwargs.
Args:
graph: The pa... | Create a subgraph that exactly recreates a node's operation.
The subgraph takes only the fx.Node arguments and recreates the operation
with the exact target, args structure, and kwargs.
Args:
graph: The parent graph
node: The node to wrap in a subgraph
Returns:
A GraphModule containing the subgraph | python | torch/_inductor/fx_passes/control_dependencies.py | 166 | [
"graph",
"node"
] | fx.GraphModule | true | 8 | 8.08 | pytorch/pytorch | 96,034 | google | false |
_should_compare | def _should_compare(self, other: Index) -> bool:
"""
Check if `self == other` can ever have non-False entries.
"""
# NB: we use inferred_type rather than is_bool_dtype to catch
# object_dtype_of_bool and categorical[object_dtype_of_bool] cases
if (
other.inf... | Check if `self == other` can ever have non-False entries. | python | pandas/core/indexes/base.py | 6,426 | [
"self",
"other"
] | bool | true | 7 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
trimmed | public ImmutableDoubleArray trimmed() {
return isPartialView() ? new ImmutableDoubleArray(toArray()) : this;
} | Returns an immutable array containing the same values as {@code this} array. This is logically
a no-op, and in some circumstances {@code this} itself is returned. However, if this instance
is a {@link #subArray} view of a larger array, this method will copy only the appropriate range
of values, resulting in an equivale... | java | android/guava/src/com/google/common/primitives/ImmutableDoubleArray.java | 642 | [] | ImmutableDoubleArray | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false |
from | static @Nullable ConfigurationPropertySource from(PropertySource<?> source) {
if (source instanceof ConfigurationPropertySourcesPropertySource) {
return null;
}
return SpringConfigurationPropertySource.from(source);
} | Return a single new {@link ConfigurationPropertySource} adapted from the given
Spring {@link PropertySource} or {@code null} if the source cannot be adapted.
@param source the Spring property source to adapt
@return an adapted source or {@code null} {@link SpringConfigurationPropertySource}
@since 2.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySource.java | 105 | [
"source"
] | ConfigurationPropertySource | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
propagateChildrenFlags | function propagateChildrenFlags(children: NodeArray<Node> | undefined): TransformFlags {
return children ? children.transformFlags : TransformFlags.None;
} | Creates a `NodeFactory` that can be used to create and update a syntax tree.
@param flags Flags that control factory behavior.
@param baseFactory A `BaseNodeFactory` used to create the base `Node` objects.
@internal | typescript | src/compiler/factory/nodeFactory.ts | 7,305 | [
"children"
] | true | 2 | 6.32 | microsoft/TypeScript | 107,154 | jsdoc | false | |
maybe_promote | def maybe_promote(dtype: np.dtype, fill_value=np.nan):
"""
Find the minimal dtype that can hold both the given dtype and fill_value.
Parameters
----------
dtype : np.dtype
fill_value : scalar, default np.nan
Returns
-------
dtype
Upcasted from dtype argument if necessary.
... | Find the minimal dtype that can hold both the given dtype and fill_value.
Parameters
----------
dtype : np.dtype
fill_value : scalar, default np.nan
Returns
-------
dtype
Upcasted from dtype argument if necessary.
fill_value
Upcasted from fill_value argument if necessary.
Raises
------
ValueError
If fill... | python | pandas/core/dtypes/cast.py | 452 | [
"dtype",
"fill_value"
] | true | 7 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
addMethodName | public NameMatchMethodPointcut addMethodName(String mappedNamePattern) {
this.mappedNamePatterns.add(mappedNamePattern);
return this;
} | Add another method name pattern, in addition to those already configured.
<p>Like the "set" methods, this method is for use when configuring proxies,
before a proxy is used.
<p><b>NOTE:</b> This method does not work after the proxy is in use, since
advice chains will be cached.
@param mappedNamePattern the additional m... | java | spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java | 82 | [
"mappedNamePattern"
] | NameMatchMethodPointcut | true | 1 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false |
newWriter | public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
} | Returns a buffered writer that writes to a file using the given character set.
<p><b>{@link java.nio.file.Path} equivalent:</b> {@link
java.nio.file.Files#newBufferedWriter(java.nio.file.Path, Charset,
java.nio.file.OpenOption...)}.
@param file the file to write to
@param charset the charset used to encode the output s... | java | android/guava/src/com/google/common/io/Files.java | 104 | [
"file",
"charset"
] | BufferedWriter | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false |
valueComparator | @Nullable Comparator<? super V> valueComparator() {
return emptySet instanceof ImmutableSortedSet
? ((ImmutableSortedSet<V>) emptySet).comparator()
: null;
} | @serialData number of distinct keys, and then for each distinct key: the key, the number of
values for that key, and the key's values | java | android/guava/src/com/google/common/collect/ImmutableSetMultimap.java | 683 | [] | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false | |
get_default_pool | def get_default_pool(session: Session = NEW_SESSION) -> Pool | None:
"""
Get the Pool of the default_pool from the Pools.
:param session: SQLAlchemy ORM Session
:return: the pool object
"""
return Pool.get_pool(Pool.DEFAULT_POOL_NAME, session=session) | Get the Pool of the default_pool from the Pools.
:param session: SQLAlchemy ORM Session
:return: the pool object | python | airflow-core/src/airflow/models/pool.py | 90 | [
"session"
] | Pool | None | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
addSeconds | public static Date addSeconds(final Date date, final int amount) {
return add(date, Calendar.SECOND, amount);
} | Adds a number of seconds to a date returning a new object.
The original {@link Date} is unchanged.
@param date the date, not null.
@param amount the amount to add, may be negative.
@return the new {@link Date} with the amount added.
@throws NullPointerException if the date is null. | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 302 | [
"date",
"amount"
] | Date | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
create | public static <T extends @Nullable Object> BloomFilter<T> create(
Funnel<? super T> funnel, long expectedInsertions, double fpp) {
return create(funnel, expectedInsertions, fpp, BloomFilterStrategies.MURMUR128_MITZ_64);
} | Creates a {@link BloomFilter} with the expected number of insertions and expected false
positive probability.
<p>Note that overflowing a {@code BloomFilter} with significantly more elements than specified,
will result in its saturation, and a sharp deterioration of its false positive probability.
<p>The constructed {@c... | java | android/guava/src/com/google/common/hash/BloomFilter.java | 422 | [
"funnel",
"expectedInsertions",
"fpp"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
parse | public static FetchSnapshotResponse parse(Readable readable, short version) {
return new FetchSnapshotResponse(new FetchSnapshotResponseData(readable, version));
} | Finds the PartitionSnapshot for a given topic partition.
@param data the fetch snapshot response data
@param topicPartition the topic partition to find
@return the response partition snapshot if found, otherwise an empty Optional | java | clients/src/main/java/org/apache/kafka/common/requests/FetchSnapshotResponse.java | 101 | [
"readable",
"version"
] | FetchSnapshotResponse | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
optLong | public long optLong(String name, long fallback) {
Object object = opt(name);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | Returns the value mapped by {@code name} if it exists and is a long or can be
coerced to a long. Returns {@code fallback} otherwise. Note that JSON represents
numbers as doubles, so this is <a href="#lossy">lossy</a>; use strings to transfer
numbers over JSON.
@param name the name of the property
@param fallback a fall... | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 544 | [
"name",
"fallback"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
prepare_function_arguments | def prepare_function_arguments(
func: Callable, args: tuple, kwargs: dict, *, num_required_args: int
) -> tuple[tuple, dict]:
"""
Prepare arguments for jitted function. As numba functions do not support kwargs,
we try to move kwargs into args if possible.
Parameters
----------
func : functi... | Prepare arguments for jitted function. As numba functions do not support kwargs,
we try to move kwargs into args if possible.
Parameters
----------
func : function
User defined function
args : tuple
User input positional arguments
kwargs : dict
User input keyword arguments
num_required_args : int
The n... | python | pandas/core/util/numba_.py | 97 | [
"func",
"args",
"kwargs",
"num_required_args"
] | tuple[tuple, dict] | true | 3 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
requestingClass | Class<?> requestingClass(Class<?> callerClass) {
if (callerClass != null) {
// fast path
return callerClass;
}
Optional<Class<?>> result = StackWalker.getInstance(RETAIN_CLASS_REFERENCE)
.walk(frames -> findRequestingFrame(frames).map(StackWalker.StackFrame::g... | Walks the stack to determine which class should be checked for entitlements.
@param callerClass when non-null will be returned;
this is a fast-path check that can avoid the stack walk
in cases where the caller class is available.
@return the requesting class, or {@code null} if the... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyCheckerImpl.java | 408 | [
"callerClass"
] | true | 2 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
describeTopics | default DescribeTopicsResult describeTopics(Collection<String> topicNames, DescribeTopicsOptions options) {
return describeTopics(TopicCollection.ofTopicNames(topicNames), options);
} | Describe some topics in the cluster.
@param topicNames The names of the topics to describe.
@param options The options to use when describing the topic.
@return The DescribeTopicsResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 306 | [
"topicNames",
"options"
] | DescribeTopicsResult | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
equals | @Override
public boolean equals(final Object obj) {
if (obj instanceof MutableBoolean) {
return value == ((MutableBoolean) obj).booleanValue();
}
return false;
} | Compares this object to the specified object. The result is {@code true} if and only if the argument is
not {@code null} and is an {@link MutableBoolean} object that contains the same
{@code boolean} value as this object.
@param obj the object to compare with, null returns false
@return {@code true} if the objects are... | java | src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java | 104 | [
"obj"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getEndOfTrailingComment | static SourceLocation getEndOfTrailingComment(SourceLocation Loc,
const SourceManager &SM,
const LangOptions &LangOpts) {
// We consider any following comment token that is indented more than the
// first comment to be part ... | Returns the end of the trailing comments after `Loc`. | cpp | clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp | 330 | [
"Loc"
] | true | 4 | 6 | llvm/llvm-project | 36,021 | doxygen | false | |
compare | private int compare(ConfigurationPropertyName n1, ConfigurationPropertyName n2) {
int l1 = n1.getNumberOfElements();
int l2 = n2.getNumberOfElements();
int i1 = 0;
int i2 = 0;
while (i1 < l1 || i2 < l2) {
try {
ElementType type1 = (i1 < l1) ? n1.elements.getType(i1) : null;
ElementType type2 = (i2 ... | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 311 | [
"n1",
"n2"
] | true | 9 | 8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
FunctionLocation | function FunctionLocation({location, displayName}: FunctionLocationProps) {
// TODO: We should support symbolication here as well, but
// symbolicating the whole stack can be expensive
const [canViewSource, viewSource] = useOpenResource(location, null);
return (
<li>
<Button
className={
... | 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/Profiler/SidebarEventInfo.js | 35 | [] | false | 2 | 6.4 | facebook/react | 241,750 | jsdoc | false | |
hashCode | @Deprecated
public static int hashCode(final Object obj) {
// hashCode(Object) for performance vs. hashCodeMulti(Object[]), as hash code is often critical
return Objects.hashCode(obj);
} | Gets the hash code of an object returning zero when the object is {@code null}.
<pre>
ObjectUtils.hashCode(null) = 0
ObjectUtils.hashCode(obj) = obj.hashCode()
</pre>
@param obj the object to obtain the hash code of, may be {@code null}.
@return the hash code of the object, or zero if null.
@since 2.1
@deprecated ... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 711 | [
"obj"
] | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false | |
of | @Contract("_, _, !null, _ -> !null")
static @Nullable ConfigurationProperty of(@Nullable ConfigurationPropertySource source,
ConfigurationPropertyName name, @Nullable Object value, @Nullable Origin origin) {
if (value == null) {
return null;
}
return new ConfigurationProperty(source, name, value, origin);
... | 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 | 136 | [
"source",
"name",
"value",
"origin"
] | ConfigurationProperty | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
forOperation | public CacheEvaluationContext forOperation(CacheExpressionRootObject rootObject,
Method targetMethod, @Nullable Object[] args) {
CacheEvaluationContext evaluationContext = new CacheEvaluationContext(
rootObject, targetMethod, args, getParameterNameDiscoverer());
this.originalContext.applyDelegatesTo(evaluat... | Creates a {@link CacheEvaluationContext} for the specified operation.
@param rootObject the {@code root} object to use for the context
@param targetMethod the target cache {@link Method}
@param args the arguments of the method invocation
@return a context suitable for this cache operation | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheEvaluationContextFactory.java | 67 | [
"rootObject",
"targetMethod",
"args"
] | CacheEvaluationContext | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
applyRollingPolicy | private <T> void applyRollingPolicy(RollingPolicySystemProperty property, PropertyResolver resolver,
Class<T> type) {
T value = getProperty(resolver, property.getApplicationPropertyName(), type);
if (value != null) {
String stringValue = String.valueOf((value instanceof DataSize dataSize) ? dataSize.toBytes()... | Create a new {@link LoggingSystemProperties} instance.
@param environment the source environment
@param defaultValueResolver function used to resolve default values or {@code null}
@param setter setter used to apply the property or {@code null} for system
properties
@since 3.2.0 | java | core/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystemProperties.java | 106 | [
"property",
"resolver",
"type"
] | void | true | 3 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
renew_from_kt | def renew_from_kt(principal: str | None, keytab: str, exit_on_fail: bool = True):
"""
Renew kerberos token from keytab.
:param principal: principal
:param keytab: keytab file
:return: None
"""
# The config is specified in seconds. But we ask for that same amount in
# minutes to give our... | Renew kerberos token from keytab.
:param principal: principal
:param keytab: keytab file
:return: None | python | airflow-core/src/airflow/security/kerberos.py | 67 | [
"principal",
"keytab",
"exit_on_fail"
] | true | 14 | 8 | apache/airflow | 43,597 | sphinx | false | |
determineDefaultCandidate | @Nullable
private String determineDefaultCandidate(Map<String, Object> candidates) {
String defaultBeanName = null;
for (String candidateBeanName : candidates.keySet()) {
if (AutowireUtils.isDefaultCandidate(this, candidateBeanName)) {
if (defaultBeanName != null) {
return null;
}
defaultBeanNa... | Return a unique "default-candidate" among remaining non-default candidates.
@param candidates a Map of candidate names and candidate instances
(or candidate classes if not created yet) that match the required type
@return the name of the default candidate, or {@code null} if none found
@since 6.2.4
@see AbstractBeanDef... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 2,233 | [
"candidates"
] | String | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
concat | public static ByteSource concat(Iterator<? extends ByteSource> sources) {
return concat(ImmutableList.copyOf(sources));
} | Concatenates multiple {@link ByteSource} instances into a single source. Streams returned from
the source will contain the concatenated data from the streams of the underlying sources.
<p>Only one underlying stream will be open at a time. Closing the concatenated stream will
close the open underlying stream.
<p>Note: T... | java | android/guava/src/com/google/common/io/ByteSource.java | 396 | [
"sources"
] | ByteSource | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false |
__getitem__ | def __getitem__(self, target):
"""
Return the value of the given string attribute node, None if the node
doesn't exist. Can also take a tuple as a parameter, (target, child),
where child is the index of the attribute in the WKT. For example:
>>> wkt = (
... 'GEOGCS["... | Return the value of the given string attribute node, None if the node
doesn't exist. Can also take a tuple as a parameter, (target, child),
where child is the index of the attribute in the WKT. For example:
>>> wkt = (
... 'GEOGCS["WGS 84",'
... ' DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]'
... ']'
...... | python | django/contrib/gis/gdal/srs.py | 113 | [
"self",
"target"
] | false | 3 | 6.32 | django/django | 86,204 | unknown | false | |
merge | public ZeroBucket merge(ZeroBucket other) {
if (other.count == 0) {
return this;
} else if (count == 0) {
return other;
} else {
long totalCount = count + other.count;
// Both are populated, so we need to use the higher zero-threshold.
... | Merges this zero bucket with another one.
<ul>
<li>If the other zero bucket or both are empty, this instance is returned unchanged.</li>
<li>If the this zero bucket is empty and the other one is populated, the other instance is returned unchanged.</li>
<li>Otherwise, the zero threshold is increased if neces... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ZeroBucket.java | 192 | [
"other"
] | ZeroBucket | true | 4 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false |
_shutdown_handler | def _shutdown_handler(worker: Worker, sig='SIGTERM', how='Warm', callback=None, exitcode=EX_OK, verbose=True):
"""Install signal handler for warm/cold shutdown.
The handler will run from the MainProcess.
Args:
worker (Worker): The worker that received the signal.
sig (str, optional): The s... | Install signal handler for warm/cold shutdown.
The handler will run from the MainProcess.
Args:
worker (Worker): The worker that received the signal.
sig (str, optional): The signal that was received. Defaults to 'TERM'.
how (str, optional): The type of shutdown to perform. Defaults to 'Warm'.
callbac... | python | celery/apps/worker.py | 282 | [
"worker",
"sig",
"how",
"callback",
"exitcode",
"verbose"
] | true | 4 | 6.88 | celery/celery | 27,741 | google | false | |
isAssignable | private static boolean isAssignable(final Type type, final ParameterizedType toParameterizedType, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type == null) {
return true;
}
// only a null type can be assigned to null type which
// would have cause the previous to r... | Tests if the subject type may be implicitly cast to the target parameterized type following the Java generics rules.
@param type the subject type to be assigned to the target type.
@param toParameterizedType the target parameterized type.
@param typeVarAssigns a map with type variables.
@return {@co... | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,049 | [
"type",
"toParameterizedType",
"typeVarAssigns"
] | true | 14 | 8 | apache/commons-lang | 2,896 | javadoc | false | |
_approximate_mode | def _approximate_mode(class_counts, n_draws, rng):
"""Computes approximate mode of multivariate hypergeometric.
This is an approximation to the mode of the multivariate
hypergeometric given by class_counts and n_draws.
It shouldn't be off by more than one.
It is the mostly likely outcome of drawin... | Computes approximate mode of multivariate hypergeometric.
This is an approximation to the mode of the multivariate
hypergeometric given by class_counts and n_draws.
It shouldn't be off by more than one.
It is the mostly likely outcome of drawing n_draws many
samples from the population given by class_counts.
Paramet... | python | sklearn/utils/extmath.py | 1,412 | [
"class_counts",
"n_draws",
"rng"
] | false | 4 | 7.12 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
renewDelegationToken | default RenewDelegationTokenResult renewDelegationToken(byte[] hmac) {
return renewDelegationToken(hmac, new RenewDelegationTokenOptions());
} | Renew a Delegation Token.
<p>
This is a convenience method for {@link #renewDelegationToken(byte[], RenewDelegationTokenOptions)} with default options.
See the overload for more details.
@param hmac HMAC of the Delegation token
@return The RenewDelegationTokenResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 751 | [
"hmac"
] | RenewDelegationTokenResult | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
create_stack | def create_stack(self, stack_name: str, cloudformation_parameters: dict) -> None:
"""
Create stack in CloudFormation.
.. seealso::
- :external+boto3:py:meth:`CloudFormation.Client.create_stack`
:param stack_name: stack_name.
:param cloudformation_parameters: paramet... | Create stack in CloudFormation.
.. seealso::
- :external+boto3:py:meth:`CloudFormation.Client.create_stack`
:param stack_name: stack_name.
:param cloudformation_parameters: parameters to be passed to CloudFormation. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/cloud_formation.py | 67 | [
"self",
"stack_name",
"cloudformation_parameters"
] | None | true | 2 | 6.08 | apache/airflow | 43,597 | sphinx | false |
_get_nearest_indexer | def _get_nearest_indexer(
self, target: Index, limit: int | None, tolerance
) -> npt.NDArray[np.intp]:
"""
Get the indexer for the nearest index labels; requires an index with
values that can be subtracted from each other (e.g., not strings or
tuples).
"""
if ... | Get the indexer for the nearest index labels; requires an index with
values that can be subtracted from each other (e.g., not strings or
tuples). | python | pandas/core/indexes/base.py | 3,973 | [
"self",
"target",
"limit",
"tolerance"
] | npt.NDArray[np.intp] | true | 4 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
equals | @Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof NameMatchCacheOperationSource otherCos &&
ObjectUtils.nullSafeEquals(this.nameMap, otherCos.nameMap)));
} | Return if the given method name matches the mapped name.
<p>The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches,
as well as direct equality. Can be overridden in subclasses.
@param methodName the method name of the class
@param mappedName the name in the descriptor
@return if the names match
@see o... | java | spring-context/src/main/java/org/springframework/cache/interceptor/NameMatchCacheOperationSource.java | 111 | [
"other"
] | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
checkPositionIndexes | public static void checkPositionIndexes(int start, int end, int size) {
// Carefully optimized for execution by hotspot (explanatory comment above)
if (start < 0 || end < start || end > size) {
throw new IndexOutOfBoundsException(badPositionIndexes(start, end, size));
}
} | Ensures that {@code start} and {@code end} specify valid <i>positions</i> in an array, list or
string of size {@code size}, and are in order. A position index may range from zero to {@code
size}, inclusive.
@param start a user-supplied index identifying a starting position in an array, list or string
@param end a user-... | java | android/guava/src/com/google/common/base/Preconditions.java | 1,445 | [
"start",
"end",
"size"
] | void | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false |
isStartOfParameter | function isStartOfParameter(isJSDocParameter: boolean): boolean {
return token() === SyntaxKind.DotDotDotToken ||
isBindingIdentifierOrPrivateIdentifierOrPattern() ||
isModifierKind(token()) ||
token() === SyntaxKind.AtToken ||
isStartOfType(/*inStartOfParame... | 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 | 3,993 | [
"isJSDocParameter"
] | true | 5 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
mapPropertiesWithReplacement | private @Nullable PropertySource<?> mapPropertiesWithReplacement(PropertiesMigrationReport report, String name,
List<PropertyMigration> properties) {
report.add(name, properties);
List<PropertyMigration> renamed = properties.stream().filter(PropertyMigration::isCompatibleType).toList();
if (renamed.isEmpty()) ... | Analyse the {@link ConfigurableEnvironment environment} and attempt to rename
legacy properties if a replacement exists.
@return a report of the migration | java | core/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java | 187 | [
"report",
"name",
"properties"
] | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
addInterface | public void addInterface(Class<?> ifc) {
Assert.notNull(ifc, "Interface must not be null");
if (!ifc.isInterface()) {
throw new IllegalArgumentException("Specified class [" + ifc.getName() + "] must be an interface");
}
this.interfaces.add(ifc);
} | Add the specified interface to the list of interfaces to introduce.
@param ifc the interface to introduce | java | spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java | 99 | [
"ifc"
] | void | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
pathToPackage | public static String pathToPackage(final String path) {
return Objects.requireNonNull(path, "path").replace('/', '.');
} | Converts a Java path ('/') to a package name.
@param path the source path.
@return a package name.
@throws NullPointerException if {@code path} is null.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/ClassPathUtils.java | 53 | [
"path"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
isInternalLanguageInterface | protected boolean isInternalLanguageInterface(Class<?> ifc) {
return (ifc.getName().equals("groovy.lang.GroovyObject") ||
ifc.getName().endsWith(".cglib.proxy.Factory") ||
ifc.getName().endsWith(".bytebuddy.MockAccess"));
} | Determine whether the given interface is a well-known internal language interface
and therefore not to be considered as a reasonable proxy interface.
<p>If no reasonable proxy interface is found for a given bean, it will get
proxied with its full target class, assuming that as the user's intention.
@param ifc the inter... | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java | 145 | [
"ifc"
] | true | 3 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false | |
withCommonFrames | public StandardStackTracePrinter withCommonFrames() {
return withOption(Option.SHOW_COMMON_FRAMES);
} | Return a new {@link StandardStackTracePrinter} from this one that will print all
common frames rather the replacing them with the {@literal "... N more"} message.
@return a new {@link StandardStackTracePrinter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 159 | [] | StandardStackTracePrinter | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
instancesOf | public static <E> Stream<E> instancesOf(final Class<? super E> clazz, final Collection<? super E> collection) {
return instancesOf(clazz, of(collection));
} | Streams only instances of the give Class in a collection.
<p>
This method shorthand for:
</p>
<pre>
{@code (Stream<E>) Streams.toStream(collection).filter(collection, SomeClass.class::isInstance);}
</pre>
@param <E> the type of elements in the collection we want to stream.
@param clazz the type of elements in the colle... | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 609 | [
"clazz",
"collection"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
max | public static float max(final float a, final float b, final float c) {
return Math.max(Math.max(a, b), c);
} | Gets the maximum of three {@code float} values.
<p>
If any value is {@code NaN}, {@code NaN} is returned. Infinity is handled.
</p>
@param a value 1.
@param b value 2.
@param c value 3.
@return the largest of the values.
@see IEEE754rUtils#max(float, float, float) for a version of this method that handles NaN different... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 969 | [
"a",
"b",
"c"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
rmdir | function rmdir(path, options, callback) {
if (typeof options === 'function') {
callback = options;
options = undefined;
}
if (options?.recursive !== undefined) {
// This API previously accepted a `recursive` option that was deprecated
// and removed. However, in order to make the change more visi... | Asynchronously removes a directory.
@param {string | Buffer | URL} path
@param {object} [options]
@param {(err?: Error) => any} callback
@returns {void} | javascript | lib/fs.js | 1,122 | [
"path",
"options",
"callback"
] | false | 3 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
inverse | @Override
public BiMap<V, K> inverse() {
BiMap<V, K> result = inverse;
return (result == null) ? inverse = new Inverse<>(this) : result;
} | An {@code Entry} implementation that attempts to follow its key around the map -- that is, if
the key is moved, deleted, or reinserted, it will account for that -- while not doing any extra
work if the key has not moved. One quirk: The {@link #getValue()} method can return {@code
null} even for a map which supposedly d... | java | android/guava/src/com/google/common/collect/HashBiMap.java | 949 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
stripEnd | public static String stripEnd(final String str, final String stripChars) {
int end = length(str);
if (end == 0) {
return str;
}
if (stripChars == null) {
while (end != 0 && Character.isWhitespace(str.charAt(end - 1))) {
end--;
}
... | Strips any of a set of characters from the end of a String.
<p>
A {@code null} input String returns {@code null}. An empty string ("") input returns the empty string.
</p>
<p>
If the stripChars String is {@code null}, whitespace is stripped as defined by {@link Character#isWhitespace(char)}.
</p>
<pre>
StringUtils.stri... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,953 | [
"str",
"stripChars"
] | String | true | 8 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
opj_mqc_raw_decode | static INLINE OPJ_UINT32 opj_mqc_raw_decode(opj_mqc_t *mqc)
{
OPJ_UINT32 d;
if (mqc->ct == 0) {
/* Given opj_mqc_raw_init_dec() we know that at some point we will */
/* have a 0xFF 0xFF artificial marker */
if (mqc->c == 0xff) {
if (*mqc->bp > 0x8f) {
mqc->c ... | Decode a symbol using raw-decoder. Cfr p.506 TAUBMAN
@param mqc MQC handle
@return Returns the decoded symbol (0 or 1) | cpp | 3rdparty/openjpeg/openjp2/mqc_inl.h | 74 | [] | true | 6 | 7.84 | opencv/opencv | 85,374 | doxygen | false | |
_fill_limit_area_2d | def _fill_limit_area_2d(
mask: npt.NDArray[np.bool_], limit_area: Literal["outside", "inside"]
) -> None:
"""Prepare 2d mask for ffill/bfill with limit_area.
When called, mask will no longer faithfully represent when
the corresponding are NA or not.
Parameters
----------
mask : np.ndarray[... | Prepare 2d mask for ffill/bfill with limit_area.
When called, mask will no longer faithfully represent when
the corresponding are NA or not.
Parameters
----------
mask : np.ndarray[bool, ndim=1]
Mask representing NA values when filling.
limit_area : { "outside", "inside" }
Whether to limit filling to outside ... | python | pandas/core/missing.py | 992 | [
"mask",
"limit_area"
] | None | true | 3 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
_box_pa | def _box_pa(
cls, value, pa_type: pa.DataType | None = None
) -> pa.Array | pa.ChunkedArray | pa.Scalar:
"""
Box value into a pyarrow Array, ChunkedArray or Scalar.
Parameters
----------
value : any
pa_type : pa.DataType | None
Returns
------... | Box value into a pyarrow Array, ChunkedArray or Scalar.
Parameters
----------
value : any
pa_type : pa.DataType | None
Returns
-------
pa.Array or pa.ChunkedArray or pa.Scalar | python | pandas/core/arrays/arrow/array.py | 508 | [
"cls",
"value",
"pa_type"
] | pa.Array | pa.ChunkedArray | pa.Scalar | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
value | public XContentBuilder value(byte[] value) throws IOException {
if (value == null) {
return nullValue();
}
generator.writeBinary(value);
return this;
} | @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 | 777 | [
"value"
] | XContentBuilder | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
may_share_memory | def may_share_memory(a, b, /, max_work=0):
"""
may_share_memory(a, b, /, max_work=0)
Determine if two arrays might share memory
A return of True does not necessarily mean that the two arrays
share any element. It just means that they *might*.
Only the memory bounds of a and b are checked by ... | may_share_memory(a, b, /, max_work=0)
Determine if two arrays might share memory
A return of True does not necessarily mean that the two arrays
share any element. It just means that they *might*.
Only the memory bounds of a and b are checked by default.
Parameters
----------
a, b : ndarray
Input arrays
max_wor... | python | numpy/_core/multiarray.py | 1,398 | [
"a",
"b",
"max_work"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
getConfiguredInstances | public <T> List<T> getConfiguredInstances(List<String> classNames, Class<T> t, Map<String, Object> configOverrides) {
List<T> objects = new ArrayList<>();
if (classNames == null)
return objects;
Map<String, Object> configPairs = originals();
configPairs.putAll(configOverrides... | Get a list of configured instances of the given class specified by the given configuration key. The configuration
may specify either null or an empty string to indicate no configured instances. In both cases, this method
returns an empty list to indicate no configured instances.
@param classNames The list of class... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 488 | [
"classNames",
"t",
"configOverrides"
] | true | 3 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
dtype | def dtype(self, idx: int = 0) -> torch.dtype:
"""
Get the dtype of a specific input node.
Args:
idx: Index of the node to get the dtype from (default: 0)
Returns:
The dtype of the specified input node
"""
return self._input_nodes[idx].get_dtype() | Get the dtype of a specific input node.
Args:
idx: Index of the node to get the dtype from (default: 0)
Returns:
The dtype of the specified input node | python | torch/_inductor/kernel_inputs.py | 165 | [
"self",
"idx"
] | torch.dtype | true | 1 | 6.56 | pytorch/pytorch | 96,034 | google | false |
meanOf | public static double meanOf(double... values) {
checkArgument(values.length > 0);
double mean = values[0];
for (int index = 1; index < values.length; index++) {
double value = values[index];
if (isFinite(value) && isFinite(mean)) {
// Art of Computer Programming vol. 2, Knuth, 4.2.2, (15... | Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of the
values. The count must be non-zero.
<p>The definition of the mean is the same as {@link Stats#mean}.
@param values a series of values
@throws IllegalArgumentException if the dataset is empty | java | android/guava/src/com/google/common/math/Stats.java | 518 | [] | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false | |
get | URL get(JarFile jarFile) {
synchronized (this) {
return this.jarFileToJarFileUrl.get(jarFile);
}
} | Get a jar file URL from the cache given a jar file.
@param jarFile the jar file
@return the cached {@link URL} or {@code null} | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFiles.java | 168 | [
"jarFile"
] | URL | true | 1 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
containsNoDescendantOf | private boolean containsNoDescendantOf(Iterable<ConfigurationPropertySource> sources,
ConfigurationPropertyName name) {
for (ConfigurationPropertySource source : sources) {
if (source.containsDescendantOf(name) != ConfigurationPropertyState.ABSENT) {
return false;
}
}
return true;
} | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param h... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 539 | [
"sources",
"name"
] | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
processBackgroundEvents | boolean processBackgroundEvents() {
AtomicReference<KafkaException> firstError = new AtomicReference<>();
List<BackgroundEvent> events = backgroundEventHandler.drainEvents();
if (!events.isEmpty()) {
long startMs = time.milliseconds();
for (BackgroundEvent event : events... | Process the events-if any-that were produced by the {@link ConsumerNetworkThread network thread}.
It is possible that {@link ErrorEvent an error}
could occur when processing the events. In such cases, the processor will take a reference to the first
error, continue to process the remaining events, and then throw the fi... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 2,199 | [] | true | 6 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
combine_kwargs | def combine_kwargs(engine_kwargs: dict[str, Any] | None, kwargs: dict) -> dict:
"""
Used to combine two sources of kwargs for the backend engine.
Use of kwargs is deprecated, this function is solely for use in 1.3 and should
be removed in 1.4/2.0. Also _base.ExcelWriter.__new__ ensures either engine_kw... | Used to combine two sources of kwargs for the backend engine.
Use of kwargs is deprecated, this function is solely for use in 1.3 and should
be removed in 1.4/2.0. Also _base.ExcelWriter.__new__ ensures either engine_kwargs
or kwargs must be None or empty respectively.
Parameters
----------
engine_kwargs: dict
kw... | python | pandas/io/excel/_util.py | 304 | [
"engine_kwargs",
"kwargs"
] | dict | true | 3 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
stringify_path | def stringify_path(
filepath_or_buffer: FilePath | BaseBufferT,
convert_file_like: bool = False,
) -> str | BaseBufferT:
"""
Attempt to convert a path-like object to a string.
Parameters
----------
filepath_or_buffer : object to be converted
Returns
-------
str_filepath_or_buff... | Attempt to convert a path-like object to a string.
Parameters
----------
filepath_or_buffer : object to be converted
Returns
-------
str_filepath_or_buffer : maybe a string version of the object
Notes
-----
Objects supporting the fspath protocol are coerced
according to its __fspath__ method.
Any other object is pa... | python | pandas/io/common.py | 243 | [
"filepath_or_buffer",
"convert_file_like"
] | str | BaseBufferT | true | 4 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
of | public static TaggedFields of(Object... fields) {
if (fields.length % 2 != 0) {
throw new RuntimeException("TaggedFields#of takes an even " +
"number of parameters.");
}
TreeMap<Integer, Field> newFields = new TreeMap<>();
for (int i = 0; i < fields.length; i ... | Create a new TaggedFields object with the given tags and fields.
@param fields This is an array containing Integer tags followed
by associated Field objects.
@return The new {@link TaggedFields} | java | clients/src/main/java/org/apache/kafka/common/protocol/types/TaggedFields.java | 43 | [] | TaggedFields | true | 3 | 7.92 | apache/kafka | 31,560 | javadoc | false |
createReplacementArray | @VisibleForTesting
static char[][] createReplacementArray(Map<Character, String> map) {
checkNotNull(map); // GWT specific check (do not optimize)
if (map.isEmpty()) {
return EMPTY_REPLACEMENT_ARRAY;
}
char max = max(map.keySet());
char[][] replacements = new char[max + 1][];
for (Charac... | Returns a new ArrayBasedEscaperMap for creating ArrayBasedCharEscaper or
ArrayBasedUnicodeEscaper instances.
@param replacements a map of characters to their escaped representations | java | android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java | 66 | [
"map"
] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
advance | private void advance() throws IOException {
close();
if (it.hasNext()) {
current = it.next().openStream();
}
} | Closes the current reader and opens the next one, if any. | java | android/guava/src/com/google/common/io/MultiReader.java | 45 | [] | void | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false |
andThen | default ByteConsumer andThen(final ByteConsumer after) {
Objects.requireNonNull(after);
return (final byte t) -> {
accept(t);
after.accept(t);
};
} | Returns a composed {@link ByteConsumer} that performs, in sequence, this operation followed by the {@code after} operation. If performing either
operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the {@code after}
operation will not be... | java | src/main/java/org/apache/commons/lang3/function/ByteConsumer.java | 61 | [
"after"
] | ByteConsumer | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
emptyToNull | static @Nullable String emptyToNull(@Nullable String string) {
return stringIsNullOrEmpty(string) ? null : string;
} | Returns the string if it is not empty, or a null string otherwise.
@param string the string to test and possibly return
@return {@code string} if it is not empty; {@code null} otherwise | java | android/guava/src/com/google/common/base/Platform.java | 77 | [
"string"
] | String | true | 2 | 8.16 | google/guava | 51,352 | javadoc | false |
toApiVersion | private Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
Optional<ApiMessageType.ListenerType> listenerType) {
// see `PRODUCE_API_VERSIONS_RESPONSE_MIN_VERSION` for details on why we do this
... | To workaround a critical bug in librdkafka, the api versions response is inconsistent with the actual versions
supported by `produce` - this method handles that. It should be called in the context of the api response protocol
handling.
It should not be used by code generating protocol documentation - we keep that consi... | java | clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java | 285 | [
"enableUnstableLastVersion",
"listenerType"
] | true | 4 | 6 | apache/kafka | 31,560 | javadoc | false | |
getMaxAssignmentSize | private int getMaxAssignmentSize(List<String> allSubscribedTopics) {
int maxAssignmentSize;
if (allSubscribedTopics.size() == partitionsPerTopic.size()) {
maxAssignmentSize = totalPartitionsCount;
} else {
maxAssignmentSize = allSubscribedTopics.stream... | get the maximum assigned partition size of the {@code allSubscribedTopics}
@param allSubscribedTopics the subscribed topics of a consumer
@return maximum assigned partition size | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java | 1,228 | [
"allSubscribedTopics"
] | true | 2 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
bindAggregate | private <T> @Nullable Object bindAggregate(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler,
Context context, AggregateBinder<?> aggregateBinder) {
AggregateElementBinder elementBinder = (itemName, itemTarget, source) -> {
boolean allowRecursiveBinding = aggregateBinder.isAllowRecursiveBi... | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param h... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 462 | [
"name",
"target",
"handler",
"context",
"aggregateBinder"
] | Object | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
opt_func_info | def opt_func_info(func_name=None, signature=None):
"""
Returns a dictionary containing the currently supported CPU dispatched
features for all optimized functions.
Parameters
----------
func_name : str (optional)
Regular expression to filter by function name.
signature : str (optio... | Returns a dictionary containing the currently supported CPU dispatched
features for all optimized functions.
Parameters
----------
func_name : str (optional)
Regular expression to filter by function name.
signature : str (optional)
Regular expression to filter by data type.
Returns
-------
dict
A diction... | python | numpy/lib/introspect.py | 8 | [
"func_name",
"signature"
] | false | 10 | 6.96 | numpy/numpy | 31,054 | numpy | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.