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
removeElement
public static boolean[] removeElement(final boolean[] array, final boolean element) { final int index = indexOf(array, element); return index == INDEX_NOT_FOUND ? clone(array) : remove(array, index); }
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. <p> This method returns a new array with the same elements of the inpu...
java
src/main/java/org/apache/commons/lang3/ArrayUtils.java
5,642
[ "array", "element" ]
true
2
7.84
apache/commons-lang
2,896
javadoc
false
peekLast
public @Nullable E peekLast() { return isEmpty() ? null : elementData(getMaxElementIndex()); }
Retrieves, but does not remove, 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
389
[]
E
true
2
6.96
google/guava
51,352
javadoc
false
whenHasUnescapedPath
default ValueProcessor<T> whenHasUnescapedPath(String path) { return whenHasPath((candidate) -> candidate.toString(false).equals(path)); }
Return a new processor from this one that only applied to members with the given path (ignoring escape characters). @param path the patch to match @return a new {@link ValueProcessor} that only applies when the path matches
java
core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java
990
[ "path" ]
true
1
6.48
spring-projects/spring-boot
79,428
javadoc
false
delete_bucket_tagging
def delete_bucket_tagging(self, bucket_name: str | None = None) -> None: """ Delete all tags from a bucket. .. seealso:: - :external+boto3:py:meth:`S3.Client.delete_bucket_tagging` :param bucket_name: The name of the bucket. :return: None """ s3_clie...
Delete all tags from a bucket. .. seealso:: - :external+boto3:py:meth:`S3.Client.delete_bucket_tagging` :param bucket_name: The name of the bucket. :return: None
python
providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py
1,708
[ "self", "bucket_name" ]
None
true
1
6.24
apache/airflow
43,597
sphinx
false
generate_inverse_formula
def generate_inverse_formula( expr: sympy.Expr, var: sympy.Symbol ) -> Optional[sympy.Expr]: """ Analyze an expression to see if it matches a specific invertible pattern that we know how to reverse. We're looking for expressions that are sums of terms where each term extracts a distinct bou...
Analyze an expression to see if it matches a specific invertible pattern that we know how to reverse. We're looking for expressions that are sums of terms where each term extracts a distinct bounded range from the input variable, like: y = c₀*a₀ + c₁*a₁ + c₂*a₂ + ... + cₙ*aₙ where each aᵢ must be one of the...
python
torch/_inductor/invert_expr_analysis.py
24
[ "expr", "var" ]
Optional[sympy.Expr]
true
3
7.84
pytorch/pytorch
96,034
google
false
_cg
def _cg(fhess_p, fgrad, maxiter, tol, verbose=0): """ Solve iteratively the linear system 'fhess_p . xsupi = fgrad' with a conjugate gradient descent. Parameters ---------- fhess_p : callable Function that takes the gradient as a parameter and returns the matrix product of the H...
Solve iteratively the linear system 'fhess_p . xsupi = fgrad' with a conjugate gradient descent. Parameters ---------- fhess_p : callable Function that takes the gradient as a parameter and returns the matrix product of the Hessian and gradient. fgrad : ndarray of shape (n_features,) or (n_features + 1,) ...
python
sklearn/utils/optimize.py
113
[ "fhess_p", "fgrad", "maxiter", "tol", "verbose" ]
false
13
6
scikit-learn/scikit-learn
64,340
numpy
false
_use_flex_flash_attention_backward
def _use_flex_flash_attention_backward( fw_subgraph: Subgraph, mask_graph: Subgraph, backend: Literal["AUTO", "TRITON", "FLASH", "TRITON_DECODE"], joint_outputs: Optional[Any] = None, score_mod_other_buffers: Optional[Sequence[TensorBox]] = None, ) -> bool: """Determine if we should use flex fla...
Determine if we should use flex flash attention for the given inputs. Args: fw_subgraph: The forward score modification subgraph mask_graph: The mask modification subgraph backend: Implementation selector (AUTO, TRITON, FLASH, TRITON_DECODE) joint_outputs: Processed joint outputs (for PR1 constraint ch...
python
torch/_inductor/kernel/flex/flex_flash_attention.py
383
[ "fw_subgraph", "mask_graph", "backend", "joint_outputs", "score_mod_other_buffers" ]
bool
true
3
7.44
pytorch/pytorch
96,034
google
false
lenientParsing
@GwtIncompatible // To be supported @CanIgnoreReturnValue CacheBuilder<K, V> lenientParsing() { strictParsing = false; return this; }
Enables lenient parsing. Useful for tests and spec parsing. @return this {@code CacheBuilder} instance (for chaining)
java
android/guava/src/com/google/common/cache/CacheBuilder.java
352
[]
true
1
6.4
google/guava
51,352
javadoc
false
setValue
@Override public R setValue(final R value) { final R result = getRight(); setRight(value); return result; }
Sets the {@code Map.Entry} value. This sets the right element of the pair. @param value the right value to set, not null. @return the old value for the right element.
java
src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
186
[ "value" ]
R
true
1
7.04
apache/commons-lang
2,896
javadoc
false
all
public KafkaFuture<Void> all() { final KafkaFutureImpl<Void> result = new KafkaFutureImpl<>(); this.future.whenComplete((topicPartitions, throwable) -> { if (throwable != null) { result.completeExceptionally(throwable); } else { for (TopicPartitio...
Return a future which succeeds only if all the deletions succeed. If not, the first partition error shall be returned.
java
clients/src/main/java/org/apache/kafka/clients/admin/DeleteConsumerGroupOffsetsResult.java
63
[]
true
3
7.04
apache/kafka
31,560
javadoc
false
formatParameters
private static String formatParameters(Map<String, String> params) { String joined = params.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(";")); return joined.isEmpty() ? "" : ";" + joined; }
Resolves this instance to a MediaType instance defined in given MediaTypeRegistry. Performs validation against parameters. @param mediaTypeRegistry a registry where a mapping between a raw media type to an instance MediaType is defined @return a MediaType instance or null if no media type could be found or if a known p...
java
libs/x-content/src/main/java/org/elasticsearch/xcontent/ParsedMediaType.java
166
[ "params" ]
String
true
2
7.52
elastic/elasticsearch
75,680
javadoc
false
read_all_dags
def read_all_dags(cls, session: Session = NEW_SESSION) -> dict[str, SerializedDAG]: """ Read all DAGs in serialized_dag table. :param session: ORM Session :returns: a dict of DAGs read from database """ latest_serialized_dag_subquery = ( select(cls.dag_id, fu...
Read all DAGs in serialized_dag table. :param session: ORM Session :returns: a dict of DAGs read from database
python
airflow-core/src/airflow/models/serialized_dag.py
523
[ "cls", "session" ]
dict[str, SerializedDAG]
true
5
8.4
apache/airflow
43,597
sphinx
false
connectionDelay
public long connectionDelay(String id, long now) { NodeConnectionState state = nodeState.get(id); if (state == null) return 0; if (state.state == ConnectionState.CONNECTING) { return connectionSetupTimeoutMs(id); } else if (state.state.isDisconnected()) { long ti...
Returns the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting, return a delay based on the connection timeout. When connected, wait indefinitely (i.e. until a wakeup). @param id the connection to ch...
java
clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java
105
[ "id", "now" ]
true
4
7.2
apache/kafka
31,560
javadoc
false
charAt
@Override public char charAt(final int index) { if (index < 0 || index >= length()) { throw new StringIndexOutOfBoundsException(index); } return buffer[index]; }
Gets the character at the specified index. @see #setCharAt(int, char) @see #deleteCharAt(int) @param index the index to retrieve, must be valid @return the character at the index @throws IndexOutOfBoundsException if the index is invalid
java
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
1,587
[ "index" ]
true
3
7.76
apache/commons-lang
2,896
javadoc
false
getBeansWithAnnotation
@Override public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) throws BeansException { Map<String, Object> results = new LinkedHashMap<>(); for (String beanName : this.beans.keySet()) { if (findAnnotationOnBean(beanName, annotationType) != null) { results.put(bea...
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
452
[ "annotationType" ]
true
2
6.88
spring-projects/spring-framework
59,386
javadoc
false
processAssignmentReceived
private void processAssignmentReceived(Map<String, SortedSet<Integer>> activeTasks, Map<String, SortedSet<Integer>> standbyTasks, Map<String, SortedSet<Integer>> warmupTasks, boolean isGroupR...
This will process the assignment received if it is different from the member's current assignment. If a new assignment is received, this will make sure reconciliation is attempted on the next call of `poll`. If another reconciliation is currently in process, the first `poll` after that reconciliation will trigger the n...
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java
988
[ "activeTasks", "standbyTasks", "warmupTasks", "isGroupReady" ]
void
true
4
6.72
apache/kafka
31,560
javadoc
false
inspectorWaitForDebugger
function inspectorWaitForDebugger() { if (!waitForDebugger()) throw new ERR_INSPECTOR_NOT_ACTIVE(); }
Blocks until a client (existing or connected later) has sent the `Runtime.runIfWaitingForDebugger` command. @returns {void}
javascript
lib/inspector.js
204
[]
false
2
6.4
nodejs/node
114,839
jsdoc
false
add_prefix
def add_prefix(self, prefix: str, axis: Axis | None = None) -> Self: """ Prefix labels with string `prefix`. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed. Parameters ---------- prefix : str The string to add ...
Prefix labels with string `prefix`. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed. Parameters ---------- prefix : str The string to add before each label. axis : {0 or 'index', 1 or 'columns', None}, default None Axis to add prefix on .. versionadded:: 2.0.0 Retu...
python
pandas/core/generic.py
4,702
[ "self", "prefix", "axis" ]
Self
true
2
8.56
pandas-dev/pandas
47,362
numpy
false
assertEndNotReached
private void assertEndNotReached() { if (hasNextValue == false) { throw new IllegalStateException("Iterator has no more buckets"); } }
Creates a new scale-adjusting iterator. @param delegate the iterator to wrap @param targetScale the target scale for the new iterator
java
libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ScaleAdjustingBucketIterator.java
85
[]
void
true
2
6.56
elastic/elasticsearch
75,680
javadoc
false
polyline
def polyline(off, scl): """ Returns an array representing a linear polynomial. Parameters ---------- off, scl : scalars The "y-intercept" and "slope" of the line, respectively. Returns ------- y : ndarray This module's representation of the linear polynomial ``off + ...
Returns an array representing a linear polynomial. Parameters ---------- off, scl : scalars The "y-intercept" and "slope" of the line, respectively. Returns ------- y : ndarray This module's representation of the linear polynomial ``off + scl*x``. See Also -------- numpy.polynomial.chebyshev.chebline num...
python
numpy/polynomial/polynomial.py
113
[ "off", "scl" ]
false
3
6.88
numpy/numpy
31,054
numpy
false
tile
def tile(A, reps): """ Construct an array by repeating A the number of times given by reps. If `reps` has length ``d``, the result will have dimension of ``max(d, A.ndim)``. If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new axes. So a shape (3,) array is promoted to (1, ...
Construct an array by repeating A the number of times given by reps. If `reps` has length ``d``, the result will have dimension of ``max(d, A.ndim)``. If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, or shape (1, 1, 3) for ...
python
numpy/lib/_shape_base_impl.py
1,158
[ "A", "reps" ]
false
8
7.76
numpy/numpy
31,054
numpy
false
findAdvisorsThatCanApply
public static List<Advisor> findAdvisorsThatCanApply(List<Advisor> candidateAdvisors, Class<?> clazz) { if (candidateAdvisors.isEmpty()) { return candidateAdvisors; } List<Advisor> eligibleAdvisors = new ArrayList<>(); for (Advisor candidate : candidateAdvisors) { if (candidate instanceof IntroductionAdvi...
Determine the sublist of the {@code candidateAdvisors} list that is applicable to the given class. @param candidateAdvisors the Advisors to evaluate @param clazz the target class @return sublist of Advisors that can apply to an object of the given class (may be the incoming List as-is)
java
spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java
319
[ "candidateAdvisors", "clazz" ]
true
6
7.92
spring-projects/spring-framework
59,386
javadoc
false
replaceParameters
private String replaceParameters(String message, Locale locale) { return replaceParameters(message, locale, new LinkedHashSet<>(4)); }
Recursively replaces all message parameters. <p> The message parameter prefix <code>&#123;</code> and suffix <code>&#125;</code> can be escaped using {@code \}, e.g. <code>\&#123;escaped\&#125;</code>. @param message the message containing the parameters to be replaced @param locale the locale to use when resolving rep...
java
core/spring-boot/src/main/java/org/springframework/boot/validation/MessageSourceMessageInterpolator.java
75
[ "message", "locale" ]
String
true
1
6.48
spring-projects/spring-boot
79,428
javadoc
false
transformCatch
function transformCatch(node: PromiseReturningCallExpression<"then" | "catch">, onRejected: Expression | undefined, transformer: Transformer, hasContinuation: boolean, continuationArgName?: SynthBindingName): readonly Statement[] { if (!onRejected || isNullOrUndefined(transformer, onRejected)) { // Ignore...
@param hasContinuation Whether another `then`, `catch`, or `finally` continuation follows this continuation. @param continuationArgName The argument name for the continuation that follows this call.
typescript
src/services/codefixes/convertToAsyncFunction.ts
521
[ "node", "onRejected", "transformer", "hasContinuation", "continuationArgName?" ]
true
6
6.08
microsoft/TypeScript
107,154
jsdoc
false
declareLongOrNull
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // https://github.com/elastic/elasticsearch/issues/130797 public void declareLongOrNull(BiConsumer<Value, Long> consumer, long nullValue, ParseField field) { // Using a method reference here angers some compilers declareField( consumer...
Declare a double field that parses explicit {@code null}s in the json to a default value.
java
libs/x-content/src/main/java/org/elasticsearch/xcontent/AbstractObjectParser.java
240
[ "consumer", "nullValue", "field" ]
void
true
2
6
elastic/elasticsearch
75,680
javadoc
false
hasDashedElement
boolean hasDashedElement() { Boolean hasDashedElement = this.hasDashedElement; if (hasDashedElement != null) { return hasDashedElement; } for (int i = 0; i < getNumberOfElements(); i++) { if (getElement(i, Form.DASHED).indexOf('-') != -1) { this.hasDashedElement = true; return true; } } thi...
Returns {@code true} if this element is an ancestor (immediate or nested parent) of the specified name. @param name the name to check @return {@code true} if this name is an ancestor
java
core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java
607
[]
true
4
8.24
spring-projects/spring-boot
79,428
javadoc
false
bind
def bind(self, sizes: Sequence[int]) -> None: """ Bind this DimList to specific sizes. Args: sizes: Sequence of sizes for each dimension Raises: ValueError: If sizes is not a sequence """ if not hasattr(sizes, "__len__") or not hasattr(sizes, "__...
Bind this DimList to specific sizes. Args: sizes: Sequence of sizes for each dimension Raises: ValueError: If sizes is not a sequence
python
functorch/dim/__init__.py
211
[ "self", "sizes" ]
None
true
4
6.56
pytorch/pytorch
96,034
google
false
of
@Contract("!null -> !null") public static @Nullable PemContent of(@Nullable String text) { return (text != null) ? new PemContent(text) : null; }
Return a new {@link PemContent} instance containing the given text. @param text the text containing PEM encoded content @return a new {@link PemContent} instance
java
core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemContent.java
162
[ "text" ]
PemContent
true
2
7.68
spring-projects/spring-boot
79,428
javadoc
false
get
public static @Nullable ConfigurationPropertiesBean get(ApplicationContext applicationContext, Object bean, String beanName) { Method factoryMethod = findFactoryMethod(applicationContext, beanName); Bindable<Object> bindTarget = createBindTarget(bean, bean.getClass(), factoryMethod); if (bindTarget == null) { ...
Return a {@link ConfigurationPropertiesBean @ConfigurationPropertiesBean} instance for the given bean details or {@code null} if the bean is not a {@link ConfigurationProperties @ConfigurationProperties} object. Annotations are considered both on the bean itself, as well as any factory method (for example a {@link Bean...
java
core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java
203
[ "applicationContext", "bean", "beanName" ]
ConfigurationPropertiesBean
true
5
7.28
spring-projects/spring-boot
79,428
javadoc
false
onApplicationEvent
@Override public void onApplicationEvent(ApplicationEvent event) { if (event.getSource() == this.source) { onApplicationEventInternal(event); } }
Create a SourceFilteringListener for the given event source, expecting subclasses to override the {@link #onApplicationEventInternal} method (instead of specifying a delegate listener). @param source the event source that this listener filters for, only processing events from this source
java
spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java
70
[ "event" ]
void
true
2
6.08
spring-projects/spring-framework
59,386
javadoc
false
autograd_not_implemented_inner
def autograd_not_implemented_inner( operator: OperatorBase, delayed_error: bool, *args: Any, **kwargs: Any ) -> Any: """If autograd is enabled and any of the arguments require grad this will either raise an error or return a DelayedError depending on the value of delayed. Args: operator: The Op...
If autograd is enabled and any of the arguments require grad this will either raise an error or return a DelayedError depending on the value of delayed. Args: operator: The Operator to call with the *args and **kwargs with op_name: The name of the Operator delayed_error: If True, return a DelayedError inst...
python
torch/_higher_order_ops/utils.py
36
[ "operator", "delayed_error" ]
Any
true
7
6.4
pytorch/pytorch
96,034
google
false
evaluate
def evaluate(op, left_op, right_op, use_numexpr: bool = True): """ Evaluate and return the expression of the op on left_op and right_op. Parameters ---------- op : the actual operand left_op : left operand right_op : right operand use_numexpr : bool, default True Whether to try ...
Evaluate and return the expression of the op on left_op and right_op. Parameters ---------- op : the actual operand left_op : left operand right_op : right operand use_numexpr : bool, default True Whether to try to use numexpr.
python
pandas/core/computation/expressions.py
227
[ "op", "left_op", "right_op", "use_numexpr" ]
true
3
6.56
pandas-dev/pandas
47,362
numpy
false
doConvertTextValue
private Object doConvertTextValue(@Nullable Object oldValue, String newTextValue, PropertyEditor editor) { try { editor.setValue(oldValue); } catch (Exception ex) { if (logger.isDebugEnabled()) { logger.debug("PropertyEditor [" + editor.getClass().getName() + "] does not support setValue call", ex); ...
Convert the given text value using the given property editor. @param oldValue the previous value, if available (may be {@code null}) @param newTextValue the proposed text value @param editor the PropertyEditor to use @return the converted value
java
spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
424
[ "oldValue", "newTextValue", "editor" ]
Object
true
3
7.76
spring-projects/spring-framework
59,386
javadoc
false
joinGroupEpoch
abstract int joinGroupEpoch();
Returns the epoch a member uses to join the group. This is group-type-specific. @return the epoch to join the group
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java
1,291
[]
true
1
6.8
apache/kafka
31,560
javadoc
false
startCodePath
function startCodePath(origin) { if (codePath) { // Emits onCodePathSegmentStart events if updated. forwardCurrentToHead(analyzer, node); } // Create the code path of this scope. codePath = analyzer.codePath = new CodePath({ id: analyzer.idGenerator.next(), origin, upper: ...
Creates a new code path and trigger the onCodePathStart event based on the currently selected node. @param {string} origin The reason the code path was started. @returns {void}
javascript
packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js
391
[ "origin" ]
false
2
6.08
facebook/react
241,750
jsdoc
false
reset
public synchronized void reset() throws IOException { try { close(); } finally { if (memory == null) { memory = new MemoryOutput(); } else { memory.reset(); } out = memory; if (file != null) { File deleteMe = file; file = null; if (!del...
Calls {@link #close} if not already closed, and then resets this object back to its initial state, for reuse. If data was buffered to a file, it will be deleted. @throws IOException if an I/O error occurred while deleting the file buffer
java
android/guava/src/com/google/common/io/FileBackedOutputStream.java
181
[]
void
true
4
7.04
google/guava
51,352
javadoc
false
to
public void to(Consumer<? super T> consumer) { Assert.notNull(consumer, "'consumer' must not be null"); T value = getValue(); if (value != null && test(value)) { consumer.accept(value); } }
Complete the mapping by passing any non-filtered value to the specified consumer. The method is designed to be used with mutable objects. @param consumer the consumer that should accept the value if it's not been filtered
java
core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java
288
[ "consumer" ]
void
true
3
6.88
spring-projects/spring-boot
79,428
javadoc
false
leaderFor
public Node leaderFor(TopicPartition topicPartition) { PartitionInfo info = partitionsByTopicPartition.get(topicPartition); if (info == null) return null; else return info.leader(); }
Get the current leader for the given topic-partition @param topicPartition The topic and partition we want to know the leader for @return The node that is the leader for this topic-partition, or null if there is currently no leader
java
clients/src/main/java/org/apache/kafka/common/Cluster.java
272
[ "topicPartition" ]
Node
true
2
7.12
apache/kafka
31,560
javadoc
false
identity
static <E extends Throwable> FailableDoubleUnaryOperator<E> identity() { return t -> t; }
Returns a unary operator that always returns its input argument. @param <E> The kind of thrown exception or error. @return a unary operator that always returns its input argument
java
src/main/java/org/apache/commons/lang3/function/FailableDoubleUnaryOperator.java
41
[]
true
1
6.8
apache/commons-lang
2,896
javadoc
false
toString
@Override public String toString() { return "ConsumerRecord(topic = " + topic + ", partition = " + partition + ", leaderEpoch = " + leaderEpoch.orElse(null) + ", offset = " + offset + ", " + timestampType + " = " + timestamp + ", del...
Get the delivery count for the record if available. Deliveries are counted for records delivered by share groups. @return the delivery count or empty when deliveries not counted
java
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRecord.java
260
[]
String
true
1
6.88
apache/kafka
31,560
javadoc
false
ensureCapacity
public static boolean[] ensureCapacity(boolean[] array, int minLength, int padding) { checkArgument(minLength >= 0, "Invalid minLength: %s", minLength); checkArgument(padding >= 0, "Invalid padding: %s", padding); return (array.length < minLength) ? Arrays.copyOf(array, minLength + padding) : array; }
Returns an array containing the same values as {@code array}, but guaranteed to be of a specified minimum length. If {@code array} already has a length of at least {@code minLength}, it is returned directly. Otherwise, a new array of size {@code minLength + padding} is returned, containing the values of {@code array}, ...
java
android/guava/src/com/google/common/primitives/Booleans.java
271
[ "array", "minLength", "padding" ]
true
2
7.92
google/guava
51,352
javadoc
false
toArray
public static Uuid[] toArray(List<Uuid> list) { if (list == null) return null; Uuid[] array = new Uuid[list.size()]; for (int i = 0; i < list.size(); i++) { array[i] = list.get(i); } return array; }
Convert a list of Uuid to an array of Uuid. @param list The input list @return The output array
java
clients/src/main/java/org/apache/kafka/common/Uuid.java
175
[ "list" ]
true
3
7.76
apache/kafka
31,560
javadoc
false
zero_one_loss
def zero_one_loss(y_true, y_pred, *, normalize=True, sample_weight=None): """Zero-one classification loss. If normalize is ``True``, returns the fraction of misclassifications, else returns the number of misclassifications. The best performance is 0. Read more in the :ref:`User Guide <zero_one_loss>`....
Zero-one classification loss. If normalize is ``True``, returns the fraction of misclassifications, else returns the number of misclassifications. The best performance is 0. Read more in the :ref:`User Guide <zero_one_loss>`. Parameters ---------- y_true : 1d array-like, or label indicator array / sparse matrix ...
python
sklearn/metrics/_classification.py
1,305
[ "y_true", "y_pred", "normalize", "sample_weight" ]
false
5
6.96
scikit-learn/scikit-learn
64,340
numpy
false
ediff1d
def ediff1d(ary, to_end=None, to_begin=None): """ The differences between consecutive elements of an array. Parameters ---------- ary : array_like If necessary, will be flattened before the differences are taken. to_end : array_like, optional Number(s) to append at the end of th...
The differences between consecutive elements of an array. Parameters ---------- ary : array_like If necessary, will be flattened before the differences are taken. to_end : array_like, optional Number(s) to append at the end of the returned differences. to_begin : array_like, optional Number(s) to prepend a...
python
numpy/lib/_arraysetops_impl.py
41
[ "ary", "to_end", "to_begin" ]
false
11
7.6
numpy/numpy
31,054
numpy
false
get_link
def get_link( self, operator: BaseOperator, *, ti_key: TaskInstanceKey, ) -> str: """ Link to Amazon Web Services Console. :param operator: airflow operator :param ti_key: TaskInstance ID to return link for :return: link to external system ...
Link to Amazon Web Services Console. :param operator: airflow operator :param ti_key: TaskInstance ID to return link for :return: link to external system
python
providers/amazon/src/airflow/providers/amazon/aws/links/base_aws.py
65
[ "self", "operator", "ti_key" ]
str
true
2
7.76
apache/airflow
43,597
sphinx
false
unauthorizedTopics
public Set<String> unauthorizedTopics() { return unauthorizedTopics; }
Get the set of topics which failed authorization. May be empty if the set is not known in the context the exception was raised in. @return possibly empty set of unauthorized topics
java
clients/src/main/java/org/apache/kafka/common/errors/TopicAuthorizationException.java
44
[]
true
1
6.96
apache/kafka
31,560
javadoc
false
lagval3d
def lagval3d(x, y, z, c): """ Evaluate a 3-D Laguerre series at points (x, y, z). This function returns the values: .. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * L_i(x) * L_j(y) * L_k(z) The parameters `x`, `y`, and `z` are converted to arrays only if they are tuples or a lists, otherwise th...
Evaluate a 3-D Laguerre series at points (x, y, z). This function returns the values: .. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * L_i(x) * L_j(y) * L_k(z) The parameters `x`, `y`, and `z` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the sam...
python
numpy/polynomial/laguerre.py
995
[ "x", "y", "z", "c" ]
false
1
6.32
numpy/numpy
31,054
numpy
false
unstructured_to_structured
def unstructured_to_structured(arr, dtype=None, names=None, align=False, copy=False, casting='unsafe'): """ Converts an n-D unstructured array into an (n-1)-D structured array. The last dimension of the input array is converted into a structure, with number of field-eleme...
Converts an n-D unstructured array into an (n-1)-D structured array. The last dimension of the input array is converted into a structure, with number of field-elements equal to the size of the last dimension of the input array. By default all output fields have the input array's dtype, but an output structured dtype w...
python
numpy/lib/recfunctions.py
1,075
[ "arr", "dtype", "names", "align", "copy", "casting" ]
false
12
7.76
numpy/numpy
31,054
numpy
false
get_import_mappings
def get_import_mappings(tree) -> dict[str, str]: """ Retrieve a mapping of local import names to their fully qualified module paths from an AST tree. :param tree: The AST tree to analyze for import statements. :return: A dictionary where the keys are the local names (aliases) used in the current modul...
Retrieve a mapping of local import names to their fully qualified module paths from an AST tree. :param tree: The AST tree to analyze for import statements. :return: A dictionary where the keys are the local names (aliases) used in the current module and the values are the fully qualified names of the imported mo...
python
devel-common/src/sphinx_exts/providers_extensions.py
121
[ "tree" ]
dict[str, str]
true
7
9.52
apache/airflow
43,597
sphinx
false
onApplicationEvent
@Override public void onApplicationEvent(SpringApplicationEvent event) { if (this.triggerEventType.isInstance(event) && created.compareAndSet(false, true)) { try { writePidFile(event); } catch (Exception ex) { String message = String.format("Cannot create pid file %s", this.file); if (failOnWrit...
Sets the type of application event that will trigger writing of the PID file. Defaults to {@link ApplicationPreparedEvent}. NOTE: If you use the {@link org.springframework.boot.context.event.ApplicationStartingEvent} to trigger the write, you will not be able to specify the PID filename in the Spring {@link Environment...
java
core/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java
136
[ "event" ]
void
true
5
6.4
spring-projects/spring-boot
79,428
javadoc
false
prepareEnvironment
private ConfigurableEnvironment prepareEnvironment(SpringApplicationRunListeners listeners, DefaultBootstrapContext bootstrapContext, ApplicationArguments applicationArguments) { // Create and configure the environment ConfigurableEnvironment environment = getOrCreateEnvironment(); configureEnvironment(environ...
Run the Spring application, creating and refreshing a new {@link ApplicationContext}. @param args the application arguments (usually passed from a Java main method) @return a running {@link ApplicationContext}
java
core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
350
[ "listeners", "bootstrapContext", "applicationArguments" ]
ConfigurableEnvironment
true
2
7.44
spring-projects/spring-boot
79,428
javadoc
false
wrapperChain
function wrapperChain() { return chain(this); }
Creates a `lodash` wrapper instance with explicit method chain sequences enabled. @name chain @memberOf _ @since 0.1.0 @category Seq @returns {Object} Returns the new `lodash` wrapper instance. @example var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 } ]; // A sequence without explicit ...
javascript
lodash.js
8,968
[]
false
1
7.44
lodash/lodash
61,490
jsdoc
false
setCharAt
public StrBuilder setCharAt(final int index, final char ch) { if (index < 0 || index >= length()) { throw new StringIndexOutOfBoundsException(index); } buffer[index] = ch; return this; }
Sets the character at the specified index. @see #charAt(int) @see #deleteCharAt(int) @param index the index to set @param ch the new character @return {@code this} instance. @throws IndexOutOfBoundsException if the index is invalid
java
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
2,787
[ "index", "ch" ]
StrBuilder
true
3
7.44
apache/commons-lang
2,896
javadoc
false
all
public KafkaFuture<Map<String, ConsumerGroupDescription>> all() { return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture<?>[0])).thenApply( nil -> { Map<String, ConsumerGroupDescription> descriptions = new HashMap<>(futures.size()); futures.forEach((key, fu...
Return a future which yields all ConsumerGroupDescription objects, if all the describes succeed.
java
clients/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsResult.java
48
[]
true
2
6.4
apache/kafka
31,560
javadoc
false
summarize_range
def summarize_range(self, start: int, end: int) -> T: """ Query a range of values in the segment tree. Args: start: Start index of the range to query (inclusive) end: End index of the range to query (inclusive) Returns: Summary value for the range ac...
Query a range of values in the segment tree. Args: start: Start index of the range to query (inclusive) end: End index of the range to query (inclusive) Returns: Summary value for the range according to the summary operation Raises: ValueError: If start > end or indices are out of bounds
python
torch/_inductor/codegen/segmented_tree.py
219
[ "self", "start", "end" ]
T
true
6
7.76
pytorch/pytorch
96,034
google
false
moveToIncompleteAcks
public boolean moveToIncompleteAcks(TopicIdPartition tip) { Acknowledgements acks = inFlightAcknowledgements.remove(tip); if (acks != null) { incompleteAcknowledgements.put(tip, acks); return true; } else { log.error("Invalid partition ...
Moves the in-flight acknowledgements for a given partition to incomplete acknowledgements to retry in the next request. @param tip The TopicIdPartition for which we move the acknowledgements. @return True if the partition was sent in the request. <p> False if the partition was not part of the request, we log an error a...
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java
1,415
[ "tip" ]
true
2
7.92
apache/kafka
31,560
javadoc
false
_set_reflect_both
def _set_reflect_both(padded, axis, width_pair, method, original_period, include_edge=False): """ Pad `axis` of `arr` with reflection. Parameters ---------- padded : ndarray Input array of arbitrary shape. axis : int Axis along which to pad `arr`. width...
Pad `axis` of `arr` with reflection. Parameters ---------- padded : ndarray Input array of arbitrary shape. axis : int Axis along which to pad `arr`. width_pair : (int, int) Pair of widths that mark the pad area on both sides in the given dimension. method : str Controls method of reflection; optio...
python
numpy/lib/_arraypad_impl.py
297
[ "padded", "axis", "width_pair", "method", "original_period", "include_edge" ]
false
7
6.16
numpy/numpy
31,054
numpy
false
initializingPartitions
public synchronized Set<TopicPartition> initializingPartitions() { return collectPartitions(TopicPartitionState::shouldInitialize); }
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
837
[]
true
1
6.96
apache/kafka
31,560
javadoc
false
parseSignatureMember
function parseSignatureMember(kind: SyntaxKind.CallSignature | SyntaxKind.ConstructSignature): CallSignatureDeclaration | ConstructSignatureDeclaration { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); if (kind === SyntaxKind.ConstructSignature) { parseExpe...
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,184
[ "kind" ]
true
3
6.72
microsoft/TypeScript
107,154
jsdoc
false
setTimeZone
public static void setTimeZone(@Nullable TimeZone timeZone, boolean inheritable) { LocaleContext localeContext = getLocaleContext(); Locale locale = (localeContext != null ? localeContext.getLocale() : null); if (timeZone != null) { localeContext = new SimpleTimeZoneAwareLocaleContext(locale, timeZone); } ...
Associate the given TimeZone with the current thread, preserving any Locale that may have been set already. <p>Will implicitly create a LocaleContext for the given Locale. @param timeZone the current TimeZone, or {@code null} to reset the time zone part of the thread-bound context @param inheritable whether to expose t...
java
spring-context/src/main/java/org/springframework/context/i18n/LocaleContextHolder.java
255
[ "timeZone", "inheritable" ]
void
true
4
6.08
spring-projects/spring-framework
59,386
javadoc
false
analyze
@Nullable FailureAnalysis analyze(Throwable failure);
Returns an analysis of the given {@code failure}, or {@code null} if no analysis was possible. @param failure the failure @return the analysis or {@code null}
java
core/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzer.java
37
[ "failure" ]
FailureAnalysis
true
1
6.64
spring-projects/spring-boot
79,428
javadoc
false
get_unicode_from_response
def get_unicode_from_response(r): """Returns the requested content back in unicode. :param r: Response object to get unicode content from. Tried: 1. charset from content-type 2. fall back and replace all unicode characters :rtype: str """ warnings.warn( ( "In requ...
Returns the requested content back in unicode. :param r: Response object to get unicode content from. Tried: 1. charset from content-type 2. fall back and replace all unicode characters :rtype: str
python
src/requests/utils.py
581
[ "r" ]
false
2
6.4
psf/requests
53,586
sphinx
false
resolve
public void resolve(RegisteredBean registeredBean, ThrowingConsumer<AutowiredArguments> action) { Assert.notNull(registeredBean, "'registeredBean' must not be null"); Assert.notNull(action, "'action' must not be null"); AutowiredArguments resolved = resolve(registeredBean); if (resolved != null) { action.acc...
Resolve the method arguments for the specified registered bean and provide it to the given action. @param registeredBean the registered bean @param action the action to execute with the resolved method arguments
java
spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredMethodArgumentsResolver.java
120
[ "registeredBean", "action" ]
void
true
2
6.56
spring-projects/spring-framework
59,386
javadoc
false
forValueObject
static ConfigurationPropertiesBean forValueObject(Class<?> beanType, String beanName) { Bindable<Object> bindTarget = createBindTarget(null, beanType, null); Assert.state(bindTarget != null && deduceBindMethod(bindTarget) == VALUE_OBJECT_BIND_METHOD, () -> "Bean '" + beanName + "' is not a @ConfigurationPropert...
Return a {@link ConfigurationPropertiesBean @ConfigurationPropertiesBean} instance for the given bean details or {@code null} if the bean is not a {@link ConfigurationProperties @ConfigurationProperties} object. Annotations are considered both on the bean itself, as well as any factory method (for example a {@link Bean...
java
core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java
242
[ "beanType", "beanName" ]
ConfigurationPropertiesBean
true
2
7.28
spring-projects/spring-boot
79,428
javadoc
false
nextBatchSize
Integer nextBatchSize() throws CorruptRecordException { int remaining = buffer.remaining(); if (remaining < LOG_OVERHEAD) return null; int recordSize = buffer.getInt(buffer.position() + SIZE_OFFSET); // V0 has the smallest overhead, stricter checking is done later if ...
Validates the header of the next batch and returns batch size. @return next batch size including LOG_OVERHEAD if buffer contains header up to magic byte, null otherwise @throws CorruptRecordException if record size or magic is invalid
java
clients/src/main/java/org/apache/kafka/common/record/ByteBufferLogInputStream.java
66
[]
Integer
true
7
7.92
apache/kafka
31,560
javadoc
false
normalizeTriggerValue
function normalizeTriggerValue(value: any): any { // we use `!= null` here because it's the most simple // way to test against a "falsy" value without mixing // in empty strings or a zero value. DO NOT OPTIMIZE. return value != null ? value : null; }
@license Copyright Google LLC All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.dev/license
typescript
packages/animations/browser/src/render/transition_animation_engine.ts
1,773
[ "value" ]
true
2
6
angular/angular
99,544
jsdoc
false
get_log_events_async
async def get_log_events_async( self, log_group: str, log_stream_name: str, start_time: int = 0, skip: int = 0, start_from_head: bool = True, ) -> AsyncGenerator[Any, dict[str, Any]]: """ Yield all the available items in a single log stream. :...
Yield all the available items in a single log stream. :param log_group: The name of the log group. :param log_stream_name: The name of the specific stream. :param start_time: The time stamp value to start reading the logs from (default: 0). :param skip: The number of log entries to skip at the start (default: 0). ...
python
providers/amazon/src/airflow/providers/amazon/aws/hooks/logs.py
179
[ "self", "log_group", "log_stream_name", "start_time", "skip", "start_from_head" ]
AsyncGenerator[Any, dict[str, Any]]
true
8
6.72
apache/airflow
43,597
sphinx
false
listOffsets
ListOffsetsResult listOffsets(Map<TopicPartition, OffsetSpec> topicPartitionOffsets, ListOffsetsOptions options);
<p>List offset for the specified partitions. This operation enables to find the beginning offset, end offset as well as the offset matching a timestamp in partitions. @param topicPartitionOffsets The mapping from partition to the OffsetSpec to look up. @param options The options to use when retrieving the offsets @retu...
java
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java
1,344
[ "topicPartitionOffsets", "options" ]
ListOffsetsResult
true
1
6.32
apache/kafka
31,560
javadoc
false
toJSONArray
public JSONArray toJSONArray(JSONArray names) { JSONArray result = new JSONArray(); if (names == null) { return null; } int length = names.length(); if (length == 0) { return null; } for (int i = 0; i < length; i++) { String name = JSON.toString(names.opt(i)); result.put(opt(name)); } retu...
Returns an array with the values corresponding to {@code names}. The array contains null for names that aren't mapped. This method returns null if {@code names} is either null or empty. @param names the names of the properties @return the array
java
cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java
653
[ "names" ]
JSONArray
true
4
8.24
spring-projects/spring-boot
79,428
javadoc
false
unicodeToArray
function unicodeToArray(string) { return string.match(reUnicode) || []; }
Converts a Unicode `string` to an array. @private @param {string} string The string to convert. @returns {Array} Returns the converted array.
javascript
lodash.js
1,402
[ "string" ]
false
2
6.16
lodash/lodash
61,490
jsdoc
false
get
static JavaVersion get(final String versionStr) { if (versionStr == null) { return null; } switch (versionStr) { case "0.9": return JAVA_0_9; case "1.1": return JAVA_1_1; case "1.2": return JAVA_1_2; case "1.3": ...
Transforms the given string with a Java version number to the corresponding constant of this enumeration class. This method is used internally. @param versionStr the Java version as string. @return the corresponding enumeration constant or <strong>null</strong> if the version is unknown.
java
src/main/java/org/apache/commons/lang3/JavaVersion.java
226
[ "versionStr" ]
JavaVersion
true
5
7.52
apache/commons-lang
2,896
javadoc
false
maybe_layout_constraints
def maybe_layout_constraints(fn: Callable[..., Any]) -> Optional[Callable[..., Any]]: """Get layout constraints. Returns None if there are no layout constraints.""" if not isinstance(fn, torch._ops.OpOverload): # Only OpOverloads have layout constraints. return None if maybe_layout_tag := g...
Get layout constraints. Returns None if there are no layout constraints.
python
torch/_inductor/lowering.py
171
[ "fn" ]
Optional[Callable[..., Any]]
true
4
6
pytorch/pytorch
96,034
unknown
false
get_fernet
def get_fernet() -> FernetProtocol: """ Deferred load of Fernet key. This function could fail either because Cryptography is not installed or because the Fernet key is invalid. :return: Fernet object :raises: airflow.exceptions.AirflowException if there's a problem trying to load Fernet ""...
Deferred load of Fernet key. This function could fail either because Cryptography is not installed or because the Fernet key is invalid. :return: Fernet object :raises: airflow.exceptions.AirflowException if there's a problem trying to load Fernet
python
airflow-core/src/airflow/models/crypto.py
97
[]
FernetProtocol
true
2
7.6
apache/airflow
43,597
unknown
false
localeLookupList
public static List<Locale> localeLookupList(final Locale locale, final Locale defaultLocale) { final List<Locale> list = new ArrayList<>(4); if (locale != null) { list.add(locale); if (!hasVariant(locale)) { list.add(new Locale(locale.getLanguage(), locale.getCoun...
Obtains the list of locales to search through when performing a locale search. <pre> localeLookupList(Locale("fr", "CA", "xxx"), Locale("en")) = [Locale("fr", "CA", "xxx"), Locale("fr", "CA"), Locale("fr"), Locale("en"] </pre> <p> The result list begins with the most specific locale, then the next more general and so...
java
src/main/java/org/apache/commons/lang3/LocaleUtils.java
289
[ "locale", "defaultLocale" ]
true
5
8.08
apache/commons-lang
2,896
javadoc
false
_json_to_math_instruction
def _json_to_math_instruction( cls, json_dict: Optional[str] ) -> Optional["MathInstruction"]: # type: ignore[name-defined] # noqa: F821 """Convert JSON string to MathInstruction object. Args: json_dict: JSON string representation Returns: Optional[MathIns...
Convert JSON string to MathInstruction object. Args: json_dict: JSON string representation Returns: Optional[MathInstruction]: Reconstructed object or None
python
torch/_inductor/codegen/cuda/serialization.py
346
[ "cls", "json_dict" ]
Optional["MathInstruction"]
true
4
7.44
pytorch/pytorch
96,034
google
false
getUnconditionalClasses
public Set<String> getUnconditionalClasses() { Set<String> filtered = new HashSet<>(this.unconditionalClasses); this.exclusions.forEach(filtered::remove); return Collections.unmodifiableSet(filtered); }
Returns the names of the classes that were evaluated but were not conditional. @return the names of the unconditional classes
java
core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java
149
[]
true
1
6.88
spring-projects/spring-boot
79,428
javadoc
false
reindex_indexer
def reindex_indexer( self, new_axis: Index, indexer: npt.NDArray[np.intp] | None, axis: AxisInt, fill_value=None, allow_dups: bool = False, only_slice: bool = False, *, use_na_proxy: bool = False, ) -> Self: """ Parameters ...
Parameters ---------- new_axis : Index indexer : ndarray[intp] or None axis : int fill_value : object, default None allow_dups : bool, default False only_slice : bool, default False Whether to take views, not copies, along columns. use_na_proxy : bool, default False Whether to use an np.void ndarray for newly i...
python
pandas/core/internals/managers.py
788
[ "self", "new_axis", "indexer", "axis", "fill_value", "allow_dups", "only_slice", "use_na_proxy" ]
Self
true
9
6.8
pandas-dev/pandas
47,362
numpy
false
len
def len(self) -> Series: """ Return the length of each list in the Series. Returns ------- pandas.Series The length of each list. See Also -------- str.len : Python built-in function returning the length of an object. Series.size : Re...
Return the length of each list in the Series. Returns ------- pandas.Series The length of each list. See Also -------- str.len : Python built-in function returning the length of an object. Series.size : Returns the length of the Series. StringMethods.len : Compute the length of each element in the Series/Index. ...
python
pandas/core/arrays/arrow/accessors.py
83
[ "self" ]
Series
true
1
7.28
pandas-dev/pandas
47,362
unknown
false
appendExportsOfImportEqualsDeclaration
function appendExportsOfImportEqualsDeclaration(statements: Statement[] | undefined, decl: ImportEqualsDeclaration): Statement[] | undefined { if (currentModuleInfo.exportEquals) { return statements; } return appendExportsOfDeclaration(statements, new IdentifierNameMap(), decl)...
Appends the exports of an ImportEqualsDeclaration to a statement list, returning the statement list. @param statements A statement list to which the down-level export statements are to be appended. If `statements` is `undefined`, a new array is allocated if statements are appended. @param decl The declaration who...
typescript
src/compiler/transformers/module/module.ts
2,003
[ "statements", "decl" ]
true
2
6.72
microsoft/TypeScript
107,154
jsdoc
false
invocableClone
@Override public MethodInvocation invocableClone(@Nullable Object... arguments) { // Force initialization of the user attributes Map, // for having a shared Map reference in the clone. if (this.userAttributes == null) { this.userAttributes = new HashMap<>(); } // Create the MethodInvocation clone. try ...
This implementation returns a shallow copy of this invocation object, using the given arguments array for the clone. <p>We want a shallow copy in this case: We want to use the same interceptor chain and other object references, but we want an independent value for the current interceptor index. @see java.lang.Object#cl...
java
spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java
220
[]
MethodInvocation
true
3
7.04
spring-projects/spring-framework
59,386
javadoc
false
parseAsn
static Long parseAsn(final String asn) { if (asn == null || Strings.hasText(asn) == false) { return null; } else { String stripped = asn.toUpperCase(Locale.ROOT).replaceAll("AS", "").trim(); try { return Long.parseLong(stripped); } catch (N...
Lax-ly parses a string that (ideally) looks like 'AS123' into a Long like 123L (or null, if such parsing isn't possible). @param asn a potentially empty (or null) ASN string that is expected to contain 'AS' and then a parsable long @return the parsed asn
java
modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IpinfoIpDataLookups.java
130
[ "asn" ]
Long
true
4
8.24
elastic/elasticsearch
75,680
javadoc
false
definePackage
private void definePackage(String className, String packageName) { if (this.undefinablePackages.contains(packageName)) { return; } String packageEntryName = packageName.replace('.', '/') + "/"; String classEntryName = className.replace('.', '/') + ".class"; for (URL url : this.urls) { try { JarFile ...
Define a package before a {@code findClass} call is made. This is necessary to ensure that the appropriate manifest for nested JARs is associated with the package. @param className the class name being found
java
loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlClassLoader.java
138
[ "className", "packageName" ]
void
true
7
6.72
spring-projects/spring-boot
79,428
javadoc
false
hasText
private static boolean hasText(CharSequence str) { if (str == null || str.length() == 0) { return false; } int strLen = str.length(); for (int i = 0; i < strLen; i++) { if (Character.isWhitespace(str.charAt(i)) == false) { return true; ...
Parses a string representation of a boolean value to <code>boolean</code>. @return <code>true</code> iff the provided value is "true". <code>false</code> iff the provided value is "false". @throws IllegalArgumentException if the string cannot be parsed to boolean.
java
libs/core/src/main/java/org/elasticsearch/core/Booleans.java
66
[ "str" ]
true
5
6.4
elastic/elasticsearch
75,680
javadoc
false
truncateTo
public int truncateTo(int targetSize) throws IOException { int originalSize = sizeInBytes(); if (targetSize > originalSize || targetSize < 0) throw new KafkaException("Attempt to truncate log segment " + file + " to " + targetSize + " bytes failed, " + " size of this log ...
Truncate this file message set to the given size in bytes. Note that this API does no checking that the given size falls on a valid message boundary. In some versions of the JDK truncating to the same size as the file message set will cause an update of the files mtime, so truncate is only performed if the targetSize i...
java
clients/src/main/java/org/apache/kafka/common/record/FileRecords.java
278
[ "targetSize" ]
true
4
8.08
apache/kafka
31,560
javadoc
false
create_logger
def create_logger(app: App) -> logging.Logger: """Get the Flask app's logger and configure it if needed. The logger name will be the same as :attr:`app.import_name <flask.Flask.name>`. When :attr:`~flask.Flask.debug` is enabled, set the logger level to :data:`logging.DEBUG` if it is not set. ...
Get the Flask app's logger and configure it if needed. The logger name will be the same as :attr:`app.import_name <flask.Flask.name>`. When :attr:`~flask.Flask.debug` is enabled, set the logger level to :data:`logging.DEBUG` if it is not set. If there is no handler for the logger's effective level, add a :class:`~lo...
python
src/flask/logging.py
58
[ "app" ]
logging.Logger
true
4
6.4
pallets/flask
70,946
unknown
false
completeAsync
@Override public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier, Executor executor) { throw erroneousCompletionException(); }
Completes this future exceptionally. For internal use by the Kafka clients, not by user code. @param throwable the exception. @return {@code true} if this invocation caused this CompletableFuture to transition to a completed state, else {@code false}
java
clients/src/main/java/org/apache/kafka/common/internals/KafkaCompletableFuture.java
77
[ "supplier", "executor" ]
true
1
6.64
apache/kafka
31,560
javadoc
false
initializeKeyParameterDetails
private static List<CacheParameterDetail> initializeKeyParameterDetails(List<CacheParameterDetail> allParameters) { List<CacheParameterDetail> all = new ArrayList<>(); List<CacheParameterDetail> annotated = new ArrayList<>(); for (CacheParameterDetail allParameter : allParameters) { if (!allParameter.isValue()...
Return the {@link CacheInvocationParameter} for the parameters that are to be used to compute the key. <p>Per the spec, if some method parameters are annotated with {@link javax.cache.annotation.CacheKey}, only those parameters should be part of the key. If none are annotated, all parameters except the parameter annota...
java
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheKeyOperation.java
93
[ "allParameters" ]
true
4
7.44
spring-projects/spring-framework
59,386
javadoc
false
addContextValue
@Override public ContextedException addContextValue(final String label, final Object value) { exceptionContext.addContextValue(label, value); return this; }
Adds information helpful to a developer in diagnosing and correcting the problem. For the information to be meaningful, the value passed should have a reasonable toString() implementation. Different values can be added with the same label multiple times. <p> Note: This exception is only serializable if the object added...
java
src/main/java/org/apache/commons/lang3/exception/ContextedException.java
167
[ "label", "value" ]
ContextedException
true
1
6.56
apache/commons-lang
2,896
javadoc
false
get
public static <O, T extends Throwable> O get(final FailableSupplier<O, T> supplier) { try { return supplier.get(); } catch (final Throwable t) { throw rethrow(t); } }
Invokes a supplier, and returns the result. @param supplier The supplier to invoke. @param <O> The suppliers output type. @param <T> The type of checked exception, which the supplier can throw. @return The object, which has been created by the supplier @since 3.10
java
src/main/java/org/apache/commons/lang3/Functions.java
476
[ "supplier" ]
O
true
2
8.24
apache/commons-lang
2,896
javadoc
false
convert_cross_package_dependencies_to_table
def convert_cross_package_dependencies_to_table( cross_package_dependencies: list[str], markdown: bool = True, ) -> str: """ Converts cross-package dependencies to a Markdown table :param cross_package_dependencies: list of cross-package dependencies :param markdown: if True, Markdown format is ...
Converts cross-package dependencies to a Markdown table :param cross_package_dependencies: list of cross-package dependencies :param markdown: if True, Markdown format is used else rst :return: formatted table
python
dev/breeze/src/airflow_breeze/utils/packages.py
607
[ "cross_package_dependencies", "markdown" ]
str
true
6
7.12
apache/airflow
43,597
sphinx
false
_builtin_constant_ids
def _builtin_constant_ids() -> dict[int, str]: """ Collects constant builtins by eliminating callable items. """ rv = { id(v): f"builtins.{k}" for k, v in builtins.__dict__.items() if not k.startswith("_") and not callable(v) } return rv
Collects constant builtins by eliminating callable items.
python
torch/_dynamo/trace_rules.py
3,218
[]
dict[int, str]
true
2
6.4
pytorch/pytorch
96,034
unknown
false
createApplicationListener
ApplicationListener<?> createApplicationListener(String beanName, Class<?> type, Method method);
Create an {@link ApplicationListener} for the specified method. @param beanName the name of the bean @param type the target type of the instance @param method the {@link EventListener} annotated method @return an application listener, suitable to invoke the specified method
java
spring-context/src/main/java/org/springframework/context/event/EventListenerFactory.java
46
[ "beanName", "type", "method" ]
true
1
6
spring-projects/spring-framework
59,386
javadoc
false
get
public static LoggingSystem get(ClassLoader classLoader) { String loggingSystemClassName = System.getProperty(SYSTEM_PROPERTY); if (StringUtils.hasLength(loggingSystemClassName)) { if (NONE.equals(loggingSystemClassName)) { return new NoOpLoggingSystem(); } return get(classLoader, loggingSystemClassNam...
Detect and return the logging system in use. Supports Logback and Java Logging. @param classLoader the classloader @return the logging system
java
core/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java
162
[ "classLoader" ]
LoggingSystem
true
3
7.76
spring-projects/spring-boot
79,428
javadoc
false
seq_concat_item
def seq_concat_item(seq, item): """Return copy of sequence seq with item added. Returns: Sequence: if seq is a tuple, the result will be a tuple, otherwise it depends on the implementation of ``__add__``. """ return seq + (item,) if isinstance(seq, tuple) else seq + [item]
Return copy of sequence seq with item added. Returns: Sequence: if seq is a tuple, the result will be a tuple, otherwise it depends on the implementation of ``__add__``.
python
celery/utils/functional.py
373
[ "seq", "item" ]
false
2
6.96
celery/celery
27,741
unknown
false
create
public static ZeroBucket create(double zeroThreshold, long count) { if (zeroThreshold == 0) { return minimalWithCount(count); } return new ZeroBucket(zeroThreshold, count); }
Creates a zero bucket from the given threshold represented as double. @param zeroThreshold the zero threshold defining the bucket range [-zeroThreshold, +zeroThreshold], must be non-negative @param count the number of values in the bucket @return the new {@link ZeroBucket}
java
libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ZeroBucket.java
127
[ "zeroThreshold", "count" ]
ZeroBucket
true
2
7.28
elastic/elasticsearch
75,680
javadoc
false
visitForInitializer
function visitForInitializer(node: ForInitializer): ForInitializer { if (shouldHoistForInitializer(node)) { let expressions: Expression[] | undefined; for (const variable of node.declarations) { expressions = append(expressions, transformInitializedVariable(variable, ...
Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement @param node The node to visit.
typescript
src/compiler/transformers/module/system.ts
1,370
[ "node" ]
true
5
6.08
microsoft/TypeScript
107,154
jsdoc
false
intersection
public ComposablePointcut intersection(MethodMatcher other) { this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other); return this; }
Apply an intersection with the given MethodMatcher. @param other the MethodMatcher to apply an intersection with @return this composable pointcut (for call chaining)
java
spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java
146
[ "other" ]
ComposablePointcut
true
1
6.16
spring-projects/spring-framework
59,386
javadoc
false
equals
@Deprecated public static boolean equals(final CharSequence cs1, final CharSequence cs2) { return Strings.CS.equals(cs1, cs2); }
Compares two CharSequences, returning {@code true} if they represent equal sequences of characters. <p> {@code null}s are handled without exceptions. Two {@code null} references are considered to be equal. The comparison is <strong>case-sensitive</strong>. </p> <pre> StringUtils.equals(null, null) = true StringUtils....
java
src/main/java/org/apache/commons/lang3/StringUtils.java
1,787
[ "cs1", "cs2" ]
true
1
6.32
apache/commons-lang
2,896
javadoc
false
wrapper
def wrapper(fn: Callable[_P, _R]) -> Callable[_P, _R]: """Wrap the function to retrieve from cache. Args: fn: The function to wrap (not actually called). Returns: A wrapped version of the function. """ # If caching is disabled...
Wrap the function to retrieve from cache. Args: fn: The function to wrap (not actually called). Returns: A wrapped version of the function.
python
torch/_inductor/runtime/caching/interfaces.py
543
[ "fn" ]
Callable[_P, _R]
true
4
8.08
pytorch/pytorch
96,034
google
false
cartesian
def cartesian(arrays, out=None): """Generate a cartesian product of input arrays. Parameters ---------- arrays : list of array-like 1-D arrays to form the cartesian product of. out : ndarray of shape (M, len(arrays)), default=None Array to place the cartesian product in. Return...
Generate a cartesian product of input arrays. Parameters ---------- arrays : list of array-like 1-D arrays to form the cartesian product of. out : ndarray of shape (M, len(arrays)), default=None Array to place the cartesian product in. Returns ------- out : ndarray of shape (M, len(arrays)) Array containi...
python
sklearn/utils/extmath.py
861
[ "arrays", "out" ]
false
3
7.68
scikit-learn/scikit-learn
64,340
numpy
false