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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
binaryToHexDigitMsb0_4bits | public static char binaryToHexDigitMsb0_4bits(final boolean[] src, final int srcPos) {
if (src.length > Byte.SIZE) {
throw new IllegalArgumentException("src.length > 8: src.length=" + src.length);
}
if (src.length - srcPos < 4) {
throw new IllegalArgumentException("src.le... | Converts binary (represented as boolean array) to a hexadecimal digit using the MSB0 bit ordering.
<p>
(1, 0, 0, 0) is converted as follow: '8' (1, 0, 0, 1, 1, 0, 1, 0) with srcPos = 3 is converted to 'D'
</p>
@param src the binary to convert.
@param srcPos the position of the LSB to start the conversion.
@return a ... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 258 | [
"src",
"srcPos"
] | true | 18 | 6.72 | apache/commons-lang | 2,896 | javadoc | false | |
finish | @Override
public void finish() throws IOException {
if (finished) {
throw new IllegalStateException("already finished");
}
finished = true;
flatVectorWriter.finish();
if (meta != null) {
// write end of fields marker
meta.writeInt(-1);
... | Flushes vector data and associated data to disk.
<p>
This method and the private helpers it calls only need to support FLOAT32.
For FlatFieldVectorWriter we only need to support float[] during flush: during indexing users provide floats[], and pass floats to
FlatFieldVectorWriter, even when we have a BYTE dataType (i.e... | java | libs/gpu-codec/src/main/java/org/elasticsearch/gpu/codec/ES92GpuHnswVectorsWriter.java | 241 | [] | void | true | 4 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
from_file | def from_file(
self,
filename: str | os.PathLike[str],
load: t.Callable[[t.IO[t.Any]], t.Mapping[str, t.Any]],
silent: bool = False,
text: bool = True,
) -> bool:
"""Update the values in the config from a file that is loaded
using the ``load`` parameter. The l... | Update the values in the config from a file that is loaded
using the ``load`` parameter. The loaded data is passed to the
:meth:`from_mapping` method.
.. code-block:: python
import json
app.config.from_file("config.json", load=json.load)
import tomllib
app.config.from_file("config.toml", load=tomllib... | python | src/flask/config.py | 256 | [
"self",
"filename",
"load",
"silent",
"text"
] | bool | true | 4 | 7.92 | pallets/flask | 70,946 | sphinx | false |
findAgentJar | static String findAgentJar() {
String propertyName = "es.entitlement.agentJar";
String propertyValue = System.getProperty(propertyName);
if (propertyValue != null) {
return propertyValue;
}
Path esHome = Path.of(System.getProperty("es.path.home"));
Path dir =... | Main entry point that activates entitlement checking. Once this method returns,
calls to methods protected by entitlements from classes without a valid
policy will throw {@link org.elasticsearch.entitlement.runtime.api.NotEntitledException}.
@param serverPolicyPatch additional entitlements to patch the embed... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java | 139 | [] | String | true | 5 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
identityToString | public static String identityToString(final Object object) {
if (object == null) {
return null;
}
final String name = object.getClass().getName();
final String hexString = identityHashCodeHex(object);
final StringBuilder builder = new StringBuilder(name.length() + 1 +... | Gets the toString that would be produced by {@link Object} if a class did not override toString itself. {@code null} will return {@code null}.
<pre>
ObjectUtils.identityToString(null) = null
ObjectUtils.identityToString("") = "java.lang.String@1e23"
ObjectUtils.identityToString(Boolean.TRUE) = "java.l... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 813 | [
"object"
] | String | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
enableSubstitutionsForBlockScopedBindings | function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & ES2015SubstitutionFlags.BlockScopedBindings) === 0) {
enabledSubstitutions |= ES2015SubstitutionFlags.BlockScopedBindings;
context.enableSubstitution(SyntaxKind.Identifier);
}
} | Enables a more costly code path for substitutions when we determine a source file
contains block-scoped bindings (e.g. `let` or `const`). | typescript | src/compiler/transformers/es2015.ts | 4,875 | [] | false | 2 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
decorateIfRequired | public BeanDefinitionHolder decorateIfRequired(
Node node, BeanDefinitionHolder originalDef, @Nullable BeanDefinition containingBd) {
String namespaceUri = getNamespaceURI(node);
if (namespaceUri != null && !isDefaultNamespace(namespaceUri)) {
NamespaceHandler handler = this.readerContext.getNamespaceHandler... | Decorate the given bean definition through a namespace handler,
if applicable.
@param node the current child node
@param originalDef the current bean definition
@param containingBd the containing bean definition (if any)
@return the decorated bean definition | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java | 1,430 | [
"node",
"originalDef",
"containingBd"
] | BeanDefinitionHolder | true | 7 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
prepareRangeContainsErrorFunction | function prepareRangeContainsErrorFunction(errors: readonly Diagnostic[], originalRange: TextRange): (r: TextRange) => boolean {
if (!errors.length) {
return rangeHasNoErrors;
}
// pick only errors that fall in range
const sorted = errors
.filter(d => rangeOverlapsWithStartEnd(or... | formatting is not applied to ranges that contain parse errors.
This function will return a predicate that for a given text range will tell
if there are any parse errors that overlap with the range. | typescript | src/services/formatting/formatting.ts | 330 | [
"errors",
"originalRange"
] | true | 7 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
takeRenewedRecords | public void takeRenewedRecords() {
for (Map.Entry<TopicIdPartition, ShareInFlightBatch<K, V>> entry : batches.entrySet()) {
entry.getValue().takeRenewals();
}
// Any acquisition lock timeout updated by renewal is applied as the renewed records are move back to in-flight
if (a... | Take any renewed records and move them back into in-flight state. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetch.java | 143 | [] | void | true | 2 | 7.2 | apache/kafka | 31,560 | javadoc | false |
make_mask_descr | def make_mask_descr(ndtype):
"""
Construct a dtype description list from a given dtype.
Returns a new dtype object, with the type of all fields in `ndtype` to a
boolean type. Field names are not altered.
Parameters
----------
ndtype : dtype
The dtype to convert.
Returns
--... | Construct a dtype description list from a given dtype.
Returns a new dtype object, with the type of all fields in `ndtype` to a
boolean type. Field names are not altered.
Parameters
----------
ndtype : dtype
The dtype to convert.
Returns
-------
result : dtype
A dtype that looks like `ndtype`, the type of al... | python | numpy/ma/core.py | 1,366 | [
"ndtype"
] | false | 1 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
print | public abstract String print(Duration value, @Nullable ChronoUnit unit); | Print the specified duration using the given unit.
@param value the value to print
@param unit the value to use for printing
@return the printed result | java | core/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java | 134 | [
"value",
"unit"
] | String | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
will_fusion_create_cycle | def will_fusion_create_cycle(
self, node1: BaseSchedulerNode, node2: BaseSchedulerNode
) -> bool:
"""
Finds whether there's a path from node1 to node2 (or vice-versa)
caused indirectly by other fusions.
"""
# since we are just returning boolean here, use slightly fast... | Finds whether there's a path from node1 to node2 (or vice-versa)
caused indirectly by other fusions. | python | torch/_inductor/scheduler.py | 4,383 | [
"self",
"node1",
"node2"
] | bool | true | 7 | 6 | pytorch/pytorch | 96,034 | unknown | false |
createScheduler | @SuppressWarnings("NullAway") // Dataflow analysis limitation
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, @Nullable String schedulerName)
throws SchedulerException {
// Override thread context ClassLoader to work around naive Quartz ClassLoadHelper loading.
Thread currentThread = Thr... | Create the Scheduler instance for the given factory and scheduler name.
Called by {@link #afterPropertiesSet}.
<p>The default implementation invokes SchedulerFactory's {@code getScheduler}
method. Can be overridden for custom Scheduler creation.
@param schedulerFactory the factory to create the Scheduler with
@param sc... | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java | 652 | [
"schedulerFactory",
"schedulerName"
] | Scheduler | true | 7 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
_mode | def _mode(self, dropna: bool = True) -> Self:
"""
Returns the mode(s) of the ExtensionArray.
Always returns `ExtensionArray` even if only one value.
Parameters
----------
dropna : bool, default True
Don't consider counts of NA values.
Returns
... | Returns the mode(s) of the ExtensionArray.
Always returns `ExtensionArray` even if only one value.
Parameters
----------
dropna : bool, default True
Don't consider counts of NA values.
Returns
-------
same type as self
Sorted, if possible. | python | pandas/core/arrays/arrow/array.py | 2,394 | [
"self",
"dropna"
] | Self | true | 8 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
_parser_dispatch | def _parser_dispatch(flavor: HTMLFlavors | None) -> type[_HtmlFrameParser]:
"""
Choose the parser based on the input flavor.
Parameters
----------
flavor : {{"lxml", "html5lib", "bs4"}} or None
The type of parser to use. This must be a valid backend.
Returns
-------
cls : _Html... | Choose the parser based on the input flavor.
Parameters
----------
flavor : {{"lxml", "html5lib", "bs4"}} or None
The type of parser to use. This must be a valid backend.
Returns
-------
cls : _HtmlFrameParser subclass
The parser class based on the requested input flavor.
Raises
------
ValueError
* If `f... | python | pandas/io/html.py | 883 | [
"flavor"
] | type[_HtmlFrameParser] | true | 4 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
asFailableSupplier | @SuppressWarnings("unchecked")
public static <R> FailableSupplier<R, Throwable> asFailableSupplier(final Method method) {
return asInterfaceInstance(FailableSupplier.class, method);
} | Produces a {@link FailableSupplier} for a given a <em>supplier</em> Method. The FailableSupplier return type must
match the method's return type.
<p>
Only works with static methods.
</p>
@param <R> The Method return type.
@param method the method to invoke.
@return a correctly-typed wrapper for the given target. | java | src/main/java/org/apache/commons/lang3/function/MethodInvokers.java | 169 | [
"method"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
match | public boolean match(String parserName, Supplier<XContentLocation> location, String fieldName, DeprecationHandler deprecationHandler) {
Objects.requireNonNull(fieldName, "fieldName cannot be null");
// if this parse field has not been completely deprecated then try to
// match the preferred name... | Does {@code fieldName} match this field?
@param parserName
the name of the parent object holding this field
@param location
the XContentLocation of the field
@param fieldName
the field name to match against this {@link ParseField}
@param deprecationHandler called if {@code fieldName} is... | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ParseField.java | 157 | [
"parserName",
"location",
"fieldName",
"deprecationHandler"
] | true | 8 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false | |
device | def device(x: _ArrayApiObj, /) -> Device:
"""
Hardware device the array data resides on.
This is equivalent to `x.device` according to the `standard
<https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.device.html>`__.
This helper is included because some array librar... | Hardware device the array data resides on.
This is equivalent to `x.device` according to the `standard
<https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.device.html>`__.
This helper is included because some array libraries either do not have
the `device` attribute or include it with a... | python | sklearn/externals/array_api_compat/common/_helpers.py | 699 | [
"x"
] | Device | true | 9 | 6.32 | scikit-learn/scikit-learn | 64,340 | numpy | false |
get_include | def get_include():
"""
Return the directory that contains the NumPy \\*.h header files.
Extension modules that need to compile against NumPy may need to use this
function to locate the appropriate include directory.
Notes
-----
When using ``setuptools``, for example in ``setup.py``::
... | Return the directory that contains the NumPy \\*.h header files.
Extension modules that need to compile against NumPy may need to use this
function to locate the appropriate include directory.
Notes
-----
When using ``setuptools``, for example in ``setup.py``::
import numpy as np
...
Extension('extension... | python | numpy/lib/_utils_impl.py | 78 | [] | false | 3 | 7.2 | numpy/numpy | 31,054 | unknown | false | |
process_fd | def process_fd(
proc,
fd,
log: Logger,
process_line_callback: Callable[[str], None] | None = None,
is_dataflow_job_id_exist_callback: Callable[[], bool] | None = None,
):
"""
Print output to logs.
:param proc: subprocess.
:param fd: File descriptor.
:param process_line_callback:... | Print output to logs.
:param proc: subprocess.
:param fd: File descriptor.
:param process_line_callback: Optional callback which can be used to process
stdout and stderr to detect job id.
:param log: logger. | python | providers/apache/beam/src/airflow/providers/apache/beam/hooks/beam.py | 122 | [
"proc",
"fd",
"log",
"process_line_callback",
"is_dataflow_job_id_exist_callback"
] | true | 6 | 6.88 | apache/airflow | 43,597 | sphinx | false | |
get_secret | def get_secret(self, secret_name: str) -> str | bytes:
"""
Retrieve secret value from AWS Secrets Manager as a str or bytes.
The value reflects format it stored in the AWS Secrets Manager.
.. seealso::
- :external+boto3:py:meth:`SecretsManager.Client.get_secret_value`
... | Retrieve secret value from AWS Secrets Manager as a str or bytes.
The value reflects format it stored in the AWS Secrets Manager.
.. seealso::
- :external+boto3:py:meth:`SecretsManager.Client.get_secret_value`
:param secret_name: name of the secrets.
:return: Union[str, bytes] with the information about the secr... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/secrets_manager.py | 43 | [
"self",
"secret_name"
] | str | bytes | true | 3 | 7.6 | apache/airflow | 43,597 | sphinx | false |
truePredicate | @SuppressWarnings("unchecked")
static <E extends Throwable> FailableLongPredicate<E> truePredicate() {
return TRUE;
} | Gets the TRUE singleton.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailableLongPredicate.java | 57 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
partitionResponse | public static FetchResponseData.PartitionData partitionResponse(int partition, Errors error) {
return new FetchResponseData.PartitionData()
.setPartitionIndex(partition)
.setErrorCode(error.code())
.setHighWatermark(FetchResponse.INVALID_HIGH_WATERMARK)
.setRecord... | Convenience method to find the size of a response.
@param version The version of the response to use.
@param partIterator The partition iterator.
@return The response size in bytes. | java | clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java | 201 | [
"partition",
"error"
] | true | 1 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
apply | @Nullable String apply(String value) {
try {
Long result = this.action.apply(value);
return (result != null) ? String.valueOf(result) : null;
}
catch (RuntimeException ex) {
if (this.ignoredExceptions.test(ex)) {
return null;
}
throw ex;
}
} | Attempt to convert the specified value to epoch time.
@param value the value to coerce to
@return the epoch time in milliseconds or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java | 140 | [
"value"
] | String | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
Tree | function Tree({
badgeClassName,
actions,
className,
clearMessages,
entries,
isTransitionPending,
label,
messageClassName,
}: TreeProps) {
if (entries.length === 0) {
return null;
}
return (
<div className={className}>
<div className={`${sharedStyles.HeaderRow} ${styles.HeaderRow}`}>
... | 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/Components/InspectedElementErrorsAndWarningsTree.js | 125 | [] | false | 2 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
geoAzimuthRads | double geoAzimuthRads(double x, double y, double z) {
// from https://www.movable-type.co.uk/scripts/latlong-vectors.html
// N = {0,0,1}
// c1 = a×b
// c2 = a×N
// sinθ = |c1×c2| · sgn(c1×c2 · a)
// cosθ = c1·c2
// θ = atan2(sinθ, cosθ)
final double c1X = ... | Determines the azimuth to the provided 3D coordinate.
@param x The first 3D coordinate.
@param y The second 3D coordinate.
@param z The third 3D coordinate.
@return The azimuth in radians. | java | libs/h3/src/main/java/org/elasticsearch/h3/Vec3d.java | 138 | [
"x",
"y",
"z"
] | true | 1 | 7.2 | elastic/elasticsearch | 75,680 | javadoc | false | |
tryInstallExecSandbox | @Override
public void tryInstallExecSandbox() {
// create a new Job
Handle job = kernel.CreateJobObjectW();
if (job == null) {
throw new UnsupportedOperationException("CreateJobObject: " + kernel.GetLastError());
}
try {
// retrieve the current basic ... | Install exec system call filtering on Windows.
<p>
Process creation is restricted with {@code SetInformationJobObject/ActiveProcessLimit}.
<p>
Note: This is not intended as a real sandbox. It is another level of security, mostly intended to annoy
security researchers and make their lives more difficult in achieving "re... | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/WindowsNativeAccess.java | 96 | [] | void | true | 5 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
set | public Struct set(String name, Object value) {
BoundField field = this.schema.get(name);
if (field == null)
throw new SchemaException("Unknown field: " + name);
this.values[field.index] = value;
return this;
} | Set the field specified by the given name to the value
@param name The name of the field
@param value The value to set
@throws SchemaException If the field is not known | java | clients/src/main/java/org/apache/kafka/common/protocol/types/Struct.java | 147 | [
"name",
"value"
] | Struct | true | 2 | 6.24 | apache/kafka | 31,560 | javadoc | false |
maxTimestamp | @Override
public long maxTimestamp() {
return buffer.getLong(MAX_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 | 169 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
loadBeanPostProcessors | static <T extends BeanPostProcessor> List<T> loadBeanPostProcessors(
ConfigurableListableBeanFactory beanFactory, Class<T> beanPostProcessorType) {
String[] postProcessorNames = beanFactory.getBeanNamesForType(beanPostProcessorType, true, false);
List<T> postProcessors = new ArrayList<>();
for (String ppName ... | Load and sort the post-processors of the specified type.
@param beanFactory the bean factory to use
@param beanPostProcessorType the post-processor type
@param <T> the post-processor type
@return a list of sorted post-processors for the specified type | java | spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java | 301 | [
"beanFactory",
"beanPostProcessorType"
] | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
deleteShareGroups | DeleteShareGroupsResult deleteShareGroups(Collection<String> groupIds, DeleteShareGroupsOptions options); | Delete share groups from the cluster.
@param groupIds Collection of share group ids which are to be deleted.
@param options The options to use when deleting a share group.
@return The DeleteShareGroupsResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 2,025 | [
"groupIds",
"options"
] | DeleteShareGroupsResult | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
prod | def prod(
self,
numeric_only: bool = False,
min_count: int = 0,
):
"""
Compute prod of group values.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
.. versionchanged:: 2.0.0
... | Compute prod of group values.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
.. versionchanged:: 2.0.0
numeric_only no longer accepts ``None``.
min_count : int, default 0
The required number of valid values to perform the operation. If fewer
... | python | pandas/core/resample.py | 1,158 | [
"self",
"numeric_only",
"min_count"
] | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false | |
privateKey | @Nullable PrivateKey privateKey(); | The private key for this store or {@code null}.
@return the private key | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStore.java | 73 | [] | PrivateKey | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
ipFloatBit | public static float ipFloatBit(float[] q, byte[] d) {
if (q.length != d.length * Byte.SIZE) {
throw new IllegalArgumentException("vector dimensions incompatible: " + q.length + "!= " + Byte.SIZE + " x " + d.length);
}
return IMPL.ipFloatBit(q, d);
} | Compute the inner product of two vectors, where the query vector is a float vector and the document vector is a bit vector.
This will return the sum of the query vector values using the document vector as a mask.
When comparing the bits with the floats, they are done in "big endian" order. For example, if the float vec... | java | libs/simdvec/src/main/java/org/elasticsearch/simdvec/ESVectorUtil.java | 101 | [
"q",
"d"
] | true | 2 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
calcTSPScore | std::pair<uint64_t, uint64_t>
calcTSPScore(const BinaryFunctionListType &BinaryFunctions,
const std::unordered_map<BinaryBasicBlock *, uint64_t> &BBAddr,
const std::unordered_map<BinaryBasicBlock *, uint64_t> &BBSize) {
uint64_t Score = 0;
uint64_t JumpCount = 0;
for (BinaryFunction *BF ... | (the number of fallthrough branches, the total number of branches) | cpp | bolt/lib/Passes/CacheMetrics.cpp | 56 | [] | true | 5 | 6.56 | llvm/llvm-project | 36,021 | doxygen | false | |
toEncodedString | public static String toEncodedString(final byte[] bytes, final Charset charset) {
return new String(bytes, Charsets.toCharset(charset));
} | Converts a {@code byte[]} to a String using the specified character encoding.
@param bytes the byte array to read from.
@param charset the encoding to use, if null then use the platform default.
@return a new String.
@throws NullPointerException if {@code bytes} is null
@since 3.2
@since 3.3 No longer throws {@link U... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,661 | [
"bytes",
"charset"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
_finishAndReturnText | protected Text _finishAndReturnText() throws IOException {
int ptr = _inputPtr;
if (ptr >= _inputEnd) {
_loadMoreGuaranteed();
ptr = _inputPtr;
}
int startPtr = ptr;
final int[] codes = INPUT_CODES_UTF8;
final int max = _inputEnd;
final by... | Method that will try to get underlying UTF-8 encoded bytes of the current string token.
This is only a best-effort attempt; if there is some reason the bytes cannot be retrieved, this method will return null. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParser.java | 76 | [] | Text | true | 12 | 7.12 | elastic/elasticsearch | 75,680 | javadoc | false |
format | public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone) {
return format(calendar, pattern, timeZone, null);
} | Formats a calendar into a specific pattern in a time zone.
@param calendar the calendar to format, not null.
@param pattern the pattern to use to format the calendar, not null.
@param timeZone the time zone to use, may be {@code null}.
@return the formatted calendar.
@see FastDateFormat#format(Calendar)
@since 2.4 | java | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | 239 | [
"calendar",
"pattern",
"timeZone"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
saturatedPow | @SuppressWarnings("ShortCircuitBoolean")
public static long saturatedPow(long b, int k) {
checkNonNegative("exponent", k);
if (b >= -2 & b <= 2) {
switch ((int) b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case -1:
return ((k & 1) == 0) ? ... | Returns the {@code b} to the {@code k}th power, unless it would overflow or underflow in which
case {@code Long.MAX_VALUE} or {@code Long.MIN_VALUE} is returned, respectively.
@since 20.0 | java | android/guava/src/com/google/common/math/LongMath.java | 709 | [
"b",
"k"
] | true | 11 | 6 | google/guava | 51,352 | javadoc | false | |
adaptCaffeineCache | protected Cache adaptCaffeineCache(String name, AsyncCache<Object, Object> cache) {
return new CaffeineCache(name, cache, isAllowNullValues());
} | Adapt the given new Caffeine AsyncCache instance to Spring's {@link Cache}
abstraction for the specified cache name.
@param name the name of the cache
@param cache the Caffeine AsyncCache instance
@return the Spring CaffeineCache adapter (or a decorator thereof)
@since 6.1
@see CaffeineCache#CaffeineCache(String, Async... | java | spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java | 357 | [
"name",
"cache"
] | Cache | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
execute | public abstract double execute(Map<String, Object> params, double[] values); | @param params The user-provided parameters
@param values The values in the window that we are moving a function across
@return A double representing the value from this particular window | java | modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/MovingFunctionScript.java | 27 | [
"params",
"values"
] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
getMin | @Override
public double getMin() {
if (mergingDigest != null) {
return mergingDigest.getMin();
}
return sortingDigest.getMin();
} | 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 | 198 | [] | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
checkNonLoadingCache | private void checkNonLoadingCache() {
checkState(refreshNanos == UNSET_INT, "refreshAfterWrite requires a LoadingCache");
} | Builds a cache which does not automatically load values when keys are requested.
<p>Consider {@link #build(CacheLoader)} instead, if it is feasible to implement a {@code
CacheLoader}.
<p>This method does not alter the state of this {@code CacheBuilder} instance, so it can be
invoked again to create multiple independent... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 1,060 | [] | void | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false |
parseNonArrayType | function parseNonArrayType(): TypeNode {
switch (token()) {
case SyntaxKind.AnyKeyword:
case SyntaxKind.UnknownKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.BigIntKeyword:
case SyntaxKind.Symb... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 4,589 | [] | true | 9 | 6.8 | microsoft/TypeScript | 107,154 | jsdoc | false | |
subarray | public static <T> T[] subarray(final T[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
return null;
}
startIndexInclusive = max0(startIndexInclusive);
endIndexExclusive = Math.min(endIndexExclusive, array.length);
final int newSize = en... | Produces a new array containing the elements between the start and end indices.
<p>
The start index is inclusive, the end index exclusive. Null array input produces null output.
</p>
<p>
The component type of the subarray is always the same as that of the input array. Thus, if the input is an array of type {@link Date}... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 7,988 | [
"array",
"startIndexInclusive",
"endIndexExclusive"
] | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
toPercent | function toPercent(parsedNumber: ParsedNumber): ParsedNumber {
// if the number is 0, don't do anything
if (parsedNumber.digits[0] === 0) {
return parsedNumber;
}
// Getting the current number of decimals
const fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
if (parsedNumber.exponen... | @ngModule CommonModule
@description
Formats a number as text, with group sizing, separator, and other
parameters based on the locale.
@param value The number to format.
@param locale A locale code for the locale format rules to use.
@param digitsInfo Decimal representation options, specified by a string in the followin... | typescript | packages/common/src/i18n/format_number.ts | 357 | [
"parsedNumber"
] | true | 7 | 7.6 | angular/angular | 99,544 | jsdoc | false | |
compile_multiarch_bundle_from_llvm_ir | def compile_multiarch_bundle_from_llvm_ir(
llvm_ir_path: str, output_bundle_path: str, target_archs: Optional[list[str]] = None
) -> bool:
"""
Complete workflow: LLVM IR → multiple code objects → bundle.
This is the main entry point for multi-arch compilation.
Args:
llvm_ir_path: Path to .... | Complete workflow: LLVM IR → multiple code objects → bundle.
This is the main entry point for multi-arch compilation.
Args:
llvm_ir_path: Path to .ll file
output_bundle_path: Where to write bundle
target_archs: Optional list of architectures
Returns:
True if successful | python | torch/_inductor/rocm_multiarch_utils.py | 215 | [
"llvm_ir_path",
"output_bundle_path",
"target_archs"
] | bool | true | 6 | 8.08 | pytorch/pytorch | 96,034 | google | false |
allConsumed | public synchronized Map<TopicPartition, OffsetAndMetadata> allConsumed() {
Map<TopicPartition, OffsetAndMetadata> allConsumed = new HashMap<>();
assignment.forEach((topicPartition, partitionState) -> {
if (partitionState.hasValidPosition())
allConsumed.put(topicPartition, new... | 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 | 775 | [] | true | 2 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
fit | def fit(self, X, y=None):
"""Compute the median and quantiles to be used for scaling.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to compute the median and quantiles
used for later scaling along the feature... | Compute the median and quantiles to be used for scaling.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to compute the median and quantiles
used for later scaling along the features axis.
y : Ignored
Not used, present here for API consistency by conven... | python | sklearn/preprocessing/_data.py | 1,668 | [
"self",
"X",
"y"
] | false | 11 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
alterReplicaLogDirs | AlterReplicaLogDirsResult alterReplicaLogDirs(Map<TopicPartitionReplica, String> replicaAssignment,
AlterReplicaLogDirsOptions options); | Change the log directory for the specified replicas. If the replica does not exist on the broker, the result
shows REPLICA_NOT_AVAILABLE for the given replica and the replica will be created in the given log directory on the
broker when it is created later. If the replica already exists on the broker, the replica will ... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 567 | [
"replicaAssignment",
"options"
] | AlterReplicaLogDirsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
findCandidateComponents | public Set<BeanDefinition> findCandidateComponents(String basePackage) {
if (this.componentsIndex != null && indexSupportsIncludeFilters()) {
if (this.componentsIndex.hasScannedPackage(basePackage)) {
return addCandidateComponentsFromIndex(this.componentsIndex, basePackage);
}
else {
this.componentsI... | Scan the component index or class path for candidate components.
@param basePackage the package to check for annotated classes
@return a corresponding Set of autodetected bean definitions | java | spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java | 312 | [
"basePackage"
] | true | 4 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_query_range_helper | def _query_range_helper(
self, node: int, start: int, end: int, left: int, right: int
) -> T:
"""
Helper method to query a range of values in the segment tree.
Args:
node: Current node index
start: Start index of the current segment
end: End index... | Helper method to query a range of values in the segment tree.
Args:
node: Current node index
start: Start index of the current segment
end: End index of the current segment
left: Start index of the range to query
right: End index of the range to query
Returns:
Summary value for the range | python | torch/_inductor/codegen/segmented_tree.py | 158 | [
"self",
"node",
"start",
"end",
"left",
"right"
] | T | true | 5 | 8.08 | pytorch/pytorch | 96,034 | google | false |
inline_subgraph_to_ir_nodes | def inline_subgraph_to_ir_nodes(
gm: torch.fx.GraphModule, inputs: list[Any], name: str
) -> Any:
"""Inline a subgraph by converting its FX operations to individual IR nodes.
This converts a subgraph to multiple ComputedBuffer nodes (fusable),
enabling epilogue fusion with subsequent operations.
R... | Inline a subgraph by converting its FX operations to individual IR nodes.
This converts a subgraph to multiple ComputedBuffer nodes (fusable),
enabling epilogue fusion with subsequent operations.
Returns:
TensorBox containing the final operation result as individual IR nodes | python | torch/_inductor/codegen/subgraph.py | 30 | [
"gm",
"inputs",
"name"
] | Any | true | 1 | 6.24 | pytorch/pytorch | 96,034 | unknown | false |
flip | def flip(m, axis=None):
"""
Reverse the order of elements in an array along the given axis.
The shape of the array is preserved, but the elements are reordered.
Parameters
----------
m : array_like
Input array.
axis : None or int or tuple of ints, optional
Axis or axes alo... | Reverse the order of elements in an array along the given axis.
The shape of the array is preserved, but the elements are reordered.
Parameters
----------
m : array_like
Input array.
axis : None or int or tuple of ints, optional
Axis or axes along which to flip over. The default,
axis=None, will flip ov... | python | numpy/lib/_function_base_impl.py | 273 | [
"m",
"axis"
] | false | 5 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
_update_memory_tracking_after_swap_sink_waits | def _update_memory_tracking_after_swap_sink_waits(
candidate: BaseSchedulerNode,
gns: list[BaseSchedulerNode],
candidate_delta_mem: int,
candidate_allocfree: SNodeMemory,
group_n_to_bufs_after_swap_dealloc_instead_of_candidate: dict,
post_alloc_update: dict[BaseSchedulerNode, int],
size_free... | Update memory tracking structures after swap (sink_waits version).
Updates curr_memory and snodes_allocfree dictionaries to reflect the new
memory state after swapping candidate with group.
Args:
candidate: Node that was moved
gns: Group nodes
candidate_delta_mem: Net memory change from candidate (alloc -... | python | torch/_inductor/comms.py | 1,442 | [
"candidate",
"gns",
"candidate_delta_mem",
"candidate_allocfree",
"group_n_to_bufs_after_swap_dealloc_instead_of_candidate",
"post_alloc_update",
"size_free_delta_update",
"curr_memory",
"snodes_allocfree"
] | None | true | 4 | 6.08 | pytorch/pytorch | 96,034 | google | false |
nanvar | def nanvar(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
ddof: int = 1,
mask=None,
):
"""
Compute the variance along given axis while ignoring NaNs
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
... | Compute the variance along given axis while ignoring NaNs
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
where N represents the number of elements.
mask : ndarray[bool], option... | python | pandas/core/nanops.py | 960 | [
"values",
"axis",
"skipna",
"ddof",
"mask"
] | true | 12 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false | |
hoistBindingElement | function hoistBindingElement(node: VariableDeclaration | BindingElement): void {
if (isBindingPattern(node.name)) {
for (const element of node.name.elements) {
if (!isOmittedExpression(element)) {
hoistBindingElement(element);
}
}... | Hoists the declared names of a VariableDeclaration or BindingElement.
@param node The declaration to hoist. | typescript | src/compiler/transformers/module/system.ts | 922 | [
"node"
] | true | 4 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toString | @Override
public String toString() {
return "ValueHint{value=" + this.value + ", description='" + this.description + '\'' + '}';
} | A single-line, single-sentence description of this hint, if any.
@return the short description
@see #getDescription() | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueHint.java | 75 | [] | String | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
fromIPv6BigInteger | public static Inet6Address fromIPv6BigInteger(BigInteger address) {
return (Inet6Address) fromBigInteger(address, true);
} | Returns the {@code Inet6Address} corresponding to a given {@code BigInteger}.
@param address BigInteger representing the IPv6 address
@return Inet6Address representation of the given BigInteger
@throws IllegalArgumentException if the BigInteger is not between 0 and 2^128-1
@since 28.2 | java | android/guava/src/com/google/common/net/InetAddresses.java | 1,106 | [
"address"
] | Inet6Address | true | 1 | 6 | google/guava | 51,352 | javadoc | false |
_set_var | def _set_var(env: dict[str, str], variable: str, attribute: str | bool | None, default: str | None = None):
"""Set variable in env dict.
Priorities:
1. attribute comes first if not None
2. then environment variable if set
3. then not None default value if environment variable is None
4. if defa... | Set variable in env dict.
Priorities:
1. attribute comes first if not None
2. then environment variable if set
3. then not None default value if environment variable is None
4. if default is None, then the key is not set at all in dictionary | python | dev/breeze/src/airflow_breeze/params/shell_params.py | 131 | [
"env",
"variable",
"attribute",
"default"
] | true | 7 | 7.04 | apache/airflow | 43,597 | unknown | false | |
sum | def sum(
self,
numeric_only: bool = False,
min_count: int = 0,
):
"""
Compute sum of group values.
This method provides a simple way to compute the sum of values within each
resampled group, particularly useful for aggregating time-based data into
dai... | Compute sum of group values.
This method provides a simple way to compute the sum of values within each
resampled group, particularly useful for aggregating time-based data into
daily, monthly, or yearly sums.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
... | python | pandas/core/resample.py | 1,098 | [
"self",
"numeric_only",
"min_count"
] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false | |
convertRemainingAccentCharacters | private static void convertRemainingAccentCharacters(final StringBuilder decomposed) {
for (int i = 0; i < decomposed.length(); i++) {
final char charAt = decomposed.charAt(i);
switch (charAt) {
case '\u0141':
decomposed.setCharAt(i, 'L');
brea... | Tests whether the given CharSequence contains any whitespace characters.
<p>
Whitespace is defined by {@link Character#isWhitespace(char)}.
</p>
<pre>
StringUtils.containsWhitespace(null) = false
StringUtils.containsWhitespace("") = false
StringUtils.containsWhitespace("ab") = false
StringUtils.cont... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 1,369 | [
"decomposed"
] | void | true | 2 | 7.68 | apache/commons-lang | 2,896 | javadoc | false |
stamp_links | def stamp_links(self, visitor, append_stamps=False, **headers):
"""Stamp this signature links (callbacks and errbacks).
Using a visitor will pass on responsibility for the stamping
to the visitor.
Arguments:
visitor (StampingVisitor): Visitor API object.
append_s... | Stamp this signature links (callbacks and errbacks).
Using a visitor will pass on responsibility for the stamping
to the visitor.
Arguments:
visitor (StampingVisitor): Visitor API object.
append_stamps (bool):
If True, duplicated stamps will be appended to a list.
If False, duplicated stamps wi... | python | celery/canvas.py | 635 | [
"self",
"visitor",
"append_stamps"
] | false | 9 | 6.08 | celery/celery | 27,741 | google | false | |
checkElementIndex | @CanIgnoreReturnValue
public static int checkElementIndex(int index, int size) {
return checkElementIndex(index, size, "index");
} | Ensures that {@code index} specifies a valid <i>element</i> in an array, list or string of size
{@code size}. An element index may range from zero, inclusive, to {@code size}, exclusive.
@param index a user-supplied index identifying an element of an array, list or string
@param size the size of that array, list or str... | java | android/guava/src/com/google/common/base/Preconditions.java | 1,349 | [
"index",
"size"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
doWithMainClasses | static <T> @Nullable T doWithMainClasses(JarFile jarFile, @Nullable String classesLocation,
MainClassCallback<T> callback) throws IOException {
List<JarEntry> classEntries = getClassEntries(jarFile, classesLocation);
classEntries.sort(new ClassEntryComparator());
for (JarEntry entry : classEntries) {
try (I... | Perform the given callback operation on all main classes from the given jar.
@param <T> the result type
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@param callback the callback
@return the first callback result or {@code null}
@throws IOException in case o... | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 219 | [
"jarFile",
"classesLocation",
"callback"
] | T | true | 4 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
createBeanDefinition | public static AbstractBeanDefinition createBeanDefinition(
@Nullable String parentName, @Nullable String className, @Nullable ClassLoader classLoader) throws ClassNotFoundException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setParentName(parentName);
if (className != null) {
if (classLoad... | Create a new GenericBeanDefinition for the given parent name and class name,
eagerly loading the bean class if a ClassLoader has been specified.
@param parentName the name of the parent bean, if any
@param className the name of the bean class, if any
@param classLoader the ClassLoader to use for loading bean classes
(c... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java | 57 | [
"parentName",
"className",
"classLoader"
] | AbstractBeanDefinition | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
isZip | private boolean isZip(InputStreamSupplier supplier) {
try {
try (InputStream inputStream = supplier.openStream()) {
return isZip(inputStream);
}
}
catch (IOException ex) {
return false;
}
} | Writes a signature file if necessary for the given {@code writtenLibraries}.
@param writtenLibraries the libraries
@param writer the writer to use to write the signature file if necessary
@throws IOException if a failure occurs when writing the signature file | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java | 282 | [
"supplier"
] | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getMainClass | @Override
protected String getMainClass() throws Exception {
String mainClass = getProperty(MAIN, "Start-Class");
if (mainClass == null) {
throw new IllegalStateException("No '%s' or 'Start-Class' specified".formatted(MAIN));
}
return mainClass;
} | Properties key for boolean flag (default false) which, if set, will cause the
external configuration properties to be copied to System properties (assuming that
is allowed by Java security). | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/PropertiesLauncher.java | 367 | [] | String | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
writeLoaderClasses | private void writeLoaderClasses(AbstractJarWriter writer) throws IOException {
Layout layout = getLayout();
if (layout instanceof CustomLoaderLayout customLoaderLayout) {
customLoaderLayout.writeLoadedClasses(writer);
}
else if (layout.isExecutable()) {
writer.writeLoaderClasses();
}
} | Sets if jarmode jars relevant for the packaging should be automatically included.
@param includeRelevantJarModeJars if relevant jars are included | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java | 218 | [
"writer"
] | void | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
_process_line_with_next_version_comment | def _process_line_with_next_version_comment(
line: str, pyproject_file: Path, updates_made: dict[str, dict[str, Any]]
) -> tuple[str, bool]:
"""
Process a line that contains the "# use next version" comment.
Returns:
Tuple of (processed_line, was_modified)
"""
# Extract the provider pac... | Process a line that contains the "# use next version" comment.
Returns:
Tuple of (processed_line, was_modified) | python | dev/breeze/src/airflow_breeze/utils/packages.py | 1,268 | [
"line",
"pyproject_file",
"updates_made"
] | tuple[str, bool] | true | 3 | 7.6 | apache/airflow | 43,597 | unknown | false |
isIncluded | private boolean isIncluded(Class<?> candidate) {
for (MethodValidationExcludeFilter exclusionFilter : this.excludeFilters) {
if (exclusionFilter.isExcluded(candidate)) {
return false;
}
}
return true;
} | Creates a new {@code FilteredMethodValidationPostProcessor} that will apply the
given {@code excludeFilters} when identifying beans that are eligible for method
validation post-processing.
@param excludeFilters filters to apply | java | core/spring-boot/src/main/java/org/springframework/boot/validation/beanvalidation/FilteredMethodValidationPostProcessor.java | 71 | [
"candidate"
] | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
eager_shape | def eager_shape(x: Array, /) -> tuple[int, ...]:
"""
Return shape of an array. Raise if shape is not fully defined.
Parameters
----------
x : Array
Input array.
Returns
-------
tuple[int, ...]
Shape of the array.
"""
shape = x.shape
# Dask arrays uses non-st... | Return shape of an array. Raise if shape is not fully defined.
Parameters
----------
x : Array
Input array.
Returns
-------
tuple[int, ...]
Shape of the array. | python | sklearn/externals/array_api_extra/_lib/_utils/_helpers.py | 253 | [
"x"
] | tuple[int, ...] | true | 3 | 7.04 | scikit-learn/scikit-learn | 64,340 | numpy | false |
lastSequence | @Override
public int lastSequence() {
int baseSequence = baseSequence();
if (baseSequence == RecordBatch.NO_SEQUENCE)
return RecordBatch.NO_SEQUENCE;
return incrementSequence(baseSequence, lastOffsetDelta());
} | 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 | 208 | [] | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
make_circles | def make_circles(
n_samples=100, *, shuffle=True, noise=None, random_state=None, factor=0.8
):
"""Make a large circle containing a smaller circle in 2d.
A simple toy dataset to visualize clustering and classification
algorithms.
Read more in the :ref:`User Guide <sample_generators>`.
Paramete... | Make a large circle containing a smaller circle in 2d.
A simple toy dataset to visualize clustering and classification
algorithms.
Read more in the :ref:`User Guide <sample_generators>`.
Parameters
----------
n_samples : int or tuple of shape (2,), dtype=int, default=100
If int, it is the total number of points ... | python | sklearn/datasets/_samples_generator.py | 807 | [
"n_samples",
"shuffle",
"noise",
"random_state",
"factor"
] | false | 6 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
to_frame | def to_frame(
self,
index: bool = True,
name=lib.no_default,
allow_duplicates: bool = False,
) -> DataFrame:
"""
Create a DataFrame with the levels of the MultiIndex as columns.
Column ordering is determined by the DataFrame constructor with data as
a... | Create a DataFrame with the levels of the MultiIndex as columns.
Column ordering is determined by the DataFrame constructor with data as
a dict.
Parameters
----------
index : bool, default True
Set the index of the returned DataFrame as the original MultiIndex.
name : list / sequence of str, optional
The pas... | python | pandas/core/indexes/multi.py | 1,880 | [
"self",
"index",
"name",
"allow_duplicates"
] | DataFrame | true | 8 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
immutableEnumSet | public static <E extends Enum<E>> ImmutableSet<E> immutableEnumSet(Iterable<E> elements) {
if (elements instanceof ImmutableEnumSet) {
return (ImmutableEnumSet<E>) elements;
} else if (elements instanceof Collection) {
Collection<E> collection = (Collection<E>) elements;
if (collection.isEmpty... | Returns an immutable set instance containing the given enum elements. Internally, the returned
set will be backed by an {@link EnumSet}.
<p>The iteration order of the returned set follows the enum's iteration order, not the order in
which the elements appear in the given collection.
@param elements the elements, all of... | java | android/guava/src/com/google/common/collect/Sets.java | 120 | [
"elements"
] | true | 5 | 7.92 | google/guava | 51,352 | javadoc | false | |
getElement | public String getElement(int elementIndex, Form form) {
CharSequence element = this.elements.get(elementIndex);
ElementType type = this.elements.getType(elementIndex);
if (type.isIndexed()) {
return element.toString();
}
if (form == Form.ORIGINAL) {
if (type != ElementType.NON_UNIFORM) {
return elem... | Return an element in the name in the given form.
@param elementIndex the element index
@param form the form to return
@return the last element | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 149 | [
"elementIndex",
"form"
] | String | true | 9 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
timestampType | TimestampType timestampType(); | Get the timestamp type of this record batch. This will be {@link TimestampType#NO_TIMESTAMP_TYPE}
if the batch has magic 0.
@return The timestamp type | java | clients/src/main/java/org/apache/kafka/common/record/RecordBatch.java | 101 | [] | TimestampType | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
tryAddBucket | boolean tryAddBucket(long index, long count, boolean isPositive) {
assert index >= MIN_INDEX && index <= MAX_INDEX : "index must be in range [" + MIN_INDEX + ".." + MAX_INDEX + "]";
assert isPositive || positiveBuckets.numBuckets == 0 : "Cannot add negative buckets after a positive bucket has been added... | Attempts to add a bucket to the positive or negative range of this histogram.
<br>
Callers must adhere to the following rules:
<ul>
<li>All buckets for the negative values range must be provided before the first one from the positive values range.</li>
<li>For both the negative and positive ranges, buckets must... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/FixedCapacityExponentialHistogram.java | 175 | [
"index",
"count",
"isPositive"
] | true | 4 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false | |
needs_i8_conversion | def needs_i8_conversion(dtype: DtypeObj | None) -> bool:
"""
Check whether the dtype should be converted to int64.
Dtype "needs" such a conversion if the dtype is of a datetime-like dtype
Parameters
----------
dtype : np.dtype, ExtensionDtype, or None
Returns
-------
boolean
... | Check whether the dtype should be converted to int64.
Dtype "needs" such a conversion if the dtype is of a datetime-like dtype
Parameters
----------
dtype : np.dtype, ExtensionDtype, or None
Returns
-------
boolean
Whether or not the dtype should be converted to int64.
Examples
--------
>>> needs_i8_conversion(... | python | pandas/core/dtypes/common.py | 1,204 | [
"dtype"
] | bool | true | 2 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false |
head | def head(self, n: int = 5) -> Self:
"""
Return the first `n` rows.
This function exhibits the same behavior as ``df[:n]``, returning the
first ``n`` rows based on position. It is useful for quickly checking
if your object has the right type of data in it.
When ``n`` is ... | Return the first `n` rows.
This function exhibits the same behavior as ``df[:n]``, returning the
first ``n`` rows based on position. It is useful for quickly checking
if your object has the right type of data in it.
When ``n`` is positive, it returns the first ``n`` rows. For ``n`` equal to 0,
it returns an empty obj... | python | pandas/core/generic.py | 5,631 | [
"self",
"n"
] | Self | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
combine | @CanIgnoreReturnValue
@SuppressWarnings("unchecked") // ArrayBasedBuilder stores its elements as Object.
Builder<E> combine(Builder<E> other) {
if (hashTable != null) {
for (int i = 0; i < other.size; ++i) {
// requireNonNull is safe because the first `size` elements are non-null.
... | Adds each element of {@code elements} to the {@code ImmutableSet}, ignoring duplicate
elements (only the first duplicate element is added).
@param elements the elements to add to the {@code ImmutableSet}
@return this {@code Builder} object
@throws NullPointerException if {@code elements} is null or contains a null elem... | java | android/guava/src/com/google/common/collect/ImmutableSet.java | 577 | [
"other"
] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
add | public static boolean[] add(final boolean[] array, final boolean element) {
final boolean[] newArray = (boolean[]) copyArrayGrow1(array, Boolean.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
} | Copies the given array and adds the given element at the end of the new array.
<p>
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
</p>
<p>
If the input array is {@code null}, a new one e... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 221 | [
"array",
"element"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
createOffsetCommitRequest | private OffsetCommitRequestState createOffsetCommitRequest(final Map<TopicPartition, OffsetAndMetadata> offsets,
final long deadlineMs) {
return jitter.isPresent() ?
new OffsetCommitRequestState(
offsets,
... | Commit offsets, retrying on expected retriable errors while the retry timeout hasn't expired.
@param offsets Offsets to commit
@param deadlineMs Time until which the request will be retried if it fails with
an expected retriable error.
@return Future that will complete when a successful response | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 441 | [
"offsets",
"deadlineMs"
] | OffsetCommitRequestState | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false |
determinePointcutClassLoader | private @Nullable ClassLoader determinePointcutClassLoader() {
if (this.beanFactory instanceof ConfigurableBeanFactory cbf) {
return cbf.getBeanClassLoader();
}
if (this.pointcutDeclarationScope != null) {
return this.pointcutDeclarationScope.getClassLoader();
}
return ClassUtils.getDefaultClassLoader()... | Determine the ClassLoader to use for pointcut evaluation. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java | 209 | [] | ClassLoader | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
withScope | @Override
public Releasable withScope(Traceable traceable) {
final Context context = spans.get(traceable.getSpanId());
if (context != null && Span.fromContextOrNull(context).isRecording()) {
return context.makeCurrent()::close;
}
return () -> {};
} | Most of the examples of how to use the OTel API look something like this, where the span context
is automatically propagated:
<pre>{@code
Span span = tracer.spanBuilder("parent").startSpan();
try (Scope scope = parentSpan.makeCurrent()) {
// ...do some stuff, possibly creating further spans
} finally {
span.end... | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracer.java | 290 | [
"traceable"
] | Releasable | true | 3 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
hasNext | @Override
public final boolean hasNext() {
checkState(state != State.FAILED);
switch (state) {
case DONE:
return false;
case READY:
return true;
default:
}
return tryToComputeNext();
} | Implementations of {@link #computeNext} <b>must</b> invoke this method when there are no
elements left in the iteration.
@return {@code null}; a convenience so your {@code computeNext} implementation can use the
simple statement {@code return endOfData();} | java | android/guava/src/com/google/common/collect/AbstractIterator.java | 126 | [] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
containsSuperCall | function containsSuperCall(node: Node): boolean {
if (isSuperCall(node)) {
return true;
}
if (!(node.transformFlags & TransformFlags.ContainsLexicalSuper)) {
return false;
}
switch (node.kind) {
// stop at function boundaries
... | Transforms the parameters of the constructor declaration of a class.
@param constructor The constructor for the class.
@param hasSynthesizedSuper A value indicating whether the constructor starts with a
synthesized `super` call. | typescript | src/compiler/transformers/es2015.ts | 1,216 | [
"node"
] | true | 4 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
ofNonNull | public static <L, R> MutablePair<L, R> ofNonNull(final Map.Entry<L, R> pair) {
return of(Objects.requireNonNull(pair, "pair"));
} | Creates a mutable pair from a map entry.
@param <L> the left element type
@param <R> the right element type
@param pair the existing map entry.
@return a mutable pair formed from the map entry
@throws NullPointerException if the pair is null.
@since 3.20 | java | src/main/java/org/apache/commons/lang3/tuple/MutablePair.java | 118 | [
"pair"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
customizers | public ThreadPoolTaskExecutorBuilder customizers(ThreadPoolTaskExecutorCustomizer... customizers) {
Assert.notNull(customizers, "'customizers' must not be null");
return customizers(Arrays.asList(customizers));
} | Set the {@link ThreadPoolTaskExecutorCustomizer ThreadPoolTaskExecutorCustomizers}
that should be applied to the {@link ThreadPoolTaskExecutor}. Customizers are
applied in the order that they were added after builder configuration has been
applied. Setting this value will replace any previously configured customizers.
... | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskExecutorBuilder.java | 243 | [] | ThreadPoolTaskExecutorBuilder | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
conn_config | def conn_config(self) -> AwsConnectionWrapper:
"""Get the Airflow Connection object and wrap it in helper (cached)."""
connection = None
if self.aws_conn_id:
try:
connection = self.get_connection(self.aws_conn_id)
except AirflowNotFoundException:
... | Get the Airflow Connection object and wrap it in helper (cached). | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/base_aws.py | 613 | [
"self"
] | AwsConnectionWrapper | true | 4 | 6 | apache/airflow | 43,597 | unknown | false |
compute | public double compute(long... dataset) {
return computeInPlace(longsToDoubles(dataset));
} | Computes the quantile value of the given dataset.
@param dataset the dataset to do the calculation on, which must be non-empty, which will be
cast to doubles (with any associated lost of precision), and which will not be mutated by
this call (it is copied instead)
@return the quantile value | java | android/guava/src/com/google/common/math/Quantiles.java | 265 | [] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
createFetchRequest | protected FetchRequest.Builder createFetchRequest(final Node fetchTarget,
final FetchSessionHandler.FetchRequestData requestData) {
// Version 12 is the maximum version that could be used without topic IDs. See FetchRequest.json for schema
// changel... | Creates a new {@link FetchRequest fetch request} in preparation for sending to the Kafka cluster.
@param fetchTarget {@link Node} from which the fetch data will be requested
@param requestData {@link FetchSessionHandler.FetchRequestData} that represents the session data
@return {@link FetchRequest.Builder} that can be ... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractFetch.java | 310 | [
"fetchTarget",
"requestData"
] | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
setHtmlTextToMimePart | private void setHtmlTextToMimePart(MimePart mimePart, String text) throws MessagingException {
if (getEncoding() != null) {
mimePart.setContent(text, CONTENT_TYPE_HTML + CONTENT_TYPE_CHARSET_SUFFIX + getEncoding());
}
else {
mimePart.setContent(text, CONTENT_TYPE_HTML);
}
} | Set the given plain text and HTML text as alternatives, offering
both options to the email client. Requires multipart mode.
<p><b>NOTE:</b> Invoke {@link #addInline} <i>after</i> {@code setText};
else, mail readers might not be able to resolve inline references correctly.
@param plainText the plain text for the message... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 876 | [
"mimePart",
"text"
] | void | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
setAll | public static <T> T[] setAll(final T[] array, final IntFunction<? extends T> generator) {
if (array != null && generator != null) {
Arrays.setAll(array, generator);
}
return array;
} | Sets all elements of the specified array, using the provided generator supplier to compute each element.
<p>
If the generator supplier throws an exception, it is relayed to the caller and the array is left in an indeterminate
state.
</p>
@param <T> type of elements of the array, may be {@code null}.
@param array array ... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,748 | [
"array",
"generator"
] | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
iterable_not_string | def iterable_not_string(obj: object) -> bool:
"""
Check if the object is an iterable but not a string.
Parameters
----------
obj : The object to check.
Returns
-------
is_iter_not_string : bool
Whether `obj` is a non-string iterable.
Examples
--------
>>> iterable_... | Check if the object is an iterable but not a string.
Parameters
----------
obj : The object to check.
Returns
-------
is_iter_not_string : bool
Whether `obj` is a non-string iterable.
Examples
--------
>>> iterable_not_string([1, 2, 3])
True
>>> iterable_not_string("foo")
False
>>> iterable_not_string(1)
False | python | pandas/core/dtypes/inference.py | 81 | [
"obj"
] | bool | true | 2 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
eventuallyClose | @CanIgnoreReturnValue
@ParametricNullness
public <C extends @Nullable Object & @Nullable AutoCloseable> C eventuallyClose(
@ParametricNullness C closeable, Executor closingExecutor) {
checkNotNull(closingExecutor);
if (closeable != null) {
list.add(closeable, closingExecutor);
... | Captures an object to be closed when a {@link ClosingFuture} pipeline is done.
<p>Be careful when targeting an older SDK than you are building against (most commonly when
building for Android): Ensure that any object you pass implements the interface not just in
your current SDK version but also at the oldest version y... | java | android/guava/src/com/google/common/util/concurrent/ClosingFuture.java | 224 | [
"closeable",
"closingExecutor"
] | C | true | 2 | 7.44 | google/guava | 51,352 | javadoc | false |
agentmain | public static void agentmain(String agentArgs, Instrumentation inst) {
final Class<?> initClazz;
try {
initClazz = Class.forName(agentArgs);
} catch (ClassNotFoundException e) {
throw new AssertionError("entitlement agent does could not find EntitlementInitialization", e)... | The agent main method
@param agentArgs arguments passed to the agent.For our agent, this is the class to load and use for Entitlement Initialization.
See e.g. {@code EntitlementsBootstrap#loadAgent}
@param inst The {@link Instrumentation} instance to use for injecting Entitlements checks | java | libs/entitlement/agent/src/main/java/org/elasticsearch/entitlement/agent/EntitlementAgent.java | 34 | [
"agentArgs",
"inst"
] | void | true | 4 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
get_query_results_paginator | def get_query_results_paginator(
self,
query_execution_id: str,
max_items: int | None = None,
page_size: int | None = None,
starting_token: str | None = None,
) -> PageIterator | None:
"""
Fetch submitted Athena query results.
.. seealso::
... | Fetch submitted Athena query results.
.. seealso::
- :external+boto3:py:class:`Athena.Paginator.GetQueryResults`
:param query_execution_id: Id of submitted athena query
:param max_items: The total number of items to return.
:param page_size: The size of each page.
:param starting_token: A token to specify where t... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py | 227 | [
"self",
"query_execution_id",
"max_items",
"page_size",
"starting_token"
] | PageIterator | None | true | 4 | 7.44 | apache/airflow | 43,597 | sphinx | false |
purge | def purge(self, now=None):
# type: (float) -> None
"""Check oldest items and remove them if needed.
Arguments:
now (float): Time of purging -- by default right now.
This can be useful for unit testing.
"""
now = now or time.monotonic()
now = n... | Check oldest items and remove them if needed.
Arguments:
now (float): Time of purging -- by default right now.
This can be useful for unit testing. | python | celery/utils/collections.py | 577 | [
"self",
"now"
] | false | 8 | 6.24 | celery/celery | 27,741 | google | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.