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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
serializeTypeReferenceNode | function serializeTypeReferenceNode(node: TypeReferenceNode): SerializedTypeNode {
const kind = resolver.getTypeReferenceSerializationKind(node.typeName, currentNameScope ?? currentLexicalScope);
switch (kind) {
case TypeReferenceSerializationKind.Unknown:
// From conditi... | Serializes a TypeReferenceNode to an appropriate JS constructor value for use with decorator type metadata.
@param node The type reference node. | typescript | src/compiler/transformers/typeSerializer.ts | 490 | [
"node"
] | true | 5 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
_replace_locals | def _replace_locals(tok: tuple[int, str]) -> tuple[int, str]:
"""
Replace local variables with a syntactically valid name.
Parameters
----------
tok : tuple of int, str
ints correspond to the all caps constants in the tokenize module
Returns
-------
tuple of int, str
Ei... | Replace local variables with a syntactically valid name.
Parameters
----------
tok : tuple of int, str
ints correspond to the all caps constants in the tokenize module
Returns
-------
tuple of int, str
Either the input or token or the replacement values
Notes
-----
This is somewhat of a hack in that we rewri... | python | pandas/core/computation/expr.py | 99 | [
"tok"
] | tuple[int, str] | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
from | public static Object from(BeanFactory beanFactory, String beanName, Class<?> beanType) {
ConfigurationPropertiesBean bean = ConfigurationPropertiesBean.forValueObject(beanType, beanName);
ConfigurationPropertiesBinder binder = ConfigurationPropertiesBinder.get(beanFactory);
try {
return binder.bindOrCreate(bea... | Create an immutable {@link ConfigurationProperties} instance for the specified
{@code beanName} and {@code beanType} using the specified {@link BeanFactory}.
@param beanFactory the bean factory to use
@param beanName the name of the bean
@param beanType the type of the bean
@return an instance from the specified bean | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConstructorBound.java | 40 | [
"beanFactory",
"beanName",
"beanType"
] | Object | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
visitAwaitExpression | function visitAwaitExpression(node: AwaitExpression): Expression {
if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) {
return setOriginalNode(
setTextRange(
factory.createYieldExpression(/*asteriskToken*/ und... | @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the
expression of an `ExpressionStatement`). | typescript | src/compiler/transformers/es2018.ts | 395 | [
"node"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
enterIfInterruptibly | public boolean enterIfInterruptibly(Guard guard) throws InterruptedException {
if (guard.monitor != this) {
throw new IllegalMonitorStateException();
}
ReentrantLock lock = this.lock;
lock.lockInterruptibly();
boolean satisfied = false;
try {
return satisfied = guard.isSatisfied();
... | Enters this monitor if the guard is satisfied. Blocks indefinitely acquiring the lock, but does
not wait for the guard to be satisfied, and may be interrupted.
@return whether the monitor was entered, which guarantees that the guard is now satisfied
@throws InterruptedException if interrupted while waiting | java | android/guava/src/com/google/common/util/concurrent/Monitor.java | 742 | [
"guard"
] | true | 3 | 6.56 | google/guava | 51,352 | javadoc | false | |
collapseOverlappingBuckets | public ZeroBucket collapseOverlappingBuckets(BucketIterator buckets) {
long collapsedCount = 0;
long highestCollapsedIndex = 0;
while (buckets.hasNext() && compareExponentiallyScaledValues(buckets.peekIndex(), buckets.scale(), index(), scale()) < 0) {
highestCollapsedIndex = buckets... | Collapses all buckets from the given iterator whose lower boundaries are smaller than the zero threshold.
The iterator is advanced to point at the first, non-collapsed bucket.
@param buckets The iterator whose buckets may be collapsed.
@return A potentially updated {@link ZeroBucket} with the collapsed buckets' counts ... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ZeroBucket.java | 245 | [
"buckets"
] | ZeroBucket | true | 5 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false |
as_json_table_type | def as_json_table_type(x: DtypeObj) -> str:
"""
Convert a NumPy / pandas type to its corresponding json_table.
Parameters
----------
x : np.dtype or ExtensionDtype
Returns
-------
str
the Table Schema data types
Notes
-----
This table shows the relationship between... | Convert a NumPy / pandas type to its corresponding json_table.
Parameters
----------
x : np.dtype or ExtensionDtype
Returns
-------
str
the Table Schema data types
Notes
-----
This table shows the relationship between NumPy / pandas dtypes,
and Table Schema dtypes.
============== =================
Pandas type ... | python | pandas/io/json/_table_schema.py | 55 | [
"x"
] | str | true | 9 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
withGenerator | public BeanInstanceSupplier<T> withGenerator(ThrowingBiFunction<RegisteredBean, AutowiredArguments, T> generator) {
Assert.notNull(generator, "'generator' must not be null");
return new BeanInstanceSupplier<>(this.lookup, null, generator, this.shortcutBeanNames);
} | Return a new {@link BeanInstanceSupplier} instance that uses the specified
{@code generator} bi-function to instantiate the underlying bean.
@param generator a {@link ThrowingBiFunction} that uses the
{@link RegisteredBean} and resolved {@link AutowiredArguments} to
instantiate the underlying bean
@return a new {@link ... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 156 | [
"generator"
] | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
onFiber | inline bool onFiber() {
auto fm = FiberManager::getFiberManagerUnsafe();
return fm ? fm->hasActiveFiber() : false;
} | @return true iff we are running in a fiber's context | cpp | folly/fibers/FiberManagerInternal.h | 634 | [] | true | 2 | 7.36 | facebook/folly | 30,157 | doxygen | false | |
format | @Deprecated
@Override
public StringBuffer format(final long millis, final StringBuffer buf) {
return printer.format(millis, buf);
} | Formats a millisecond {@code long} value into the supplied {@link StringBuffer}.
@param millis the millisecond value to format.
@param buf the buffer to format into.
@return the specified string buffer.
@since 2.1
@deprecated Use {{@link #format(long, Appendable)}. | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 510 | [
"millis",
"buf"
] | StringBuffer | true | 1 | 6.4 | apache/commons-lang | 2,896 | javadoc | false |
all | public KafkaFuture<Void> all() {
final KafkaFutureImpl<Void> result = new KafkaFutureImpl<>();
partitions().whenComplete(
(topicPartitions, throwable) -> {
if (throwable != null) {
result.completeExceptionally(throwable);
}... | Return a future which succeeds if all the topic elections succeed. | java | clients/src/main/java/org/apache/kafka/clients/admin/ElectLeadersResult.java | 54 | [] | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
format_html_join | def format_html_join(sep, format_string, args_generator):
"""
A wrapper of format_html, for the common case of a group of arguments that
need to be formatted using the same format string, and then joined using
'sep'. 'sep' is also passed through conditional_escape.
'args_generator' should be an ite... | A wrapper of format_html, for the common case of a group of arguments that
need to be formatted using the same format string, and then joined using
'sep'. 'sep' is also passed through conditional_escape.
'args_generator' should be an iterator that returns the sequence of 'args'
that will be passed to format_html.
Exa... | python | django/utils/html.py | 148 | [
"sep",
"format_string",
"args_generator"
] | false | 2 | 7.68 | django/django | 86,204 | unknown | false | |
k | public abstract double k(double q, double normalizer); | Converts a quantile to the k-scale. The normalizer value depends on compression and (possibly) number of points
in the digest. #normalizer(double, double)
@param q The quantile
@param normalizer The normalizer value which depends on compression and (possibly) number of points in the
digest.
... | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/ScaleFunction.java | 508 | [
"q",
"normalizer"
] | true | 1 | 6.48 | elastic/elasticsearch | 75,680 | javadoc | false | |
maybeCloseFetchSessions | protected void maybeCloseFetchSessions(final Timer timer) {
final List<RequestFuture<ClientResponse>> requestFutures = sendFetchesInternal(
prepareCloseFetchSessionRequests(),
this::handleCloseFetchSessionSuccess,
this::handleCloseFetchSessionFailure
);
... | 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 | 122 | [
"timer"
] | void | true | 4 | 7.2 | apache/kafka | 31,560 | javadoc | false |
DialogContent | function DialogContent({
unsupportedBridgeProtocol,
}: {
unsupportedBridgeProtocol: BridgeProtocol,
}) {
const {version, minNpmVersion, maxNpmVersion} = unsupportedBridgeProtocol;
let instructions;
if (maxNpmVersion === null) {
const upgradeInstructions = `npm i -g react-devtools@^${minNpmVersion}`;
... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/UnsupportedBridgeProtocolDialog.js | 68 | [] | false | 3 | 6.16 | facebook/react | 241,750 | jsdoc | false | |
saturatedPow | @SuppressWarnings("ShortCircuitBoolean")
public static int saturatedPow(int b, int k) {
checkNonNegative("exponent", k);
switch (b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case -1:
return ((k & 1) == 0) ? 1 : -1;
case 2:
if (k >= Integer.SIZ... | Returns the {@code b} to the {@code k}th power, unless it would overflow or underflow in which
case {@code Integer.MAX_VALUE} or {@code Integer.MIN_VALUE} is returned, respectively.
@since 20.0 | java | android/guava/src/com/google/common/math/IntMath.java | 571 | [
"b",
"k"
] | true | 10 | 6 | google/guava | 51,352 | javadoc | false | |
coerceDate | private static void coerceDate(Properties properties, String key) {
String value = properties.getProperty(key);
if (value != null) {
try {
String updatedValue = String
.valueOf(DateTimeFormatter.ISO_INSTANT.parse(value, Instant::from).toEpochMilli());
properties.setProperty(key, updatedValue);
}
... | Return the timestamp of the build or {@code null}.
<p>
If the original value could not be parsed properly, it is still available with the
{@code time} key.
@return the build time
@see #get(String) | java | core/spring-boot/src/main/java/org/springframework/boot/info/BuildProperties.java | 97 | [
"properties",
"key"
] | void | true | 3 | 7.2 | spring-projects/spring-boot | 79,428 | javadoc | false |
opj_int_max | static INLINE OPJ_INT32 opj_int_max(OPJ_INT32 a, OPJ_INT32 b)
{
return (a > b) ? a : b;
} | Get the maximum of two integers
@return Returns a if a > b else b | cpp | 3rdparty/openjpeg/openjp2/opj_intmath.h | 74 | [
"a",
"b"
] | true | 2 | 6.48 | opencv/opencv | 85,374 | doxygen | false | |
getAndIncrement | public long getAndIncrement() {
final long 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/MutableLong.java | 247 | [] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
streamingIterator | CloseableIterator<Record> streamingIterator(BufferSupplier decompressionBufferSupplier); | Return a streaming iterator which basically delays decompression of the record stream until the records
are actually asked for using {@link Iterator#next()}. If the message format does not support streaming
iteration, then the normal iterator is returned. Either way, callers should ensure that the iterator is closed.
@... | java | clients/src/main/java/org/apache/kafka/common/record/RecordBatch.java | 240 | [
"decompressionBufferSupplier"
] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
finishToValueAndCloser | public void finishToValueAndCloser(
ValueAndCloserConsumer<? super V> consumer, Executor executor) {
checkNotNull(consumer);
if (!compareAndUpdateState(OPEN, WILL_CREATE_VALUE_AND_CLOSER)) {
switch (state.get()) {
case SUBSUMED:
throw new IllegalStateException(
"Canno... | Marks this step as the last step in the {@code ClosingFuture} pipeline. When this step is done,
{@code receiver} will be called with an object that contains the result of the operation. The
receiver can store the {@link ValueAndCloser} outside the receiver for later synchronous use.
<p>After calling this method, you ma... | java | android/guava/src/com/google/common/util/concurrent/ClosingFuture.java | 1,039 | [
"consumer",
"executor"
] | void | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
add | @Override
public void add(double x, long w) {
reserve(w);
if (mergingDigest != null) {
mergingDigest.add(x, w);
} else {
sortingDigest.add(x, w);
}
} | 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 | 99 | [
"x",
"w"
] | void | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
validate_metadata | def validate_metadata(self, *, method, params):
"""Validate given metadata for a method.
This raises a ``TypeError`` if some of the passed metadata are not
understood by child objects.
Parameters
----------
method : str
The name of the :term:`router`'s metho... | Validate given metadata for a method.
This raises a ``TypeError`` if some of the passed metadata are not
understood by child objects.
Parameters
----------
method : str
The name of the :term:`router`'s method through which the metadata is
routed. For example, if called inside the :term:`fit` method of a route... | python | sklearn/utils/_metadata_requests.py | 1,112 | [
"self",
"method",
"params"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
get_connection_with_tls_context | def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None):
"""Returns a urllib3 connection for the given request and TLS settings.
This should not be called from user code, and is only exposed for use
when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapt... | Returns a urllib3 connection for the given request and TLS settings.
This should not be called from user code, and is only exposed for use
when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param request:
The :class:`PreparedRequest <PreparedRequest>` object to be sent
over the connect... | python | src/requests/adapters.py | 423 | [
"self",
"request",
"verify",
"proxies",
"cert"
] | false | 4 | 6.08 | psf/requests | 53,586 | sphinx | false | |
setupWebsocket | function setupWebsocket() {
if (getOptionValue('--no-experimental-websocket')) {
delete globalThis.WebSocket;
delete globalThis.CloseEvent;
}
} | 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 | 347 | [] | false | 2 | 6.8 | nodejs/node | 114,839 | jsdoc | false | |
on_chord_body | def on_chord_body(self, sig, **header) -> dict:
"""Method that is called on chord body stamping.
Arguments:
sig (chord): chord that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: headers to update.
... | Method that is called on chord body stamping.
Arguments:
sig (chord): chord that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: headers to update. | python | celery/canvas.py | 197 | [
"self",
"sig"
] | dict | true | 1 | 6.88 | celery/celery | 27,741 | google | false |
findSource | private File findSource(URL location) throws IOException, URISyntaxException {
URLConnection connection = location.openConnection();
if (connection instanceof JarURLConnection jarURLConnection) {
return getRootJarFile(jarURLConnection.getJarFile());
}
return new File(location.toURI());
} | Create a new {@link ApplicationHome} instance for the specified source class.
@param sourceClass the source class or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java | 124 | [
"location"
] | File | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_transform_params | def get_transform_params(
self,
split_node: torch.fx.Node,
next_users: list[torch.fx.Node],
user_inputs_list: list[list[torch.fx.Node | _Range]],
) -> list[list[_TransformParam]] | None:
"""
Figure out what transforms are needed for each input to each cat node.
... | Figure out what transforms are needed for each input to each cat node.
We replace a split node with an unflatten followed by a movedim | python | torch/_inductor/fx_passes/split_cat.py | 844 | [
"self",
"split_node",
"next_users",
"user_inputs_list"
] | list[list[_TransformParam]] | None | true | 12 | 6 | pytorch/pytorch | 96,034 | unknown | false |
insertCaptureNewTargetIfNeeded | function insertCaptureNewTargetIfNeeded(statements: Statement[], node: FunctionLikeDeclaration): Statement[] {
if (hierarchyFacts & HierarchyFacts.NewTarget) {
let newTarget: Expression;
switch (node.kind) {
case SyntaxKind.ArrowFunction:
return s... | Adds a statement to capture the `this` of a function declaration if it is needed.
NOTE: This must be executed *after* the subtree has been visited.
@param statements The statements for the new function body.
@param node A node. | typescript | src/compiler/transformers/es2015.ts | 2,177 | [
"statements",
"node"
] | true | 2 | 6.96 | microsoft/TypeScript | 107,154 | jsdoc | false | |
hashCode | static int hashCode(ExponentialHistogram histogram) {
int hash = histogram.scale();
hash = 31 * hash + Double.hashCode(histogram.sum());
hash = 31 * hash + Long.hashCode(histogram.valueCount());
hash = 31 * hash + Double.hashCode(histogram.min());
hash = 31 * hash + Double.hashCo... | Default hash code implementation to be used with {@link #equals(ExponentialHistogram, ExponentialHistogram)}.
@param histogram the histogram to hash
@return the hash code | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogram.java | 206 | [
"histogram"
] | true | 1 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
asContributors | private List<ConfigDataEnvironmentContributor> asContributors(
Map<ConfigDataResolutionResult, ConfigData> imported) {
List<ConfigDataEnvironmentContributor> contributors = new ArrayList<>(imported.size() * 5);
imported.forEach((resolutionResult, data) -> {
ConfigDataLocation location = resolutionResult.getLo... | Processes imports from all active contributors and return a new
{@link ConfigDataEnvironmentContributors} instance.
@param importer the importer used to import {@link ConfigData}
@param activationContext the current activation context or {@code null} if the
context has not yet been created
@return a {@link ConfigDataEn... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java | 172 | [
"imported"
] | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
clearMetadataCache | @Override
public void clearMetadataCache() {
super.clearMetadataCache();
this.mergedBeanDefinitionHolders.clear();
clearByTypeCache();
} | Determine whether the specified bean definition qualifies as an autowire candidate,
to be injected into other beans which declare a dependency of matching type.
@param beanName the name of the bean definition to check
@param mbd the merged bean definition to check
@param descriptor the descriptor of the dependency to r... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 990 | [] | void | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
checkState | boolean checkState(); | Checks the state of this circuit breaker and changes it if necessary. The return
value indicates whether the circuit breaker is now in state <em>closed</em>; a value
of <strong>true</strong> typically means that the current operation can continue.
@return <strong>true</strong> if the circuit breaker is now closed;
<str... | java | src/main/java/org/apache/commons/lang3/concurrent/CircuitBreaker.java | 51 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
_check_ns_shape_dtype | def _check_ns_shape_dtype(
actual: Array,
desired: Array,
check_dtype: bool,
check_shape: bool,
check_scalar: bool,
) -> ModuleType: # numpydoc ignore=RT03
"""
Assert that namespace, shape and dtype of the two arrays match.
Parameters
----------
actual : Array
The array... | Assert that namespace, shape and dtype of the two arrays match.
Parameters
----------
actual : Array
The array produced by the tested function.
desired : Array
The expected array (typically hardcoded).
check_dtype, check_shape : bool, default: True
Whether to check agreement between actual and desired dtyp... | python | sklearn/externals/array_api_extra/_lib/_testing.py | 34 | [
"actual",
"desired",
"check_dtype",
"check_shape",
"check_scalar"
] | ModuleType | true | 9 | 6.8 | scikit-learn/scikit-learn | 64,340 | numpy | false |
cleanupLoggingSystem | void cleanupLoggingSystem() {
if (this.loggingSystem != null) {
this.loggingSystem.cleanUp();
}
} | The name of the {@link Lifecycle} bean used to handle cleanup. | java | core/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java | 277 | [] | void | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
slowRemoveIfForRemainingElements | private static <T extends @Nullable Object> void slowRemoveIfForRemainingElements(
List<T> list, Predicate<? super T> predicate, int to, int from) {
// Here we know that:
// * (to < from) and that both are valid indices.
// * Everything with (index < to) should be kept.
// * Everything with (to <=... | Removes, from an iterable, every element that satisfies the provided predicate.
<p>Removals may or may not happen immediately as each element is tested against the predicate.
The behavior of this method is not specified if {@code predicate} is dependent on {@code
removeFrom}.
<p><b>Java 8+ users:</b> if {@code removeFr... | java | android/guava/src/com/google/common/collect/Iterables.java | 228 | [
"list",
"predicate",
"to",
"from"
] | void | true | 4 | 7.6 | google/guava | 51,352 | javadoc | false |
asarrays | def asarrays(
a: Array | complex,
b: Array | complex,
xp: ModuleType,
) -> tuple[Array, Array]:
"""
Ensure both `a` and `b` are arrays.
If `b` is a python scalar, it is converted to the same dtype as `a`, and vice versa.
Behavior is not specified when mixing a Python ``float`` and an array... | Ensure both `a` and `b` are arrays.
If `b` is a python scalar, it is converted to the same dtype as `a`, and vice versa.
Behavior is not specified when mixing a Python ``float`` and an array with an
integer data type; this may give ``float32``, ``float64``, or raise an exception.
Behavior is implementation-specific.
... | python | sklearn/externals/array_api_extra/_lib/_utils/_helpers.py | 156 | [
"a",
"b",
"xp"
] | tuple[Array, Array] | true | 9 | 6.8 | scikit-learn/scikit-learn | 64,340 | numpy | false |
_drop_labels_or_levels | def _drop_labels_or_levels(self, keys, axis: AxisInt = 0):
"""
Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (... | Drop labels and/or levels for the given `axis`.
For each key in `keys`:
- (axis=0): If key matches a column label then drop the column.
Otherwise if key matches an index level then drop the level.
- (axis=1): If key matches an index label then drop the row.
Otherwise if key matches a column level then drop... | python | pandas/core/generic.py | 1,802 | [
"self",
"keys",
"axis"
] | true | 10 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false | |
endBlockScope | function endBlockScope() {
Debug.assert(state > TransformationState.Uninitialized, "Cannot end a block scope during initialization.");
Debug.assert(state < TransformationState.Completed, "Cannot end a block scope after transformation has completed.");
const statements: Statement[] | undefined... | Ends a block scope. The previous set of block hoisted variables are restored. Any hoisted declarations are returned. | typescript | src/compiler/transformer.ts | 600 | [] | false | 3 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getMBeanName | static String getMBeanName(String prefix, MetricName metricName) {
StringBuilder mBeanName = new StringBuilder();
mBeanName.append(prefix);
mBeanName.append(":type=");
mBeanName.append(metricName.group());
for (Map.Entry<String, String> entry : metricName.tags().entrySet()) {
... | @param metricName
@return standard JMX MBean name in the following format domainName:type=metricType,key1=val1,key2=val2 | java | clients/src/main/java/org/apache/kafka/common/metrics/JmxReporter.java | 176 | [
"prefix",
"metricName"
] | String | true | 3 | 6.64 | apache/kafka | 31,560 | javadoc | false |
buildTrustConfig | protected SslTrustConfig buildTrustConfig(
Path basePath,
SslVerificationMode verificationMode,
SslKeyConfig keyConfig,
@Nullable Set<X509Field> restrictedTrustFields
) {
final List<String> certificateAuthorities = resolveListSetting(CERTIFICATE_AUTHORITIES, Function.identity... | 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 | 338 | [
"basePath",
"verificationMode",
"keyConfig",
"restrictedTrustFields"
] | SslTrustConfig | true | 6 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
incrementalAlterConfigs | AlterConfigsResult incrementalAlterConfigs(Map<ConfigResource,
Collection<AlterConfigOp>> configs, AlterConfigsOptions options); | Incrementally update the configuration for the specified resources.
<p>
Updates are not transactional so they may succeed for some resources while fail for others. The configs for
a particular resource are updated atomically.
<p>
The following exceptions can be anticipated when calling {@code get()} on the futures obta... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 530 | [
"configs",
"options"
] | AlterConfigsResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
convertExportsDotXEquals_replaceNode | function convertExportsDotXEquals_replaceNode(name: string | undefined, exported: Expression, useSitesToUnqualify: Map<Node, Node> | undefined): Statement {
const modifiers = [factory.createToken(SyntaxKind.ExportKeyword)];
switch (exported.kind) {
case SyntaxKind.FunctionExpression: {
c... | Convert `module.exports = { ... }` to individual exports..
We can't always do this if the module has interesting members -- then it will be a default export instead. | typescript | src/services/codefixes/convertToEsModule.ts | 430 | [
"name",
"exported",
"useSitesToUnqualify"
] | true | 3 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
format | @Override
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
return toAppendTo.append(printer.format(obj));
} | Formats a {@link Date}, {@link Calendar} or {@link Long} (milliseconds) object. This method is an implementation of
{@link Format#format(Object, StringBuffer, FieldPosition)}
@param obj the object to format.
@param toAppendTo the buffer to append to.
@param pos the position, ignored.
@return the given buf... | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 525 | [
"obj",
"toAppendTo",
"pos"
] | StringBuffer | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
addClassAnnotationIfNeeded | private void addClassAnnotationIfNeeded() {
if (annotationNeeded) {
// logger.debug("Adding {} annotation", ENTITLEMENT_ANNOTATION);
AnnotationVisitor av = cv.visitAnnotation(ENTITLEMENT_ANNOTATION_DESCRIPTOR, true);
if (av != null) {
av.vi... | A class annotation can be added via visitAnnotation; we need to call visitAnnotation after all other visitAnnotation
calls (in case one of them detects our annotation is already present), but before any other subsequent visit* method is called
(up to visitMethod -- if no visitMethod is called, there is nothing to instr... | java | libs/entitlement/asm-provider/src/main/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumenterImpl.java | 223 | [] | void | true | 3 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
readWriteLock | public static Striped<ReadWriteLock> readWriteLock(int stripes) {
return custom(stripes, ReentrantReadWriteLock::new);
} | Creates a {@code Striped<ReadWriteLock>} with eagerly initialized, strongly referenced
read-write locks. Every lock is reentrant.
@param stripes the minimum number of stripes (locks) required
@return a new {@code Striped<ReadWriteLock>} | java | android/guava/src/com/google/common/util/concurrent/Striped.java | 268 | [
"stripes"
] | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false | |
getUnderlyingFile | private @Nullable File getUnderlyingFile(Resource resource) {
try {
if (resource instanceof ClassPathResource || resource instanceof FileSystemResource
|| resource instanceof FileUrlResource) {
return resource.getFile().getAbsoluteFile();
}
}
catch (IOException ex) {
// Ignore
}
return null;... | Return the profile or {@code null} if the resource is not profile specific.
@return the profile or {@code null}
@since 2.4.6 | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java | 133 | [
"resource"
] | File | true | 5 | 7.2 | spring-projects/spring-boot | 79,428 | javadoc | false |
setMaxTimestamp | @Override
public void setMaxTimestamp(TimestampType timestampType, long maxTimestamp) {
long currentMaxTimestamp = maxTimestamp();
// We don't need to recompute crc if the timestamp is not updated.
if (timestampType() == timestampType && currentMaxTimestamp == maxTimestamp)
retur... | 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 | 370 | [
"timestampType",
"maxTimestamp"
] | void | true | 3 | 7.04 | apache/kafka | 31,560 | javadoc | false |
toNumber | function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
... | Converts `value` to a number.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to process.
@returns {number} Returns the number.
@example
_.toNumber(3.2);
// => 3.2
_.toNumber(Number.MIN_VALUE);
// => 5e-324
_.toNumber(Infinity);
// => Infinity
_.toNumber('3.2');
// => 3.2 | javascript | lodash.js | 12,564 | [
"value"
] | false | 12 | 7.04 | lodash/lodash | 61,490 | jsdoc | false | |
removeOccurrences | @CanIgnoreReturnValue
public static boolean removeOccurrences(
Multiset<?> multisetToModify, Iterable<?> occurrencesToRemove) {
if (occurrencesToRemove instanceof Multiset) {
return removeOccurrences(multisetToModify, (Multiset<?>) occurrencesToRemove);
} else {
checkNotNull(multisetToModify... | For each occurrence of an element {@code e} in {@code occurrencesToRemove}, removes one
occurrence of {@code e} in {@code multisetToModify}.
<p>Equivalently, this method modifies {@code multisetToModify} so that {@code
multisetToModify.count(e)} is set to {@code Math.max(0, multisetToModify.count(e) -
Iterables.frequen... | java | android/guava/src/com/google/common/collect/Multisets.java | 762 | [
"multisetToModify",
"occurrencesToRemove"
] | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false | |
before | function before(n, func) {
var result;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n > 0) {
result = func.apply(this, arguments);
}
if (n <= 1) {
func = undefined;
... | Creates a function that invokes `func`, with the `this` binding and arguments
of the created function, while it's called less than `n` times. Subsequent
calls to the created function return the result of the last `func` invocation.
@static
@memberOf _
@since 3.0.0
@category Function
@param {number} n The number of call... | javascript | lodash.js | 10,149 | [
"n",
"func"
] | false | 4 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
is_container | def is_container(obj) -> bool:
"""Test if an object is a container (iterable) but not a string."""
if isinstance(obj, Proxy):
# Proxy of any object is considered a container because it implements __iter__
# to forward the call to the lazily initialized object
# Unwrap Proxy before checki... | Test if an object is a container (iterable) but not a string. | python | airflow-core/src/airflow/utils/helpers.py | 106 | [
"obj"
] | bool | true | 3 | 6 | apache/airflow | 43,597 | unknown | false |
_forward_pass_fast | def _forward_pass_fast(self, X, check_input=True):
"""Predict using the trained model
This is the same as _forward_pass but does not record the activations
of all layers and only returns the last layer's activation.
Parameters
----------
X : {array-like, sparse matrix} ... | Predict using the trained model
This is the same as _forward_pass but does not record the activations
of all layers and only returns the last layer's activation.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The input data.
check_input : bool, default=True
Perform inp... | python | sklearn/neural_network/_multilayer_perceptron.py | 189 | [
"self",
"X",
"check_input"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
quantile | def quantile(self, q: float | list[float] | AnyArrayLike = 0.5, **kwargs):
"""
Return value at the given quantile.
Parameters
----------
q : float or array-like, default 0.5 (50% quantile)
Returns
-------
DataFrame or Series
Quantile of value... | Return value at the given quantile.
Parameters
----------
q : float or array-like, default 0.5 (50% quantile)
Returns
-------
DataFrame or Series
Quantile of values within each group.
See Also
--------
Series.quantile
Return a series, where the index is q and the values are the quantiles.
DataFrame.quantile
... | python | pandas/core/resample.py | 1,895 | [
"self",
"q"
] | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false | |
stubArray | function stubArray() {
return [];
} | This method returns a new empty array.
@static
@memberOf _
@since 4.13.0
@category Util
@returns {Array} Returns the new empty array.
@example
var arrays = _.times(2, _.stubArray);
console.log(arrays);
// => [[], []]
console.log(arrays[0] === arrays[1]);
// => false | javascript | lodash.js | 16,151 | [] | false | 1 | 6.96 | lodash/lodash | 61,490 | jsdoc | false | |
update_providers_next_version | def update_providers_next_version():
"""
Scan all provider pyproject.toml files for dependencies with "# use next version" comment
and update them to use the current version from the referenced provider's pyproject.toml.
"""
from airflow_breeze.utils.packages import update_providers_with_next_versio... | Scan all provider pyproject.toml files for dependencies with "# use next version" comment
and update them to use the current version from the referenced provider's pyproject.toml. | python | dev/breeze/src/airflow_breeze/commands/release_management_commands.py | 3,032 | [] | false | 5 | 6.4 | apache/airflow | 43,597 | unknown | false | |
removeFrom | long removeFrom(long time) {
return time - this.defaultTimeZone.getOffset(time);
} | Remove the default offset from the given time.
@param time the time to remove the default offset from
@return the time with the default offset removed | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultTimeZoneOffset.java | 54 | [
"time"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
noResult | @SuppressWarnings("unchecked")
public static <R> InvocationResult<R> noResult() {
return (InvocationResult<R>) NONE;
} | Return an {@link InvocationResult} instance representing no result.
@param <R> the result type
@return an {@link InvocationResult} | java | core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java | 441 | [] | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
ensureUseStrict | function ensureUseStrict(statements: NodeArray<Statement>): NodeArray<Statement> {
const foundUseStrict = findUseStrictPrologue(statements);
if (!foundUseStrict) {
return setTextRange(createNodeArray<Statement>([createUseStrictPrologue(), ...statements]), statements);
}
... | Ensures "use strict" directive is added
@param statements An array of statements | typescript | src/compiler/factory/nodeFactory.ts | 6,944 | [
"statements"
] | true | 2 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
transitionToFenced | public void transitionToFenced() {
if (state == MemberState.PREPARE_LEAVING) {
log.info("Member {} with epoch {} got fenced but it is already preparing to leave " +
"the group, so it will stop sending heartbeat and won't attempt to send the " +
"leave request ... | Transition the member to the FENCED state, where the member will release the assignment by
calling the onPartitionsLost callback, and when the callback completes, it will transition
to {@link MemberState#JOINING} to rejoin the group. This is expected to be invoked when
the heartbeat returns a FENCED_MEMBER_EPOCH or UNK... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 387 | [] | void | true | 6 | 6.72 | apache/kafka | 31,560 | javadoc | false |
preprocessFlamechart | function preprocessFlamechart(rawData: TimelineEvent[]): Flamechart {
let parsedData;
try {
parsedData = importFromChromeTimeline(rawData, 'react-devtools');
} catch (error) {
// Assume any Speedscope errors are caused by bad profiles
const errorToRethrow = new InvalidProfileError(error.message);
... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-timeline/src/import-worker/preprocessData.js | 955 | [] | false | 2 | 6.4 | facebook/react | 241,750 | jsdoc | false | |
baseTimestamp | public long baseTimestamp() {
return buffer.getLong(BASE_TIMESTAMP_OFFSET);
} | 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 | 165 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
getVersionedContentEntry | private ZipContent.Entry getVersionedContentEntry(String name) {
// NOTE: we can't call isMultiRelease() directly because it's a final method and
// it inspects the container jar. We use ManifestInfo instead.
if (BASE_VERSION >= this.version || name.startsWith(META_INF) || !getManifestInfo().isMultiRelease()) {
... | Return if an entry with the given name exists.
@param name the name to check
@return if the entry exists | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java | 273 | [
"name"
] | true | 7 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
throttleTimeMs | @Override
public int throttleTimeMs() {
return data.throttleTimeMs();
} | The number of each type of error in the response, including {@link Errors#NONE} and top-level errors as well as
more specifically scoped errors (such as topic or partition-level errors).
@return A count of errors. | java | clients/src/main/java/org/apache/kafka/common/requests/AllocateProducerIdsResponse.java | 53 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
currentLag | @Override
public OptionalLong currentLag(TopicPartition topicPartition) {
return delegate.currentLag(topicPartition);
} | Get the consumer's current lag on the partition. Returns an "empty" {@link OptionalLong} if the lag is not known,
for example if there is no position yet, or if the end offset is not known yet.
<p>
This method uses locally cached metadata. If the log end offset is not known yet, it triggers a request to fetch
the log e... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 1,722 | [
"topicPartition"
] | OptionalLong | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
getPropertyName | function getPropertyName(
child: AngularRoute,
property: 'title' | 'redirectTo' | 'matcher' | 'runGuardsAndResolvers',
) {
if (child[property] instanceof Function) {
return getClassOrFunctionName(child[property], property);
}
return child[property];
} | Get the display name for a function or class.
@param fn - The function or class to get the name from
@param defaultName - Optional name to check against. If the function name matches this value,
'[Function]' is returned instead
@returns The formatted name: class name, function name with '()', or '[Function]' for anonym... | typescript | devtools/projects/ng-devtools-backend/src/lib/router-tree.ts | 208 | [
"child",
"property"
] | false | 2 | 7.12 | angular/angular | 99,544 | jsdoc | false | |
deallocate | public void deallocate(ByteBuffer buffer, int size) {
lock.lock();
try {
if (size == this.poolableSize && size == buffer.capacity()) {
buffer.clear();
this.free.add(buffer);
} else {
this.nonPooledAvailableMemory += size;
... | Return buffers to the pool. If they are of the poolable size add them to the free list, otherwise just mark the
memory as free.
@param buffer The buffer to return
@param size The size of the buffer to mark as deallocated, note that this may be smaller than buffer.capacity
since the buffer may re-allocate it... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java | 260 | [
"buffer",
"size"
] | void | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false |
nextToken | public String nextToken() {
if (hasNext()) {
return tokens[tokenPos++];
}
return null;
} | Gets the next token from the String.
Equivalent to {@link #next()} except it returns null rather than
throwing {@link NoSuchElementException} when no tokens remain.
@return the next sequential token, or null when no more tokens are found. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 655 | [] | String | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
getRawType | public final Class<? super T> getRawType() {
if (runtimeType instanceof Class) {
@SuppressWarnings("unchecked") // raw type is T
Class<? super T> result = (Class<? super T>) runtimeType;
return result;
} else if (runtimeType instanceof ParameterizedType) {
@SuppressWarnings("unchecked") ... | Returns the raw type of {@code T}. Formally speaking, if {@code T} is returned by {@link
java.lang.reflect.Method#getGenericReturnType}, the raw type is what's returned by {@link
java.lang.reflect.Method#getReturnType} of the same method object. Specifically:
<ul>
<li>If {@code T} is a {@code Class} itself, {@code T}... | java | android/guava/src/com/google/common/reflect/TypeToken.java | 193 | [] | true | 3 | 7.04 | google/guava | 51,352 | javadoc | false | |
_hash_pandas_object | def _hash_pandas_object(
self, *, encoding: str, hash_key: str, categorize: bool
) -> npt.NDArray[np.uint64]:
"""
Hash a Categorical by hashing its categories, and then mapping the codes
to the hashes.
Parameters
----------
encoding : str
hash_key : s... | Hash a Categorical by hashing its categories, and then mapping the codes
to the hashes.
Parameters
----------
encoding : str
hash_key : str
categorize : bool
Ignored for Categorical.
Returns
-------
np.ndarray[uint64] | python | pandas/core/arrays/categorical.py | 2,179 | [
"self",
"encoding",
"hash_key",
"categorize"
] | npt.NDArray[np.uint64] | true | 4 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
deliveryCount | public Optional<Short> deliveryCount() {
return deliveryCount;
} | Get the delivery count for the record if available. Deliveries
are counted for records delivered by share groups.
@return the delivery count or empty when deliveries not counted | java | clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRecord.java | 256 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
generateCodeChallenge | async function generateCodeChallenge(codeVerifier: string): Promise<string> {
const encoder = new TextEncoder();
const data = encoder.encode(codeVerifier);
const digest = await crypto.subtle.digest('SHA-256', data);
// Base64url encode the digest
const base64String = btoa(String.fromCharCode(...new Uint8Array(dig... | Generates a PKCE code challenge from a code verifier using SHA-256.
@param codeVerifier The code verifier string
@returns A base64url-encoded SHA-256 hash of the code verifier | typescript | extensions/github-authentication/src/flows.ts | 135 | [
"codeVerifier"
] | true | 1 | 6.56 | microsoft/vscode | 179,840 | jsdoc | true | |
toMap | public Map<String, Map<String, Short>> toMap() {
return features.entrySet().stream().collect(
Collectors.toMap(
Map.Entry::getKey,
entry -> entry.getValue().toMap()));
} | @return A map representation of the underlying features. The returned value can be converted
back to Features using one of the from*FeaturesMap() APIs of this class. | java | clients/src/main/java/org/apache/kafka/common/feature/Features.java | 96 | [] | true | 1 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
invokeAdviceMethod | protected @Nullable Object invokeAdviceMethod(JoinPoint jp, @Nullable JoinPointMatch jpMatch,
@Nullable Object returnValue, @Nullable Throwable t) throws Throwable {
return invokeAdviceMethodWithGivenArgs(argBinding(jp, jpMatch, returnValue, t));
} | Invoke the advice method.
@param jpMatch the JoinPointMatch that matched this execution join point
@param returnValue the return value from the method execution (may be null)
@param ex the exception thrown by the method execution (may be null)
@return the invocation result
@throws Throwable in case of invocation failur... | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java | 627 | [
"jp",
"jpMatch",
"returnValue",
"t"
] | Object | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
withProfiles | ConfigDataActivationContext withProfiles(Profiles profiles) {
return new ConfigDataActivationContext(this.cloudPlatform, profiles);
} | Return a new {@link ConfigDataActivationContext} with specific profiles.
@param profiles the profiles
@return a new {@link ConfigDataActivationContext} with specific profiles | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataActivationContext.java | 74 | [
"profiles"
] | ConfigDataActivationContext | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
requestOffsetReset | public synchronized void requestOffsetReset(Collection<TopicPartition> partitions, AutoOffsetResetStrategy offsetResetStrategy) {
partitions.forEach(tp -> {
log.info("Seeking to {} offset of partition {}", offsetResetStrategy, tp);
assignedState(tp).reset(offsetResetStrategy);
})... | 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 | 789 | [
"partitions",
"offsetResetStrategy"
] | void | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
create | public static <E extends @Nullable Object> CompactHashSet<E> create(
Collection<? extends E> collection) {
CompactHashSet<E> set = createWithExpectedSize(collection.size());
set.addAll(collection);
return set;
} | Creates a <i>mutable</i> {@code CompactHashSet} instance containing the elements of the given
collection in unspecified order.
@param collection 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 | 92 | [
"collection"
] | true | 1 | 6.08 | google/guava | 51,352 | javadoc | false | |
trace | def trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None):
"""
Return the sum along diagonals of the array.
If `a` is 2-D, the sum along its diagonal with the given offset
is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i.
If `a` has more than two dimensions, then the axes sp... | Return the sum along diagonals of the array.
If `a` is 2-D, the sum along its diagonal with the given offset
is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i.
If `a` has more than two dimensions, then the axes specified by axis1 and
axis2 are used to determine the 2-D sub-arrays whose traces are ret... | python | numpy/_core/fromnumeric.py | 1,807 | [
"a",
"offset",
"axis1",
"axis2",
"dtype",
"out"
] | false | 3 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
addJsonPropertySource | private void addJsonPropertySource(ConfigurableEnvironment environment, PropertySource<?> source) {
MutablePropertySources sources = environment.getPropertySources();
String name = findPropertySource(sources);
if (sources.contains(name)) {
sources.addBefore(name, source);
}
else {
sources.addFirst(sourc... | Flatten the map keys using period separator.
@param map the map that should be flattened
@return the flattened map | java | core/spring-boot/src/main/java/org/springframework/boot/support/SpringApplicationJsonEnvironmentPostProcessor.java | 155 | [
"environment",
"source"
] | void | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
append | public StrBuilder append(final float value) {
return append(String.valueOf(value));
} | Appends a float value to the string builder using {@code String.valueOf}.
@param value the value to append
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 527 | [
"value"
] | StrBuilder | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
getMessageFormat | protected @Nullable MessageFormat getMessageFormat(ResourceBundle bundle, String code, Locale locale)
throws MissingResourceException {
Map<String, Map<Locale, MessageFormat>> codeMap = this.cachedBundleMessageFormats.get(bundle);
Map<Locale, MessageFormat> localeMap = null;
if (codeMap != null) {
localeMa... | Return a MessageFormat for the given bundle and code,
fetching already generated MessageFormats from the cache.
@param bundle the ResourceBundle to work on
@param code the message code to retrieve
@param locale the Locale to use to build the MessageFormat
@return the resulting MessageFormat, or {@code null} if no messa... | java | spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java | 308 | [
"bundle",
"code",
"locale"
] | MessageFormat | true | 7 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
dropna | def dropna(
self,
*,
axis: Axis = 0,
inplace: bool = False,
how: AnyAll | None = None,
ignore_index: bool = False,
) -> Series | None:
"""
Return a new Series with missing values removed.
See the :ref:`User Guide <missing_data>` for more on wh... | Return a new Series with missing values removed.
See the :ref:`User Guide <missing_data>` for more on which values are
considered missing, and how to work with missing data.
Parameters
----------
axis : {0 or 'index'}
Unused. Parameter needed for compatibility with DataFrame.
inplace : bool, default False
If ... | python | pandas/core/series.py | 6,347 | [
"self",
"axis",
"inplace",
"how",
"ignore_index"
] | Series | None | true | 9 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
visitTopLevelExportAssignment | function visitTopLevelExportAssignment(node: ExportAssignment): VisitResult<Statement | undefined> {
if (node.isExportEquals) {
return undefined;
}
return createExportStatement(factory.createIdentifier("default"), visitNode(node.expression, visitor, isExpression), /*location*/ ... | Visits an ExportAssignment node.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 1,736 | [
"node"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
concat | public static CharSource concat(Iterable<? extends CharSource> sources) {
return new ConcatenatedCharSource(sources);
} | Concatenates multiple {@link CharSource} instances into a single source. Streams returned from
the source will contain the concatenated data from the streams of the underlying sources.
<p>Only one underlying stream will be open at a time. Closing the concatenated stream will
close the open underlying stream.
@param sou... | java | android/guava/src/com/google/common/io/CharSource.java | 450 | [
"sources"
] | CharSource | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false |
put | public JSONObject put(String name, double value) throws JSONException {
this.nameValuePairs.put(checkName(name), JSON.checkDouble(value));
return this;
} | Maps {@code name} to {@code value}, clobbering any existing name/value mapping with
the same name.
@param name the name of the property
@param value a finite value. May not be {@link Double#isNaN() NaNs} or
{@link Double#isInfinite() infinities}.
@return this object.
@throws JSONException if an error occurs | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 219 | [
"name",
"value"
] | JSONObject | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
asSharedProxy | SharedProxy asSharedProxy() && { return SharedProxy{std::move(*this)}; } | Move this `Function` into a copyable callable object, of which all copies
share the state. | cpp | folly/Function.h | 920 | [] | true | 2 | 6.8 | facebook/folly | 30,157 | doxygen | false | |
subtypeOfComponentType | private static @Nullable Type subtypeOfComponentType(Type[] bounds) {
for (Type bound : bounds) {
Type componentType = getComponentType(bound);
if (componentType != null) {
// Only the first bound can be a class or array.
// Bounds after the first can only be interfaces.
if (comp... | Returns {@code ? extends X} if any of {@code bounds} is a subtype of {@code X[]}; or null
otherwise. | java | android/guava/src/com/google/common/reflect/Types.java | 198 | [
"bounds"
] | Type | true | 4 | 6 | google/guava | 51,352 | javadoc | false |
forTypes | public static BindableRuntimeHintsRegistrar forTypes(Class<?>... types) {
return new BindableRuntimeHintsRegistrar(types);
} | Create a new {@link BindableRuntimeHintsRegistrar} for the specified types.
@param types the types to process
@return a new {@link BindableRuntimeHintsRegistrar} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java | 121 | [] | BindableRuntimeHintsRegistrar | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
toPrimitive | public static int[] toPrimitive(final Integer[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_INT_ARRAY;
}
final int[] result = new int[array.length];
for (int i = 0; i < array.length; i++) {
result[... | Converts an array of object Integers to primitives.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array a {@link Integer} array, may be {@code null}.
@return an {@code int} array, {@code null} if null array input.
@throws NullPointerException if an array element is {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 9,055 | [
"array"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
convert_sbom_entry_to_dict | def convert_sbom_entry_to_dict(
dependency: dict[str, Any],
dependency_depth: dict[str, int],
is_core: bool,
is_devel: bool,
include_open_psf_scorecard: bool,
include_github_stats: bool,
include_actions: bool,
github_token: str | None,
console: Console,
) -> dict[str, Any] | None:
... | Convert SBOM to Row for CSV or spreadsheet output
:param dependency: Dependency to convert
:param is_core: Whether the dependency is core or not
:param is_devel: Whether the dependency is devel or not
:param include_open_psf_scorecard: Whether to include Open PSF Scorecard | python | dev/breeze/src/airflow_breeze/commands/sbom_commands.py | 994 | [
"dependency",
"dependency_depth",
"is_core",
"is_devel",
"include_open_psf_scorecard",
"include_github_stats",
"include_actions",
"github_token",
"console"
] | dict[str, Any] | None | true | 12 | 6.16 | apache/airflow | 43,597 | sphinx | false |
nextToInternal | private String nextToInternal(String excluded) {
int start = this.pos;
for (; this.pos < this.in.length(); this.pos++) {
char c = this.in.charAt(this.pos);
if (c == '\r' || c == '\n' || excluded.indexOf(c) != -1) {
return this.in.substring(start, this.pos);
}
}
return this.in.substring(start);
} | Returns the string up to but not including any of the given characters or a newline
character. This does not consume the excluded character.
@return the string up to but not including any of the given characters or a newline
character | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 337 | [
"excluded"
] | String | true | 5 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
createTrustManager | @Override
public X509ExtendedTrustManager createTrustManager() {
final Path path = resolvePath();
try {
final KeyStore store = readKeyStore(path);
if (requireTrustAnchors) {
checkTrustStore(store, path);
}
return KeyStoreUtil.createTrus... | @param path The path to the keystore file
@param password The password for the keystore
@param type The {@link KeyStore#getType() type} of the keystore (typically "PKCS12" or "jks").
See {@link KeyStoreUtil#inferKeyStoreType}.
@param algorithm The algorithm to use for the Trust Manager (see ... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/StoreTrustConfig.java | 78 | [] | X509ExtendedTrustManager | true | 3 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
processPair | function processPair(currentItem: TextRangeWithKind, currentStartLine: number, currentParent: Node, previousItem: TextRangeWithKind, previousStartLine: number, previousParent: Node, contextNode: Node, dynamicIndentation: DynamicIndentation | undefined): LineAction {
formattingContext.updateContext(previousItem... | Tries to compute the indentation for a list element.
If list element is not in range then
function will pick its actual indentation
so it can be pushed downstream as inherited indentation.
If list element is in the range - its indentation will be equal
to inherited indentation from its predecessors. | typescript | src/services/formatting/formatting.ts | 1,101 | [
"currentItem",
"currentStartLine",
"currentParent",
"previousItem",
"previousStartLine",
"previousParent",
"contextNode",
"dynamicIndentation"
] | true | 11 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getBestComparator | static Comparator<byte[]> getBestComparator() {
try {
Class<? extends LexicographicalComparator> unsafeImpl =
Class.forName(UNSAFE_COMPARATOR_NAME).asSubclass(LexicographicalComparator.class);
// requireNonNull is safe because the class is an enum.
LexicographicalComparator uns... | Returns the best comparator supported by the current runtime. | java | android/guava/src/com/google/common/primitives/UnsignedBytes.java | 474 | [] | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false | |
shrink_mask | def shrink_mask(self):
"""
Reduce a mask to nomask when possible.
Parameters
----------
None
Returns
-------
result : MaskedArray
A :class:`~ma.MaskedArray` object.
Examples
--------
>>> import numpy as np
>>>... | Reduce a mask to nomask when possible.
Parameters
----------
None
Returns
-------
result : MaskedArray
A :class:`~ma.MaskedArray` object.
Examples
--------
>>> import numpy as np
>>> x = np.ma.array([[1,2 ], [3, 4]], mask=[0]*4)
>>> x.mask
array([[False, False],
[False, False]])
>>> x.shrink_mask()
masked... | python | numpy/ma/core.py | 3,723 | [
"self"
] | false | 1 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
isErrorEnabled | @Override
public boolean isErrorEnabled() {
synchronized (this.lines) {
return (this.destination == null) || this.destination.isErrorEnabled();
}
} | Create a new {@link DeferredLog} instance managed by a {@link DeferredLogFactory}.
@param destination the switch-over destination
@param lines the lines backing all related deferred logs
@since 2.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java | 93 | [] | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false | |
values | @Override
public Set<V> values() {
/*
* We can almost reuse the inverse's keySet, except we have to fix the
* iteration order so that it is consistent with the forward map.
*/
Set<V> result = valueSet;
return (result == null) ? valueSet = new ValueSet() : result;
} | Specifies the delegate maps going in each direction. Called by subclasses during
deserialization. | java | android/guava/src/com/google/common/collect/AbstractBiMap.java | 253 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
nanany | def nanany(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
mask: npt.NDArray[np.bool_] | None = None,
) -> bool:
"""
Check if any elements along an axis evaluate to True.
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool,... | Check if any elements along an axis evaluate to True.
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
mask : ndarray[bool], optional
nan-mask if known
Returns
-------
result : bool
Examples
--------
>>> from pandas.core import nanops
>>> s = pd.Series([1, 2])
>>> nanops.na... | python | pandas/core/nanops.py | 484 | [
"values",
"axis",
"skipna",
"mask"
] | bool | true | 5 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
_maybe_infer_tz | def _maybe_infer_tz(tz: tzinfo | None, inferred_tz: tzinfo | None) -> tzinfo | None:
"""
If a timezone is inferred from data, check that it is compatible with
the user-provided timezone, if any.
Parameters
----------
tz : tzinfo or None
inferred_tz : tzinfo or None
Returns
-------
... | If a timezone is inferred from data, check that it is compatible with
the user-provided timezone, if any.
Parameters
----------
tz : tzinfo or None
inferred_tz : tzinfo or None
Returns
-------
tz : tzinfo or None
Raises
------
TypeError : if both timezones are present but do not match | python | pandas/core/arrays/datetimes.py | 2,709 | [
"tz",
"inferred_tz"
] | tzinfo | None | true | 4 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
declareNamedObjects | @Override
public <T> void declareNamedObjects(
BiConsumer<Value, List<T>> consumer,
NamedObjectParser<T, Context> namedObjectParser,
ParseField field
) {
Consumer<Value> orderedModeCallback = (v) -> {
throw new IllegalArgumentException("[" + field + "] doesn't support... | Parses a Value from the given {@link XContentParser}
@param parser the parser to build a value from
@param value the value to fill from the parser
@param context a context that is passed along to all declared field parsers
@return the parsed value
@throws IOException if an IOException occurs. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java | 561 | [
"consumer",
"namedObjectParser",
"field"
] | void | true | 1 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.