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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sortedIndexBy | function sortedIndexBy(array, value, iteratee) {
return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
} | This method is like `_.sortedIndex` except that it accepts `iteratee`
which is invoked for `value` and each element of `array` to compute their
sort ranking. The iteratee is invoked with one argument: (value).
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} array The sorted array to inspect.
@param {*} ... | javascript | lodash.js | 8,076 | [
"array",
"value",
"iteratee"
] | false | 1 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
_get_skiprows | def _get_skiprows(skiprows: int | Sequence[int] | slice | None) -> int | Sequence[int]:
"""
Get an iterator given an integer, slice or container.
Parameters
----------
skiprows : int, slice, container
The iterator to use to skip rows; can also be a slice.
Raises
------
TypeErro... | Get an iterator given an integer, slice or container.
Parameters
----------
skiprows : int, slice, container
The iterator to use to skip rows; can also be a slice.
Raises
------
TypeError
* If `skiprows` is not a slice, integer, or Container
Returns
-------
it : iterable
A proper iterator to use to skip ... | python | pandas/io/html.py | 88 | [
"skiprows"
] | int | Sequence[int] | true | 7 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
is_tensor | def is_tensor(obj: _Any, /) -> _TypeIs["torch.Tensor"]:
r"""Returns True if `obj` is a PyTorch tensor.
Args:
obj (object): Object to test
Example::
>>> x = torch.tensor([1, 2, 3])
>>> torch.is_tensor(x)
True
"""
return isinstance(obj, torch.Tensor) | r"""Returns True if `obj` is a PyTorch tensor.
Args:
obj (object): Object to test
Example::
>>> x = torch.tensor([1, 2, 3])
>>> torch.is_tensor(x)
True | python | torch/__init__.py | 1,143 | [
"obj"
] | _TypeIs["torch.Tensor"] | true | 1 | 7.28 | pytorch/pytorch | 96,034 | google | false |
buildAspectJAdvisors | public List<Advisor> buildAspectJAdvisors() {
List<String> aspectNames = this.aspectBeanNames;
if (aspectNames == null) {
synchronized (this) {
aspectNames = this.aspectBeanNames;
if (aspectNames == null) {
List<Advisor> advisors = new ArrayList<>();
aspectNames = new ArrayList<>();
Strin... | Look for AspectJ-annotated aspect beans in the current bean factory,
and return to a list of Spring AOP Advisors representing them.
<p>Creates a Spring Advisor for each AspectJ advice method.
@return the list of {@link org.springframework.aop.Advisor} beans
@see #isEligibleBean | java | spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java | 87 | [] | true | 13 | 7.68 | spring-projects/spring-framework | 59,386 | javadoc | false | |
mapOf | public static <K, V> Bindable<Map<K, V>> mapOf(Class<K> keyType, Class<V> valueType) {
return of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType));
} | Create a new {@link Bindable} {@link Map} of the specified key and value type.
@param <K> the key type
@param <V> the value type
@param keyType the map key type
@param valueType the map value type
@return a {@link Bindable} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | 303 | [
"keyType",
"valueType"
] | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false | |
findFactoryMethod | private static @Nullable Method findFactoryMethod(ApplicationContext applicationContext, String beanName) {
if (applicationContext instanceof ConfigurableApplicationContext configurableContext) {
return findFactoryMethod(configurableContext, beanName);
}
return null;
} | Return a {@link ConfigurationPropertiesBean @ConfigurationPropertiesBean} instance
for the given bean details or {@code null} if the bean is not a
{@link ConfigurationProperties @ConfigurationProperties} object. Annotations are
considered both on the bean itself, as well as any factory method (for example a
{@link Bean... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java | 220 | [
"applicationContext",
"beanName"
] | Method | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
render_dag | def render_dag(dag: DAG | SerializedDAG, tis: list[TaskInstance] | None = None) -> graphviz.Digraph:
"""
Render the DAG object to the DOT object.
If an task instance list is passed, the nodes will be painted according to task statuses.
:param dag: DAG that will be rendered.
:param tis: List of tas... | Render the DAG object to the DOT object.
If an task instance list is passed, the nodes will be painted according to task statuses.
:param dag: DAG that will be rendered.
:param tis: List of task instances
:return: Graphviz object | python | airflow-core/src/airflow/utils/dot_renderer.py | 197 | [
"dag",
"tis"
] | graphviz.Digraph | true | 4 | 8.4 | apache/airflow | 43,597 | sphinx | false |
lowercase | public static String lowercase(String value) {
return LowercaseProcessor.apply(value);
} | Uses {@link LowercaseProcessor} to convert a string to its lowercase
equivalent.
@param value string to convert
@return lowercase equivalent | java | modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/Processors.java | 40 | [
"value"
] | String | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
write_batch_data | def write_batch_data(self, items: Iterable) -> bool:
"""
Write batch items to DynamoDB table with provisioned throughout capacity.
.. seealso::
- :external+boto3:py:meth:`DynamoDB.ServiceResource.Table`
- :external+boto3:py:meth:`DynamoDB.Table.batch_writer`
... | Write batch items to DynamoDB table with provisioned throughout capacity.
.. seealso::
- :external+boto3:py:meth:`DynamoDB.ServiceResource.Table`
- :external+boto3:py:meth:`DynamoDB.Table.batch_writer`
- :external+boto3:py:meth:`DynamoDB.Table.put_item`
:param items: list of DynamoDB items. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/dynamodb.py | 65 | [
"self",
"items"
] | bool | true | 2 | 6.08 | apache/airflow | 43,597 | sphinx | false |
resetStrategy | public synchronized AutoOffsetResetStrategy resetStrategy(TopicPartition partition) {
return assignedState(partition).resetStrategy();
} | Unset the preferred read replica. This causes the fetcher to go back to the leader for fetches.
@param tp The topic partition
@return the removed preferred read replica if set, Empty otherwise. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 822 | [
"partition"
] | AutoOffsetResetStrategy | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
asList | @Override
public ImmutableList<E> asList() {
ImmutableList<E> result = asList;
return (result == null) ? asList = createAsList() : result;
} | Returns {@code true} if the {@code hashCode()} method runs quickly. | java | android/guava/src/com/google/common/collect/ImmutableSet.java | 370 | [] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
get_query_info | def get_query_info(self, query_execution_id: str, use_cache: bool = False) -> dict:
"""
Get information about a single execution of a query.
.. seealso::
- :external+boto3:py:meth:`Athena.Client.get_query_execution`
:param query_execution_id: Id of submitted athena query
... | Get information about a single execution of a query.
.. seealso::
- :external+boto3:py:meth:`Athena.Client.get_query_execution`
:param query_execution_id: Id of submitted athena query
:param use_cache: If True, use execution information cache | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py | 131 | [
"self",
"query_execution_id",
"use_cache"
] | dict | true | 4 | 6.08 | apache/airflow | 43,597 | sphinx | false |
readSchemaFromSingleFile | async function readSchemaFromSingleFile(schemaPath: string): Promise<LookupResult> {
debug('Reading schema from single file', schemaPath)
const typeError = await ensureType(schemaPath, 'file')
if (typeError) {
return { ok: false, error: typeError }
}
const file = await readFile(schemaPath, { encoding: 'u... | Loads the schema, returns null if it is not found
Throws an error if schema is specified explicitly in
any of the available ways (argument, package.json config), but
can not be loaded
@param schemaPathFromArgs
@param schemaPathFromConfig
@param opts
@returns | typescript | packages/internals/src/cli/getSchema.ts | 115 | [
"schemaPath"
] | true | 2 | 7.44 | prisma/prisma | 44,834 | jsdoc | true | |
repeat | def repeat(self, repeats: int | Sequence[int], axis: AxisInt | None = None) -> Self:
"""
Repeat elements of an ExtensionArray.
Returns a new ExtensionArray where each element of the current ExtensionArray
is repeated consecutively a given number of times.
Parameters
---... | Repeat elements of an ExtensionArray.
Returns a new ExtensionArray where each element of the current ExtensionArray
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or array of ints
The number of repetitions for each element. This should be a
non-negative integer. Repeati... | python | pandas/core/arrays/base.py | 1,745 | [
"self",
"repeats",
"axis"
] | Self | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
call | @Override
public T call() throws Exception {
try {
return initialize();
} finally {
if (execFinally != null) {
execFinally.shutdown();
}
}
} | Initiates initialization and returns the result.
@return the result object
@throws Exception if an error occurs | java | src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java | 151 | [] | T | true | 2 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
getBeanDefinitionNames | @Override
public String[] getBeanDefinitionNames() {
String[] frozenNames = this.frozenBeanDefinitionNames;
if (frozenNames != null) {
return frozenNames.clone();
}
else {
return StringUtils.toStringArray(this.beanDefinitionNames);
}
} | Return the autowire candidate resolver for this BeanFactory (never {@code null}). | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 422 | [] | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
predict | def predict(self, X):
"""Predict class labels for samples in `X`.
Parameters
----------
X : {array-like, spare matrix} of shape (n_samples, n_features)
The data matrix for which we want to predict the targets.
Returns
-------
y_pred : ndarray of shap... | Predict class labels for samples in `X`.
Parameters
----------
X : {array-like, spare matrix} of shape (n_samples, n_features)
The data matrix for which we want to predict the targets.
Returns
-------
y_pred : ndarray of shape (n_samples,) or (n_samples, n_outputs)
Vector or matrix containing the predictions.... | python | sklearn/linear_model/_ridge.py | 1,341 | [
"self",
"X"
] | false | 2 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
calculateAllFilenames | protected List<String> calculateAllFilenames(String basename, Locale locale) {
Map<Locale, List<String>> localeMap = this.cachedFilenames.get(basename);
if (localeMap != null) {
List<String> filenames = localeMap.get(locale);
if (filenames != null) {
return filenames;
}
}
// Filenames for given Lo... | Calculate all filenames for the given bundle basename and Locale.
Will calculate filenames for the given Locale, the system Locale
(if applicable), and the default file.
@param basename the basename of the bundle
@param locale the locale
@return the List of filenames to check
@see #setFallbackToSystemLocale
@see #calcu... | java | spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java | 324 | [
"basename",
"locale"
] | true | 8 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
findBreakTarget | function findBreakTarget(labelText?: string): Label {
if (blockStack) {
if (labelText) {
for (let i = blockStack.length - 1; i >= 0; i--) {
const block = blockStack[i];
if (supportsLabeledBreakOrContinue(block) && block.labelText === label... | Finds the label that is the target for a `break` statement.
@param labelText An optional name of a containing labeled statement. | typescript | src/compiler/transformers/generators.ts | 2,464 | [
"labelText?"
] | true | 12 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
list_prefixes | def list_prefixes(
self,
bucket_name: str | None = None,
prefix: str | None = None,
delimiter: str | None = None,
page_size: int | None = None,
max_items: int | None = None,
) -> list:
"""
List prefixes in a bucket under prefix.
.. seealso::
... | List prefixes in a bucket under prefix.
.. seealso::
- :external+boto3:py:class:`S3.Paginator.ListObjectsV2`
:param bucket_name: the name of the bucket
:param prefix: a key prefix
:param delimiter: the delimiter marks key hierarchy.
:param page_size: pagination size
:param max_items: maximum items to return
:retu... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 384 | [
"self",
"bucket_name",
"prefix",
"delimiter",
"page_size",
"max_items"
] | list | true | 6 | 7.44 | apache/airflow | 43,597 | sphinx | false |
describeProducers | DescribeProducersResult describeProducers(Collection<TopicPartition> partitions, DescribeProducersOptions options); | Describe active producer state on a set of topic partitions. Unless a specific broker
is requested through {@link DescribeProducersOptions#brokerId(int)}, this will
query the partition leader to find the producer state.
@param partitions The set of partitions to query
@param options Options to control the method behavi... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,688 | [
"partitions",
"options"
] | DescribeProducersResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
fit | def fit(self, X, y=None):
"""Fit the GraphicalLasso model to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data from which to compute the covariance estimate.
y : Ignored
Not used, present for API consistency by convention.
... | Fit the GraphicalLasso model to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data from which to compute the covariance estimate.
y : Ignored
Not used, present for API consistency by convention.
Returns
-------
self : object
Returns the instance itself. | python | sklearn/covariance/_graph_lasso.py | 550 | [
"self",
"X",
"y"
] | false | 5 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
equals | @Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
MainClass other = (MainClass) obj;
return this.name.equals(other.name);
} | Creates a new {@code MainClass} rather represents the main class with the given
{@code name}. The class is annotated with the annotations with the given
{@code annotationNames}.
@param name the name of the class
@param annotationNames the names of the annotations on the class | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 403 | [
"obj"
] | true | 4 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false | |
start | start() && {
folly::Promise<lift_unit_t<StorageType>> p;
auto sf = p.getSemiFuture();
std::move(*this).startImpl(
[promise = std::move(p)](Try<StorageType>&& result) mutable {
promise.setTry(std::move(result));
},
folly::CancellationToken{},
FOLLY_ASYNC_STACK_RETU... | @returns folly::SemiFuture<T> that will complete with the result. | cpp | folly/coro/Task.h | 338 | [] | true | 3 | 7.44 | facebook/folly | 30,157 | doxygen | false | |
collect | public ShareFetch<K, V> collect(final ShareFetchBuffer fetchBuffer) {
ShareFetch<K, V> fetch = ShareFetch.empty();
int recordsRemaining = shareFetchConfig.maxPollRecords;
try {
while (recordsRemaining > 0) {
final ShareCompletedFetch nextInLineFetch = fetchBuffer.nex... | Return the fetched {@link ConsumerRecord records}.
@param fetchBuffer {@link ShareFetchBuffer} from which to retrieve the {@link ConsumerRecord records}
@return A {@link ShareFetch} for the requested partitions
@throws TopicAuthorizationException If there is TopicAuthorization error in fetchResponse. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetchCollector.java | 70 | [
"fetchBuffer"
] | true | 13 | 7.28 | apache/kafka | 31,560 | javadoc | false | |
lock | def lock(self) -> locks._LockProtocol:
"""Get a pseudo lock that does nothing.
Most remote cache implementations don't have an ability to implement
any form of locking, so we provide a no-op pseudo-lock for consistency
with the interface.
Args:
... | Get a pseudo lock that does nothing.
Most remote cache implementations don't have an ability to implement
any form of locking, so we provide a no-op pseudo-lock for consistency
with the interface.
Args:
timeout: Optional timeout in seconds (float). Ignored in this
Returns:
A callable that returns a no-op con... | python | torch/_inductor/runtime/caching/implementations.py | 377 | [
"self"
] | locks._LockProtocol | true | 1 | 6.72 | pytorch/pytorch | 96,034 | google | false |
close | @Override
public void close() {
if (closed == false) {
closed = true;
arrays.adjustBreaker(-SHALLOW_SIZE);
Releasables.close(sortingDigest, mergingDigest);
}
} | Similar to the constructor above. The limit for switching from a {@link SortingDigest} to a {@link MergingDigest} implementation
is calculated based on the passed compression factor.
@param compression The compression factor for the MergingDigest | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/HybridDigest.java | 222 | [] | void | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
getAsLong | public static <E extends Throwable> long getAsLong(final FailableLongSupplier<E> supplier) {
try {
return supplier.getAsLong();
} catch (final Throwable t) {
throw rethrow(t);
}
} | Invokes a long supplier, and returns the result.
@param supplier The long supplier to invoke.
@param <E> The type of checked exception, which the supplier can throw.
@return The long, which has been created by the supplier | java | src/main/java/org/apache/commons/lang3/function/Failable.java | 467 | [
"supplier"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
_check_object_for_strings | def _check_object_for_strings(values: np.ndarray) -> str:
"""
Check if we can use string hashtable instead of object hashtable.
Parameters
----------
values : ndarray
Returns
-------
str
"""
ndtype = values.dtype.name
if ndtype == "object":
# it's cheaper to use a S... | Check if we can use string hashtable instead of object hashtable.
Parameters
----------
values : ndarray
Returns
-------
str | python | pandas/core/algorithms.py | 298 | [
"values"
] | str | true | 3 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
parallel_coordinates | def parallel_coordinates(
frame: DataFrame,
class_column: str,
cols: list[str] | None = None,
ax: Axes | None = None,
color: list[str] | tuple[str, ...] | None = None,
use_columns: bool = False,
xticks: list | tuple | None = None,
colormap: Colormap | str | None = None,
axvlines: boo... | Parallel coordinates plotting.
Parameters
----------
frame : DataFrame
The DataFrame to be plotted.
class_column : str
Column name containing class names.
cols : list, optional
A list of column names to use.
ax : matplotlib.axis, optional
Matplotlib axis object.
color : list or tuple, optional
Colo... | python | pandas/plotting/_misc.py | 500 | [
"frame",
"class_column",
"cols",
"ax",
"color",
"use_columns",
"xticks",
"colormap",
"axvlines",
"axvlines_kwds",
"sort_labels"
] | Axes | true | 1 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
fill_missing_names | def fill_missing_names(names: Sequence[Hashable | None]) -> list[Hashable]:
"""
If a name is missing then replace it by level_n, where n is the count
Parameters
----------
names : list-like
list of column names or None values.
Returns
-------
list
list of column names w... | If a name is missing then replace it by level_n, where n is the count
Parameters
----------
names : list-like
list of column names or None values.
Returns
-------
list
list of column names with the None values replaced. | python | pandas/core/common.py | 641 | [
"names"
] | list[Hashable] | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
handleAcknowledgeTimedOut | void handleAcknowledgeTimedOut(TopicIdPartition tip) {
Acknowledgements acks = incompleteAcknowledgements.get(tip);
if (acks != null) {
acks.complete(Errors.REQUEST_TIMED_OUT.exception());
// We do not know whether this is a renew ack, but handling the error as if... | Sets the error code for the acknowledgements which were timed out
after some retries. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 1,335 | [
"tip"
] | void | true | 2 | 6 | apache/kafka | 31,560 | javadoc | false |
round | def round(self, decimals: int = 0, *args, **kwargs) -> Series:
"""
Round each value in a Series to the given number of decimals.
Parameters
----------
decimals : int, default 0
Number of decimal places to round to. If decimals is negative,
it specifies th... | Round each value in a Series to the given number of decimals.
Parameters
----------
decimals : int, default 0
Number of decimal places to round to. If decimals is negative,
it specifies the number of positions to the left of the decimal point.
*args, **kwargs
Additional arguments and keywords have no effec... | python | pandas/core/series.py | 2,540 | [
"self",
"decimals"
] | Series | true | 2 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
run | public final ExitStatus run(String... args) throws Exception {
String[] argsToUse = args.clone();
for (int i = 0; i < argsToUse.length; i++) {
if ("-cp".equals(argsToUse[i])) {
argsToUse[i] = "--cp";
}
argsToUse[i] = this.argumentProcessor.apply(argsToUse[i]);
}
OptionSet options = getParser().pars... | Create a new {@link OptionHandler} instance with an argument processor.
@param argumentProcessor strategy that can be used to manipulate arguments before
they are used. | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java | 97 | [] | ExitStatus | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
build | @Override
public ImmutableSet<E> build() {
requireNonNull(impl); // see the comment on the field
forceCopy = true;
impl = impl.review();
return impl.build();
} | Adds each element of {@code elements} to the {@code ImmutableSet}, ignoring duplicate
elements (only the first duplicate element is added).
@param elements the elements to add
@return this {@code Builder} object
@throws NullPointerException if {@code elements} is null or contains a null element | java | guava/src/com/google/common/collect/ImmutableSet.java | 573 | [] | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false | |
postProcessApplicationContext | protected void postProcessApplicationContext(ConfigurableApplicationContext context) {
if (this.beanNameGenerator != null) {
context.getBeanFactory()
.registerSingleton(AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR, this.beanNameGenerator);
}
if (this.resourceLoader != null) {
if (context inst... | Apply any relevant post-processing to the {@link ApplicationContext}. Subclasses
can apply additional processing as required.
@param context the application context | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 591 | [
"context"
] | void | true | 6 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
setSourceMapSource | function setSourceMapSource(source: SourceMapSource) {
if (sourceMapsDisabled) {
return;
}
sourceMapSource = source;
if (source === mostRecentlyAddedSourceMapSource) {
// Fast path for when the new source map is the most recently added, in which case
... | Emits a token of a node with possible leading and trailing source maps.
@param node The node containing the token.
@param token The token to emit.
@param tokenStartPos The start pos of the token.
@param emitCallback The callback used to emit the token. | typescript | src/compiler/emitter.ts | 6,273 | [
"source"
] | false | 5 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
identical | def identical(self, other) -> bool:
"""
Similar to equals, but checks that object attributes and types are also equal.
Parameters
----------
other : Index
The Index object you want to compare with the current Index object.
Returns
-------
boo... | Similar to equals, but checks that object attributes and types are also equal.
Parameters
----------
other : Index
The Index object you want to compare with the current Index object.
Returns
-------
bool
If two Index objects have equal elements and same type True,
otherwise False.
See Also
--------
Index... | python | pandas/core/indexes/base.py | 5,596 | [
"self",
"other"
] | bool | true | 4 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
ofNonNull | public static <L, R> Pair<L, R> ofNonNull(final L left, final R right) {
return ImmutablePair.ofNonNull(left, right);
} | Creates an immutable pair of two non-null objects inferring the generic types.
@param <L> the left element type.
@param <R> the right element type.
@param left the left element, may not be null.
@param right the right element, may not be null.
@return an immutable pair formed from the two parameters, not null.
@thro... | java | src/main/java/org/apache/commons/lang3/tuple/Pair.java | 107 | [
"left",
"right"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
write | public static long write(DataOutputStream out,
byte magic,
long timestamp,
ByteBuffer key,
ByteBuffer value,
CompressionType compressionType,
Time... | Write the record data with the given compression type and return the computed crc.
@param out The output stream to write to
@param magic The magic value to be used
@param timestamp The timestamp of the record
@param key The record key
@param value The record value
@param compressionType The compression type
@param time... | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 410 | [
"out",
"magic",
"timestamp",
"key",
"value",
"compressionType",
"timestampType"
] | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
size | long size() {
return MINIMUM_SIZE + this.commentLength;
} | Return the size of this record.
@return the record size | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipEndOfCentralDirectoryRecord.java | 75 | [] | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
createInstance | @Override
@SuppressWarnings("unchecked")
protected Map<Object, Object> createInstance() {
if (this.sourceMap == null) {
throw new IllegalArgumentException("'sourceMap' is required");
}
Map<Object, Object> result = null;
if (this.targetMapClass != null) {
result = BeanUtils.instantiateClass(this.targetMa... | Set the class to use for the target Map. Can be populated with a fully
qualified class name when defined in a Spring application context.
<p>Default is a linked HashMap, keeping the registration order.
@see java.util.LinkedHashMap | java | spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java | 76 | [] | true | 6 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
swap | public static void swap(final boolean[] array, int offset1, int offset2, int len) {
if (isEmpty(array) || offset1 >= array.length || offset2 >= array.length) {
return;
}
offset1 = max0(offset1);
offset2 = max0(offset2);
len = Math.min(Math.min(len, array.length - offs... | Swaps a series of elements in the given boolean array.
<p>This method does nothing for a {@code null} or empty input array or
for overflow indices. Negative indices are promoted to 0(zero). If any
of the sub-arrays to swap falls outside of the given array, then the
swap is stopped at the end of the array and as many as... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,051 | [
"array",
"offset1",
"offset2",
"len"
] | void | true | 5 | 8.48 | apache/commons-lang | 2,896 | javadoc | false |
toZonedDateTime | public static ZonedDateTime toZonedDateTime(final Calendar calendar) {
return ZonedDateTime.ofInstant(calendar.toInstant(), toZoneId(calendar));
} | Converts a Calendar to a ZonedDateTime.
@param calendar the Calendar to convert.
@return a ZonedDateTime.
@since 3.17.0 | java | src/main/java/org/apache/commons/lang3/time/CalendarUtils.java | 96 | [
"calendar"
] | ZonedDateTime | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
orElseGet | public T orElseGet(Supplier<? extends T> other) {
return (this.value != null) ? this.value : other.get();
} | Return the object that was bound, or the result of invoking {@code other} if no
value has been bound.
@param other a {@link Supplier} of the value to be returned if there is no bound
value
@return the value, if bound, otherwise the supplied {@code other} | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java | 115 | [
"other"
] | T | true | 2 | 8.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
unzip | function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLikeObject(group)) {
length = nativeMax(group.length, length);
return true;
}
});
return baseTimes(... | This method is like `_.zip` except that it accepts an array of grouped
elements and creates an array regrouping the elements to their pre-zip
configuration.
@static
@memberOf _
@since 1.2.0
@category Array
@param {Array} array The array of grouped elements to process.
@returns {Array} Returns the new array of regrouped... | javascript | lodash.js | 8,568 | [
"array"
] | false | 4 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
forEach | @Override
public void forEach(BiConsumer<? super K, ? super V> action) {
checkNotNull(action);
for (Node<K, V> node = firstInKeyInsertionOrder;
node != null;
node = node.nextInKeyInsertionOrder) {
action.accept(node.key, node.value);
}
} | Returns {@code true} if this BiMap contains an entry whose value is equal to {@code value} (or,
equivalently, if this inverse view contains a key that is equal to {@code value}).
<p>Due to the property that values in a BiMap are unique, this will tend to execute in
faster-than-linear time.
@param value the object to se... | java | guava/src/com/google/common/collect/HashBiMap.java | 588 | [
"action"
] | void | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false |
get_names_flat | def get_names_flat(adtype):
"""
Returns the field names of the input datatype as a tuple. Input datatype
must have fields otherwise error is raised.
Nested structure are flattened beforehand.
Parameters
----------
adtype : dtype
Input datatype
Examples
--------
>>> impo... | Returns the field names of the input datatype as a tuple. Input datatype
must have fields otherwise error is raised.
Nested structure are flattened beforehand.
Parameters
----------
adtype : dtype
Input datatype
Examples
--------
>>> import numpy as np
>>> from numpy.lib import recfunctions as rfn
>>> rfn.get_nam... | python | numpy/lib/recfunctions.py | 136 | [
"adtype"
] | false | 3 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
build_memory_profile | def build_memory_profile(
graph: fx.Graph,
is_releasable: Callable[[fx.Node], bool],
size_of: Callable[[int | torch.SymInt], int] | None = None,
) -> list[int]:
"""
Function to estimate the memory profile of an input FX graph.
Args:
- graph (fx.Graph): The input FX graph for which the memor... | Function to estimate the memory profile of an input FX graph.
Args:
- graph (fx.Graph): The input FX graph for which the memory profile
is to be estimated.
- is_releasable (Callable[[fx.Node], bool]): A function that
determines if a node's memory can be released (e.g. primal nodes
cannot be released).
- size_of ... | python | torch/_inductor/fx_passes/memory_estimator.py | 154 | [
"graph",
"is_releasable",
"size_of"
] | list[int] | true | 12 | 8.08 | pytorch/pytorch | 96,034 | google | false |
byteSize | @Override
public int byteSize() {
if (mergingDigest != null) {
return mergingDigest.byteSize();
}
return sortingDigest.byteSize();
} | Similar to the constructor above. The limit for switching from a {@link SortingDigest} to a {@link MergingDigest} implementation
is calculated based on the passed compression factor.
@param compression The compression factor for the MergingDigest | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/HybridDigest.java | 214 | [] | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
failableStream | @SafeVarargs // Creating a stream from an array is safe
public static <T> FailableStream<T> failableStream(final T... values) {
return failableStream(of(values));
} | Shorthand for {@code Streams.failableStream(Streams.of(arrayValues))}.
@param <T> the type of stream elements.
@param values the elements of the new stream, may be {@code null}.
@return the new FailableStream on {@code values} or an empty stream.
@since 3.14.0 | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 589 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
polycompanion | def polycompanion(c):
"""
Return the companion matrix of c.
The companion matrix for power series cannot be made symmetric by
scaling the basis, so this function differs from those for the
orthogonal polynomials.
Parameters
----------
c : array_like
1-D array of polynomial coef... | Return the companion matrix of c.
The companion matrix for power series cannot be made symmetric by
scaling the basis, so this function differs from those for the
orthogonal polynomials.
Parameters
----------
c : array_like
1-D array of polynomial coefficients ordered from low to high
degree.
Returns
-------... | python | numpy/polynomial/polynomial.py | 1,448 | [
"c"
] | false | 3 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
decrementAndGet | public int decrementAndGet() {
value--;
return value;
} | Decrements this instance's value by 1; this method returns the value associated with the instance
immediately after the decrement operation. This method is not thread safe.
@return the value associated with the instance after it is decremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableInt.java | 157 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
setContextValue | @Override
public ContextedException setContextValue(final String label, final Object value) {
exceptionContext.setContextValue(label, value);
return this;
} | Sets information helpful to a developer in diagnosing and correcting the problem.
For the information to be meaningful, the value passed should have a reasonable
toString() implementation.
Any existing values with the same labels are removed before the new one is added.
<p>
Note: This exception is only serializable if ... | java | src/main/java/org/apache/commons/lang3/exception/ContextedException.java | 248 | [
"label",
"value"
] | ContextedException | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false |
option_context | def option_context(*args) -> Generator[None]:
"""
Context manager to temporarily set options in a ``with`` statement.
This method allows users to set one or more pandas options temporarily
within a controlled block. The previous options' values are restored
once the block is exited. This is useful ... | Context manager to temporarily set options in a ``with`` statement.
This method allows users to set one or more pandas options temporarily
within a controlled block. The previous options' values are restored
once the block is exited. This is useful when making temporary adjustments
to pandas' behavior without affectin... | python | pandas/_config/config.py | 454 | [] | Generator[None] | true | 7 | 8.24 | pandas-dev/pandas | 47,362 | numpy | false |
stream | public static <O> FailableStream<O> stream(final Collection<O> stream) {
return stream(stream.stream());
} | Converts the given {@link Collection} into a {@link FailableStream}.
This is basically a simplified, reduced version of the {@link Stream}
class, with the same underlying element stream, except that failable
objects, like {@link FailablePredicate}, {@link FailableFunction}, or
{@link FailableConsumer} may be applied, i... | java | src/main/java/org/apache/commons/lang3/Streams.java | 493 | [
"stream"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
join | def join(
self,
other: Index,
*,
how: JoinHow = "left",
level: Level | None = None,
return_indexers: bool = False,
sort: bool = False,
) -> Index | tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]:
"""
Compute join_index a... | Compute join_index and indexers to conform data structures to the new index.
Parameters
----------
other : Index
The other index on which join is performed.
how : {'left', 'right', 'inner', 'outer'}
level : int or level name, default None
It is either the integer position or the name of the level.
return_index... | python | pandas/core/indexes/base.py | 4,386 | [
"self",
"other",
"how",
"level",
"return_indexers",
"sort"
] | Index | tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None] | true | 33 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
getAndDecrement | public byte getAndDecrement() {
final byte last = value;
value--;
return last;
} | Decrements this instance's value by 1; this method returns the value associated with the instance
immediately prior to the decrement operation. This method is not thread safe.
@return the value associated with the instance before it was decremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 245 | [] | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false | |
equals | @Override
public boolean equals(final Object obj) {
if (!(obj instanceof FastDatePrinter)) {
return false;
}
final FastDatePrinter other = (FastDatePrinter) obj;
return pattern.equals(other.pattern)
&& timeZone.equals(other.timeZone)
&& locale.equa... | Compares two objects for equality.
@param obj the object to compare to.
@return {@code true} if equal. | java | src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java | 1,107 | [
"obj"
] | true | 4 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
join | public static String join(String separator, long... array) {
checkNotNull(separator);
if (array.length == 0) {
return "";
}
// For pre-sizing a builder, just get the right order of magnitude
StringBuilder builder = new StringBuilder(array.length * 10);
builder.append(array[0]);
for (i... | Returns a string containing the supplied {@code long} values separated by {@code separator}.
For example, {@code join("-", 1L, 2L, 3L)} returns the string {@code "1-2-3"}.
@param separator the text that should appear between consecutive values in the resulting string
(but not at the start or end)
@param array an ar... | java | android/guava/src/com/google/common/primitives/Longs.java | 507 | [
"separator"
] | String | true | 3 | 6.72 | google/guava | 51,352 | javadoc | false |
generateBeanTypeCode | private CodeBlock generateBeanTypeCode(ResolvableType beanType) {
if (!beanType.hasGenerics()) {
return valueCodeGenerator.generateCode(ClassUtils.getUserClass(beanType.toClass()));
}
return valueCodeGenerator.generateCode(beanType);
} | 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 | 148 | [
"beanType"
] | CodeBlock | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
unzipWith | function unzipWith(array, iteratee) {
if (!(array && array.length)) {
return [];
}
var result = unzip(array);
if (iteratee == null) {
return result;
}
return arrayMap(result, function(group) {
return apply(iteratee, undefined, group);
});
} | This method is like `_.unzip` except that it accepts `iteratee` to specify
how regrouped values should be combined. The iteratee is invoked with the
elements of each group: (...group).
@static
@memberOf _
@since 3.8.0
@category Array
@param {Array} array The array of grouped elements to process.
@param {Function} [iter... | javascript | lodash.js | 8,605 | [
"array",
"iteratee"
] | false | 4 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
of | static RegisteredBean of(ConfigurableListableBeanFactory beanFactory, String beanName, RootBeanDefinition mbd) {
return new RegisteredBean(beanFactory, () -> beanName, false, () -> mbd, null);
} | Create a new {@link RegisteredBean} instance for a regular bean.
@param beanFactory the source bean factory
@param beanName the bean name
@param mbd the pre-determined merged bean definition
@return a new {@link RegisteredBean} instance
@since 6.0.7 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/RegisteredBean.java | 98 | [
"beanFactory",
"beanName",
"mbd"
] | RegisteredBean | true | 1 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false |
task_state | def task_state(args) -> None:
"""
Return the state of a TaskInstance at the command line.
>>> airflow tasks state tutorial sleep 2015-01-01
success
"""
if not (dag := SerializedDagModel.get_dag(args.dag_id)):
raise SystemExit(f"Can not find dag {args.dag_id!r}")
task = dag.get_task(... | Return the state of a TaskInstance at the command line.
>>> airflow tasks state tutorial sleep 2015-01-01
success | python | airflow-core/src/airflow/cli/commands/task_command.py | 263 | [
"args"
] | None | true | 2 | 7.12 | apache/airflow | 43,597 | unknown | false |
_parse_content_type_header | def _parse_content_type_header(header):
"""Returns content type and parameters from given header
:param header: string
:return: tuple containing content type and dictionary of
parameters
"""
tokens = header.split(";")
content_type, params = tokens[0].strip(), tokens[1:]
params_dic... | Returns content type and parameters from given header
:param header: string
:return: tuple containing content type and dictionary of
parameters | python | src/requests/utils.py | 504 | [
"header"
] | false | 4 | 6 | psf/requests | 53,586 | sphinx | false | |
_aot_stage2b_compile_forward_or_inference | def _aot_stage2b_compile_forward_or_inference(
fw_module: torch.fx.GraphModule,
adjusted_flat_args: list[Any],
maybe_subclass_meta: Optional[SubclassMeta],
fw_metadata: ViewAndMutationMeta,
aot_config: AOTConfig,
*,
is_inference: bool,
num_fw_outs_saved_for_bw: Optional[int] = None,
) ->... | Compile the forward or inference graph. Returns:
- the output strides of the forward graph
- the compiled forward/inference function
Args:
fw_module: The forward graph module to compile
adjusted_flat_args: Flattened arguments after adjustments
maybe_subclass_meta: Metadata for tensor subclasses
fw_meta... | python | torch/_functorch/_aot_autograd/graph_compile.py | 2,270 | [
"fw_module",
"adjusted_flat_args",
"maybe_subclass_meta",
"fw_metadata",
"aot_config",
"is_inference",
"num_fw_outs_saved_for_bw"
] | tuple[Optional[list[Optional[tuple[int, ...]]]], Callable] | true | 11 | 6.72 | pytorch/pytorch | 96,034 | google | false |
estimateMin | public static OptionalDouble estimateMin(
ZeroBucket zeroBucket,
ExponentialHistogram.Buckets negativeBuckets,
ExponentialHistogram.Buckets positiveBuckets
) {
int scale = negativeBuckets.iterator().scale();
assert scale == positiveBuckets.iterator().scale();
Optiona... | Estimates the minimum value of the histogram based on the populated buckets.
The returned value is guaranteed to be less than or equal to the exact minimum value of the histogram values.
If the histogram is empty, an empty Optional is returned.
<p>
Note that this method can return +-Infinity if the histogram bucket bou... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramUtils.java | 78 | [
"zeroBucket",
"negativeBuckets",
"positiveBuckets"
] | OptionalDouble | true | 5 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
convert_object_array | def convert_object_array(
content: list[npt.NDArray[np.object_]],
dtype: DtypeObj | None,
dtype_backend: str = "numpy",
coerce_float: bool = False,
) -> list[ArrayLike]:
"""
Internal function to convert object array.
Parameters
----------
content: List[np.ndarray]
dtype: np.dtyp... | Internal function to convert object array.
Parameters
----------
content: List[np.ndarray]
dtype: np.dtype or ExtensionDtype
dtype_backend: Controls if nullable/pyarrow dtypes are returned.
coerce_float: Cast floats that are integers to int.
Returns
-------
List[ArrayLike] | python | pandas/core/internals/construction.py | 949 | [
"content",
"dtype",
"dtype_backend",
"coerce_float"
] | list[ArrayLike] | true | 12 | 6.32 | pandas-dev/pandas | 47,362 | numpy | false |
tryParseAsyncSimpleArrowFunctionExpression | function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction: boolean): ArrowFunction | undefined {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
if (token() === SyntaxKind.AsyncKeyword) {
if (lookAhead(isUnParenthesizedAsyncArrowF... | 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,395 | [
"allowReturnTypeInArrowFunction"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
delete_any_nodegroups | def delete_any_nodegroups(self) -> None:
"""
Delete all Amazon EKS managed node groups for a provided Amazon EKS Cluster.
Amazon EKS managed node groups can be deleted in parallel, so we can send all
delete commands in bulk and move on once the count of nodegroups is zero.
"""
... | Delete all Amazon EKS managed node groups for a provided Amazon EKS Cluster.
Amazon EKS managed node groups can be deleted in parallel, so we can send all
delete commands in bulk and move on once the count of nodegroups is zero. | python | providers/amazon/src/airflow/providers/amazon/aws/operators/eks.py | 764 | [
"self"
] | None | true | 3 | 6 | apache/airflow | 43,597 | unknown | false |
buildKeyConfig | public SslKeyConfig buildKeyConfig(Path basePath) {
final String certificatePath = stringSetting(CERTIFICATE);
final String keyPath = stringSetting(KEY);
final String keyStorePath = stringSetting(KEYSTORE_PATH);
if (certificatePath != null && keyStorePath != null) {
throw ne... | Resolve all necessary configuration settings, and load a {@link SslConfiguration}.
@param basePath The base path to use for any settings that represent file paths. Typically points to the Elasticsearch
configuration directory.
@throws SslConfigException For any problems with the configuration, or with l... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslConfigurationLoader.java | 376 | [
"basePath"
] | SslKeyConfig | true | 9 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
is_categorical_dtype | def is_categorical_dtype(arr_or_dtype) -> bool:
"""
Check whether an array-like or dtype is of the Categorical dtype.
.. deprecated:: 2.2.0
Use isinstance(dtype, pd.CategoricalDtype) instead.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype to ch... | Check whether an array-like or dtype is of the Categorical dtype.
.. deprecated:: 2.2.0
Use isinstance(dtype, pd.CategoricalDtype) instead.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype to check.
Returns
-------
boolean
Whether or not the array-like or dtype is of the C... | python | pandas/core/dtypes/common.py | 549 | [
"arr_or_dtype"
] | bool | true | 3 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false |
partial_fit | def partial_fit(self, X, y=None):
"""Online computation of min and max on X for later scaling.
All of X is processed as a single batch. This is intended for cases
when :meth:`fit` is not feasible due to very large number of
`n_samples` or because X is read from a continuous stream.
... | Online computation of min and max on X for later scaling.
All of X is processed as a single batch. This is intended for cases
when :meth:`fit` is not feasible due to very large number of
`n_samples` or because X is read from a continuous stream.
Parameters
----------
X : array-like of shape (n_samples, n_features)
... | python | sklearn/preprocessing/_data.py | 474 | [
"self",
"X",
"y"
] | false | 5 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_idxmax_idxmin | def _idxmax_idxmin(
self,
how: Literal["idxmax", "idxmin"],
ignore_unobserved: bool = False,
skipna: bool = True,
numeric_only: bool = False,
) -> NDFrameT:
"""Compute idxmax/idxmin.
Parameters
----------
how : {'idxmin', 'idxmax'}
... | Compute idxmax/idxmin.
Parameters
----------
how : {'idxmin', 'idxmax'}
Whether to compute idxmin or idxmax.
numeric_only : bool, default False
Include only float, int, boolean columns.
skipna : bool, default True
Exclude NA/null values. If an entire group is NA, the result will be NA.
ignore_unobserved : ... | python | pandas/core/groupby/groupby.py | 5,668 | [
"self",
"how",
"ignore_unobserved",
"skipna",
"numeric_only"
] | NDFrameT | true | 10 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
acknowledge | public void acknowledge(final String topic, final int partition, final long offset, final AcknowledgeType type) {
for (Map.Entry<TopicIdPartition, ShareInFlightBatch<K, V>> tipBatch : batches.entrySet()) {
TopicIdPartition tip = tipBatch.getKey();
ShareInFlightBatchException exception = ... | Acknowledge a single record which experienced an exception during its delivery by its topic, partition
and offset in the current batch. This method is specifically for overriding the default acknowledge
type for records whose delivery failed.
@param topic The topic of the record to acknowledge
@param partition The ... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetch.java | 180 | [
"topic",
"partition",
"offset",
"type"
] | void | true | 5 | 6.4 | apache/kafka | 31,560 | javadoc | false |
drain | void drain() {
if (!isConsumed) {
maybeCloseRecordStream();
cachedRecordException = null;
this.isConsumed = true;
recordAggregatedMetrics(bytesRead, recordsRead);
// we move the partition to the end if we received some bytes. This way, it's more likel... | Draining a {@link CompletedFetch} will signal that the data has been consumed and the underlying resources
are closed. This is somewhat analogous to {@link Closeable#close() closing}, though no error will result if a
caller invokes {@link #fetchRecords(FetchConfig, Deserializers, int)}; an empty {@link List list} will ... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CompletedFetch.java | 139 | [] | void | true | 3 | 6.24 | apache/kafka | 31,560 | javadoc | false |
unregisterBroker | @InterfaceStability.Unstable
UnregisterBrokerResult unregisterBroker(int brokerId, UnregisterBrokerOptions options); | Unregister a broker.
<p>
This operation does not have any effect on partition assignments.
The following exceptions can be anticipated when calling {@code get()} on the future from the
returned {@link UnregisterBrokerResult}:
<ul>
<li>{@link org.apache.kafka.common.errors.TimeoutException}
If the request timed out ... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,665 | [
"brokerId",
"options"
] | UnregisterBrokerResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
appendSeparator | public StrBuilder appendSeparator(final char separator) {
if (isNotEmpty()) {
append(separator);
}
return this;
} | Appends a separator if the builder is currently non-empty.
The separator is appended using {@link #append(char)}.
<p>
This method is useful for adding a separator each time around the
loop except the first.
</p>
<pre>
for (Iterator it = list.iterator(); it.hasNext(); ) {
appendSeparator(',');
append(it.next());
}
<... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,219 | [
"separator"
] | StrBuilder | true | 2 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
easy_dtype | def easy_dtype(ndtype, names=None, defaultfmt="f%i", **validationargs):
"""
Convenience function to create a `np.dtype` object.
The function processes the input `dtype` and matches it with the given
names.
Parameters
----------
ndtype : var
Definition of the dtype. Can be any strin... | Convenience function to create a `np.dtype` object.
The function processes the input `dtype` and matches it with the given
names.
Parameters
----------
ndtype : var
Definition of the dtype. Can be any string or dictionary recognized
by the `np.dtype` function, or a sequence of types.
names : str or sequence, ... | python | numpy/lib/_iotools.py | 824 | [
"ndtype",
"names",
"defaultfmt"
] | false | 12 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
default_dtypes | def default_dtypes(self, *, device=None):
"""
The default data types used for new CuPy arrays.
For CuPy, this always returns the following dictionary:
- **"real floating"**: ``cupy.float64``
- **"complex floating"**: ``cupy.complex128``
- **"integral"**: ``cupy.intp``
... | The default data types used for new CuPy arrays.
For CuPy, this always returns the following dictionary:
- **"real floating"**: ``cupy.float64``
- **"complex floating"**: ``cupy.complex128``
- **"integral"**: ``cupy.intp``
- **"indexing"**: ``cupy.intp``
Parameters
----------
device : str, optional
The device to... | python | sklearn/externals/array_api_compat/cupy/_info.py | 142 | [
"self",
"device"
] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
create | static ReleasableExponentialHistogram create(int maxBucketCount, ExponentialHistogramCircuitBreaker breaker, double... values) {
try (ExponentialHistogramGenerator generator = ExponentialHistogramGenerator.create(maxBucketCount, breaker)) {
for (double val : values) {
generator.add(v... | Creates a histogram representing the distribution of the given values with at most the given number of buckets.
If the given {@code maxBucketCount} is greater than or equal to the number of values, the resulting histogram will have a
relative error of less than {@code 2^(2^-MAX_SCALE) - 1}.
@param maxBucketCount the ma... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogram.java | 253 | [
"maxBucketCount",
"breaker"
] | ReleasableExponentialHistogram | true | 1 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
lstat | function lstat(path, options = { bigint: false }, callback) {
if (typeof options === 'function') {
callback = options;
options = kEmptyObject;
}
callback = makeStatsCallback(callback);
path = getValidatedPath(path);
if (permission.isEnabled() && !permission.has('fs.read', path)) {
const resource =... | Retrieves the `fs.Stats` for the symbolic link
referred to by the `path`.
@param {string | Buffer | URL} path
@param {{ bigint?: boolean; }} [options]
@param {(
err?: Error,
stats?: Stats
) => any} callback
@returns {void} | javascript | lib/fs.js | 1,589 | [
"path",
"callback"
] | false | 5 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
prepareSchedulerFactory | private SchedulerFactory prepareSchedulerFactory() throws SchedulerException, IOException {
SchedulerFactory schedulerFactory = this.schedulerFactory;
if (schedulerFactory == null) {
// Create local SchedulerFactory instance (typically a LocalSchedulerFactory)
schedulerFactory = (this.schedulerFactoryClass ==... | Create a SchedulerFactory if necessary and apply locally defined Quartz properties to it.
@return the initialized SchedulerFactory | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java | 512 | [] | SchedulerFactory | true | 8 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
register | private void register(@Nullable Deprecated annotation) {
if (annotation != null) {
if (annotation.forRemoval()) {
register("removal");
}
else {
register("deprecation");
}
}
} | Return the currently registered warnings.
@return the warnings | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/CodeWarnings.java | 152 | [
"annotation"
] | void | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
contains | public boolean contains(final CharRange range) {
Objects.requireNonNull(range, "range");
if (negated) {
if (range.negated) {
return start >= range.start && end <= range.end;
}
return range.end < start || range.start > end;
}
if (range.n... | Are all the characters of the passed in range contained in
this range.
@param range the range to check against.
@return {@code true} if this range entirely contains the input range.
@throws NullPointerException if {@code null} input. | java | src/main/java/org/apache/commons/lang3/CharRange.java | 259 | [
"range"
] | true | 8 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getPropertySymbolsFromBaseTypes | function getPropertySymbolsFromBaseTypes<T>(symbol: Symbol, propertyName: string, checker: TypeChecker, cb: (symbol: Symbol) => T | undefined): T | undefined {
const seen = new Set<Symbol>();
return recur(symbol);
function recur(symbol: Symbol): T | undefined {
// Use `addToSee... | Find symbol of the given property-name and add the symbol to the given result array
@param symbol a symbol to start searching for the given propertyName
@param propertyName a name of property to search for
@param result an array of symbol of found property symbols
@param previousIterationSymbolsCache a cache of sym... | typescript | src/services/findAllReferences.ts | 2,668 | [
"symbol",
"propertyName",
"checker",
"cb"
] | true | 7 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
read_iceberg | def read_iceberg(
table_identifier: str,
catalog_name: str | None = None,
*,
catalog_properties: dict[str, Any] | None = None,
row_filter: str | None = None,
selected_fields: tuple[str] | None = None,
case_sensitive: bool = True,
snapshot_id: int | None = None,
limit: int | None = No... | Read an Apache Iceberg table into a pandas DataFrame.
.. versionadded:: 3.0.0
.. warning::
read_iceberg is experimental and may change without warning.
Parameters
----------
table_identifier : str
Table identifier.
catalog_name : str, optional
The name of the catalog.
catalog_properties : dict of {str: s... | python | pandas/io/iceberg.py | 12 | [
"table_identifier",
"catalog_name",
"catalog_properties",
"row_filter",
"selected_fields",
"case_sensitive",
"snapshot_id",
"limit",
"scan_properties"
] | DataFrame | true | 5 | 8.08 | pandas-dev/pandas | 47,362 | numpy | false |
createDestructuringPropertyAccess | function createDestructuringPropertyAccess(flattenContext: FlattenContext, value: Expression, propertyName: PropertyName): LeftHandSideExpression {
const { factory } = flattenContext.context;
if (isComputedPropertyName(propertyName)) {
const argumentExpression = ensureIdentifier(flattenContext, Debug... | Creates either a PropertyAccessExpression or an ElementAccessExpression for the
right-hand side of a transformed destructuring assignment.
@link https://tc39.github.io/ecma262/#sec-runtime-semantics-keyeddestructuringassignmentevaluation
@param flattenContext Options used to control flattening.
@param value The R... | typescript | src/compiler/transformers/destructuring.ts | 556 | [
"flattenContext",
"value",
"propertyName"
] | true | 6 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
checkNonAnimatableInTimelines | function checkNonAnimatableInTimelines(
timelines: AnimationTimelineInstruction[],
triggerName: string,
driver: AnimationDriver,
): void {
if (!driver.validateAnimatableStyleProperty) {
return;
}
const allowedNonAnimatableProps = new Set<string>([
// 'easing' is a utility/synthetic prop we use to r... | Checks inside a set of timelines if they try to animate a css property which is not considered
animatable, in that case it prints a warning on the console.
Besides that the function doesn't have any other effect.
Note: this check is done here after the timelines are built instead of doing on a lower level so
that we ca... | typescript | packages/animations/browser/src/dsl/animation_transition_factory.ts | 166 | [
"timelines",
"triggerName",
"driver"
] | true | 8 | 7.04 | angular/angular | 99,544 | jsdoc | false | |
forDirectFieldAccess | public static ConfigurablePropertyAccessor forDirectFieldAccess(Object target) {
return new DirectFieldAccessor(target);
} | Obtain a PropertyAccessor for the given target object,
accessing properties in direct field style.
@param target the target object to wrap
@return the property accessor
@see DirectFieldAccessor | java | spring-beans/src/main/java/org/springframework/beans/PropertyAccessorFactory.java | 51 | [
"target"
] | ConfigurablePropertyAccessor | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
completeIfEmpty | public void completeIfEmpty() {
if (remainingResults != null && remainingResults.get() == 0) {
future.ifPresent(future -> future.complete(result));
}
} | Handles the case where there are no results pending after initialization. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 1,476 | [] | void | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false |
getAllFieldsList | public static List<Field> getAllFieldsList(final Class<?> cls) {
Objects.requireNonNull(cls, "cls");
final List<Field> allFields = new ArrayList<>();
Class<?> currentClass = cls;
while (currentClass != null) {
Collections.addAll(allFields, currentClass.getDeclaredFields());
... | Gets all fields of the given class and its parents (if any).
@param cls
the {@link Class} to query
@return a list of Fields (possibly empty).
@throws NullPointerException
if the class is {@code null}.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | 71 | [
"cls"
] | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
fuzz_non_contiguous_dense_tensor | def fuzz_non_contiguous_dense_tensor(
size: tuple[int, ...] | None = None, dtype: torch.dtype | None = None
) -> torch.Tensor:
"""
Specifically generates tensors that are non-contiguous but dense and non-overlapping.
Args:
size: Tensor shape/size. If None, auto-generated.
dtype: PyTorch... | Specifically generates tensors that are non-contiguous but dense and non-overlapping.
Args:
size: Tensor shape/size. If None, auto-generated.
dtype: PyTorch tensor data type. If None, auto-generated.
Returns:
torch.Tensor: A non-contiguous but dense tensor | python | tools/experimental/torchfuzz/tensor_fuzzer.py | 447 | [
"size",
"dtype"
] | torch.Tensor | true | 8 | 7.6 | pytorch/pytorch | 96,034 | google | false |
transform | function transform(object, iteratee, accumulator) {
var isArr = isArray(object),
isArrLike = isArr || isBuffer(object) || isTypedArray(object);
iteratee = getIteratee(iteratee, 4);
if (accumulator == null) {
var Ctor = object && object.constructor;
if (isArrLike) {
... | An alternative to `_.reduce`; this method transforms `object` to a new
`accumulator` object which is the result of running each of its own
enumerable string keyed properties thru `iteratee`, with each invocation
potentially mutating the `accumulator` object. If `accumulator` is not
provided, a new object with the same ... | javascript | lodash.js | 13,895 | [
"object",
"iteratee",
"accumulator"
] | false | 12 | 7.36 | lodash/lodash | 61,490 | jsdoc | false | |
hashCode | @Override
public int hashCode() {
// See Map.Entry API specification
return Objects.hashCode(getKey()) ^ Objects.hashCode(getValue());
} | Returns a suitable hash code.
<p>
The hash code follows the definition in {@code Map.Entry}.
</p>
@return the hash code. | java | src/main/java/org/apache/commons/lang3/tuple/Pair.java | 232 | [] | true | 1 | 7.2 | apache/commons-lang | 2,896 | javadoc | false | |
generateParameterTypesCode | private CodeBlock generateParameterTypesCode(Class<?>[] parameterTypes) {
CodeBlock.Builder code = CodeBlock.builder();
for (int i = 0; i < parameterTypes.length; i++) {
code.add(i > 0 ? ", " : "");
code.add("$T.class", parameterTypes[i]);
}
return code.build();
} | Generate the instance supplier code.
@param registeredBean the bean to handle
@param instantiationDescriptor the executable to use to create the bean
@return the generated code
@since 6.1.7 | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java | 389 | [
"parameterTypes"
] | CodeBlock | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
centroids | @Override
public Collection<Centroid> centroids() {
mergeNewValues();
// we don't actually keep centroid structures around so we have to fake it
return new AbstractCollection<>() {
@Override
public Iterator<Centroid> iterator() {
return new Iterator<>... | Merges any pending inputs and compresses the data down to the public setting.
Note that this typically loses a bit of precision and thus isn't a thing to
be doing all the time. It is best done only when we want to show results to
the outside world. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/MergingDigest.java | 555 | [] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
pendingToString | protected @Nullable String pendingToString() {
// TODO(diamondm) consider moving this into addPendingString so it's always in the output
if (this instanceof ScheduledFuture) {
return "remaining delay=[" + ((ScheduledFuture) this).getDelay(MILLISECONDS) + " ms]";
}
return null;
} | 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 | 885 | [] | String | true | 2 | 8.4 | google/guava | 51,352 | javadoc | false |
reserve | @Override
public void reserve(long size) {
if (mergingDigest != null) {
mergingDigest.reserve(size);
return;
}
// Check if we need to switch implementations.
assert sortingDigest != null;
if (sortingDigest.size() + size >= maxSortingSize) {
... | Similar to the constructor above. The limit for switching from a {@link SortingDigest} to a {@link MergingDigest} implementation
is calculated based on the passed compression factor.
@param compression The compression factor for the MergingDigest | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/HybridDigest.java | 119 | [
"size"
] | void | true | 4 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
addDefaultValueAssignmentsIfNeeded | function addDefaultValueAssignmentsIfNeeded(statements: Statement[], node: FunctionLikeDeclaration): boolean {
if (!some(node.parameters, hasDefaultValueOrBindingPattern)) {
return false;
}
let added = false;
for (const parameter of node.parameters) {
cons... | Adds statements to the body of a function-like node if it contains parameters with
binding patterns or initializers.
@param statements The statements for the new function body.
@param node A function-like node. | typescript | src/compiler/transformers/es2015.ts | 1,903 | [
"statements",
"node"
] | true | 7 | 7.04 | microsoft/TypeScript | 107,154 | jsdoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.