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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
calculate_range | def calculate_range(dtype: torch.dtype) -> tuple:
"""
Calculate the range of values for a given torch.dtype.
Args:
dtype (torch.dtype): The input dtype.
Returns:
tuple: A tuple containing the minimum and maximum values.
"""
info = torch.finfo(dtype)
return info.min, info.max | Calculate the range of values for a given torch.dtype.
Args:
dtype (torch.dtype): The input dtype.
Returns:
tuple: A tuple containing the minimum and maximum values. | python | torch/_functorch/partitioners.py | 597 | [
"dtype"
] | tuple | true | 1 | 6.72 | pytorch/pytorch | 96,034 | google | false |
createEntrySet | @Override
ImmutableSet<Entry<K, V>> createEntrySet() {
final class EntrySet extends ImmutableMapEntrySet<K, V> {
@Override
public UnmodifiableIterator<Entry<K, V>> iterator() {
return asList().iterator();
}
@Override
ImmutableList<Entry<K, V>> createAsList() {
return... | Returns an immutable set of the mappings in this map, sorted by the key ordering. | java | android/guava/src/com/google/common/collect/ImmutableSortedMap.java | 850 | [] | true | 2 | 7.2 | google/guava | 51,352 | javadoc | false | |
hashDelete | function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
} | Removes `key` and its value from the hash.
@private
@name delete
@memberOf Hash
@param {Object} hash The hash to modify.
@param {string} key The key of the value to remove.
@returns {boolean} Returns `true` if the entry was removed, else `false`. | javascript | lodash.js | 1,979 | [
"key"
] | false | 3 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
Core | explicit Core(Try<T>&& t) : CoreBase(State::OnlyResult, 1) {
new (&this->result_) Result(std::move(t));
} | This can not be called concurrently with setResult(). | cpp | folly/futures/detail/Core.h | 688 | [] | true | 2 | 6.64 | facebook/folly | 30,157 | doxygen | false | |
parse_arguments | def parse_arguments() -> argparse.Namespace:
"""
Parses command-line arguments using argparse.
Returns:
argparse.Namespace: The parsed arguments containing the PR number, optional target directory, and strip count.
"""
parser = argparse.ArgumentParser(
description=(
"Dow... | Parses command-line arguments using argparse.
Returns:
argparse.Namespace: The parsed arguments containing the PR number, optional target directory, and strip count. | python | tools/nightly_hotpatch.py | 13 | [] | argparse.Namespace | true | 1 | 6.24 | pytorch/pytorch | 96,034 | unknown | false |
_filter_header | def _filter_header(s):
"""Clean up 'L' in npz header ints.
Cleans up the 'L' in strings representing integers. Needed to allow npz
headers produced in Python2 to be read in Python3.
Parameters
----------
s : string
Npy file header.
Returns
-------
header : str
Clea... | Clean up 'L' in npz header ints.
Cleans up the 'L' in strings representing integers. Needed to allow npz
headers produced in Python2 to be read in Python3.
Parameters
----------
s : string
Npy file header.
Returns
-------
header : str
Cleaned up header. | python | numpy/lib/_format_impl.py | 586 | [
"s"
] | false | 6 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
toBoolean | public Boolean toBoolean() {
return Boolean.valueOf(booleanValue());
} | Gets this mutable as an instance of Boolean.
@return a Boolean instance containing the value from this mutable, never null
@since 2.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java | 198 | [] | Boolean | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
combine | def combine(
self,
other: Series | Hashable,
func: Callable[[Hashable, Hashable], Hashable],
fill_value: Hashable | None = None,
) -> Series:
"""
Combine the Series with a Series or scalar according to `func`.
Combine the Series and `other` using `func` to pe... | Combine the Series with a Series or scalar according to `func`.
Combine the Series and `other` using `func` to perform elementwise
selection for combined Series.
`fill_value` is assumed when value is not present at some index
from one of the two Series being combined.
Parameters
----------
other : Series or scalar
... | python | pandas/core/series.py | 3,165 | [
"self",
"other",
"func",
"fill_value"
] | Series | true | 5 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
getPointcut | private @Nullable AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) {
AspectJAnnotation aspectJAnnotation =
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod);
if (aspectJAnnotation == null) {
return null;
}
AspectJExpressi... | Build a {@link org.springframework.aop.aspectj.DeclareParentsAdvisor}
for the given introduction field.
<p>Resulting Advisors will need to be evaluated for targets.
@param introductionField the field to introspect
@return the Advisor instance, or {@code null} if not an Advisor | java | spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java | 224 | [
"candidateAdviceMethod",
"candidateAspectClass"
] | AspectJExpressionPointcut | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
isposinf | def isposinf(x, out=None):
"""
Test element-wise for positive infinity, return result as bool array.
Parameters
----------
x : array_like
The input array.
out : array_like, optional
A location into which the result is stored. If provided, it must have a
shape that the in... | Test element-wise for positive infinity, return result as bool array.
Parameters
----------
x : array_like
The input array.
out : array_like, optional
A location into which the result is stored. If provided, it must have a
shape that the input broadcasts to. If not provided or None, a
freshly-allocated... | python | numpy/lib/_ufunclike_impl.py | 63 | [
"x",
"out"
] | false | 2 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
filter | def filter(
self,
items=None,
like: str | None = None,
regex: str | None = None,
axis: Axis | None = None,
) -> Self:
"""
Subset the DataFrame or Series according to the specified index labels.
For DataFrame, filter rows or columns depending on ``axis... | Subset the DataFrame or Series according to the specified index labels.
For DataFrame, filter rows or columns depending on ``axis`` argument.
Note that this routine does not filter based on content.
The filter is applied to the labels of the index.
Parameters
----------
items : list-like
Keep labels from axis whi... | python | pandas/core/generic.py | 5,518 | [
"self",
"items",
"like",
"regex",
"axis"
] | Self | true | 8 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
get_partition_cudagraph_metadata | def get_partition_cudagraph_metadata(
partition_map: GraphPartitionMap,
metadata: CudagraphMetadata,
) -> CudagraphMetadata:
"""
Convert the cudagraph metadata at the graph level to the graph partition level,
given the graph partition info (i.e., mapping from partition input/output index
to grap... | Convert the cudagraph metadata at the graph level to the graph partition level,
given the graph partition info (i.e., mapping from partition input/output index
to graph input/output index). | python | torch/_inductor/cudagraph_utils.py | 373 | [
"partition_map",
"metadata"
] | CudagraphMetadata | true | 9 | 6 | pytorch/pytorch | 96,034 | unknown | false |
open | JSONStringer open(Scope empty, String openBracket) throws JSONException {
if (this.stack.isEmpty() && !this.out.isEmpty()) {
throw new JSONException("Nesting problem: multiple top-level roots");
}
beforeValue();
this.stack.add(empty);
this.out.append(openBracket);
return this;
} | Enters a new scope by appending any necessary whitespace and the given bracket.
@param empty any necessary whitespace
@param openBracket the open bracket
@return this object
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONStringer.java | 175 | [
"empty",
"openBracket"
] | JSONStringer | true | 3 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
batches | Iterable<? extends RecordBatch> batches(); | Get the record batches. Note that the signature allows subclasses
to return a more specific batch type. This enables optimizations such as in-place offset
assignment (see for example {@link DefaultRecordBatch}), and partial reading of
record data, see {@link FileLogInputStream.FileChannelRecordBatch#magic()}.
@return A... | java | clients/src/main/java/org/apache/kafka/common/record/Records.java | 64 | [] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
sendJoinGroupRequest | RequestFuture<ByteBuffer> sendJoinGroupRequest() {
if (coordinatorUnknown())
return RequestFuture.coordinatorNotAvailable();
// send a join group request to the coordinator
log.info("(Re-)joining group");
JoinGroupRequest.Builder requestBuilder = new JoinGroupRequest.Builder... | Join the group and return the assignment for the next generation. This function handles both
JoinGroup and SyncGroup, delegating to {@link #onLeaderElected(String, String, List, boolean)} if
elected leader by the coordinator.
NOTE: This is visible only for testing
@return A request future which wraps the assignment ret... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 606 | [] | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
getSharedInstance | public static ConversionService getSharedInstance() {
ApplicationConversionService sharedInstance = ApplicationConversionService.sharedInstance;
if (sharedInstance == null) {
synchronized (ApplicationConversionService.class) {
sharedInstance = ApplicationConversionService.sharedInstance;
if (sharedInstan... | Return a shared default application {@code ConversionService} instance, lazily
building it once needed.
<p>
Note: This method actually returns an {@link ApplicationConversionService}
instance. However, the {@code ConversionService} signature has been preserved for
binary compatibility.
@return the shared {@code Applica... | java | core/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java | 202 | [] | ConversionService | true | 3 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
loadManifest | private Object loadManifest() throws IOException {
File file = new File(this.rootDirectory, "META-INF/MANIFEST.MF");
if (!file.exists()) {
return NO_MANIFEST;
}
try (FileInputStream inputStream = new FileInputStream(file)) {
return new Manifest(inputStream);
}
} | Create a new {@link ExplodedArchive} instance.
@param rootDirectory the root directory | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/ExplodedArchive.java | 76 | [] | Object | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
copyIncludes | private EnumSet<Include> copyIncludes() {
return (this.includes.isEmpty()) ? EnumSet.noneOf(Include.class) : EnumSet.copyOf(this.includes);
} | Remove elements from the given map if they are not included in this set of options.
@param map the map to update
@since 3.2.7 | java | core/spring-boot/src/main/java/org/springframework/boot/web/error/ErrorAttributeOptions.java | 98 | [] | true | 2 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
build | @Override
public ImmutableSortedMultiset<E> build() {
dedupAndCoalesceAndDeleteEmpty();
if (length == 0) {
return emptyMultiset(comparator);
}
RegularImmutableSortedSet<E> elementSet =
(RegularImmutableSortedSet<E>) ImmutableSortedSet.construct(comparator, length, elements)... | Returns a newly-created {@code ImmutableSortedMultiset} based on the contents of the {@code
Builder}. | java | android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 689 | [] | true | 3 | 6.08 | google/guava | 51,352 | javadoc | false | |
getNestedJarEntry | private NestedJarEntry getNestedJarEntry(String name) {
Objects.requireNonNull(name, "name");
NestedJarEntry lastEntry = this.lastEntry;
if (lastEntry != null && name.equals(lastEntry.getName())) {
return lastEntry;
}
ZipContent.Entry entry = getVersionedContentEntry(name);
entry = (entry != null) ? entr... | 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 | 257 | [
"name"
] | NestedJarEntry | true | 5 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
_unbox_scalar | def _unbox_scalar(
self, value: DTScalarOrNaT
) -> np.int64 | np.datetime64 | np.timedelta64:
"""
Unbox the integer value of a scalar `value`.
Parameters
----------
value : Period, Timestamp, Timedelta, or NaT
Depending on subclass.
Returns
... | Unbox the integer value of a scalar `value`.
Parameters
----------
value : Period, Timestamp, Timedelta, or NaT
Depending on subclass.
Returns
-------
int
Examples
--------
>>> arr = pd.array(np.array(["1970-01-01"], "datetime64[ns]"))
>>> arr._unbox_scalar(arr[0])
np.datetime64('1970-01-01T00:00:00.000000000') | python | pandas/core/arrays/datetimelike.py | 258 | [
"self",
"value"
] | np.int64 | np.datetime64 | np.timedelta64 | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
is_keys_unchanged_async | async def is_keys_unchanged_async(
self,
client: AioBaseClient,
bucket_name: str,
prefix: str,
inactivity_period: float = 60 * 60,
min_objects: int = 1,
previous_objects: set[str] | None = None,
inactivity_seconds: int = 0,
allow_delete: bool = Tru... | Check if new objects have been uploaded and the period has passed; update sensor state accordingly.
:param client: aiobotocore client
:param bucket_name: the name of the bucket
:param prefix: a key prefix
:param inactivity_period: the total seconds of inactivity to designate
keys unchanged. Note, this mechanism i... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 724 | [
"self",
"client",
"bucket_name",
"prefix",
"inactivity_period",
"min_objects",
"previous_objects",
"inactivity_seconds",
"allow_delete",
"last_activity_time"
] | dict[str, Any] | true | 9 | 6.64 | apache/airflow | 43,597 | sphinx | false |
newSample | @Override
protected HistogramSample newSample(long timeMs) {
return new HistogramSample(binScheme, timeMs);
} | Return the computed frequency describing the number of occurrences of the values in the bucket for the given
center point, relative to the total number of occurrences in the samples.
@param config the metric configuration
@param now the current time in milliseconds
@param centerValue the value correspondin... | java | clients/src/main/java/org/apache/kafka/common/metrics/stats/Frequencies.java | 161 | [
"timeMs"
] | HistogramSample | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
lastIndexOf | public int lastIndexOf(final String str) {
return lastIndexOf(str, size - 1);
} | Searches the string builder to find the last reference to the specified string.
<p>
Note that a null input string will return -1, whereas the JDK throws an exception.
</p>
@param str the string to find, null returns -1
@return the last index of the string, or -1 if not found | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,345 | [
"str"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
hermfromroots | def hermfromroots(roots):
"""
Generate a Hermite series with given roots.
The function returns the coefficients of the polynomial
.. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),
in Hermite form, where the :math:`r_n` are the roots specified in `roots`.
If a zero has multiplicity n, ... | Generate a Hermite series with given roots.
The function returns the coefficients of the polynomial
.. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),
in Hermite form, where the :math:`r_n` are the roots specified in `roots`.
If a zero has multiplicity n, then it must appear in `roots` n times.
For instance, ... | python | numpy/polynomial/hermite.py | 256 | [
"roots"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
fallback_to_default_project_endpoint | def fallback_to_default_project_endpoint(func: Callable[..., RT]) -> Callable[..., RT]:
"""
Provide fallback for MaxCompute project and endpoint to be used as a decorator.
If the project or endpoint is None it will be replaced with the project from the
connection extra definition.
:param func: fun... | Provide fallback for MaxCompute project and endpoint to be used as a decorator.
If the project or endpoint is None it will be replaced with the project from the
connection extra definition.
:param func: function to wrap
:return: result of the function call | python | providers/alibaba/src/airflow/providers/alibaba/cloud/hooks/maxcompute.py | 34 | [
"func"
] | Callable[..., RT] | true | 4 | 8.08 | apache/airflow | 43,597 | sphinx | false |
iterator | @Override
public Iterator<ConditionAndOutcome> iterator() {
return Collections.unmodifiableSet(this.outcomes).iterator();
} | Return a {@link Stream} of the {@link ConditionAndOutcome} items.
@return a stream of the {@link ConditionAndOutcome} items.
@since 3.5.0 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | 253 | [] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
start_go_pipeline_with_binary | def start_go_pipeline_with_binary(
self,
variables: dict,
launcher_binary: str,
worker_binary: str,
process_line_callback: Callable[[str], None] | None = None,
) -> None:
"""
Start Apache Beam Go pipeline with an executable binary.
:param variables: V... | Start Apache Beam Go pipeline with an executable binary.
:param variables: Variables passed to the job.
:param launcher_binary: Path to the binary compiled for the launching platform.
:param worker_binary: Path to the binary compiled for the worker platform.
:param process_line_callback: (optional) Callback that can b... | python | providers/apache/beam/src/airflow/providers/apache/beam/hooks/beam.py | 406 | [
"self",
"variables",
"launcher_binary",
"worker_binary",
"process_line_callback"
] | None | true | 2 | 6.72 | apache/airflow | 43,597 | sphinx | false |
onStart | default <T> @Nullable Bindable<T> onStart(ConfigurationPropertyName name, Bindable<T> target, BindContext context) {
return target;
} | Called when binding of an element starts but before any result has been determined.
@param <T> the bindable source type
@param name the name of the element being bound
@param target the item being bound
@param context the bind context
@return the actual item that should be used for binding (may be {@code null}) | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindHandler.java | 48 | [
"name",
"target",
"context"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
ensure_python_int | def ensure_python_int(value: int | np.integer) -> int:
"""
Ensure that a value is a python int.
Parameters
----------
value: int or numpy.integer
Returns
-------
int
Raises
------
TypeError: if the value isn't an int or can't be converted to one.
"""
if not (is_int... | Ensure that a value is a python int.
Parameters
----------
value: int or numpy.integer
Returns
-------
int
Raises
------
TypeError: if the value isn't an int or can't be converted to one. | python | pandas/core/dtypes/common.py | 96 | [
"value"
] | int | true | 4 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
_write_dump_to_disk | def _write_dump_to_disk(self, dump: CacheDump) -> None:
"""Write the cache dump to disk.
Writes the provided dump to the shared cache JSON file and logs the result.
Args:
dump: The cache dump to write.
"""
try:
with open(self._shared_cache_filepath, "w")... | Write the cache dump to disk.
Writes the provided dump to the shared cache JSON file and logs the result.
Args:
dump: The cache dump to write. | python | torch/_inductor/runtime/caching/interfaces.py | 305 | [
"self",
"dump"
] | None | true | 3 | 6.72 | pytorch/pytorch | 96,034 | google | false |
_gotitem | def _gotitem(self, key, ndim: int, subset=None):
"""
sub-classes to define
return a sliced object
Parameters
----------
key : string / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset t... | sub-classes to define
return a sliced object
Parameters
----------
key : string / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset to act on | python | pandas/core/groupby/generic.py | 2,849 | [
"self",
"key",
"ndim",
"subset"
] | true | 5 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false | |
reduce | function reduce(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduce : baseReduce,
initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
} | Reduces `collection` to a value which is the accumulated result of running
each element in `collection` thru `iteratee`, where each successive
invocation is supplied the return value of the previous. If `accumulator`
is not given, the first element of `collection` is used as the initial
value. The iteratee is invoked w... | javascript | lodash.js | 9,784 | [
"collection",
"iteratee",
"accumulator"
] | false | 2 | 7.04 | lodash/lodash | 61,490 | jsdoc | false | |
hasCycle | public static boolean hasCycle(Network<?, ?> network) {
// In a directed graph, parallel edges cannot introduce a cycle in an acyclic graph.
// However, in an undirected graph, any parallel edge induces a cycle in the graph.
if (!network.isDirected()
&& network.allowsParallelEdges()
&& netwo... | Returns true if {@code network} has at least one cycle. A cycle is defined as a non-empty
subset of edges in a graph arranged to form a path (a sequence of adjacent outgoing edges)
starting and ending with the same node.
<p>This method will detect any non-empty cycle, including self-loops (a cycle of length 1). | java | android/guava/src/com/google/common/graph/Graphs.java | 86 | [
"network"
] | true | 4 | 6 | google/guava | 51,352 | javadoc | false | |
createCellSet | @Override
abstract ImmutableSet<Cell<R, C, V>> createCellSet(); | A builder for creating immutable table instances, especially {@code public static final} tables
("constant tables"). Example:
{@snippet :
static final ImmutableTable<Integer, Character, String> SPREADSHEET =
new ImmutableTable.Builder<Integer, Character, String>()
.put(1, 'A', "foo")
.put(1, 'B', "b... | java | android/guava/src/com/google/common/collect/ImmutableTable.java | 306 | [] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
from_constructor | def from_constructor(
cls,
aws_conn_id: str | None,
region_name: str | None,
verify: bool | str | None,
botocore_config: dict[str, Any] | None,
additional_params: dict,
):
"""
Resolve generic AWS Hooks parameters in class constructor.
Examples... | Resolve generic AWS Hooks parameters in class constructor.
Examples:
.. code-block:: python
class AwsFooBarOperator(BaseOperator):
def __init__(
self,
*,
aws_conn_id: str | None = "aws_default",
region_name: str | None = None,
verify: bool | str... | python | providers/amazon/src/airflow/providers/amazon/aws/utils/mixins.py | 53 | [
"cls",
"aws_conn_id",
"region_name",
"verify",
"botocore_config",
"additional_params"
] | true | 1 | 6.48 | apache/airflow | 43,597 | unknown | false | |
of | static EnvironmentPostProcessorsFactory of(String... classNames) {
return of(null, classNames);
} | Return a {@link EnvironmentPostProcessorsFactory} that reflectively creates post
processors from the given class names.
@param classNames the post processor class names
@return an {@link EnvironmentPostProcessorsFactory} instance | java | core/spring-boot/src/main/java/org/springframework/boot/support/EnvironmentPostProcessorsFactory.java | 74 | [] | EnvironmentPostProcessorsFactory | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
deleteHorizonMs | OptionalLong deleteHorizonMs(); | Get the delete horizon, returns OptionalLong.EMPTY if the first timestamp is not the delete horizon
@return timestamp of the delete horizon | java | clients/src/main/java/org/apache/kafka/common/record/RecordBatch.java | 220 | [] | OptionalLong | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
toStringBase | protected String toStringBase() {
return "owner='" + owner + '\'' +
", exponentialBackoff=" + exponentialBackoff +
", lastSentMs=" + lastSentMs +
", lastReceivedMs=" + lastReceivedMs +
", numAttempts=" + numAttempts +
", backoffMs="... | This method appends the instance variables together in a simple String of comma-separated key value pairs.
This allows subclasses to include these values and not have to duplicate each variable, helping to prevent
any variables from being omitted when new ones are added.
@return String version of instance variables. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestState.java | 149 | [] | String | true | 1 | 6.88 | apache/kafka | 31,560 | javadoc | false |
check_increasing | def check_increasing(x, y):
"""Determine whether y is monotonically correlated with x.
y is found increasing or decreasing with respect to x based on a Spearman
correlation test.
Parameters
----------
x : array-like of shape (n_samples,)
Training data.
y : array-like of shape ... | Determine whether y is monotonically correlated with x.
y is found increasing or decreasing with respect to x based on a Spearman
correlation test.
Parameters
----------
x : array-like of shape (n_samples,)
Training data.
y : array-like of shape (n_samples,)
Training target.
Returns
-------
increasing_b... | python | sklearn/isotonic.py | 31 | [
"x",
"y"
] | false | 4 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
pollLast | @CanIgnoreReturnValue
public @Nullable E pollLast() {
return isEmpty() ? null : removeAndGet(getMaxElementIndex());
} | Removes and returns the greatest element of this queue, or returns {@code null} if the queue is
empty. | java | android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java | 367 | [] | E | true | 2 | 6.96 | google/guava | 51,352 | javadoc | false |
format_tags | def format_tags(source: Any, *, key_label: str = "Key", value_label: str = "Value"):
"""
Format tags for boto call which expect a given format.
If given a dictionary, formats it as an array of objects with a key and a value field to be passed to boto
calls that expect this format.
Else, assumes th... | Format tags for boto call which expect a given format.
If given a dictionary, formats it as an array of objects with a key and a value field to be passed to boto
calls that expect this format.
Else, assumes that it's already in the right format and returns it as is. We do not validate
the format here since it's done ... | python | providers/amazon/src/airflow/providers/amazon/aws/utils/tags.py | 22 | [
"source",
"key_label",
"value_label"
] | true | 3 | 7.04 | apache/airflow | 43,597 | sphinx | false | |
compressionType | @Override
public CompressionType compressionType() {
return CompressionType.forId(attributes() & COMPRESSION_CODEC_MASK);
} | 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 | 216 | [] | CompressionType | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
visitYieldExpression | function visitYieldExpression(node: YieldExpression) {
if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) {
if (node.asteriskToken) {
const expression = visitNode(Debug.checkDefined(node.expression), visitor, isExpression);
... | @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 | 408 | [
"node"
] | false | 5 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
excluded_combos | def excluded_combos(list_1: list[str], list_2: list[str]) -> list[tuple[str, str]]:
"""
Return exclusion lists of elements that should be excluded from the matrix of the two list of items
if what's left should be representative list of combos (i.e. each item from both lists,
has to be present at least o... | Return exclusion lists of elements that should be excluded from the matrix of the two list of items
if what's left should be representative list of combos (i.e. each item from both lists,
has to be present at least once in the combos).
:param list_1: first list
:param list_2: second list
:return: list of exclusions = l... | python | dev/breeze/src/airflow_breeze/utils/exclude_from_matrix.py | 36 | [
"list_1",
"list_2"
] | list[tuple[str, str]] | true | 1 | 7.04 | apache/airflow | 43,597 | sphinx | false |
peek | ShareCompletedFetch peek() {
lock.lock();
try {
return completedFetches.peek();
} finally {
lock.unlock();
}
} | Returns {@code true} if there are no completed fetches pending to return to the user.
@return {@code true} if the buffer is empty, {@code false} otherwise | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetchBuffer.java | 104 | [] | ShareCompletedFetch | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
upgrade | def upgrade():
"""Apply Change value column type to longblob in xcom table for mysql."""
conn = op.get_bind()
if conn.dialect.name == "mysql":
with op.batch_alter_table("xcom", schema=None) as batch_op:
batch_op.alter_column("value", type_=sa.LargeBinary().with_variant(LONGBLOB, "mysql")... | Apply Change value column type to longblob in xcom table for mysql. | python | airflow-core/src/airflow/migrations/versions/0013_2_9_0_make_xcom_value_to_longblob_for_mysql.py | 42 | [] | false | 2 | 6.24 | apache/airflow | 43,597 | unknown | false | |
regionMatches | static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart,
final CharSequence substring, final int start, final int length) {
if (cs instanceof String && substring instanceof String) {
return ((String) cs).regionMatches(ignoreCase, thisStart, (S... | Green implementation of regionMatches.
@param cs the {@link CharSequence} to be processed.
@param ignoreCase whether or not to be case-insensitive.
@param thisStart the index to start on the {@code cs} CharSequence.
@param substring the {@link CharSequence} to be looked for.
@param start the index to start on the {@cod... | java | src/main/java/org/apache/commons/lang3/CharSequenceUtils.java | 295 | [
"cs",
"ignoreCase",
"thisStart",
"substring",
"start",
"length"
] | true | 13 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
completeProxiedInterfaces | public static Class<?>[] completeProxiedInterfaces(AdvisedSupport advised) {
return completeProxiedInterfaces(advised, false);
} | Determine the complete set of interfaces to proxy for the given AOP configuration.
<p>This will always add the {@link Advised} interface unless the AdvisedSupport's
{@link AdvisedSupport#setOpaque "opaque"} flag is on. Always adds the
{@link org.springframework.aop.SpringProxy} marker interface.
@param advised the prox... | java | spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java | 146 | [
"advised"
] | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false | |
read_log_chunks | def read_log_chunks(
self,
ti: TaskInstance | TaskInstanceHistory,
try_number: int | None,
metadata: LogMetadata,
) -> tuple[LogHandlerOutputStream, LogMetadata]:
"""
Read chunks of Task Instance logs.
:param ti: The taskInstance
:param try_number:
... | Read chunks of Task Instance logs.
:param ti: The taskInstance
:param try_number:
:param metadata: A dictionary containing information about how to read the task log
The following is an example of how to use this method to read log:
.. code-block:: python
logs, metadata = task_log_reader.read_log_chunks(ti, try... | python | airflow-core/src/airflow/utils/log/log_reader.py | 77 | [
"self",
"ti",
"try_number",
"metadata"
] | tuple[LogHandlerOutputStream, LogMetadata] | true | 2 | 6.88 | apache/airflow | 43,597 | sphinx | false |
visitNewExpression | function visitNewExpression(node: NewExpression): LeftHandSideExpression {
if (some(node.arguments, isSpreadElement)) {
// We are here because we contain a SpreadElementExpression.
// [source]
// new C(...a)
//
// [output]
// ... | Visits a NewExpression that contains a spread element.
@param node A NewExpression node. | typescript | src/compiler/transformers/es2015.ts | 4,601 | [
"node"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
leastOf | public <E extends T> List<E> leastOf(Iterable<E> iterable, int k) {
if (iterable instanceof Collection) {
Collection<E> collection = (Collection<E>) iterable;
if (collection.size() <= 2L * k) {
// In this case, just dumping the collection to an array and sorting is
// faster than using t... | Returns the {@code k} least elements of the given iterable according to this ordering, in order
from least to greatest. If there are fewer than {@code k} elements present, all will be
included.
<p>The implementation does not necessarily use a <i>stable</i> sorting algorithm; when multiple
elements are equivalent, it is... | java | android/guava/src/com/google/common/collect/Ordering.java | 745 | [
"iterable",
"k"
] | true | 4 | 6.4 | google/guava | 51,352 | javadoc | false | |
compare | @Override
public int compare(LoggerConfiguration o1, LoggerConfiguration o2) {
if (this.rootLoggerName.equals(o1.getName())) {
return -1;
}
if (this.rootLoggerName.equals(o2.getName())) {
return 1;
}
return o1.getName().compareTo(o2.getName());
} | Create a new {@link LoggerConfigurationComparator} instance.
@param rootLoggerName the name of the "root" logger | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfigurationComparator.java | 42 | [
"o1",
"o2"
] | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
joinA | public <A extends Appendable> A joinA(final A appendable, final Iterable<T> elements) throws IOException {
return joinIterable(appendable, prefix, suffix, delimiter, appender, elements);
} | Joins stringified objects from the given Iterable into an Appendable.
@param <A> the Appendable type.
@param appendable The target.
@param elements The source.
@return The given StringBuilder.
@throws IOException If an I/O error occurs | java | src/main/java/org/apache/commons/lang3/AppendableJoiner.java | 296 | [
"appendable",
"elements"
] | A | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
random | @Deprecated
public static String random(final int count, final char... chars) {
return secure().next(count, chars);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of characters specified.
</p>
@param count the length of random string to create.
@param chars the character array containing the set of characters to use, may be null.
@return the random string.
@thro... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 171 | [
"count"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
isTraceEnabled | @Override
public boolean isTraceEnabled() {
synchronized (this.lines) {
return (this.destination == null) || this.destination.isTraceEnabled();
}
} | 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 | 65 | [] | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false | |
ffill | def ffill(self, limit: int | None = None):
"""
Forward fill the values.
This method fills missing values by propagating the last valid
observation forward, up to the next valid observation. It is commonly
used in time series analysis when resampling data to a higher frequency
... | Forward fill the values.
This method fills missing values by propagating the last valid
observation forward, up to the next valid observation. It is commonly
used in time series analysis when resampling data to a higher frequency
(upsampling) and filling gaps in the resampled output.
Parameters
----------
limit : int... | python | pandas/core/resample.py | 608 | [
"self",
"limit"
] | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false | |
masked_all | def masked_all(shape, dtype=float):
"""
Empty masked array with all elements masked.
Return an empty masked array of the given shape and dtype, where all the
data are masked.
Parameters
----------
shape : int or tuple of ints
Shape of the required MaskedArray, e.g., ``(2, 3)`` or `... | Empty masked array with all elements masked.
Return an empty masked array of the given shape and dtype, where all the
data are masked.
Parameters
----------
shape : int or tuple of ints
Shape of the required MaskedArray, e.g., ``(2, 3)`` or ``2``.
dtype : dtype, optional
Data type of the output.
Returns
----... | python | numpy/ma/extras.py | 120 | [
"shape",
"dtype"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
equals | @Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof AbstractRegexpMethodPointcut otherPointcut &&
Arrays.equals(this.patterns, otherPointcut.patterns) &&
Arrays.equals(this.excludedPatterns, otherPointcut.excludedPatterns)));
} | Does the exclusion pattern at the given index match the given String?
@param pattern the {@code String} pattern to match
@param patternIndex index of pattern (starting from 0)
@return {@code true} if there is a match, {@code false} otherwise | java | spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java | 198 | [
"other"
] | true | 4 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false | |
set_context | def set_context(
self, ti: TaskInstance | TaskInstanceHistory, *, identifier: str | None = None
) -> None | SetContextPropagate:
"""
Provide task_instance context to airflow task handler.
Generally speaking returns None. But if attr `maintain_propagate` has
been set to prop... | Provide task_instance context to airflow task handler.
Generally speaking returns None. But if attr `maintain_propagate` has
been set to propagate, then returns sentinel MAINTAIN_PROPAGATE. This
has the effect of overriding the default behavior to set `propagate`
to False whenever set_context is called. At time of w... | python | airflow-core/src/airflow/utils/log/file_task_handler.py | 462 | [
"self",
"ti",
"identifier"
] | None | SetContextPropagate | true | 3 | 6.72 | apache/airflow | 43,597 | sphinx | false |
chebdiv | def chebdiv(c1, c2):
"""
Divide one Chebyshev series by another.
Returns the quotient-with-remainder of two Chebyshev series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``T_0 + 2*T_1 + 3*T_2``.
Parameter... | Divide one Chebyshev series by another.
Returns the quotient-with-remainder of two Chebyshev series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, c2 : array_like
1-D arrays of Ch... | python | numpy/polynomial/chebyshev.py | 747 | [
"c1",
"c2"
] | false | 5 | 6.24 | numpy/numpy | 31,054 | numpy | false | |
toLong | public @Nullable Long toLong() {
return this.pid;
} | Return the application PID as a {@link Long}.
@return the application PID or {@code null}
@since 3.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java | 76 | [] | Long | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false |
drainRecencyQueue | @GuardedBy("this")
void drainRecencyQueue() {
ReferenceEntry<K, V> e;
while ((e = recencyQueue.poll()) != null) {
// An entry may be in the recency queue despite it being removed from
// the map . This can occur when the entry was concurrently read while a
// writer is removing i... | Drains the recency queue, updating eviction metadata that the entries therein were read in
the specified relative order. This currently amounts to adding them to relevant eviction
lists (accounting for the fact that they could have been removed from the map since being
added to the recency queue). | java | android/guava/src/com/google/common/cache/LocalCache.java | 2,492 | [] | void | true | 3 | 7.04 | google/guava | 51,352 | javadoc | false |
postProcessBeforeInitialization | default @Nullable Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
} | Apply this {@code BeanPostProcessor} to the given new bean instance <i>before</i> any bean
initialization callbacks (like InitializingBean's {@code afterPropertiesSet}
or a custom init-method). The bean will already be populated with property values.
The returned bean instance may be a wrapper around the original.
<p>T... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/BeanPostProcessor.java | 74 | [
"bean",
"beanName"
] | Object | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
moduleResolve | function moduleResolve(specifier, base, conditions, preserveSymlinks) {
const protocol = typeof base === 'string' ?
StringPrototypeSlice(base, 0, StringPrototypeIndexOf(base, ':') + 1) :
base.protocol;
const isData = protocol === 'data:';
// Order swapped from spec for minor perf gain.
// Ok since relat... | Resolves a module specifier to a URL.
@param {string} specifier - The module specifier to resolve.
@param {string | URL | undefined} base - The base URL to resolve against.
@param {Set<string>} conditions - An object containing environment conditions.
@param {boolean} preserveSymlinks - Whether to preserve symlinks in ... | javascript | lib/internal/modules/esm/resolve.js | 830 | [
"specifier",
"base",
"conditions",
"preserveSymlinks"
] | false | 12 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
oss_write | def oss_write(self, log, remote_log_location, append=True) -> bool:
"""
Write the log to remote_log_location and return `True`; fails silently and returns `False` on error.
:param log: the log to write to the remote_log_location
:param remote_log_location: the log's location in remote s... | Write the log to remote_log_location and return `True`; fails silently and returns `False` on error.
:param log: the log to write to the remote_log_location
:param remote_log_location: the log's location in remote storage
:param append: if False, any existing log file is overwritten. If True,
the new log is append... | python | providers/alibaba/src/airflow/providers/alibaba/cloud/log/oss_task_handler.py | 129 | [
"self",
"log",
"remote_log_location",
"append"
] | bool | true | 3 | 7.92 | apache/airflow | 43,597 | sphinx | false |
parseDsaDer | private static DSAPrivateKeySpec parseDsaDer(byte[] keyBytes) throws IOException {
DerParser parser = new DerParser(keyBytes);
DerParser.Asn1Object sequence = parser.readAsn1Object();
parser = sequence.getParser();
parser.readAsn1Object().getInteger(); // (version) We don't need it but m... | Parses a DER encoded DSA key to a {@link DSAPrivateKeySpec} using a minimal {@link DerParser}
@param keyBytes the private key raw bytes
@return {@link DSAPrivateKeySpec}
@throws IOException if the DER encoded key can't be parsed | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | 646 | [
"keyBytes"
] | DSAPrivateKeySpec | true | 1 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
genericArrayType | public static GenericArrayType genericArrayType(final Type componentType) {
return new GenericArrayTypeImpl(Objects.requireNonNull(componentType, "componentType"));
} | Creates a generic array type instance.
@param componentType the type of the elements of the array. For example the component type of {@code boolean[]} is {@code boolean}.
@return {@link GenericArrayType}.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 573 | [
"componentType"
] | GenericArrayType | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
setFileExtensions | public void setFileExtensions(List<String> fileExtensions) {
Assert.isTrue(!CollectionUtils.isEmpty(fileExtensions), "At least one file extension is required");
for (String extension : fileExtensions) {
if (!extension.startsWith(".")) {
throw new IllegalArgumentException("File extension '" + extension + "' s... | Set the list of supported file extensions.
<p>The default is a list containing {@code .properties} and {@code .xml}.
@param fileExtensions the file extensions (starts with a dot)
@since 6.1 | java | spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java | 125 | [
"fileExtensions"
] | void | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
getCommands | async function getCommands(options: ExecOptionsWithStringEncoding, existingCommands?: Set<string>): Promise<ICompletionResource[]> {
const output = await execHelper('Get-Command -All | Select-Object Name, CommandType, Definition, ModuleName, @{Name="Version";Expression={$_.Version.ToString()}} | ConvertTo-Json', {
.... | The numeric values associated with CommandType from Get-Command. It appears that this is a
bitfield based on the values but I think it's actually used as an enum where a CommandType can
only be a single one of these.
Source:
```
[enum]::GetValues([System.Management.Automation.CommandTypes]) | ForEach-Object {
[pscu... | typescript | extensions/terminal-suggest/src/shell/pwsh.ts | 103 | [
"options",
"existingCommands?"
] | true | 6 | 6.96 | microsoft/vscode | 179,840 | jsdoc | true | |
findPropertySource | private String findPropertySource(MutablePropertySources sources) {
if (ClassUtils.isPresent(SERVLET_ENVIRONMENT_CLASS, null)) {
PropertySource<?> servletPropertySource = sources.stream()
.filter((source) -> SERVLET_ENVIRONMENT_PROPERTY_SOURCES.contains(source.getName()))
.findFirst()
.orElse(null);
... | 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 | 166 | [
"sources"
] | String | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
from_range | def from_range(cls, data: range, name=None, dtype: Dtype | None = None) -> Self:
"""
Create :class:`pandas.RangeIndex` from a ``range`` object.
This method provides a way to create a :class:`pandas.RangeIndex` directly
from a Python ``range`` object. The resulting :class:`RangeIndex` wi... | Create :class:`pandas.RangeIndex` from a ``range`` object.
This method provides a way to create a :class:`pandas.RangeIndex` directly
from a Python ``range`` object. The resulting :class:`RangeIndex` will have
the same start, stop, and step values as the input ``range`` object.
It is particularly useful for constructi... | python | pandas/core/indexes/range.py | 188 | [
"cls",
"data",
"name",
"dtype"
] | Self | true | 2 | 8 | pandas-dev/pandas | 47,362 | numpy | false |
availableMemory | long availableMemory(); | Returns the amount of memory available for allocation by this pool.
NOTE: result may be negative (pools may over allocate to avoid starvation issues)
@return bytes available | java | clients/src/main/java/org/apache/kafka/common/memory/MemoryPool.java | 84 | [] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
throwableOfThrowable | public static <T extends Throwable> T throwableOfThrowable(final Throwable throwable, final Class<T> clazz, final int fromIndex) {
return throwableOf(throwable, clazz, fromIndex, false);
} | Returns the first {@link Throwable} that matches the specified type in the exception chain from a specified index. Subclasses of the specified class do
not match - see {@link #throwableOfType(Throwable, Class, int)} for the opposite.
<p>
A {@code null} throwable returns {@code null}. A {@code null} type returns {@code ... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 974 | [
"throwable",
"clazz",
"fromIndex"
] | T | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
mean_pinball_loss | def mean_pinball_loss(
y_true, y_pred, *, sample_weight=None, alpha=0.5, multioutput="uniform_average"
):
"""Pinball loss for quantile regression.
Read more in the :ref:`User Guide <pinball_loss>`.
Parameters
----------
y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)
... | Pinball loss for quantile regression.
Read more in the :ref:`User Guide <pinball_loss>`.
Parameters
----------
y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)
Ground truth (correct) target values.
y_pred : array-like of shape (n_samples,) or (n_samples, n_outputs)
Estimated target values.... | python | sklearn/metrics/_regression.py | 318 | [
"y_true",
"y_pred",
"sample_weight",
"alpha",
"multioutput"
] | false | 5 | 7.28 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
outputKeys | public Set<String> outputKeys() {
Set<String> result = new LinkedHashSet<>(matchPairs.size());
for (DissectPair matchPair : matchPairs) {
if (matchPair.key.getModifier() != DissectKey.Modifier.NAMED_SKIP) {
result.add(matchPair.key.getName());
}
}
... | Returns the output keys produced by the instance (excluding named skip keys),
e.g. for the pattern <code>"%{a} %{b} %{?c}"</code> the result is <code>[a, b]</code>.
<p>
The result is an ordered set, where the entries are in the same order as they appear in the pattern.
<p>
The reference keys are returned with the name ... | java | libs/dissect/src/main/java/org/elasticsearch/dissect/DissectParser.java | 310 | [] | true | 2 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
removeAll | @CanIgnoreReturnValue
public static boolean removeAll(Iterator<?> removeFrom, Collection<?> elementsToRemove) {
checkNotNull(elementsToRemove);
boolean result = false;
while (removeFrom.hasNext()) {
if (elementsToRemove.contains(removeFrom.next())) {
removeFrom.remove();
result = tru... | Traverses an iterator and removes every element that belongs to the provided collection. The
iterator will be left exhausted: its {@code hasNext()} method will return {@code false}.
@param removeFrom the iterator to (potentially) remove elements from
@param elementsToRemove the elements to remove
@return {@code true} i... | java | android/guava/src/com/google/common/collect/Iterators.java | 205 | [
"removeFrom",
"elementsToRemove"
] | true | 3 | 7.6 | google/guava | 51,352 | javadoc | false | |
wrapHook | function wrapHook(index, userHookOrDefault, next) {
return function nextStep(arg0, context) {
lastRunIndex = index;
if (context && context !== mergedContext) {
ObjectAssign(mergedContext, context);
}
const hookResult = userHookOrDefault(arg0, mergedContext, next);
if (lastRunIn... | Helper function to wrap around invocation of user hook or the default step
in order to fill in missing arguments or check returned results.
Due to the merging of the context, this must be a closure.
@param {number} index Index in the chain. Default step is 0, last added hook is 1,
and so on.
@param {Function} userHoo... | javascript | lib/internal/modules/customization_hooks.js | 183 | [
"index",
"userHookOrDefault",
"next"
] | false | 6 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
bindOrCreate | public <T> T bindOrCreate(String name, Bindable<T> target) {
return bindOrCreate(ConfigurationPropertyName.of(name), target, null);
} | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param <... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 317 | [
"name",
"target"
] | T | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
predict | def predict(self, X):
"""Predict classes for X.
The predicted class of an input sample is computed as the weighted mean
prediction of the classifiers in the ensemble.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The ... | Predict classes for X.
The predicted class of an input sample is computed as the weighted mean
prediction of the classifiers in the ensemble.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The training input samples. Sparse matrix can be CSC, CSR, COO,
DOK, or LIL. COO,... | python | sklearn/ensemble/_weight_boosting.py | 572 | [
"self",
"X"
] | false | 2 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
run_node | def run_node(
tracer: Any, node: torch.fx.Node, args: Any, kwargs: Any, nnmodule: Any
) -> Any:
"""
Runs a given node, with the given args and kwargs.
Behavior is dictated by a node's op.
run_node is useful for extracting real values out of nodes.
See get_real_value for more info on common usa... | Runs a given node, with the given args and kwargs.
Behavior is dictated by a node's op.
run_node is useful for extracting real values out of nodes.
See get_real_value for more info on common usage.
Note: The tracer arg is only used for 'get_attr' ops
Note: The nnmodule arg is only used for 'call_module' ops
Nodes t... | python | torch/_dynamo/utils.py | 3,689 | [
"tracer",
"node",
"args",
"kwargs",
"nnmodule"
] | Any | true | 8 | 6.96 | pytorch/pytorch | 96,034 | unknown | false |
indexOf | public static int indexOf(final Object[] array, final Object objectToFind, int startIndex) {
if (array == null) {
return INDEX_NOT_FOUND;
}
startIndex = max0(startIndex);
if (objectToFind == null) {
for (int i = startIndex; i < array.length; i++) {
... | Finds the index of the given object in the array starting at the given index.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.
</p>
<p>
A negative startIndex is treated as zero. A startIndex larger than the array length will return {@link #INDEX_NOT_FOUND} ({@code -1}).
</p>... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,719 | [
"array",
"objectToFind",
"startIndex"
] | true | 7 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
accepts | boolean accepts(String mode); | Returns if this accepts and can run the given mode.
@param mode the mode to check
@return if this instance accepts the mode | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jarmode/JarMode.java | 33 | [
"mode"
] | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false | |
inner | def inner(*args: _P.args, **kwargs: _P.kwargs) -> _R:
"""Retrieve the cached result without calling the function.
Checks memory cache first, then disk cache. Populates memory
cache from disk on a disk hit.
Args:
*args: Positional argu... | Retrieve the cached result without calling the function.
Checks memory cache first, then disk cache. Populates memory
cache from disk on a disk hit.
Args:
*args: Positional arguments to generate the cache key.
**kwargs: Keyword arguments to generate the cache key.
Returns:
The cached result (decoded if d... | python | torch/_inductor/runtime/caching/interfaces.py | 765 | [] | _R | true | 3 | 8.08 | pytorch/pytorch | 96,034 | google | false |
get_log_events | def get_log_events(
self,
log_group: str,
log_stream_name: str,
start_time: int = 0,
skip: int = 0,
start_from_head: bool | None = None,
continuation_token: ContinuationToken | None = None,
end_time: int | None = None,
) -> Generator[CloudWatchLogEvent... | Return a generator for log items in a single stream; yields all items available at the current moment.
.. seealso::
- :external+boto3:py:meth:`CloudWatchLogs.Client.get_log_events`
:param log_group: The name of the log group.
:param log_stream_name: The name of the specific stream.
:param start_time: The timestam... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/logs.py | 69 | [
"self",
"log_group",
"log_stream_name",
"start_time",
"skip",
"start_from_head",
"continuation_token",
"end_time"
] | Generator[CloudWatchLogEvent, None, None] | true | 11 | 8.16 | apache/airflow | 43,597 | sphinx | false |
findAnnotationOnBean | @Override
public <A extends Annotation> @Nullable A findAnnotationOnBean(
String beanName, Class<A> annotationType, boolean allowFactoryBeanInit)
throws NoSuchBeanDefinitionException {
Class<?> beanType = getType(beanName, allowFactoryBeanInit);
return (beanType != null ? AnnotatedElementUtils.findMergedAnn... | Add a new singleton bean.
<p>Will overwrite any existing instance for the given name.
@param name the name of the bean
@param bean the bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java | 472 | [
"beanName",
"annotationType",
"allowFactoryBeanInit"
] | A | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
poke | def poke(self, context: Context) -> bool:
"""
Pokes until the QuickSight Ingestion has successfully finished.
:param context: The task context during execution.
:return: True if it COMPLETED and False if not.
"""
self.log.info("Poking for Amazon QuickSight Ingestion ID: ... | Pokes until the QuickSight Ingestion has successfully finished.
:param context: The task context during execution.
:return: True if it COMPLETED and False if not. | python | providers/amazon/src/airflow/providers/amazon/aws/sensors/quicksight.py | 63 | [
"self",
"context"
] | bool | true | 2 | 7.92 | apache/airflow | 43,597 | sphinx | false |
_get_field_choices | def _get_field_choices():
"""Yield all allowed field paths in breadth-first search order."""
queue = collections.deque([(None, self.klass_info)])
while queue:
parent_path, klass_info = queue.popleft()
if parent_path is None:
path = ... | Yield all allowed field paths in breadth-first search order. | python | django/db/models/sql/compiler.py | 1,452 | [] | false | 5 | 6.08 | django/django | 86,204 | unknown | false | |
principalSerde | @Override
public Optional<KafkaPrincipalSerde> principalSerde() {
return Optional.of(principalBuilder);
} | Constructs Principal using configured principalBuilder.
@return the built principal | java | clients/src/main/java/org/apache/kafka/common/network/SslChannelBuilder.java | 163 | [] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
sanitize_conn_id | def sanitize_conn_id(conn_id: str | None, max_length=CONN_ID_MAX_LEN) -> str | None:
r"""
Sanitizes the connection id and allows only specific characters to be within.
Namely, it allows alphanumeric characters plus the symbols #,!,-,_,.,:,\,/ and () from 1 and up to
250 consecutive matches. If desired,... | r"""
Sanitizes the connection id and allows only specific characters to be within.
Namely, it allows alphanumeric characters plus the symbols #,!,-,_,.,:,\,/ and () from 1 and up to
250 consecutive matches. If desired, the max length can be adjusted by setting `max_length`.
You can try to play with the regex here: ht... | python | airflow-core/src/airflow/models/connection.py | 55 | [
"conn_id",
"max_length"
] | str | None | true | 4 | 8.4 | apache/airflow | 43,597 | sphinx | false |
readDeclaredField | public static Object readDeclaredField(final Object target, final String fieldName) throws IllegalAccessException {
return readDeclaredField(target, fieldName, false);
} | Reads the named {@code public} {@link Field}. Only the class of the specified object will be considered.
@param target
the object to reflect, must not be {@code null}.
@param fieldName
the field name to obtain.
@return the value of the field.
@throws NullPointerException
if {@code targ... | java | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | 277 | [
"target",
"fieldName"
] | Object | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
containsDescendantOf | @Override
public ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name) {
PropertySource<?> source = getPropertySource();
Object underlyingSource = source.getSource();
if (underlyingSource instanceof Random) {
return containsDescendantOfForRandom("random", name);
}
if (underlyingS... | Create a new {@link SpringConfigurationPropertySource} implementation.
@param propertySource the source property source
@param systemEnvironmentSource if the source is from the system environment
@param mappers the property mappers | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java | 119 | [
"name"
] | ConfigurationPropertyState | true | 4 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
getExistingKeys | function getExistingKeys(keys: Array<string | symbol>, keysToLayerMap: Map<string | symbol, CompositeProxyLayer>) {
return keys.filter((key) => {
const layer = keysToLayerMap.get(key)
return layer?.has?.(key) ?? true
})
} | Creates a proxy from a set of layers.
Each layer is a building for a proxy (potentially, reusable) that
can add or override property on top of the target.
When multiple layers define the same property, last one wins
@param target
@param layers
@returns | typescript | packages/client/src/runtime/core/compositeProxy/createCompositeProxy.ts | 141 | [
"keys",
"keysToLayerMap"
] | false | 1 | 6.08 | prisma/prisma | 44,834 | jsdoc | false | |
read | @Override
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException {
if ((offset < 0) || (length < 0) || (offset > dsts.length - length))
throw new IndexOutOfBoundsException();
int totalRead = 0;
int i = offset;
while (i < offset + length) {
... | Reads a sequence of bytes from this channel into a subsequence of the given buffers.
@param dsts - The buffers into which bytes are to be transferred
@param offset - The offset within the buffer array of the first buffer into which bytes are to be transferred; must be non-negative and no larger than dsts.length.
@param... | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 679 | [
"dsts",
"offset",
"length"
] | true | 8 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
destroy | @Override
public void destroy() throws Exception {
if (this.pool != null) {
logger.debug("Closing Commons ObjectPool");
this.pool.close();
}
} | Closes the underlying {@code ObjectPool} when destroying this object. | java | spring-aop/src/main/java/org/springframework/aop/target/CommonsPool2TargetSource.java | 259 | [] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
nullToEmpty | public static Short[] nullToEmpty(final Short[] array) {
return nullTo(array, EMPTY_SHORT_OBJECT_ARRAY);
} | Defensive programming technique to change a {@code null}
reference to an empty one.
<p>
This method returns an empty array for a {@code null} input array.
</p>
<p>
As a memory optimizing technique an empty array passed in will be overridden with
the empty {@code public static} references in this class.
</p>
@param arra... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,603 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
getBeans | private static <T> Map<String, T> getBeans(ListableBeanFactory beanFactory, Class<T> type,
@Nullable String qualifier) {
return (!StringUtils.hasLength(qualifier)) ? beanFactory.getBeansOfType(type)
: BeanFactoryAnnotationUtils.qualifiedBeansOfType(beanFactory, type, qualifier);
} | Add {@link Printer}, {@link Parser}, {@link Formatter}, {@link Converter},
{@link ConverterFactory}, {@link GenericConverter}, and beans from the specified
bean factory.
@param registry the service to register beans with
@param beanFactory the bean factory to get the beans from
@param qualifier the qualifier required o... | java | core/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java | 344 | [
"beanFactory",
"type",
"qualifier"
] | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
duplicated | def duplicated(self, keep: DropKeep = "first") -> npt.NDArray[np.bool_]:
"""
Indicate duplicate index values.
Duplicated values are indicated as ``True`` values in the resulting
array. Either all duplicates, all except the first, or all except the
last occurrence of duplicates c... | Indicate duplicate index values.
Duplicated values are indicated as ``True`` values in the resulting
array. Either all duplicates, all except the first, or all except the
last occurrence of duplicates can be indicated.
Parameters
----------
keep : {'first', 'last', False}, default 'first'
The value or values in a... | python | pandas/core/indexes/base.py | 2,907 | [
"self",
"keep"
] | npt.NDArray[np.bool_] | true | 2 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false |
to_timestamp | def to_timestamp(self, freq=None, how: str = "start") -> DatetimeArray:
"""
Cast to DatetimeArray/Index.
Parameters
----------
freq : str or DateOffset, optional
Target frequency. The default is 'D' for week or longer,
's' otherwise.
how : {'s', '... | Cast to DatetimeArray/Index.
Parameters
----------
freq : str or DateOffset, optional
Target frequency. The default is 'D' for week or longer,
's' otherwise.
how : {'s', 'e', 'start', 'end'}
Whether to use the start or end of the time period being converted.
Returns
-------
DatetimeArray/Index
Timesta... | python | pandas/core/arrays/period.py | 758 | [
"self",
"freq",
"how"
] | DatetimeArray | true | 16 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
getEntry | public Entry getEntry(CharSequence namePrefix, CharSequence name) {
int nameHash = nameHash(namePrefix, name);
int lookupIndex = getFirstLookupIndex(nameHash);
int size = size();
while (lookupIndex >= 0 && lookupIndex < size && this.nameHashLookups[lookupIndex] == nameHash) {
long pos = getCentralDirectoryFi... | Return the entry with the given name, if any.
@param namePrefix an optional prefix for the name
@param name the name of the entry to find
@return the entry or {@code null} | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 210 | [
"namePrefix",
"name"
] | Entry | true | 5 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.