Datasets:
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parseTypeParameter | function parseTypeParameter(): TypeParameterDeclaration {
const pos = getNodePos();
const modifiers = parseModifiers(/*allowDecorators*/ false, /*permitConstAsModifier*/ true);
const name = parseIdentifier();
let constraint: TypeNode | undefined;
let expression: Expression |... | 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,955 | [] | true | 6 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
convert | def convert(self, values: np.ndarray, nan_rep, encoding: str, errors: str):
"""
Convert the data from this selection to the appropriate pandas type.
Parameters
----------
values : np.ndarray
nan_rep :
encoding : str
errors : str
Returns
-... | Convert the data from this selection to the appropriate pandas type.
Parameters
----------
values : np.ndarray
nan_rep :
encoding : str
errors : str
Returns
-------
index : listlike to become an Index
data : ndarraylike to become a column | python | pandas/io/pytables.py | 2,655 | [
"self",
"values",
"nan_rep",
"encoding",
"errors"
] | true | 15 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false | |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Location other = (Location) obj;
boolean result = true;
result = result && this.line == other.line;
result = result && this.column == other... | Return the column of the text resource where the property originated.
@return the column number (zero indexed) | java | core/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java | 166 | [
"obj"
] | true | 6 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
parseAddressRange | bool parseAddressRange(const char *Str, uint64_t &StartAddress,
uint64_t &EndAddress) {
if (!Str)
return false;
// Parsed string format: <hex1>-<hex2>
StartAddress = hexToLong(Str, '-');
while (*Str && *Str != '-')
++Str;
if (!*Str)
return false;
++Str; // swallow '-'
En... | Get string with address and parse it to hex pair <StartAddress, EndAddress> | cpp | bolt/runtime/instr.cpp | 660 | [] | true | 5 | 6.4 | llvm/llvm-project | 36,021 | doxygen | false | |
_iter | def _iter(self, fitted, column_as_labels, skip_drop, skip_empty_columns):
"""
Generate (name, trans, columns, weight) tuples.
Parameters
----------
fitted : bool
If True, use the fitted transformers (``self.transformers_``) to
iterate through transformer... | Generate (name, trans, columns, weight) tuples.
Parameters
----------
fitted : bool
If True, use the fitted transformers (``self.transformers_``) to
iterate through transformers, else use the transformers passed by
the user (``self.transformers``).
column_as_labels : bool
If True, columns are returne... | python | sklearn/compose/_column_transformer.py | 437 | [
"self",
"fitted",
"column_as_labels",
"skip_drop",
"skip_empty_columns"
] | false | 12 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
containsLocalBean | boolean containsLocalBean(String name); | Return whether the local bean factory contains a bean of the given name,
ignoring beans defined in ancestor contexts.
<p>This is an alternative to {@code containsBean}, ignoring a bean
of the given name from an ancestor bean factory.
@param name the name of the bean to query
@return whether a bean with the given name i... | java | spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java | 50 | [
"name"
] | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false | |
advance | @Override
public void advance() {
boolean hasNextA = itA.hasNext();
boolean hasNextB = itB.hasNext();
endReached = hasNextA == false && hasNextB == false;
if (endReached) {
return;
}
long idxA = 0;
long idxB = 0;
if (hasNextA) {
... | Creates a new merging iterator, using the provided operator to merge the counts.
Note that the resulting count can be negative if the operator produces negative results.
@param itA the first iterator to merge
@param itB the second iterator to merge
@param countMergeOperator the operator to use to merge ... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/MergingBucketIterator.java | 68 | [] | void | true | 11 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
_check_for_default_values | def _check_for_default_values(fname, arg_val_dict, compat_args) -> None:
"""
Check that the keys in `arg_val_dict` are mapped to their
default values as specified in `compat_args`.
Note that this function is to be called only when it has been
checked that arg_val_dict.keys() is a subset of compat_a... | Check that the keys in `arg_val_dict` are mapped to their
default values as specified in `compat_args`.
Note that this function is to be called only when it has been
checked that arg_val_dict.keys() is a subset of compat_args | python | pandas/util/_validators.py | 51 | [
"fname",
"arg_val_dict",
"compat_args"
] | None | true | 9 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
elapsedNanos | private long elapsedNanos() {
return isRunning ? ticker.read() - startTick + elapsedNanos : elapsedNanos;
} | Sets the elapsed time for this stopwatch to zero, and places it in a stopped state.
@return this {@code Stopwatch} instance | java | android/guava/src/com/google/common/base/Stopwatch.java | 199 | [] | true | 2 | 8 | google/guava | 51,352 | javadoc | false | |
construct_from_string | def construct_from_string(cls, string: str) -> SparseDtype:
"""
Construct a SparseDtype from a string form.
Parameters
----------
string : str
Can take the following forms.
string dtype
================ ============================
... | Construct a SparseDtype from a string form.
Parameters
----------
string : str
Can take the following forms.
string dtype
================ ============================
'int' SparseDtype[np.int64, 0]
'Sparse' SparseDtype[np.float64, nan]
'Sparse[int]' SparseDtype... | python | pandas/core/dtypes/dtypes.py | 1,927 | [
"cls",
"string"
] | SparseDtype | true | 7 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
getOptionsDiagnostics | function getOptionsDiagnostics(): SortedReadonlyArray<Diagnostic> {
return sortAndDeduplicateDiagnostics(concatenate(
programDiagnostics.getCombinedDiagnostics(program).getGlobalDiagnostics(),
getOptionsDiagnosticsOfConfigFile(),
));
} | @returns The line index marked as preceding the diagnostic, or -1 if none was. | typescript | src/compiler/program.ts | 3,262 | [] | true | 1 | 7.04 | microsoft/TypeScript | 107,154 | jsdoc | false | |
addPendingString | @SuppressWarnings("CatchingUnchecked") // sneaky checked exception
private void addPendingString(StringBuilder builder) {
// Capture current builder length so it can be truncated if this future ends up completing while
// the toString is being calculated
int truncateLength = builder.length();
builder... | Provide a human-readable explanation of why this future has not yet completed.
@return null if an explanation cannot be provided (e.g. because the future is done).
@since 23.0 | java | android/guava/src/com/google/common/util/concurrent/AbstractFuture.java | 893 | [
"builder"
] | void | true | 5 | 7.2 | google/guava | 51,352 | javadoc | false |
randomLong | public long randomLong() {
return randomLong(Long.MAX_VALUE);
} | Generates a random long between 0 (inclusive) and Long.MAX_VALUE (exclusive).
@return the random long.
@see #randomLong(long, long)
@since 3.16.0 | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 415 | [] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
computeCacheOperations | private @Nullable Collection<CacheOperation> computeCacheOperations(Method method, @Nullable Class<?> targetClass) {
// Don't allow non-public methods, as configured.
if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) {
return null;
}
// Skip setBeanFactory method on BeanFactoryAware.... | Determine a cache key for the given method and target class.
<p>Must not produce same key for overloaded methods.
Must produce same key for different instances of the same method.
@param method the method (never {@code null})
@param targetClass the target class (may be {@code null})
@return the cache key (never {@code ... | java | spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java | 135 | [
"method",
"targetClass"
] | true | 11 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toTimestamp | ZonedDateTime toTimestamp(String value) {
// First, try parsing as milliseconds
if (isDigits(value)) {
try {
long milliseconds = Long.parseLong(value);
return Instant.ofEpochMilli(milliseconds).atZone(timezone);
} catch (NumberFormatException ignor... | A utility method for determining whether a string contains only digits, possibly with a leading '+' or '-'.
That is, does this string have any hope of being parse-able as a Long? | java | modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/CefParser.java | 523 | [
"value"
] | ZonedDateTime | true | 10 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
loadKey | private String loadKey(StringBuilder buffer, CharacterReader reader) throws IOException {
buffer.setLength(0);
boolean previousWhitespace = false;
while (!reader.isEndOfLine()) {
if (reader.isPropertyDelimiter()) {
reader.read();
return buffer.toString();
}
if (!reader.isWhiteSpace() && previousW... | Load {@code .properties} data and return a map of {@code String} ->
{@link OriginTrackedValue}.
@param expandLists if list {@code name[]=a,b,c} shortcuts should be expanded
@return the loaded properties
@throws IOException on read error | java | core/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java | 132 | [
"buffer",
"reader"
] | String | true | 5 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
of | static EnvironmentPostProcessorsFactory of(@Nullable ClassLoader classLoader, String... classNames) {
return new ReflectionEnvironmentPostProcessorsFactory(classLoader, classNames);
} | Return a {@link EnvironmentPostProcessorsFactory} that reflectively creates post
processors from the given class names.
@param classLoader the source class loader
@param classNames the post processor class names
@return an {@link EnvironmentPostProcessorsFactory} instance | java | core/spring-boot/src/main/java/org/springframework/boot/support/EnvironmentPostProcessorsFactory.java | 85 | [
"classLoader"
] | EnvironmentPostProcessorsFactory | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
to_pydatetime | def to_pydatetime(self) -> Series:
"""
Return the data as a Series of :class:`datetime.datetime` objects.
Timezone information is retained if present.
.. warning::
Python's datetime uses microsecond resolution, which is lower than
pandas (nanosecond). The values ... | Return the data as a Series of :class:`datetime.datetime` objects.
Timezone information is retained if present.
.. warning::
Python's datetime uses microsecond resolution, which is lower than
pandas (nanosecond). The values are truncated.
Returns
-------
numpy.ndarray
Object dtype array containing native ... | python | pandas/core/indexes/accessors.py | 324 | [
"self"
] | Series | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | unknown | false |
zipObjectDeep | function zipObjectDeep(props, values) {
return baseZipObject(props || [], values || [], baseSet);
} | This method is like `_.zipObject` except that it supports property paths.
@static
@memberOf _
@since 4.1.0
@category Array
@param {Array} [props=[]] The property identifiers.
@param {Array} [values=[]] The property values.
@returns {Object} Returns the new object.
@example
_.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, ... | javascript | lodash.js | 8,777 | [
"props",
"values"
] | false | 3 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
is_task_schedulable | def is_task_schedulable(task: Operator) -> bool:
"""
Determine if the task should be scheduled instead of being short-circuited to ``success``.
A task requires scheduling if it is not a trivial EmptyOperator, i.e. one of the
following conditions holds:
* it does **not** inherit... | Determine if the task should be scheduled instead of being short-circuited to ``success``.
A task requires scheduling if it is not a trivial EmptyOperator, i.e. one of the
following conditions holds:
* it does **not** inherit from ``EmptyOperator``
* it defines an ``on_execute_callback``
* it defines an ``on_success_... | python | airflow-core/src/airflow/models/taskinstance.py | 2,153 | [
"task"
] | bool | true | 5 | 6.56 | apache/airflow | 43,597 | unknown | false |
elementCompareTo | public int elementCompareTo(final T element) {
// Comparable API says throw NPE on null
Objects.requireNonNull(element, "element");
if (isAfter(element)) {
return -1;
}
if (isBefore(element)) {
return 1;
}
return 0;
} | Checks where the specified element occurs relative to this range.
<p>The API is reminiscent of the Comparable interface returning {@code -1} if
the element is before the range, {@code 0} if contained within the range and
{@code 1} if the element is after the range.</p>
@param element the element to check for, not null... | java | src/main/java/org/apache/commons/lang3/Range.java | 282 | [
"element"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
containsDescendantOf | default ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name) {
return ConfigurationPropertyState.UNKNOWN;
} | Returns if the source contains any descendants of the specified name. May return
{@link ConfigurationPropertyState#PRESENT} or
{@link ConfigurationPropertyState#ABSENT} if an answer can be determined or
{@link ConfigurationPropertyState#UNKNOWN} if it's not possible to determine a
definitive answer.
@param name the nam... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySource.java | 57 | [
"name"
] | ConfigurationPropertyState | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
doScan | protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
Assert.notEmpty(basePackages, "At least one base package must be specified");
Set<BeanDefinitionHolder> beanDefinitions = new LinkedHashSet<>();
for (String basePackage : basePackages) {
Set<BeanDefinition> candidates = findCandidateComponent... | Perform a scan within the specified base packages,
returning the registered bean definitions.
<p>This method does <i>not</i> register an annotation config processor
but rather leaves this up to the caller.
@param basePackages the packages to check for annotated classes
@return set of beans registered if any for tooling... | java | spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java | 272 | [] | true | 4 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
endObject | public XContentBuilder endObject() throws IOException {
generator.writeEndObject();
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 | 346 | [] | XContentBuilder | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
refreshIfEmpty | void refreshIfEmpty() {
if (ancestor != null) {
ancestor.refreshIfEmpty();
if (ancestor.getDelegate() != ancestorDelegate) {
throw new ConcurrentModificationException();
}
} else if (delegate.isEmpty()) {
Collection<V> newDelegate = map.get(key);
if (newDele... | If the delegate collection is empty, but the multimap has values for the key, replace the
delegate with the new collection for the key.
<p>For a subcollection, refresh its ancestor and validate that the ancestor delegate hasn't
changed. | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 351 | [] | void | true | 5 | 6.88 | google/guava | 51,352 | javadoc | false |
isParentOf | public boolean isParentOf(ConfigurationPropertyName name) {
Assert.notNull(name, "'name' must not be null");
if (getNumberOfElements() != name.getNumberOfElements() - 1) {
return false;
}
return isAncestorOf(name);
} | Returns {@code true} if this element is an immediate 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 | 284 | [
"name"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
arraycopy | public static <T> T arraycopy(final T source, final int sourcePos, final int destPos, final int length, final Supplier<T> allocator) {
return arraycopy(source, sourcePos, allocator.get(), destPos, length);
} | A fluent version of {@link System#arraycopy(Object, int, Object, int, int)} that returns the destination array.
@param <T> the type.
@param source the source array.
@param sourcePos starting position in the source array.
@param destPos starting position in the destination data.
@param length the number of... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1,419 | [
"source",
"sourcePos",
"destPos",
"length",
"allocator"
] | T | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
toString | @Override
public String toString() {
return "AutoOffsetResetStrategy{" +
"type=" + type +
(duration.map(value -> ", duration=" + value).orElse("")) +
'}';
} | Return the timestamp to be used for the ListOffsetsRequest.
@return the timestamp for the OffsetResetStrategy,
if the strategy is EARLIEST or LATEST or duration is provided
else return Optional.empty() | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AutoOffsetResetStrategy.java | 150 | [] | String | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false |
length | public int length() {
return this.values.size();
} | Returns the number of values in this array.
@return the length of this array | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 124 | [] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
count | public static int count(final String str, final String... set) {
if (isEmpty(str, set)) {
return 0;
}
final CharSet chars = CharSet.getInstance(set);
int count = 0;
for (final char c : str.toCharArray()) {
if (chars.contains(c)) {
count++;
... | Takes an argument in set-syntax, see evaluateSet,
and returns the number of characters present in the specified string.
<pre>
CharSetUtils.count(null, *) = 0
CharSetUtils.count("", *) = 0
CharSetUtils.count(*, null) = 0
CharSetUtils.count(*, "") = 0
CharSetUtils.count("hello", "k-p") = 3... | java | src/main/java/org/apache/commons/lang3/CharSetUtils.java | 84 | [
"str"
] | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
addOrMergeIndexedArgumentValue | private void addOrMergeIndexedArgumentValue(Integer key, ValueHolder newValue) {
ValueHolder currentValue = this.indexedArgumentValues.get(key);
if (currentValue != null && newValue.getValue() instanceof Mergeable mergeable) {
if (mergeable.isMergeEnabled()) {
newValue.setValue(mergeable.merge(currentValue.g... | Add an argument value for the given index in the constructor argument list,
merging the new value (typically a collection) with the current value
if demanded: see {@link org.springframework.beans.Mergeable}.
@param key the index in the constructor argument list
@param newValue the argument value in the form of a ValueH... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java | 123 | [
"key",
"newValue"
] | void | true | 4 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
writeOperation | function writeOperation(operationIndex: number): void {
tryEnterLabel(operationIndex);
tryEnterOrLeaveBlock(operationIndex);
// early termination, nothing else to process in this label
if (lastOperationWasAbrupt) {
return;
}
lastOperationWasAbrupt =... | Writes an operation as a statement to the current label's statement list.
@param operation The OpCode of the operation | typescript | src/compiler/transformers/generators.ts | 3,027 | [
"operationIndex"
] | true | 6 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
describe_replications | def describe_replications(self, filters: list[dict[str, Any]] | None = None, **kwargs) -> list[dict]:
"""
Return list of serverless replications.
.. seealso::
- :external+boto3:py:meth:`DatabaseMigrationService.Client.describe_replications`
:param filters: List of filter ob... | Return list of serverless replications.
.. seealso::
- :external+boto3:py:meth:`DatabaseMigrationService.Client.describe_replications`
:param filters: List of filter objects
:return: List of replications | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/dms.py | 300 | [
"self",
"filters"
] | list[dict] | true | 2 | 7.28 | apache/airflow | 43,597 | sphinx | false |
listShareGroupOffsets | ListShareGroupOffsetsResult listShareGroupOffsets(Map<String, ListShareGroupOffsetsSpec> groupSpecs, ListShareGroupOffsetsOptions options); | List the share group offsets available in the cluster for the specified share groups.
@param groupSpecs Map of share group ids to a spec that specifies the topic partitions of the group to list offsets for.
@param options The options to use when listing the share group offsets.
@return The ListShareGroupOffsetsResult | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,978 | [
"groupSpecs",
"options"
] | ListShareGroupOffsetsResult | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
instantiateType | public @Nullable T instantiateType(Class<?> type) {
Assert.notNull(type, "'type' must not be null");
return instantiate(TypeSupplier.forType(type));
} | Instantiate the given class, injecting constructor arguments as necessary.
@param type the type to instantiate
@return an instantiated instance
@since 3.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/util/Instantiator.java | 159 | [
"type"
] | T | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
createInitialManifest | private Manifest createInitialManifest(JarFile source) throws IOException {
if (source.getManifest() != null) {
return new Manifest(source.getManifest());
}
Manifest manifest = new Manifest();
manifest.getMainAttributes().putValue("Manifest-Version", "1.0");
return manifest;
} | Writes a signature file if necessary for the given {@code writtenLibraries}.
@param writtenLibraries the libraries
@param writer the writer to use to write the signature file if necessary
@throws IOException if a failure occurs when writing the signature file | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java | 310 | [
"source"
] | Manifest | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
toString | @Override
public String toString() {
return (this.matcher != null) ? this.matcher.group(2) : "";
} | Return the extension from the hint or return the parameter if the hint is not
{@link #isPresent() present}.
@param extension the fallback extension
@return the extension either from the hint or fallback | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/FileExtensionHint.java | 59 | [] | String | true | 2 | 7.68 | spring-projects/spring-boot | 79,428 | javadoc | false |
getDeadlineMsForTimeout | long getDeadlineMsForTimeout(final long timeoutMs) {
long expiration = time.milliseconds() + timeoutMs;
if (expiration < 0) {
return Long.MAX_VALUE;
}
return expiration;
} | Reconcile the assignment that has been received from the server. If for some topics, the
topic ID cannot be matched to a topic name, a metadata update will be triggered and only
the subset of topics that are resolvable will be reconciled. Reconciliation will trigger the
callbacks and update the subscription state.
Ther... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 922 | [
"timeoutMs"
] | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
axes | def axes(self) -> list[Index]:
"""
Return a list representing the axes of the DataFrame.
It has the row axis labels and column axis labels as the only members.
They are returned in that order.
See Also
--------
DataFrame.index: The index (row labels) of the Data... | Return a list representing the axes of the DataFrame.
It has the row axis labels and column axis labels as the only members.
They are returned in that order.
See Also
--------
DataFrame.index: The index (row labels) of the DataFrame.
DataFrame.columns: The column labels of the DataFrame.
Examples
--------
>>> df = p... | python | pandas/core/frame.py | 1,024 | [
"self"
] | list[Index] | true | 1 | 6.08 | pandas-dev/pandas | 47,362 | unknown | false |
intersects | public boolean intersects(final FluentBitSet set) {
return bitSet.intersects(set.bitSet);
} | Returns true if the specified {@link BitSet} has any bits set to {@code true} that are also set to {@code true} in
this {@link BitSet}.
@param set {@link BitSet} to intersect with.
@return boolean indicating whether this {@link BitSet} intersects the specified {@link BitSet}. | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 284 | [
"set"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
build | public SimpleAsyncTaskExecutor build() {
return configure(new SimpleAsyncTaskExecutor());
} | Build a new {@link SimpleAsyncTaskExecutor} instance and configure it using this
builder.
@return a configured {@link SimpleAsyncTaskExecutor} instance.
@see #build(Class)
@see #configure(SimpleAsyncTaskExecutor) | java | core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskExecutorBuilder.java | 241 | [] | SimpleAsyncTaskExecutor | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
parseInitializer | function parseInitializer(): Expression | undefined {
return parseOptional(SyntaxKind.EqualsToken) ? parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true) : undefined;
} | 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 | 5,065 | [] | true | 2 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
softValues | @GwtIncompatible // java.lang.ref.SoftReference
@CanIgnoreReturnValue
public CacheBuilder<K, V> softValues() {
return setValueStrength(Strength.SOFT);
} | Specifies that each value (not key) stored in the cache should be wrapped in a {@link
SoftReference} (by default, strong references are used). Softly-referenced objects will be
garbage-collected in a <i>globally</i> least-recently-used manner, in response to memory
demand.
<p><b>Warning:</b> in most circumstances it is... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 686 | [] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
completeFutureAndFireCallbacks | private void completeFutureAndFireCallbacks(
long baseOffset,
long logAppendTime,
Function<Integer, RuntimeException> recordExceptions
) {
// Set the future before invoking the callbacks as we rely on its state for the `onCompletion` call
produceFuture.set(baseOffset, logAppe... | Finalize the state of a batch. Final state, once set, is immutable. This function may be called
once or twice on a batch. It may be called twice if
1. An inflight batch expires before a response from the broker is received. The batch's final
state is set to FAILED. But it could succeed on the broker and second time aro... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java | 294 | [
"baseOffset",
"logAppendTime",
"recordExceptions"
] | void | true | 5 | 8.24 | apache/kafka | 31,560 | javadoc | false |
createBeanDefinition | protected AbstractBeanDefinition createBeanDefinition(@Nullable String className, @Nullable String parentName)
throws ClassNotFoundException {
return BeanDefinitionReaderUtils.createBeanDefinition(
parentName, className, this.readerContext.getBeanClassLoader());
} | Create a bean definition for the given class name and parent name.
@param className the name of the bean class
@param parentName the name of the bean's parent bean
@return the newly created bean definition
@throws ClassNotFoundException if bean class resolution was attempted but failed | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java | 635 | [
"className",
"parentName"
] | AbstractBeanDefinition | true | 1 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
loadBeanDefinitions | public int loadBeanDefinitions(InputSource inputSource) throws BeanDefinitionStoreException {
return loadBeanDefinitions(inputSource, "resource loaded through SAX InputSource");
} | Load bean definitions from the specified XML file.
@param inputSource the SAX InputSource to read from
@return the number of bean definitions found
@throws BeanDefinitionStoreException in case of loading or parsing errors | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java | 365 | [
"inputSource"
] | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false | |
doubleValue | @Override
public double doubleValue() {
if (value >= 0) {
return (double) value;
}
// The top bit is set, which means that the double value is going to come from the top 53 bits.
// So we can ignore the bottom 11, except for rounding. We can unsigned-shift right 1, aka
// unsigned-divide by ... | Returns the value of this {@code UnsignedLong} as a {@code double}, analogous to a widening
primitive conversion from {@code long} to {@code double}, and correctly rounded. | java | android/guava/src/com/google/common/primitives/UnsignedLong.java | 209 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
_serialize_params_dict | def _serialize_params_dict(cls, params: ParamsDict | dict) -> list[tuple[str, dict]]:
"""Serialize Params dict for a DAG or task as a list of tuples to ensure ordering."""
serialized_params = []
for k, raw_v in params.items():
# Use native param object, not resolved value if possible... | Serialize Params dict for a DAG or task as a list of tuples to ensure ordering. | python | airflow-core/src/airflow/serialization/serialized_objects.py | 908 | [
"cls",
"params"
] | list[tuple[str, dict]] | true | 5 | 6 | apache/airflow | 43,597 | unknown | false |
unused | def unused(fn: Callable[_P, _R]) -> Callable[_P, _R]:
"""
This decorator indicates to the compiler that a function or method should
be ignored and replaced with the raising of an exception. This allows you
to leave code in your model that is not yet TorchScript compatible and still
export your model... | This decorator indicates to the compiler that a function or method should
be ignored and replaced with the raising of an exception. This allows you
to leave code in your model that is not yet TorchScript compatible and still
export your model.
Example (using ``@torch.jit.unused`` on a method)::
import tor... | python | torch/_jit_internal.py | 721 | [
"fn"
] | Callable[_P, _R] | true | 3 | 6.4 | pytorch/pytorch | 96,034 | unknown | false |
minimalEmpty | public static ZeroBucket minimalEmpty() {
return MINIMAL_EMPTY;
} | @return A singleton instance of an empty zero bucket with the smallest possible threshold. | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ZeroBucket.java | 102 | [] | ZeroBucket | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false |
postProcessObjectFromFactoryBean | protected Object postProcessObjectFromFactoryBean(Object object, String beanName) throws BeansException {
return object;
} | Post-process the given object that has been obtained from the FactoryBean.
The resulting object will get exposed for bean references.
<p>The default implementation simply returns the given object as-is.
Subclasses may override this, for example, to apply post-processors.
@param object the object obtained from the Facto... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java | 259 | [
"object",
"beanName"
] | Object | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
shallBeRetried | boolean shallBeRetried() {
return timeSupplier.get() - deadUntilNanos > 0;
} | Indicates whether it's time to retry to failed host or not.
@return true if the host should be retried, false otherwise | java | client/rest/src/main/java/org/elasticsearch/client/DeadHostState.java | 75 | [] | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false | |
first | @SuppressWarnings("nullness") // Unsafe, but we can't do much about it now.
public final Optional<@NonNull E> first() {
Iterator<E> iterator = getDelegate().iterator();
return iterator.hasNext() ? Optional.of(iterator.next()) : Optional.absent();
} | Returns an {@link Optional} containing the first element in this fluent iterable. If the
iterable is empty, {@code Optional.absent()} is returned.
<p><b>{@code Stream} equivalent:</b> if the goal is to obtain any element, {@link
Stream#findAny}; if it must specifically be the <i>first</i> element, {@code Stream#findFir... | java | android/guava/src/com/google/common/collect/FluentIterable.java | 519 | [] | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false | |
onTasksAssignedCallbackCompleted | public void onTasksAssignedCallbackCompleted(final StreamsOnTasksAssignedCallbackCompletedEvent event) {
Optional<KafkaException> error = event.error();
CompletableFuture<Void> future = event.future();
if (error.isPresent()) {
Exception e = error.get();
log.warn("The onT... | Completes the future that marks the completed execution of the onTasksAssigned callback.
@param event The event containing the future sent from the application thread to the network thread to
confirm the execution of the callback. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 1,320 | [
"event"
] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
get_unanimous_names | def get_unanimous_names(*indexes: Index) -> tuple[Hashable, ...]:
"""
Return common name if all indices agree, otherwise None (level-by-level).
Parameters
----------
indexes : list of Index objects
Returns
-------
list
A list representing the unanimous 'names' found.
"""
... | Return common name if all indices agree, otherwise None (level-by-level).
Parameters
----------
indexes : list of Index objects
Returns
-------
list
A list representing the unanimous 'names' found. | python | pandas/core/indexes/base.py | 7,837 | [] | tuple[Hashable, ...] | true | 2 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false |
__init__ | def __init__(self, *args, **kwargs):
"""
Initialize on an exterior ring and a sequence of holes (both
instances may be either LinearRing instances, or a tuple/list
that may be constructed into a LinearRing).
Examples of initialization, where shell, hole1, and hole2 are
v... | Initialize on an exterior ring and a sequence of holes (both
instances may be either LinearRing instances, or a tuple/list
that may be constructed into a LinearRing).
Examples of initialization, where shell, hole1, and hole2 are
valid LinearRing geometries:
>>> from django.contrib.gis.geos import LinearRing, Polygon
>... | python | django/contrib/gis/geos/polygon.py | 10 | [
"self"
] | false | 6 | 6.48 | django/django | 86,204 | unknown | false | |
buildAllFieldTypes | function buildAllFieldTypes(
inputTypes: readonly DMMF.InputTypeRef[],
context: GenerateContext,
source?: string,
): ts.TypeBuilder {
const inputObjectTypes = inputTypes.filter((t) => t.location === 'inputObjectTypes' && !t.isList)
const otherTypes = inputTypes.filter((t) => t.location !== 'inputObjectTypes'... | Examples:
T[], T => T | T[]
T, U => XOR<T,U>
T[], T, U => XOR<T, U> | T[]
T[], U => T[] | U
T, U, null => XOR<T,U> | null
T, U, V, W, null => XOR<T, XOR<U, XOR<V, W>>> | null
1. Separate XOR and non XOR items (objects and non-objects)
2. Generate them out and `|` them | typescript | packages/client-generator-js/src/TSClient/Input.ts | 96 | [
"inputTypes",
"context",
"source?"
] | true | 5 | 7.12 | prisma/prisma | 44,834 | jsdoc | false | |
identity | static <E extends Throwable> FailableLongUnaryOperator<E> identity() {
return t -> t;
} | Returns a unary operator that always returns its input argument.
@param <E> The kind of thrown exception or error.
@return a unary operator that always returns its input argument | java | src/main/java/org/apache/commons/lang3/function/FailableLongUnaryOperator.java | 41 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
search | static <T> ConfigurationPropertyState search(T[] source, int startInclusive, int endExclusive,
Predicate<T> predicate) {
Assert.notNull(source, "'source' must not be null");
Assert.notNull(predicate, "'predicate' must not be null");
for (int i = startInclusive; i < endExclusive; i++) {
if (predicate.test(so... | Search the given iterable using a predicate to determine if content is
{@link #PRESENT} or {@link #ABSENT}.
@param <T> the data type
@param source the source iterable to search
@param startInclusive the first index to cover
@param endExclusive index immediately past the last index to cover
@param predicate the predicat... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyState.java | 80 | [
"source",
"startInclusive",
"endExclusive",
"predicate"
] | ConfigurationPropertyState | true | 3 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
getPrimitivePromotionCost | private static float getPrimitivePromotionCost(final Class<?> srcClass, final Class<?> destClass) {
if (srcClass == null) {
return 1.5f;
}
float cost = 0.0f;
Class<?> cls = srcClass;
if (!cls.isPrimitive()) {
// slight unwrapping penalty
cost +... | Gets the number of steps required to promote a primitive to another type.
@param srcClass the (primitive) source class.
@param destClass the (primitive) destination class.
@return The cost of promoting the primitive. | java | src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java | 169 | [
"srcClass",
"destClass"
] | true | 7 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
isParamMismatch | private boolean isParamMismatch(Method uniqueCandidate, Method candidate) {
int uniqueCandidateParameterCount = uniqueCandidate.getParameterCount();
int candidateParameterCount = candidate.getParameterCount();
return (uniqueCandidateParameterCount != candidateParameterCount ||
!Arrays.equals(uniqueCandidate.g... | Resolve the factory method in the specified bean definition, if possible.
{@link RootBeanDefinition#getResolvedFactoryMethod()} can be checked for the result.
@param mbd the bean definition to check | java | spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java | 360 | [
"uniqueCandidate",
"candidate"
] | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
make_hastie_10_2 | def make_hastie_10_2(n_samples=12000, *, random_state=None):
"""Generate data for binary classification used in Hastie et al. 2009, Example 10.2.
The ten features are standard independent Gaussian and
the target ``y`` is defined by::
y[i] = 1 if np.sum(X[i] ** 2) > 9.34 else -1
Read more in the... | Generate data for binary classification used in Hastie et al. 2009, Example 10.2.
The ten features are standard independent Gaussian and
the target ``y`` is defined by::
y[i] = 1 if np.sum(X[i] ** 2) > 9.34 else -1
Read more in the :ref:`User Guide <sample_generators>`.
Parameters
----------
n_samples : int, defa... | python | sklearn/datasets/_samples_generator.py | 573 | [
"n_samples",
"random_state"
] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
chunkObjectLiteralElements | function chunkObjectLiteralElements(elements: readonly ObjectLiteralElementLike[]): Expression[] {
let chunkObject: ObjectLiteralElementLike[] | undefined;
const objects: Expression[] = [];
for (const e of elements) {
if (e.kind === SyntaxKind.SpreadAssignment) {
... | @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the
expression of an `ExpressionStatement`). | typescript | src/compiler/transformers/es2018.ts | 482 | [
"elements"
] | true | 6 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
min | public static double min(final double... array) {
Objects.requireNonNull(array, "array");
Validate.isTrue(array.length != 0, "Array cannot be empty.");
// Finds and returns min
double min = array[0];
for (int i = 1; i < array.length; i++) {
min = min(array[i], min);
... | Returns the minimum value in an array.
@param array an array, must not be null or empty.
@return the minimum value in the array.
@throws NullPointerException if {@code array} is {@code null}.
@throws IllegalArgumentException if {@code array} is empty.
@since 3.4 Changed signature from min(double[]) to min(double...). | java | src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java | 151 | [] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
resolve | def resolve(self, key: str, is_local: bool):
"""
Resolve a variable name in a possibly local context.
Parameters
----------
key : str
A variable name
is_local : bool
Flag indicating whether the variable is local or not (prefixed with
t... | Resolve a variable name in a possibly local context.
Parameters
----------
key : str
A variable name
is_local : bool
Flag indicating whether the variable is local or not (prefixed with
the '@' symbol)
Returns
-------
value : object
The value of a particular variable | python | pandas/core/computation/scope.py | 208 | [
"self",
"key",
"is_local"
] | true | 4 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false | |
getPackageName | public static String getPackageName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
return getPackageName(object.getClass());
} | Gets the package 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. | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 789 | [
"object",
"valueIfNull"
] | String | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
prepareTransaction | @Override
public PreparedTxnState prepareTransaction() throws ProducerFencedException {
throwIfNoTransactionManager();
throwIfProducerClosed();
throwIfInPreparedState();
if (!transactionManager.is2PCEnabled()) {
throw new InvalidTxnStateException("Cannot prepare a transac... | Prepares the current transaction for a two-phase commit. This method will flush all pending messages
and transition the producer into a mode where only {@link #commitTransaction()}, {@link #abortTransaction()},
or completeTransaction(PreparedTxnState) may be called.
<p>
This method is used as part of a two-phase commit... | java | clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java | 808 | [] | PreparedTxnState | true | 2 | 7.44 | apache/kafka | 31,560 | javadoc | false |
parse_pattern | def parse_pattern(
pattern: str, axes_lengths: Mapping[str, int]
) -> tuple[ParsedExpression, ParsedExpression]:
"""Parse an `einops`-style pattern into a left-hand side and right-hand side `ParsedExpression` object.
Args:
pattern (str): the `einops`-style rearrangement pattern
axes_lengths... | Parse an `einops`-style pattern into a left-hand side and right-hand side `ParsedExpression` object.
Args:
pattern (str): the `einops`-style rearrangement pattern
axes_lengths (Mapping[str, int]): any additional length specifications for dimensions
Returns:
tuple[ParsedExpression, ParsedExpression]: a tupl... | python | functorch/einops/_parsing.py | 212 | [
"pattern",
"axes_lengths"
] | tuple[ParsedExpression, ParsedExpression] | true | 6 | 7.44 | pytorch/pytorch | 96,034 | google | false |
loadBeanDefinitions | public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException {
Assert.notNull(encodedResource, "EncodedResource must not be null");
if (logger.isTraceEnabled()) {
logger.trace("Loading XML bean definitions from " + encodedResource);
}
Set<EncodedResource> currentResour... | Load bean definitions from the specified XML file.
@param encodedResource the resource descriptor for the XML file,
allowing to specify an encoding to use for parsing the file
@return the number of bean definitions found
@throws BeanDefinitionStoreException in case of loading or parsing errors | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java | 327 | [
"encodedResource"
] | true | 6 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
isRequired | public boolean isRequired() {
if (!this.required) {
return false;
}
if (this.field != null) {
return !(this.field.getType() == Optional.class || Nullness.forField(this.field) == Nullness.NULLABLE);
}
else {
return !obtainMethodParameter().isOptional();
}
} | Return whether this dependency is required.
<p>Optional semantics are derived from Java 8's {@link java.util.Optional},
any variant of a parameter-level {@code Nullable} annotation (such as from
JSR-305 or the FindBugs set of annotations), or a language-level nullable
type declaration in Kotlin. | java | spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java | 157 | [] | true | 4 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
dataclasses_to_dicts | def dataclasses_to_dicts(data):
"""
Converts a list of dataclass instances to a list of dictionaries.
Parameters
----------
data : List[Type[dataclass]]
Returns
--------
list_dict : List[dict]
Examples
--------
>>> from dataclasses import dataclass
>>> @dataclass
.... | Converts a list of dataclass instances to a list of dictionaries.
Parameters
----------
data : List[Type[dataclass]]
Returns
--------
list_dict : List[dict]
Examples
--------
>>> from dataclasses import dataclass
>>> @dataclass
... class Point:
... x: int
... y: int
>>> dataclasses_to_dicts([Point(1, 2), Po... | python | pandas/core/internals/construction.py | 703 | [
"data"
] | false | 1 | 6.16 | pandas-dev/pandas | 47,362 | numpy | false | |
load | protected void load(ApplicationContext context, Object[] sources) {
if (logger.isDebugEnabled()) {
logger.debug("Loading source " + StringUtils.arrayToCommaDelimitedString(sources));
}
BeanDefinitionLoader loader = createBeanDefinitionLoader(getBeanDefinitionRegistry(context), sources);
if (this.beanNameGene... | Load beans into the application context.
@param context the context to load beans into
@param sources the sources to load | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 683 | [
"context",
"sources"
] | void | true | 5 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
_levels_to_axis | def _levels_to_axis(
ss,
levels: tuple[int] | list[int],
valid_ilocs: npt.NDArray[np.intp],
sort_labels: bool = False,
) -> tuple[npt.NDArray[np.intp], list[IndexLabel]]:
"""
For a MultiIndexed sparse Series `ss`, return `ax_coords` and `ax_labels`,
where `ax_coords` are the coordinates alon... | For a MultiIndexed sparse Series `ss`, return `ax_coords` and `ax_labels`,
where `ax_coords` are the coordinates along one of the two axes of the
destination sparse matrix, and `ax_labels` are the labels from `ss`' Index
which correspond to these coordinates.
Parameters
----------
ss : Series
levels : tuple/list
valid... | python | pandas/core/arrays/sparse/scipy_sparse.py | 40 | [
"ss",
"levels",
"valid_ilocs",
"sort_labels"
] | tuple[npt.NDArray[np.intp], list[IndexLabel]] | true | 4 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
getAsShort | public static <E extends Throwable> short getAsShort(final FailableShortSupplier<E> supplier) {
try {
return supplier.getAsShort();
} catch (final Throwable t) {
throw rethrow(t);
}
} | Invokes a short supplier, and returns the result.
@param supplier The short supplier to invoke.
@param <E> The type of checked exception, which the supplier can throw.
@return The short, which has been created by the supplier | java | src/main/java/org/apache/commons/lang3/function/Failable.java | 482 | [
"supplier"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
bindProperty | private <T> @Nullable Object bindProperty(Bindable<T> target, Context context, ConfigurationProperty property) {
context.setConfigurationProperty(property);
Object result = property.getValue();
result = this.placeholdersResolver.resolvePlaceholders(result);
result = context.getConverter().convert(result, target... | 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 | 487 | [
"target",
"context",
"property"
] | Object | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
isOTelDocument | static boolean isOTelDocument(Map<String, Object> source) {
Object resource = source.get(RESOURCE_KEY);
if (resource instanceof Map<?, ?> resourceMap) {
Object resourceAttributes = resourceMap.get(ATTRIBUTES_KEY);
if (resourceAttributes != null && (resourceAttributes instanceof M... | Checks if the given document is OpenTelemetry-compliant.
<p>A document is considered OpenTelemetry-compliant if it meets the following criteria:
<ul>
<li>The "resource" field is present and is a map
<li>The resource field either doesn't contain an "attributes" field, or the "attributes" field is a map.</li>
<li>T... | java | modules/ingest-otel/src/main/java/org/elasticsearch/ingest/otel/NormalizeForStreamProcessor.java | 209 | [
"source"
] | true | 12 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
getTargetType | public @Nullable Class<?> getTargetType() {
if (this.resolvedTargetType != null) {
return this.resolvedTargetType;
}
ResolvableType targetType = this.targetType;
return (targetType != null ? targetType.resolve() : null);
} | Return the target type of this bean definition, if known
(either specified in advance or resolved on first instantiation).
@since 3.2.2 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java | 332 | [] | true | 3 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false | |
build | public ImmutableLongArray build() {
return count == 0 ? EMPTY : new ImmutableLongArray(array, 0, count);
} | Returns a new immutable array. The builder can continue to be used after this call, to append
more values and build again.
<p><b>Performance note:</b> the returned array is backed by the same array as the builder, so
no data is copied as part of this step, but this may occupy more memory than strictly
necessary. To cop... | java | android/guava/src/com/google/common/primitives/ImmutableLongArray.java | 334 | [] | ImmutableLongArray | true | 2 | 6.96 | google/guava | 51,352 | javadoc | false |
fast_xs | def fast_xs(self, loc: int) -> SingleBlockManager:
"""
Return the array corresponding to `frame.iloc[loc]`.
Parameters
----------
loc : int
Returns
-------
np.ndarray or ExtensionArray
"""
if len(self.blocks) == 1:
# TODO: thi... | Return the array corresponding to `frame.iloc[loc]`.
Parameters
----------
loc : int
Returns
-------
np.ndarray or ExtensionArray | python | pandas/core/internals/managers.py | 1,108 | [
"self",
"loc"
] | SingleBlockManager | true | 13 | 6.32 | pandas-dev/pandas | 47,362 | numpy | false |
closeAndWait | private void closeAndWait(ConfigurableApplicationContext context) {
if (!context.isActive()) {
return;
}
context.close();
try {
int waited = 0;
while (context.isActive()) {
if (waited > TIMEOUT) {
throw new TimeoutException();
}
Thread.sleep(SLEEP);
waited += SLEEP;
}
}
catc... | Call {@link ConfigurableApplicationContext#close()} and wait until the context
becomes inactive. We can't assume that just because the close method returns that
the context is actually inactive. It could be that another thread is still in the
process of disposing beans.
@param context the context to clean | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplicationShutdownHook.java | 143 | [
"context"
] | void | true | 6 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
checkPositionIndex | @CanIgnoreReturnValue
public static int checkPositionIndex(int index, int size) {
return checkPositionIndex(index, size, "index");
} | Ensures that {@code index} specifies a valid <i>position</i> in an array, list or string of
size {@code size}. A position index may range from zero to {@code size}, inclusive.
<p><b>Java 9 users:</b> consider using {@link java.util.Objects#checkIndex(index, size)}
instead. However, note that {@code checkIndex()} throws... | java | android/guava/src/com/google/common/base/Preconditions.java | 1,398 | [
"index",
"size"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
format | static String format(final Token[] tokens, final long years, final long months, final long days, final long hours, final long minutes,
final long seconds,
final long milliseconds, final boolean padWithZeros) {
final StringBuilder buffer = new StringBuilder();
boolean lastOutputSe... | The internal method to do the formatting.
@param tokens the tokens
@param years the number of years
@param months the number of months
@param days the number of days
@param hours the number of hours
@param minutes the number of minutes
@param seconds the number of seconds
@param milliseconds the number of milli... | java | src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java | 239 | [
"tokens",
"years",
"months",
"days",
"hours",
"minutes",
"seconds",
"milliseconds",
"padWithZeros"
] | String | true | 33 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
toString | @Override
public String toString() {
return MoreObjects.toStringHelper(ServiceManager.class)
.add("services", Collections2.filter(services, not(instanceOf(NoOpService.class))))
.toString();
} | Returns the service load times. This value will only return startup times for services that
have finished starting.
@return Map of services and their corresponding startup time, the map entries will be ordered
by startup time.
@since 33.4.0 (but since 31.0 in the JRE flavor) | java | android/guava/src/com/google/common/util/concurrent/ServiceManager.java | 441 | [] | String | true | 1 | 6.88 | google/guava | 51,352 | javadoc | false |
compute | public double compute(Collection<? extends Number> dataset) {
return computeInPlace(Doubles.toArray(dataset));
} | Computes the quantile value of the given dataset.
@param dataset the dataset to do the calculation on, which must be non-empty, which will be
cast to doubles (with any associated lost of precision), and which will not be mutated by
this call (it is copied instead)
@return the quantile value | java | android/guava/src/com/google/common/math/Quantiles.java | 242 | [
"dataset"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
sem | def sem(
self, ddof: int = 1, numeric_only: bool = False, skipna: bool = True
) -> NDFrameT:
"""
Compute standard error of the mean of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex.
Parameters
----------
ddof... | Compute standard error of the mean of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex.
Parameters
----------
ddof : int, default 1
Degrees of freedom.
numeric_only : bool, default False
Include only `float`, `int` or `boolean` data.
.. versionchanged:: 2.0... | python | pandas/core/groupby/groupby.py | 2,753 | [
"self",
"ddof",
"numeric_only",
"skipna"
] | NDFrameT | true | 4 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
lookupImplementationMethod | InstrumentationInfo lookupImplementationMethod(
Class<?> targetSuperclass,
String methodName,
Class<?> implementationClass,
Class<?> checkerClass,
String checkMethodName,
Class<?>... parameterTypes
) throws NoSuchMethodException, ClassNotFoundException; | This method uses the method names of the provided class to identify the JDK method to instrument; it examines all methods prefixed
by {@code check$}, and parses the rest of the name to extract the JDK method:
<ul>
<li>
Instance methods have the fully qualified class name (with . replaced by _), followed by $, followed ... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/instrumentation/InstrumentationService.java | 53 | [
"targetSuperclass",
"methodName",
"implementationClass",
"checkerClass",
"checkMethodName"
] | InstrumentationInfo | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
unescapeJson | public static final String unescapeJson(final String input) {
return UNESCAPE_JSON.translate(input);
} | Unescapes any Json literals found in the {@link String}.
<p>For example, it will turn a sequence of {@code '\'} and {@code 'n'}
into a newline character, unless the {@code '\'} is preceded by another
{@code '\'}.</p>
@see #unescapeJava(String)
@param input the {@link String} to unescape, may be null
@return A new unes... | java | src/main/java/org/apache/commons/lang3/StringEscapeUtils.java | 758 | [
"input"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
_create_ranges_from_split_points | def _create_ranges_from_split_points(
split_points: list[int],
) -> list[tuple[int, int] | tuple[int, float]]:
"""Convert split points into ranges for autotuning dispatch.
Example:
split_points=[512, 2048]
returns:
[(1, 512), (513, 2048), (2049, float('inf'))]
"""
ran... | Convert split points into ranges for autotuning dispatch.
Example:
split_points=[512, 2048]
returns:
[(1, 512), (513, 2048), (2049, float('inf'))] | python | torch/_inductor/kernel/custom_op.py | 335 | [
"split_points"
] | list[tuple[int, int] | tuple[int, float]] | true | 2 | 9.04 | pytorch/pytorch | 96,034 | unknown | false |
codegen_body | def codegen_body(self) -> None:
"""
Concat output code from index_code, loads, compute, stores,
suffix into self.body.
For pointwise kernels, this is called just once at the end.
For reduction kernels, this generates a loop over the reduction
axis.
"""
i... | Concat output code from index_code, loads, compute, stores,
suffix into self.body.
For pointwise kernels, this is called just once at the end.
For reduction kernels, this generates a loop over the reduction
axis. | python | torch/_inductor/codegen/mps.py | 815 | [
"self"
] | None | true | 5 | 6 | pytorch/pytorch | 96,034 | unknown | false |
value_counts | def value_counts(self, dropna: bool = True) -> Series:
"""
Returns a Series containing counts of unique values.
Parameters
----------
dropna : bool, default True
Don't include counts of NaN, even if NaN is in sp_values.
Returns
-------
counts... | Returns a Series containing counts of unique values.
Parameters
----------
dropna : bool, default True
Don't include counts of NaN, even if NaN is in sp_values.
Returns
-------
counts : Series | python | pandas/core/arrays/sparse/array.py | 929 | [
"self",
"dropna"
] | Series | true | 9 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
getCommonPrefix | public static String getCommonPrefix(final String... strs) {
if (ArrayUtils.isEmpty(strs)) {
return EMPTY;
}
final int smallestIndexOfDiff = indexOfDifference(strs);
if (smallestIndexOfDiff == INDEX_NOT_FOUND) {
// all strings were identical
if (strs[0... | Compares all Strings in an array and returns the initial sequence of characters that is common to all of them.
<p>
For example, {@code getCommonPrefix("i am a machine", "i am a robot") -> "i am a "}
</p>
<pre>
StringUtils.getCommonPrefix(null) = ""
StringUtils.getCommonPrefix(new String[]... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 2,001 | [] | String | true | 5 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
substringBetween | public static String substringBetween(final String str, final String tag) {
return substringBetween(str, tag, tag);
} | Gets the String that is nested in between two instances of the same String.
<p>
A {@code null} input String returns {@code null}. A {@code null} tag returns {@code null}.
</p>
<pre>
StringUtils.substringBetween(null, *) = null
StringUtils.substringBetween("", "") = ""
StringUtils.substringBetween... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,476 | [
"str",
"tag"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
toString | public static String toString(final ClassLoader classLoader) {
if (classLoader instanceof URLClassLoader) {
return toString((URLClassLoader) classLoader);
}
return Objects.toString(classLoader);
} | Converts the given class loader to a String calling {@link #toString(URLClassLoader)}.
@param classLoader to URLClassLoader to convert.
@return the formatted string. | java | src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java | 64 | [
"classLoader"
] | String | true | 2 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
generateValueCode | protected @Nullable CodeBlock generateValueCode(GenerationContext generationContext, String name, Object value) {
RegisteredBean innerRegisteredBean = getInnerRegisteredBean(value);
if (innerRegisteredBean != null) {
BeanDefinitionMethodGenerator methodGenerator = this.beanDefinitionMethodGeneratorFactory
.... | Extract the target class of a public {@link FactoryBean} based on its
constructor. If the implementation does not resolve the target class
because it itself uses a generic, attempt to extract it from the bean type.
@param factoryBeanType the factory bean type
@param beanType the bean type
@return the target class to us... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragments.java | 180 | [
"generationContext",
"name",
"value"
] | CodeBlock | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
getMergedLocalBeanDefinition | protected RootBeanDefinition getMergedLocalBeanDefinition(String beanName) throws BeansException {
// Quick check on the concurrent map first, with minimal locking.
RootBeanDefinition mbd = this.mergedBeanDefinitions.get(beanName);
if (mbd != null && !mbd.stale) {
return mbd;
}
return getMergedBeanDefiniti... | Return a merged RootBeanDefinition, traversing the parent bean definition
if the specified bean corresponds to a child bean definition.
@param beanName the name of the bean to retrieve the merged definition for
@return a (potentially merged) RootBeanDefinition for the given bean
@throws NoSuchBeanDefinitionException if... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,363 | [
"beanName"
] | RootBeanDefinition | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
maxBucketIndex | @Override
public OptionalLong maxBucketIndex() {
if (numBuckets == 0) {
return OptionalLong.empty();
} else {
return OptionalLong.of(bucketIndices[startSlot() + numBuckets - 1]);
}
} | @return the position of the first bucket of this set of buckets within {@link #bucketCounts} and {@link #bucketIndices}. | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/FixedCapacityExponentialHistogram.java | 294 | [] | OptionalLong | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
postprocess | function postprocess(analyzer, node) {
/**
* Ends the code path for the current node.
* @returns {void}
*/
function endCodePath() {
let codePath = analyzer.codePath;
// Mark the current path as the final node.
CodePath.getState(codePath).makeFinal();
// Emits onCodePathSegmentEnd event of... | Updates the code path to finalize the current code path.
@param {CodePathAnalyzer} analyzer The instance.
@param {ASTNode} node The current AST node.
@returns {void} | javascript | packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js | 650 | [
"analyzer",
"node"
] | false | 4 | 6.16 | facebook/react | 241,750 | jsdoc | false | |
__call__ | def __call__(self, num: float) -> str:
"""
Formats a number in engineering notation, appending a letter
representing the power of 1000 of the original number. Some examples:
>>> format_eng = EngFormatter(accuracy=0, use_eng_prefix=True)
>>> format_eng(0)
' 0'
>>> ... | Formats a number in engineering notation, appending a letter
representing the power of 1000 of the original number. Some examples:
>>> format_eng = EngFormatter(accuracy=0, use_eng_prefix=True)
>>> format_eng(0)
' 0'
>>> format_eng = EngFormatter(accuracy=1, use_eng_prefix=True)
>>> format_eng(1_000_000)
' 1.0M'
>>> fo... | python | pandas/io/formats/format.py | 1,893 | [
"self",
"num"
] | str | true | 11 | 8.72 | pandas-dev/pandas | 47,362 | unknown | false |
_validate_subplots_kwarg | def _validate_subplots_kwarg(
subplots: bool | Sequence[Sequence[str]], data: Series | DataFrame, kind: str
) -> bool | list[tuple[int, ...]]:
"""
Validate the subplots parameter
- check type and content
- check for duplicate columns
- check for invalid column names
... | Validate the subplots parameter
- check type and content
- check for duplicate columns
- check for invalid column names
- convert column names into indices
- add missing columns in a group of their own
See comments in code below for more details.
Parameters
----------
subplots : subplots parameters as passed to PlotA... | python | pandas/plotting/_matplotlib/core.py | 340 | [
"subplots",
"data",
"kind"
] | bool | list[tuple[int, ...]] | true | 12 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
run | final void run(PrintStream out, Deque<String> args) {
List<String> parameters = new ArrayList<>();
Map<Option, @Nullable String> options = new HashMap<>();
while (!args.isEmpty()) {
String arg = args.removeFirst();
Option option = this.options.find(arg);
if (option != null) {
options.put(option, opti... | Run the command by processing the remaining arguments.
@param out stream for command output
@param args a mutable deque of the remaining arguments | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/Command.java | 101 | [
"out",
"args"
] | void | true | 3 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
Code2Doc: Function-Documentation Pairs Dataset
A curated dataset of 13,358 high-quality function-documentation pairs extracted from popular open-source repositories on GitHub. Designed for training models to generate documentation from code.
Dataset Description
This dataset contains functions paired with their docstrings/documentation comments from 5 programming languages, extracted from well-maintained, highly-starred GitHub repositories.
Languages Distribution
| Language | Train | Val | Test | Total |
|---|---|---|---|---|
| Java | 6,560 (61.4%) | 820 | 820 | 8,200 |
| Python | 2,885 (27.0%) | 360 | 362 | 3,607 |
| TypeScript | 681 (6.4%) | 85 | 86 | 852 |
| JavaScript | 428 (4.0%) | 53 | 55 | 536 |
| C++ | 130 (1.2%) | 16 | 17 | 163 |
| Total | 10,684 | 1,334 | 1,340 | 13,358 |
Source Repositories
The data was extracted from high-quality open-source projects including:
Python: Django, PyTorch, Pandas, NumPy, scikit-learn, FastAPI, Flask, Celery, Airflow, Requests
Java: Guava, Elasticsearch, Spring Framework, Spring Boot, Apache Kafka, Commons-Lang
TypeScript: TypeScript, VS Code, Angular, Prisma, Grafana, Storybook, NestJS
JavaScript: React, Node.js, Lodash, Axios, Express
C++: OpenCV, Protobuf, Folly, gRPC, LLVM, TensorFlow
Dataset Structure
Data Fields
| Field | Type | Description |
|---|---|---|
function_name |
string | Name of the function/method |
function_code |
string | Complete source code of the function |
documentation |
string | Extracted docstring/documentation |
language |
string | Programming language |
file_path |
string | Original file path in repository |
line_number |
int | Line number where function starts |
parameters |
list[string] | List of parameter names |
return_type |
string | Return type annotation (if available) |
has_type_hints |
bool | Whether function has type annotations |
complexity |
int | Cyclomatic complexity score |
quality_score |
float | Documentation quality score (0-10) |
repo_name |
string | Source repository (owner/repo) |
repo_stars |
int | Repository star count at extraction time |
docstring_style |
string | Documentation style (google, numpy, sphinx, jsdoc, javadoc, doxygen) |
is_async |
bool | Whether function is async |
Data Splits
- Train: 10,684 samples (80%)
- Validation: 1,334 samples (10%)
- Test: 1,340 samples (10%)
Splits are stratified by language to maintain consistent distribution across sets.
Data Processing Pipeline
The dataset was created through a multi-stage pipeline:
- Extraction: Used tree-sitter parsers to accurately extract functions with documentation
- Basic Filtering: Removed test functions, trivial functions, and applied length constraints
- Quality Scoring: Scored documentation completeness (parameters, returns, examples)
- Deduplication: Removed exact and near-duplicates using MinHash LSH
- AI Detection: Filtered potentially AI-generated documentation
Quality Criteria
- Minimum documentation length: 20 characters
- Maximum documentation length: 10,000 characters
- Minimum code length: 50 characters
- Excluded test functions and trivial getters/setters
- Required meaningful documentation structure
Usage
from datasets import load_dataset
dataset = load_dataset("kaanrkaraman/code2doc")
# Access splits
train_data = dataset["train"]
val_data = dataset["val"]
test_data = dataset["test"]
# Example: Get a Python function
python_samples = train_data.filter(lambda x: x["language"] == "python")
sample = python_samples[0]
print(f"Function: {sample['function_name']}")
print(f"Code:\n{sample['function_code']}")
print(f"Documentation:\n{sample['documentation']}")
For Fine-tuning
def format_for_training(example):
return {
"input": f"Generate documentation for the following {example['language']} function:\n\n{example['function_code']}",
"output": example["documentation"]
}
formatted_dataset = dataset.map(format_for_training)
Intended Use
- Training code documentation generation models
- Fine-tuning LLMs for code-to-text tasks
- Evaluating documentation quality metrics
- Research on code understanding and generation
Limitations
- Heavily weighted towards Java due to verbose documentation practices
- C++ representation is small due to different documentation conventions
- Documentation quality varies by repository coding standards
- Extracted from a specific snapshot in time (December 2025)
Citation
@misc{recep_kaan_karaman_2025,
author = {Recep Kaan Karaman and Meftun Akarsu},
title = {code2doc (Revision cadd4e4)},
year = 2025,
url = {https://huggingface.co/datasets/kaanrkaraman/code2doc},
doi = {10.57967/hf/7310},
publisher = {Hugging Face}
}
License
This dataset is released under the CC BY 4.0 License. The source code comes from repositories with permissive licenses (MIT, Apache 2.0, BSD).
- Downloads last month
- 67