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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
escape | function escape(string) {
string = toString(string);
return (string && reHasUnescapedHtml.test(string))
? string.replace(reUnescapedHtml, escapeHtmlChar)
: string;
} | Converts the characters "&", "<", ">", '"', and "'" in `string` to their
corresponding HTML entities.
**Note:** No other characters are escaped. To escape additional
characters use a third-party library like [_he_](https://mths.be/he).
Though the ">" character is escaped for symmetry, characters like
">" and "/" don't ... | javascript | lodash.js | 14,358 | [
"string"
] | false | 3 | 7.2 | lodash/lodash | 61,490 | jsdoc | false | |
awaitTerminationPeriod | public ThreadPoolTaskSchedulerBuilder awaitTerminationPeriod(@Nullable Duration awaitTerminationPeriod) {
return new ThreadPoolTaskSchedulerBuilder(this.poolSize, this.awaitTermination, awaitTerminationPeriod,
this.threadNamePrefix, this.taskDecorator, this.customizers);
} | Set the maximum time the executor is supposed to block on shutdown. When set, the
executor blocks on shutdown in order to wait for remaining tasks to complete their
execution before the rest of the container continues to shut down. This is
particularly useful if your remaining tasks are likely to need access to other
r... | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskSchedulerBuilder.java | 106 | [
"awaitTerminationPeriod"
] | ThreadPoolTaskSchedulerBuilder | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
asCallable | public static <O> Callable<O> asCallable(final FailableCallable<O, ?> callable) {
return () -> call(callable);
} | Converts the given {@link FailableCallable} into a standard {@link Callable}.
@param <O> the type used by the callables
@param callable a {@link FailableCallable}
@return a standard {@link Callable}
@since 3.10 | java | src/main/java/org/apache/commons/lang3/Functions.java | 391 | [
"callable"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
_apply | def _apply(
self,
func: Callable[[np.ndarray, int, int], np.ndarray],
name: str,
numeric_only: bool = False,
numba_args: tuple[Any, ...] = (),
**kwargs,
):
"""
Rolling with weights statistical measure using supplied function.
Designed to be us... | Rolling with weights statistical measure using supplied function.
Designed to be used with passed-in Cython array-based functions.
Parameters
----------
func : callable function to apply
name : str,
numeric_only : bool, default False
Whether to only operate on bool, int, and float columns
numba_args : tuple
u... | python | pandas/core/window/rolling.py | 1,156 | [
"self",
"func",
"name",
"numeric_only",
"numba_args"
] | true | 5 | 6.48 | pandas-dev/pandas | 47,362 | numpy | false | |
canonicalPropertyName | public static String canonicalPropertyName(@Nullable String propertyName) {
if (propertyName == null) {
return "";
}
StringBuilder sb = new StringBuilder(propertyName);
int searchIndex = 0;
while (searchIndex != -1) {
int keyStart = sb.indexOf(PropertyAccessor.PROPERTY_KEY_PREFIX, searchIndex);
sear... | Determine the canonical name for the given property path.
Removes surrounding quotes from map keys:<br>
{@code map['key']} → {@code map[key]}<br>
{@code map["key"]} → {@code map[key]}
@param propertyName the bean property path
@return the canonical representation of the property path | java | spring-beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java | 142 | [
"propertyName"
] | String | true | 9 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
convertLevel | private static int convertLevel(LogEvent event) {
return Severity.getSeverity(event.getLevel()).getCode();
} | Converts the log4j2 event level to the Syslog event level code.
@param event the log event
@return an integer representing the syslog log level code
@see Severity class from Log4j2 which contains the conversion logic | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java | 131 | [
"event"
] | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
buildRequest | AbstractRequest.Builder<?> buildRequest(Set<T> keys); | Build the lookup request for a set of keys. The grouping of the keys is controlled
through {@link #lookupScope(Object)}. In other words, each set of keys that map
to the same request scope object will be sent to this method.
@param keys the set of keys that require lookup
@return a builder for the lookup request | java | clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminApiLookupStrategy.java | 65 | [
"keys"
] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
dtype_to_descr | def dtype_to_descr(dtype):
"""
Get a serializable descriptor from the dtype.
The .descr attribute of a dtype object cannot be round-tripped through
the dtype() constructor. Simple types, like dtype('float32'), have
a descr which looks like a record array with one field with '' as
a name. The dt... | Get a serializable descriptor from the dtype.
The .descr attribute of a dtype object cannot be round-tripped through
the dtype() constructor. Simple types, like dtype('float32'), have
a descr which looks like a record array with one field with '' as
a name. The dtype() constructor interprets this as a request to give
... | python | numpy/lib/_format_impl.py | 251 | [
"dtype"
] | false | 5 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
ClangIncludeFixerPluginAction | explicit ClangIncludeFixerPluginAction()
: SymbolIndexMgr(std::make_shared<SymbolIndexManager>()),
SemaSource(new IncludeFixerSemaSource(*SymbolIndexMgr,
/*MinimizeIncludePaths=*/true,
/*GenerateDiagnostics=*/true)... | Sema) but we have to keep the symbol index alive until sema is done. | cpp | clang-tools-extra/clang-include-fixer/plugin/IncludeFixerPlugin.cpp | 33 | [] | true | 1 | 6 | llvm/llvm-project | 36,021 | doxygen | false | |
deduceBindMethod | static org.springframework.boot.context.properties.bind.BindMethod deduceBindMethod(Class<?> type) {
return deduceBindMethod(BindConstructorProvider.DEFAULT.getBindConstructor(type, false));
} | Deduce the {@code BindMethod} that should be used for the given type.
@param type the source type
@return the bind method to use | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java | 300 | [
"type"
] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
buildToString | private String buildToString(ToStringFormat format) {
return switch (format) {
case DEFAULT -> buildDefaultToString();
case SYSTEM_ENVIRONMENT -> buildSimpleToString('_', (i) -> getElement(i, Form.UNIFORM));
case LEGACY_SYSTEM_ENVIRONMENT ->
buildSimpleToString('_', (i) -> getElement(i, Form.ORIGINAL).re... | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 564 | [
"format"
] | String | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
doGetObjectFromFactoryBean | private Object doGetObjectFromFactoryBean(FactoryBean<?> factory, @Nullable Class<?> requiredType, String beanName)
throws BeanCreationException {
Object object;
try {
object = (requiredType != null && factory instanceof SmartFactoryBean<?> smartFactoryBean ?
smartFactoryBean.getObject(requiredType) : f... | Obtain an object to expose from the given FactoryBean.
@param factory the FactoryBean instance
@param beanName the name of the bean
@return the object obtained from the FactoryBean
@throws BeanCreationException if FactoryBean object creation failed
@see org.springframework.beans.factory.FactoryBean#getObject() | java | spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java | 197 | [
"factory",
"requiredType",
"beanName"
] | Object | true | 7 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
createCollection | Collection<V> createCollection(@ParametricNullness K key) {
return createCollection();
} | Creates the collection of values for an explicitly provided key. By default, it simply calls
{@link #createCollection()}, which is the correct behavior for most implementations. The {@link
LinkedHashMultimap} class overrides it.
@param key key to associate with values in the collection
@return an empty collection of va... | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 165 | [
"key"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
sendFetches | public synchronized int sendFetches() {
final Map<Node, FetchSessionHandler.FetchRequestData> fetchRequests = prepareFetchRequests();
sendFetchesInternal(
fetchRequests,
(fetchTarget, data, clientResponse) -> {
synchronized (Fetcher.this) {
... | Set up a fetch request for any node that we have assigned partitions for which doesn't already have
an in-flight fetch or pending fetch data.
@return number of fetches sent | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java | 105 | [] | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
is_storage | def is_storage(obj: _Any, /) -> builtins.bool:
r"""Returns True if `obj` is a PyTorch storage object.
Args:
obj (Object): Object to test
Example::
>>> import torch
>>> # UntypedStorage (recommended)
>>> tensor = torch.tensor([1, 2, 3])
>>> storage = tensor.untyped_s... | r"""Returns True if `obj` is a PyTorch storage object.
Args:
obj (Object): Object to test
Example::
>>> import torch
>>> # UntypedStorage (recommended)
>>> tensor = torch.tensor([1, 2, 3])
>>> storage = tensor.untyped_storage()
>>> torch.is_storage(storage)
True
>>>
>>> # TypedStor... | python | torch/__init__.py | 1,158 | [
"obj"
] | builtins.bool | true | 1 | 6.64 | pytorch/pytorch | 96,034 | google | false |
format | public static String format(final Date date, final String pattern, final TimeZone timeZone, final Locale locale) {
final FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale);
return df.format(date);
} | Formats a date/time into a specific pattern in a time zone and locale.
@param date the date to format, not null.
@param pattern the pattern to use to format the date, not null, not null.
@param timeZone the time zone to use, may be {@code null}.
@param locale the locale to use, may be {@code null}.
@return the for... | java | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | 303 | [
"date",
"pattern",
"timeZone",
"locale"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
and | public static Boolean and(final Boolean... array) {
ObjectUtils.requireNonEmpty(array, "array");
return and(ArrayUtils.toPrimitive(array)) ? Boolean.TRUE : Boolean.FALSE;
} | Performs an 'and' operation on an array of Booleans.
<pre>
BooleanUtils.and(Boolean.TRUE, Boolean.TRUE) = Boolean.TRUE
BooleanUtils.and(Boolean.FALSE, Boolean.FALSE) = Boolean.FALSE
BooleanUtils.and(Boolean.TRUE, Boolean.FALSE) = Boolean.FALSE
BooleanUtils.and(Boolea... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 132 | [] | Boolean | true | 2 | 7.52 | apache/commons-lang | 2,896 | javadoc | false |
indexOf | public static int indexOf(final boolean[] array, final boolean valueToFind) {
return indexOf(array, valueToFind, 0);
} | Finds the index of the given value in the array.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.
</p>
@param array the array to search for the object, may be {@code null}.
@param valueToFind the value to find.
@return the index of the value within the array, {@link #I... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,369 | [
"array",
"valueToFind"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
countNumberOfUnboundPrimitiveArguments | private int countNumberOfUnboundPrimitiveArguments() {
int count = 0;
for (int i = 0; i < this.argumentTypes.length; i++) {
if (isUnbound(i) && this.argumentTypes[i].isPrimitive()) {
count++;
}
}
return count;
} | Return {@code true} if the given argument type is a subclass
of the given supertype. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 709 | [] | true | 4 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false | |
initAgentSystemProperties | public void initAgentSystemProperties(Settings settings) {
boolean tracing = TELEMETRY_TRACING_ENABLED_SETTING.get(settings);
boolean metrics = TELEMETRY_METRICS_ENABLED_SETTING.get(settings);
this.setAgentSetting("recording", Boolean.toString(tracing || metrics));
// Apply values from ... | Initialize APM settings from the provided settings object into the corresponding system properties.
Later updates to these settings are synchronized using update consumers.
@param settings the settings to apply | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/APMAgentSettings.java | 68 | [
"settings"
] | void | true | 2 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
bind | <T> @Nullable T bind(ConfigurationPropertyName name, Bindable<T> target, Context context,
DataObjectPropertyBinder propertyBinder); | Return a bound instance or {@code null} if the {@link DataObjectBinder} does not
support the specified {@link Bindable}.
@param <T> the source type
@param name the name being bound
@param target the bindable to bind
@param context the bind context
@param propertyBinder property binder
@return a bound instance or {@code... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DataObjectBinder.java | 45 | [
"name",
"target",
"context",
"propertyBinder"
] | T | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
toString | @Override
public String toString() {
// racy single-check idiom, safe because String is immutable
String result = toString;
if (result == null) {
result = computeToString();
toString = result;
}
return result;
} | Returns the string representation of this media type in the format described in <a
href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>. | java | android/guava/src/com/google/common/net/MediaType.java | 1,227 | [] | String | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
init_PPC_32Bit | private static void init_PPC_32Bit() {
addProcessors(new Processor(Processor.Arch.BIT_32, Processor.Type.PPC), "ppc", "power", "powerpc", "power_pc", "power_rs");
} | Gets a {@link Processor} object the given value {@link String}. The {@link String} must be like a value returned by the {@code "os.arch"} system
property.
@param value A {@link String} like a value returned by the {@code os.arch} System Property.
@return A {@link Processor} when it exists, else {@code null}. | java | src/main/java/org/apache/commons/lang3/ArchUtils.java | 115 | [] | void | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
getWrapperOrPrimitiveFor | TypeMirror getWrapperOrPrimitiveFor(TypeMirror typeMirror) {
Class<?> candidate = getWrapperFor(typeMirror);
if (candidate != null) {
return this.env.getElementUtils().getTypeElement(candidate.getName()).asType();
}
TypeKind primitiveKind = getPrimitiveFor(typeMirror);
if (primitiveKind != null) {
retur... | Return the {@link PrimitiveType} of the specified type or {@code null} if the type
does not represent a valid wrapper type.
@param typeMirror a type
@return the primitive type or {@code null} if the type is not a wrapper type | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | 201 | [
"typeMirror"
] | TypeMirror | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
register | @Override
protected void register(String description, ServletContext servletContext) {
try {
servletContext.addListener(this.listener);
}
catch (RuntimeException ex) {
throw new IllegalStateException("Failed to add listener '" + this.listener + "' to servlet context", ex);
}
} | Return the listener to be registered.
@return the listener to be registered | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java | 117 | [
"description",
"servletContext"
] | void | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
substitutePropertyAccessExpression | function substitutePropertyAccessExpression(node: PropertyAccessExpression) {
if (node.expression.kind === SyntaxKind.SuperKeyword) {
return setTextRange(
factory.createPropertyAccessExpression(
factory.createUniqueName("_super", GeneratedIdentifierFlags.Optim... | Hooks node substitutions.
@param hint The context for the emitter.
@param node The node to substitute. | typescript | src/compiler/transformers/es2018.ts | 1,411 | [
"node"
] | false | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
processDatabase | boolean processDatabase(String id, DatabaseConfiguration database) throws IOException {
final String name = database.name();
logger.debug("Processing database [{}] for configuration [{}]", name, database.id());
try (ProviderDownload downloader = downloaderFor(database)) {
if (downlo... | This method fetches the checksum and database for the given database from the Maxmind endpoint, then indexes that database
file into the .geoip_databases Elasticsearch index, deleting any old versions of the database from the index if they exist.
If the computed checksum does not match the expected checksum, an error w... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloader.java | 251 | [
"id",
"database"
] | true | 3 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false | |
removeAll | static Object removeAll(final Object array, final int... indices) {
if (array == null) {
return null;
}
final int length = getLength(array);
int diff = 0; // number of distinct indexes, i.e. number of entries that will be removed
final int[] clonedIndices = ArraySorte... | Removes multiple array elements specified by index.
@param array source
@param indices to remove
@return new array of same type minus elements specified by unique values of {@code indices} | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5,150 | [
"array"
] | Object | true | 12 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
collect | public <A, R> R collect(final Supplier<R> supplier, final BiConsumer<R, ? super T> accumulator, final BiConsumer<R, R> combiner) {
makeTerminated();
return stream().collect(supplier, accumulator, combiner);
} | Performs a mutable reduction operation on the elements of this FailableStream. A mutable reduction is one in which
the reduced value is a mutable result container, such as an {@link ArrayList}, and elements are incorporated by
updating the state of the result rather than by replacing the result. This produces a result ... | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 348 | [
"supplier",
"accumulator",
"combiner"
] | R | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
_set_diag | def _set_diag(laplacian, value, norm_laplacian):
"""Set the diagonal of the laplacian matrix and convert it to a
sparse format well suited for eigenvalue decomposition.
Parameters
----------
laplacian : {ndarray, sparse matrix}
The graph laplacian.
value : float
The value of th... | Set the diagonal of the laplacian matrix and convert it to a
sparse format well suited for eigenvalue decomposition.
Parameters
----------
laplacian : {ndarray, sparse matrix}
The graph laplacian.
value : float
The value of the diagonal.
norm_laplacian : bool
Whether the value of the diagonal should be c... | python | sklearn/manifold/_spectral_embedding.py | 104 | [
"laplacian",
"value",
"norm_laplacian"
] | false | 7 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
or | default FailableIntPredicate<E> or(final FailableIntPredicate<E> other) {
Objects.requireNonNull(other);
return t -> test(t) || other.test(t);
} | Returns a composed {@link FailableIntPredicate} like {@link IntPredicate#and(IntPredicate)}.
@param other a predicate that will be logically-ORed with this predicate.
@return a composed {@link FailableIntPredicate} like {@link IntPredicate#and(IntPredicate)}.
@throws NullPointerException if other is null | java | src/main/java/org/apache/commons/lang3/function/FailableIntPredicate.java | 90 | [
"other"
] | true | 2 | 7.36 | apache/commons-lang | 2,896 | javadoc | false | |
equals | @Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof ControlFlowPointcut that &&
this.clazz.equals(that.clazz)) && this.methodNamePatterns.equals(that.methodNamePatterns));
} | Determine if the given method name matches the method name pattern.
<p>This method is invoked by {@link #isMatch(String, int)}.
<p>The default implementation checks for direct equality as well as
{@code xxx*}, {@code *xxx}, {@code *xxx*}, and {@code xxx*yyy} matches.
<p>Can be overridden in subclasses — for examp... | java | spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java | 237 | [
"other"
] | true | 4 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
forward | def forward(self, x, lengths):
"""
:param x: The input of size BxCxDxT
:param lengths: The actual length of each sequence in the batch
:return: Masked output from the module
"""
for module in self.seq_module:
x = module(x)
mask = torch.BoolTensor(x... | :param x: The input of size BxCxDxT
:param lengths: The actual length of each sequence in the batch
:return: Masked output from the module | python | benchmarks/functional_autograd_benchmark/torchaudio_models.py | 153 | [
"self",
"x",
"lengths"
] | false | 5 | 6.64 | pytorch/pytorch | 96,034 | sphinx | false | |
telemetryReporter | public static Optional<ClientTelemetryReporter> telemetryReporter(String clientId, AbstractConfig config) {
if (!config.getBoolean(CommonClientConfigs.ENABLE_METRICS_PUSH_CONFIG)) {
return Optional.empty();
}
ClientTelemetryReporter telemetryReporter = new ClientTelemetryReporter(Ti... | Log warning if the exponential backoff is disabled due to initial backoff value is greater than max backoff value.
@param config The config object. | java | clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java | 321 | [
"clientId",
"config"
] | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
_upsample | def _upsample(self, method, limit: int | None = None, fill_value=None):
"""
Parameters
----------
method : string {'backfill', 'bfill', 'pad',
'ffill', 'asfreq'} method for upsampling
limit : int, default None
Maximum size gap to fill when reindexing
... | Parameters
----------
method : string {'backfill', 'bfill', 'pad',
'ffill', 'asfreq'} method for upsampling
limit : int, default None
Maximum size gap to fill when reindexing
fill_value : scalar, default None
Value to use for missing values | python | pandas/core/resample.py | 2,110 | [
"self",
"method",
"limit",
"fill_value"
] | true | 8 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false | |
get_batch_is_authorized_single_result | def get_batch_is_authorized_single_result(
self,
*,
batch_is_authorized_results: list[dict],
request: IsAuthorizedRequest,
user: AwsAuthManagerUser,
) -> dict:
"""
Get a specific authorization result from the output of ``get_batch_is_authorized_results``.
... | Get a specific authorization result from the output of ``get_batch_is_authorized_results``.
:param batch_is_authorized_results: the response from the ``batch_is_authorized`` API
:param request: the request information. Used to find the result in the response.
:param user: the user | python | providers/amazon/src/airflow/providers/amazon/aws/auth_manager/avp/facade.py | 208 | [
"self",
"batch_is_authorized_results",
"request",
"user"
] | dict | true | 3 | 6.72 | apache/airflow | 43,597 | sphinx | false |
iterator | @Override
public Iterator<Record> iterator() {
if (count() == 0)
return Collections.emptyIterator();
if (!isCompressed())
return uncompressedIterator();
// for a normal iterator, we cannot ensure that the underlying compression stream is closed,
// so we dec... | Gets the base timestamp of the batch which is used to calculate the record timestamps from the deltas.
@return The base timestamp | java | clients/src/main/java/org/apache/kafka/common/record/DefaultRecordBatch.java | 319 | [] | true | 4 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
join | public static String join(String separator, char... array) {
checkNotNull(separator);
int len = array.length;
if (len == 0) {
return "";
}
StringBuilder builder = new StringBuilder(len + separator.length() * (len - 1));
builder.append(array[0]);
for (int i = 1; i < len; i++) {
b... | Returns a string containing the supplied {@code char} values separated by {@code separator}.
For example, {@code join("-", '1', '2', '3')} 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... | java | android/guava/src/com/google/common/primitives/Chars.java | 370 | [
"separator"
] | String | true | 3 | 6.56 | google/guava | 51,352 | javadoc | false |
isHostType | function isHostType(object, property) {
if (object == null) {
return false;
}
var type = typeof object[property];
return !rePrimitive.test(type) && (type != 'object' || !!object[property]);
} | Host objects can return type values that are different from their actual
data type. The objects we are concerned with usually return non-primitive
types of "object", "function", or "unknown".
@private
@param {*} object The owner of the property.
@param {string} property The property to check.
@returns {boolean} Returns... | javascript | perf/perf.js | 167 | [
"object",
"property"
] | false | 4 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
tearDown | @TearDown(Level.Trial)
public void tearDown() {
if (executorService != null) {
executorService.shutdown();
try {
if (executorService.awaitTermination(30, TimeUnit.SECONDS) == false) {
executorService.shutdownNow();
}
} c... | Shuts down the executor service after the trial completes. | java | benchmarks/src/main/java/org/elasticsearch/benchmark/search/query/range/DateFieldMapperDocValuesSkipperBenchmark.java | 332 | [] | void | true | 4 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
EffectWithState | function EffectWithState() {
const [didMount, setDidMount] = useState(0);
const renderCountRef = useRef(0);
renderCountRef.current++;
useLayoutEffect(() => {
if (!didMount) {
setDidMount(true);
}
}, [didMount]);
return (
<ul>
<li>Rendered {renderCountRef.current} times</li>
... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree. | javascript | packages/react-devtools-shell/src/multi/right.js | 20 | [] | false | 3 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
copy | private Options copy(Consumer<EnumSet<Option>> processor) {
EnumSet<Option> options = (!this.options.isEmpty()) ? EnumSet.copyOf(this.options)
: EnumSet.noneOf(Option.class);
processor.accept(options);
return new Options(options);
} | Create a new {@link Options} instance that contains the options in this set
including the given option.
@param option the option to include
@return a new {@link Options} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java | 243 | [
"processor"
] | Options | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
buildListOffsetsRequests | private List<NetworkClientDelegate.UnsentRequest> buildListOffsetsRequests(
final Map<TopicPartition, Long> timestampsToSearch,
final boolean requireTimestamps,
final ListOffsetsRequestState listOffsetsRequestState) {
log.debug("Building ListOffsets request for partitions {}"... | Build ListOffsets requests to fetch offsets by target times for the specified partitions.
@param timestampsToSearch the mapping between partitions and target time
@param requireTimestamps true if we should fail with an UnsupportedVersionException if the broker does
not support fetching precis... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java | 554 | [
"timestampsToSearch",
"requireTimestamps",
"listOffsetsRequestState"
] | true | 5 | 7.6 | apache/kafka | 31,560 | javadoc | false | |
loadPreloadModules | function loadPreloadModules() {
// For user code, we preload modules if `-r` is passed
const preloadModules = getOptionValue('--require');
if (preloadModules && preloadModules.length > 0) {
const {
Module: {
_preloadModules,
},
} = require('internal/modules/cjs/loader');
_preloadMo... | Patch the process object with legacy properties and normalizations.
Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.
Replace `process.argv[1]` with the resolved absolute file path of the entry point, if found.
@param {boolean} expandArgv1 - Whether to replac... | javascript | lib/internal/process/pre_execution.js | 700 | [] | false | 3 | 6.96 | nodejs/node | 114,839 | jsdoc | false | |
resolvePasswordSetting | private char[] resolvePasswordSetting(String secureSettingKey, String legacySettingKey) {
final char[] securePassword = resolveSecureSetting(secureSettingKey, null);
final String legacyPassword = stringSetting(legacySettingKey);
if (securePassword == null) {
if (legacyPassword == nul... | 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 | 424 | [
"secureSettingKey",
"legacySettingKey"
] | true | 4 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
hash | static int hash(int initialHash, CharSequence charSequence, boolean addEndSlash) {
if (charSequence == null || charSequence.isEmpty()) {
return (!addEndSlash) ? EMPTY_HASH : EMPTY_SLASH_HASH;
}
boolean endsWithSlash = charSequence.charAt(charSequence.length() - 1) == '/';
int hash = initialHash;
if (charSe... | Return a hash for a char sequence, optionally appending '/'.
@param initialHash the initial hash value
@param charSequence the source char sequence
@param addEndSlash if slash should be added to the string if it's not already
present
@return the hash | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipString.java | 71 | [
"initialHash",
"charSequence",
"addEndSlash"
] | true | 9 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getThrowableList | public static List<Throwable> getThrowableList(Throwable throwable) {
final List<Throwable> list = new ArrayList<>();
while (throwable != null && !list.contains(throwable)) {
list.add(throwable);
throwable = throwable.getCause();
}
return list;
} | Gets the list of {@link Throwable} objects in the
exception chain.
<p>A throwable without cause will return a list containing
one element - the input throwable.
A throwable with one cause will return a list containing
two elements. - the input throwable and the cause throwable.
A {@code null} throwable will return a li... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 513 | [
"throwable"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
consume | public void consume(PointError pointError) {
if (length > 1) {
// we need at least three points to calculate the error of the middle point
points[length - 1].error = calculator.calculateError(points[length - 2], points[length - 1], pointError);
queue.add(points[length - 1]);
... | Consume a single point on the stream of points to be simplified.
No memory management of the points passed in is done, so only use this call if you manage these objects from calling code. | java | libs/geo/src/main/java/org/elasticsearch/geometry/simplify/StreamingGeometrySimplifier.java | 81 | [
"pointError"
] | void | true | 3 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
apiVersion | public ApiVersion apiVersion(ApiKeys apiKey) {
return supportedVersions.get(apiKey);
} | Get the version information for a given API.
@param apiKey The api key to lookup
@return The api version information from the broker or null if it is unsupported | java | clients/src/main/java/org/apache/kafka/clients/NodeApiVersions.java | 249 | [
"apiKey"
] | ApiVersion | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
read | @Override
public synchronized int read() throws IOException {
checkOpen();
requireNonNull(seq); // safe because of checkOpen
return hasRemaining() ? seq.charAt(pos++) : -1;
} | Creates a new reader wrapping the given character sequence. | java | android/guava/src/com/google/common/io/CharSequenceReader.java | 92 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
lookupMethods | Map<MethodKey, CheckMethod> lookupMethods(Class<?> clazz) throws 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 | 51 | [
"clazz"
] | true | 1 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
doubleValue | @Override
public double doubleValue() {
return (double) numerator / (double) denominator;
} | Gets the fraction as a {@code double}. This calculates the fraction
as the numerator divided by denominator.
@return the fraction as a {@code double} | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 627 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
create | function create(prototype, properties) {
var result = baseCreate(prototype);
return properties == null ? result : baseAssign(result, properties);
} | Creates an object that inherits from the `prototype` object. If a
`properties` object is given, its own enumerable string keyed properties
are assigned to the created object.
@static
@memberOf _
@since 2.3.0
@category Object
@param {Object} prototype The object to inherit from.
@param {Object} [properties] The properti... | javascript | lodash.js | 12,867 | [
"prototype",
"properties"
] | false | 2 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
get_db_instance_status | def get_db_instance_status(self, instance_id: str) -> str:
"""
Get the status of a Neptune instance.
:param instance_id: The ID of the instance to get the status of.
:return: The status of the instance.
"""
return self.conn.describe_db_instances(DBInstanceIdentifier=inst... | Get the status of a Neptune instance.
:param instance_id: The ID of the instance to get the status of.
:return: The status of the instance. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/neptune.py | 93 | [
"self",
"instance_id"
] | str | true | 1 | 7.04 | apache/airflow | 43,597 | sphinx | false |
locate | private static long locate(DataBlock dataBlock, ByteBuffer buffer) throws IOException {
long endPos = dataBlock.size();
debug.log("Finding EndOfCentralDirectoryRecord starting at end position %s", endPos);
while (endPos > 0) {
buffer.clear();
long totalRead = dataBlock.size() - endPos;
if (totalRead > MA... | Create a new {@link ZipEndOfCentralDirectoryRecord} instance from the specified
{@link DataBlock} by searching backwards from the end until a valid record is
located.
@param dataBlock the source data block
@return the {@link Located located} {@link ZipEndOfCentralDirectoryRecord}
@throws IOException if the {@link ZipEn... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipEndOfCentralDirectoryRecord.java | 113 | [
"dataBlock",
"buffer"
] | true | 5 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
unused | public Set<String> unused() {
Set<String> keys = new HashSet<>(originals.keySet());
keys.removeAll(used);
return keys;
} | Called directly after user configs got parsed (and thus default values got set).
This allows to change default values for "secondary defaults" if required.
@param parsedValues unmodifiable map of current configuration
@return a map of updates that should be applied to the configuration (will be validated to prevent bad... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 237 | [] | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
check_below_min_count | def check_below_min_count(
shape: tuple[int, ...], mask: npt.NDArray[np.bool_] | None, min_count: int
) -> bool:
"""
Check for the `min_count` keyword. Returns True if below `min_count` (when
missing value should be returned from the reduction).
Parameters
----------
shape : tuple
T... | Check for the `min_count` keyword. Returns True if below `min_count` (when
missing value should be returned from the reduction).
Parameters
----------
shape : tuple
The shape of the values (`values.shape`).
mask : ndarray[bool] or None
Boolean numpy array (typically of same shape as `shape`) or None.
min_count... | python | pandas/core/nanops.py | 1,581 | [
"shape",
"mask",
"min_count"
] | bool | true | 5 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
append | public ConfigurationPropertyName append(@Nullable ConfigurationPropertyName suffix) {
if (suffix == null) {
return this;
}
return new ConfigurationPropertyName(this.elements.append(suffix.elements));
} | Create a new {@link ConfigurationPropertyName} by appending the given suffix.
@param suffix the elements to append
@return a new {@link ConfigurationPropertyName}
@since 2.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 227 | [
"suffix"
] | ConfigurationPropertyName | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
shared_task | def shared_task(*args, **kwargs):
"""Create shared task (decorator).
This can be used by library authors to create tasks that'll work
for any app environment.
Returns:
~celery.local.Proxy: A proxy that always takes the task from the
current apps task registry.
Example:
>>... | Create shared task (decorator).
This can be used by library authors to create tasks that'll work
for any app environment.
Returns:
~celery.local.Proxy: A proxy that always takes the task from the
current apps task registry.
Example:
>>> from celery import Celery, shared_task
>>> @shared_task
...... | python | celery/app/__init__.py | 24 | [] | false | 6 | 8.88 | celery/celery | 27,741 | unknown | false | |
toByteArray | public static byte[] toByteArray(File file) throws IOException {
return asByteSource(file).read();
} | Reads all bytes from a file into a byte array.
<p><b>{@link java.nio.file.Path} equivalent:</b> {@link java.nio.file.Files#readAllBytes}.
@param file the file to read from
@return a byte array containing all the bytes from file
@throws IllegalArgumentException if the file is bigger than the largest possible byte array
... | java | android/guava/src/com/google/common/io/Files.java | 236 | [
"file"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
BinaryData | BinaryData(BinaryData &&) = default; | from \p Address - Section.getAddress() when the data has been reordered. | cpp | bolt/include/bolt/Core/BinaryData.h | 79 | [] | true | 2 | 6.48 | llvm/llvm-project | 36,021 | doxygen | false | |
getPath | private Path getPath() {
if (this.path == null) {
this.pathLock.lock();
try {
if (this.path == null) {
String hash = HexFormat.of().withUpperCase().formatHex(generateHash(this.sourceClass));
this.path = createDirectory(getTempDirectory().resolve(hash));
}
}
finally {
this.pathLock.un... | Return a subdirectory of the application temp.
@param subDir the subdirectory name
@return a subdirectory | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java | 98 | [] | Path | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
put | @CanIgnoreReturnValue
@Override
public @Nullable V put(@ParametricNullness K key, @ParametricNullness V value) {
return put(key, value, false);
} | 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 | android/guava/src/com/google/common/collect/HashBiMap.java | 281 | [
"key",
"value"
] | V | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false |
_median_nancheck | def _median_nancheck(data, result, axis):
"""
Utility function to check median result from data for NaN values at the end
and return NaN in that case. Input result can also be a MaskedArray.
Parameters
----------
data : array
Sorted input data to median function
result : Array or Ma... | Utility function to check median result from data for NaN values at the end
and return NaN in that case. Input result can also be a MaskedArray.
Parameters
----------
data : array
Sorted input data to median function
result : Array or MaskedArray
Result of median function.
axis : int
Axis along which the m... | python | numpy/lib/_utils_impl.py | 407 | [
"data",
"result",
"axis"
] | false | 5 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
attributesForRepeatable | static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata,
Class<? extends Annotation> annotationType, Class<? extends Annotation> containerType,
Predicate<MergedAnnotation<? extends Annotation>> predicate) {
return metadata.getMergedRepeatableAnnotationAttributes(annotationType, con... | Register all relevant annotation post processors in the given registry.
@param registry the registry to operate on
@param source the configuration source element (already extracted)
that this registration was triggered from. May be {@code null}.
@return a Set of BeanDefinitionHolders, containing all bean definitions
th... | java | spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java | 297 | [
"metadata",
"annotationType",
"containerType",
"predicate"
] | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
findPathTo | private @Nullable ExampleStackTrace findPathTo(LockGraphNode node, Set<LockGraphNode> seen) {
if (!seen.add(this)) {
return null; // Already traversed this node.
}
ExampleStackTrace found = allowedPriorLocks.get(node);
if (found != null) {
return found; // Found a path ending at ... | Performs a depth-first traversal of the graph edges defined by each node's {@code
allowedPriorLocks} to find a path between {@code this} and the specified {@code lock}.
@return If a path was found, a chained {@link ExampleStackTrace} illustrating the path to the
{@code lock}, or {@code null} if no path was found. | java | android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java | 685 | [
"node",
"seen"
] | ExampleStackTrace | true | 4 | 6.88 | google/guava | 51,352 | javadoc | false |
leaderEpoch | public Optional<Integer> leaderEpoch() {
return leaderEpoch;
} | Get the leader epoch for the partition.
@return The leader epoch of the partition. | java | clients/src/main/java/org/apache/kafka/clients/admin/SharePartitionOffsetInfo.java | 62 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
toString | @Override
public String toString() {
return "RecordBatch(magic=" + magic() + ", offsets=[" + baseOffset() + ", " + lastOffset() + "], " +
"sequence=[" + baseSequence() + ", " + lastSequence() + "], " +
"partitionLeaderEpoch=" + partitionLeaderEpoch() + ", " +
... | Gets the base timestamp of the batch which is used to calculate the record timestamps from the deltas.
@return The base timestamp | java | clients/src/main/java/org/apache/kafka/common/record/DefaultRecordBatch.java | 501 | [] | String | true | 1 | 6.88 | apache/kafka | 31,560 | javadoc | false |
visitCallExpressionWithPotentialCapturedThisAssignment | function visitCallExpressionWithPotentialCapturedThisAssignment(node: CallExpression, assignToCapturedThis: boolean): CallExpression | BinaryExpression {
// We are here either because SuperKeyword was used somewhere in the expression, or
// because we contain a SpreadElementExpression.
if (
... | Visits a CallExpression that contains either a spread element or `super`.
@param node a CallExpression. | typescript | src/compiler/transformers/es2015.ts | 4,522 | [
"node",
"assignToCapturedThis"
] | true | 12 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
loads | def loads(s: str | bytes, **kwargs: t.Any) -> t.Any:
"""Deserialize data as JSON.
If :data:`~flask.current_app` is available, it will use its
:meth:`app.json.loads() <flask.json.provider.JSONProvider.loads>`
method, otherwise it will use :func:`json.loads`.
:param s: Text or UTF-8 bytes.
:para... | Deserialize data as JSON.
If :data:`~flask.current_app` is available, it will use its
:meth:`app.json.loads() <flask.json.provider.JSONProvider.loads>`
method, otherwise it will use :func:`json.loads`.
:param s: Text or UTF-8 bytes.
:param kwargs: Arguments passed to the ``loads`` implementation.
.. versionchanged::... | python | src/flask/json/__init__.py | 77 | [
"s"
] | t.Any | true | 2 | 6.4 | pallets/flask | 70,946 | sphinx | false |
transformAndEmitContinueStatement | function transformAndEmitContinueStatement(node: ContinueStatement): void {
const label = findContinueTarget(node.label ? idText(node.label) : undefined);
if (label > 0) {
emitBreak(label, /*location*/ node);
}
else {
// invalid continue without a containing... | Visits an ElementAccessExpression that contains a YieldExpression.
@param node The node to visit. | typescript | src/compiler/transformers/generators.ts | 1,742 | [
"node"
] | true | 4 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
hermeadd | def hermeadd(c1, c2):
"""
Add one Hermite series to another.
Returns the sum of two Hermite series `c1` + `c2`. The arguments
are sequences of coefficients ordered from lowest order term to
highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1,... | Add one Hermite series to another.
Returns the sum of two Hermite series `c1` + `c2`. The arguments
are sequences of coefficients ordered from lowest order term to
highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 : array_like
1-D arrays of Hermite series coeffici... | python | numpy/polynomial/hermite_e.py | 312 | [
"c1",
"c2"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
buildNewKeyStore | private static KeyStore buildNewKeyStore(String type) throws GeneralSecurityException {
KeyStore keyStore = KeyStore.getInstance(type);
try {
keyStore.load(null, null);
} catch (IOException e) {
// This should never happen so callers really shouldn't be forced to deal wit... | Construct an in-memory keystore with multiple trusted cert entries.
@param certificates The root certificates to trust | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/KeyStoreUtil.java | 128 | [
"type"
] | KeyStore | true | 2 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
get_window_bounds | def get_window_bounds(
self,
num_values: int = 0,
min_periods: int | None = None,
center: bool | None = None,
closed: str | None = None,
step: int | None = None,
) -> tuple[np.ndarray, np.ndarray]:
"""
Computes the bounds of a window.
Paramete... | Computes the bounds of a window.
Parameters
----------
num_values : int, default 0
number of values that will be aggregated over
window_size : int, default 0
the number of rows in a window
min_periods : int, default None
min_periods passed from the top level rolling API
center : bool, default None
cent... | python | pandas/core/indexers/objects.py | 569 | [
"self",
"num_values",
"min_periods",
"center",
"closed",
"step"
] | tuple[np.ndarray, np.ndarray] | true | 5 | 6.48 | pandas-dev/pandas | 47,362 | numpy | false |
clear | @Override
public void clear() {
if (needsAllocArrays()) {
return;
}
incrementModCount();
Map<K, V> delegate = delegateOrNull();
if (delegate != null) {
metadata =
Ints.constrainToRange(size(), CompactHashing.DEFAULT_SIZE, CompactHashing.MAX_SIZE);
delegate.clear(); // i... | Ensures that this {@code CompactHashMap} has the smallest representation in memory, given its
current size. | java | android/guava/src/com/google/common/collect/CompactHashMap.java | 972 | [] | void | true | 3 | 6.24 | google/guava | 51,352 | javadoc | false |
copyTo | @CanIgnoreReturnValue
public long copyTo(OutputStream output) throws IOException {
checkNotNull(output);
Closer closer = Closer.create();
try {
InputStream in = closer.register(openStream());
return ByteStreams.copy(in, output);
} catch (Throwable e) {
throw closer.rethrow(e);
}... | Copies the contents of this byte source to the given {@code OutputStream}. Does not close
{@code output}.
@return the number of bytes copied
@throws IOException if an I/O error occurs while reading from this source or writing to {@code
output} | java | android/guava/src/com/google/common/io/ByteSource.java | 249 | [
"output"
] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
isTeredoAddress | public static boolean isTeredoAddress(Inet6Address ip) {
byte[] bytes = ip.getAddress();
return (bytes[0] == (byte) 0x20)
&& (bytes[1] == (byte) 0x01)
&& (bytes[2] == 0)
&& (bytes[3] == 0);
} | Evaluates whether the argument is a Teredo address.
<p>Teredo addresses begin with the {@code "2001::/32"} prefix.
@param ip {@link Inet6Address} to be examined for Teredo address format
@return {@code true} if the argument is a Teredo address | java | android/guava/src/com/google/common/net/InetAddresses.java | 808 | [
"ip"
] | true | 4 | 8.08 | google/guava | 51,352 | javadoc | false | |
computeError | void computeError( InputArray _m1, InputArray _m2, InputArray _model, OutputArray _err ) const CV_OVERRIDE
{
Mat __m1 = _m1.getMat(), __m2 = _m2.getMat(), __model = _model.getMat();
int i, count = __m1.checkVector(2);
const Point2f* m1 = __m1.ptr<Point2f>();
const Point2f* m2 = __m2.... | Compute the fundamental matrix using the 8-point algorithm.
\f[
(\mathrm{m2}_i,1)^T \mathrm{fmatrix} (\mathrm{m1}_i,1) = 0
\f]
@param _m1 Contain points in the reference view. Depth CV_32F with 2-channel
1 column or 1-channel 2 columns. It has 8 rows.
@param _m2 Contain points in the other view. Depth CV_32... | cpp | modules/calib3d/src/fundam.cpp | 817 | [
"_m1",
"_m2",
"_model",
"_err"
] | true | 2 | 7.84 | opencv/opencv | 85,374 | doxygen | false | |
insert | def insert(
self,
loc: int,
column: Hashable,
value: object,
allow_duplicates: bool | lib.NoDefault = lib.no_default,
) -> None:
"""
Insert column into DataFrame at specified location.
Raises a ValueError if `column` is already contained in the DataFr... | Insert column into DataFrame at specified location.
Raises a ValueError if `column` is already contained in the DataFrame,
unless `allow_duplicates` is set to True.
Parameters
----------
loc : int
Insertion index. Must verify 0 <= loc <= len(columns).
column : str, number, or hashable object
Label of the inse... | python | pandas/core/frame.py | 5,366 | [
"self",
"loc",
"column",
"value",
"allow_duplicates"
] | None | true | 10 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
print | public String print(Period value) {
return print(value, null);
} | Print the specified period.
@param value the value to print
@return the printed result | java | core/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java | 166 | [
"value"
] | String | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false |
joinWith | private Joiner joinWith(String delimiter) {
return (prefix, name) -> {
StringBuilder joined = new StringBuilder(prefix.length() + delimiter.length() + name.length());
joined.append(prefix);
if (!prefix.isEmpty() && !prefix.endsWith(delimiter) && !name.startsWith(delimiter)) {
joined.append(delimiter);
... | Add pairs using nested naming (for example as used in ECS).
@param <T> the item type
@param pairs callback to add all the pairs
@return a {@link BiConsumer} for use with the {@link JsonWriter} | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java | 89 | [
"delimiter"
] | Joiner | true | 4 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
getAndIncrement | public double getAndIncrement() {
final double last = value;
value++;
return last;
} | Increments this instance's value by 1; this method returns the value associated with the instance
immediately prior to the increment operation. This method is not thread safe.
@return the value associated with the instance before it was incremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java | 264 | [] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
from_fields | def from_fields(
cls,
*,
year=None,
quarter=None,
month=None,
day=None,
hour=None,
minute=None,
second=None,
freq=None,
) -> Self:
"""
Construct a PeriodIndex from fields (year, month, day, etc.).
Parameters
... | Construct a PeriodIndex from fields (year, month, day, etc.).
Parameters
----------
year : int, array, or Series, default None
Year for the PeriodIndex.
quarter : int, array, or Series, default None
Quarter for the PeriodIndex.
month : int, array, or Series, default None
Month for the PeriodIndex.
day : in... | python | pandas/core/indexes/period.py | 259 | [
"cls",
"year",
"quarter",
"month",
"day",
"hour",
"minute",
"second",
"freq"
] | Self | true | 1 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
read | public byte[] read() throws IOException {
Closer closer = Closer.create();
try {
InputStream in = closer.register(openStream());
Optional<Long> size = sizeIfKnown();
return size.isPresent()
? ByteStreams.toByteArray(in, size.get())
: ByteStreams.toByteArray(in);
} catch... | Reads the full contents of this byte source as a byte array.
@throws IOException if an I/O error occurs while reading from this source | java | android/guava/src/com/google/common/io/ByteSource.java | 292 | [] | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false | |
is_complex_dtype | def is_complex_dtype(arr_or_dtype) -> bool:
"""
Check whether the provided array or dtype is of a complex dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
boolean
Whether or not the array or dtype is of a compl... | Check whether the provided array or dtype is of a complex dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
boolean
Whether or not the array or dtype is of a complex dtype.
See Also
--------
api.types.is_complex: Return True if given object is comple... | python | pandas/core/dtypes/common.py | 1,559 | [
"arr_or_dtype"
] | bool | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
split | public static String[] split(final String str, final String separatorChars) {
return splitWorker(str, separatorChars, -1, false);
} | Splits the provided text into an array, separators specified. This is an alternative to using StringTokenizer.
<p>
The separator is not included in the returned String array. Adjacent separators are treated as one separator. For more control over the split use the
StrTokenizer class.
</p>
<p>
A {@code null} input Strin... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,093 | [
"str",
"separatorChars"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
filteredTransactionalIdPattern | public String filteredTransactionalIdPattern() {
return filteredTransactionalIdPattern;
} | Returns transactional ID being filtered.
@return the current transactional ID pattern filter (empty means no transactional IDs are filtered and all
transactions will be returned) | java | clients/src/main/java/org/apache/kafka/clients/admin/ListTransactionsOptions.java | 122 | [] | String | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
opj_int_fix_mul | static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b)
{
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
OPJ_INT64 temp = __emul(a, b);
#else
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
#endif
temp += 4096;
assert((temp >> 13) <= (OPJ_INT64)0... | Multiply two fixed-precision rational numbers.
@param a
@param b
@return Returns a * b | cpp | 3rdparty/openjpeg/openjp2/opj_intmath.h | 263 | [
"a",
"b"
] | true | 4 | 8.24 | opencv/opencv | 85,374 | doxygen | false | |
resolveSignature | public static @Nullable Method resolveSignature(String signature, Class<?> clazz) {
Assert.hasText(signature, "'signature' must not be empty");
Assert.notNull(clazz, "Class must not be null");
int startParen = signature.indexOf('(');
int endParen = signature.indexOf(')');
if (startParen > -1 && endParen == -1... | Parse a method signature in the form {@code methodName[([arg_list])]},
where {@code arg_list} is an optional, comma-separated list of fully-qualified
type names, and attempts to resolve that signature against the supplied {@code Class}.
<p>When not supplying an argument list ({@code methodName}) the method whose name
m... | java | spring-beans/src/main/java/org/springframework/beans/BeanUtils.java | 452 | [
"signature",
"clazz"
] | Method | true | 8 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
as_array | def as_array(obj, shape=None):
"""
Create a numpy array from a ctypes array or POINTER.
The numpy array shares the memory with the ctypes object.
The shape parameter must be given if converting from a ctypes POINTER.
The shape parameter is ignored if converting from a ctypes ar... | Create a numpy array from a ctypes array or POINTER.
The numpy array shares the memory with the ctypes object.
The shape parameter must be given if converting from a ctypes POINTER.
The shape parameter is ignored if converting from a ctypes array
Examples
--------
Converting a ctypes integer array:
>>> import ctype... | python | numpy/ctypeslib/_ctypeslib.py | 521 | [
"obj",
"shape"
] | false | 3 | 6.8 | numpy/numpy | 31,054 | unknown | false | |
maybeBindThrowingVariable | private void maybeBindThrowingVariable() {
if (this.throwingName == null) {
return;
}
// So there is binding work to do...
int throwableIndex = -1;
for (int i = 0; i < this.argumentTypes.length; i++) {
if (isUnbound(i) && isSubtypeOf(Throwable.class, i)) {
if (throwableIndex == -1) {
throwable... | If a throwing name was specified and there is exactly one choice remaining
(argument that is a subtype of Throwable) then bind it. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 329 | [] | void | true | 7 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
create | public static URL create(File file, String nestedEntryName, String path) {
try {
path = (path != null) ? path : "";
return new URL(null, "jar:" + getJarReference(file, nestedEntryName) + "!/" + path, Handler.INSTANCE);
}
catch (MalformedURLException ex) {
throw new IllegalStateException("Unable to create... | Create a new jar URL.
@param file the jar file
@param nestedEntryName the nested entry name or {@code null}
@param path the path within the jar or nested jar
@return a jar file URL | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrl.java | 71 | [
"file",
"nestedEntryName",
"path"
] | URL | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
flatten_mask | def flatten_mask(mask):
"""
Returns a completely flattened version of the mask, where nested fields
are collapsed.
Parameters
----------
mask : array_like
Input array, which will be interpreted as booleans.
Returns
-------
flattened_mask : ndarray of bools
The flatt... | Returns a completely flattened version of the mask, where nested fields
are collapsed.
Parameters
----------
mask : array_like
Input array, which will be interpreted as booleans.
Returns
-------
flattened_mask : ndarray of bools
The flattened input.
Examples
--------
>>> import numpy as np
>>> mask = np.arra... | python | numpy/ma/core.py | 1,805 | [
"mask"
] | false | 6 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
writeLines | function writeLines(text: string): void {
const lines = text.split(/\r\n?|\n/);
const indentation = guessIndentation(lines);
for (const lineText of lines) {
const line = indentation ? lineText.slice(indentation) : lineText;
if (line.length) {
writeLi... | Emits a list without brackets or raising events.
NOTE: You probably don't want to call this directly and should be using `emitList` or `emitExpressionList` instead. | typescript | src/compiler/emitter.ts | 4,958 | [
"text"
] | true | 3 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
listConsumerGroupOffsets | default ListConsumerGroupOffsetsResult listConsumerGroupOffsets(String groupId, ListConsumerGroupOffsetsOptions options) {
ListConsumerGroupOffsetsSpec groupSpec = new ListConsumerGroupOffsetsSpec();
// We can use the provided options with the batched API, which uses topic partitions from
// th... | List the consumer group offsets available in the cluster.
@param options The options to use when listing the consumer group offsets.
@return The ListConsumerGroupOffsetsResult | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 910 | [
"groupId",
"options"
] | ListConsumerGroupOffsetsResult | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false |
create_tuning_job | def create_tuning_job(
self,
config: dict,
wait_for_completion: bool = True,
check_interval: int = 30,
max_ingestion_time: int | None = None,
):
"""
Start a hyperparameter tuning job.
A hyperparameter tuning job finds the best version of a model by ru... | Start a hyperparameter tuning job.
A hyperparameter tuning job finds the best version of a model by running
many training jobs on your dataset using the algorithm you choose and
values for hyperparameters within ranges that you specify. It then
chooses the hyperparameter values that result in a model that performs
the... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 342 | [
"self",
"config",
"wait_for_completion",
"check_interval",
"max_ingestion_time"
] | true | 2 | 7.92 | apache/airflow | 43,597 | sphinx | false | |
truncateSync | function truncateSync(path, len) {
if (len === undefined) {
len = 0;
}
// Allow error to be thrown, but still close fd.
const fd = fs.openSync(path, 'r+');
try {
fs.ftruncateSync(fd, len);
} finally {
fs.closeSync(fd);
}
} | Synchronously truncates the file.
@param {string | Buffer | URL} path
@param {number} [len]
@returns {void} | javascript | lib/fs.js | 1,057 | [
"path",
"len"
] | false | 2 | 6.16 | nodejs/node | 114,839 | jsdoc | false | |
isTypeArgumentOrParameterOrAssertion | function isTypeArgumentOrParameterOrAssertion(token: TextRangeWithKind, parent: Node): boolean {
if (token.kind !== SyntaxKind.LessThanToken && token.kind !== SyntaxKind.GreaterThanToken) {
return false;
}
switch (parent.kind) {
case SyntaxKind.TypeReference:
case SyntaxKind.Ty... | A rule takes a two tokens (left/right) and a particular context
for which you're meant to look at them. You then declare what should the
whitespace annotation be between these tokens via the action param.
@param debugName Name to print
@param left The left side of the comparison
@param right The right side of the... | typescript | src/services/formatting/rules.ts | 840 | [
"token",
"parent"
] | true | 3 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
create | @SafeVarargs
public static <E extends @Nullable Object> CompactHashSet<E> create(E... elements) {
CompactHashSet<E> set = createWithExpectedSize(elements.length);
Collections.addAll(set, elements);
return set;
} | Creates a <i>mutable</i> {@code CompactHashSet} instance containing the given elements in
unspecified order.
@param elements the elements that the set should contain
@return a new {@code CompactHashSet} containing those elements (minus duplicates) | java | android/guava/src/com/google/common/collect/CompactHashSet.java | 106 | [] | true | 1 | 6.08 | google/guava | 51,352 | javadoc | false | |
getLastModified | @Override
public long getLastModified(Object templateSource) {
Resource resource = (Resource) templateSource;
try {
return resource.lastModified();
}
catch (IOException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Could not obtain last-modified timestamp for FreeMarker template in " +
res... | Create a new {@code SpringTemplateLoader}.
@param resourceLoader the Spring ResourceLoader to use
@param templateLoaderPath the template loader path to use | java | spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java | 93 | [
"templateSource"
] | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.