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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
updateWith | function updateWith(object, path, updater, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
} | This method is like `_.update` except that it accepts `customizer` which is
invoked to produce the objects of `path`. If `customizer` returns `undefined`
path creation is handled by the method instead. The `customizer` is invoked
with three arguments: (nsValue, key, nsObject).
**Note:** This method mutates `object`.
@... | javascript | lodash.js | 14,004 | [
"object",
"path",
"updater",
"customizer"
] | false | 3 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
hasCachePut | private boolean hasCachePut(CacheOperationContexts contexts) {
// Evaluate the conditions *without* the result object because we don't have it yet...
Collection<CacheOperationContext> cachePutContexts = contexts.get(CachePutOperation.class);
Collection<CacheOperationContext> excluded = new ArrayList<>(1);
for (... | Find a cached value only for {@link CacheableOperation} that passes the condition.
@param contexts the cacheable operations
@return a {@link Cache.ValueWrapper} holding the cached value,
or {@code null} if none is found | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 639 | [
"contexts"
] | true | 3 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
cumsum | def cumsum(self, axis: AxisInt = 0, *args, **kwargs) -> SparseArray:
"""
Cumulative sum of non-NA/null values.
When performing the cumulative summation, any non-NA/null values will
be skipped. The resulting SparseArray will preserve the locations of
NaN values, but the fill valu... | Cumulative sum of non-NA/null values.
When performing the cumulative summation, any non-NA/null values will
be skipped. The resulting SparseArray will preserve the locations of
NaN values, but the fill value will be `np.nan` regardless.
Parameters
----------
axis : int or None
Axis over which to perform the cumul... | python | pandas/core/arrays/sparse/array.py | 1,549 | [
"self",
"axis"
] | SparseArray | true | 4 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
setExternalExecutor | public final synchronized void setExternalExecutor(final ExecutorService externalExecutor) {
if (isStarted()) {
throw new IllegalStateException("Cannot set ExecutorService after start()!");
}
this.externalExecutor = externalExecutor;
} | Sets an {@link ExecutorService} to be used by this class. The {@code
ExecutorService} passed to this method is used for executing the
background task. Thus it is possible to re-use an already existing
{@link ExecutorService} or to use a specially configured one. If no
{@link ExecutorService} is set, this instance creat... | java | src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java | 377 | [
"externalExecutor"
] | void | true | 2 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
visitFunctionExpression | function visitFunctionExpression(node: FunctionExpression): Expression {
const ancestorFacts = getEmitFlags(node) & EmitFlags.AsyncFunctionBody
? enterSubtree(HierarchyFacts.AsyncFunctionBodyExcludes, HierarchyFacts.AsyncFunctionBodyIncludes)
: enterSubtree(HierarchyFacts.FunctionExcl... | Visits a FunctionExpression node.
@param node a FunctionExpression node. | typescript | src/compiler/transformers/es2015.ts | 2,449 | [
"node"
] | true | 3 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
sequential_split | def sequential_split(
gm: torch.fx.GraphModule,
node_call_back: Callable[[torch.fx.Node], Union[torch.fx.Node, bool]],
) -> torch.fx.GraphModule:
"""
sequential_split creates a new graph module that splits the input graph module into multiple submodules
based on the node_call_back. It doesn't mutate... | sequential_split creates a new graph module that splits the input graph module into multiple submodules
based on the node_call_back. It doesn't mutate the input graph module. The node_call_back should return
True if the node is a delimiter. Delimiter will be the first node in the next submodule. | python | torch/_export/utils.py | 620 | [
"gm",
"node_call_back"
] | torch.fx.GraphModule | true | 3 | 6 | pytorch/pytorch | 96,034 | unknown | false |
field | public XContentBuilder field(String name, Short value) throws IOException {
return (value == null) ? nullField(name) : field(name, value.shortValue());
} | @return the value of the "human readable" flag. When the value is equal to true,
some types of values are written in a format easier to read for a human. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 624 | [
"name",
"value"
] | XContentBuilder | true | 2 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
terminate_job | def terminate_job(self, job_id: str, reason: str) -> dict:
"""
Terminate a Batch job.
:param job_id: a job ID to terminate
:param reason: a reason to terminate job ID
:return: an API response
"""
response = self.get_conn().terminate_job(jobId=job_id, reason=rea... | Terminate a Batch job.
:param job_id: a job ID to terminate
:param reason: a reason to terminate job ID
:return: an API response | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/batch_client.py | 242 | [
"self",
"job_id",
"reason"
] | dict | true | 1 | 7.04 | apache/airflow | 43,597 | sphinx | false |
runtime_version | def runtime_version() -> str | None:
"""Get the version string for the detected runtime.
Returns:
Version string for the current runtime (CUDA or HIP), or None if
no supported runtime is detected.
"""
return {
"CUDA": torch.version.cuda,
"... | Get the version string for the detected runtime.
Returns:
Version string for the current runtime (CUDA or HIP), or None if
no supported runtime is detected. | python | torch/_inductor/runtime/caching/context.py | 178 | [] | str | None | true | 1 | 6.72 | pytorch/pytorch | 96,034 | unknown | false |
spaceMatcher | public static StrMatcher spaceMatcher() {
return SPACE_MATCHER;
} | Gets the matcher for the space character.
@return the matcher for a space. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 331 | [] | StrMatcher | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
toArray | @Override
@J2ktIncompatible // Incompatible return type change. Use inherited implementation
public Object[] toArray() {
/*
* If we could, we'd declare the no-arg `Collection.toArray()` to return "Object[] but elements
* have the same nullness as E." Since we can't, we declare it to return nullable el... | Adds the given element to this queue. If the queue is currently full, the element at the head
of the queue is evicted to make room.
@return {@code true} always | java | android/guava/src/com/google/common/collect/EvictingQueue.java | 128 | [] | true | 1 | 7.04 | google/guava | 51,352 | javadoc | false | |
expiredBatches | public List<ProducerBatch> expiredBatches(long now) {
List<ProducerBatch> expiredBatches = new ArrayList<>();
for (TopicInfo topicInfo : topicInfoMap.values()) {
for (Deque<ProducerBatch> deque : topicInfo.batches.values()) {
// expire the batches in the order of sending
... | Get a list of batches which have been sitting in the accumulator too long and need to be expired. | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java | 465 | [
"now"
] | true | 3 | 6 | apache/kafka | 31,560 | javadoc | false | |
isTypeMatch | private boolean isTypeMatch(FactoryBean<?> factoryBean, Class<?> typeToMatch) throws NoSuchBeanDefinitionException {
if (factoryBean instanceof SmartFactoryBean<?> smartFactoryBean) {
return smartFactoryBean.supportsType(typeToMatch);
}
Class<?> objectType = factoryBean.getObjectType();
return (objectType !=... | 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 | 252 | [
"factoryBean",
"typeToMatch"
] | true | 3 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
isInstance | public static boolean isInstance(final Object value, final Type type) {
if (type == null) {
return false;
}
return value == null ? !(type instanceof Class<?>) || !((Class<?>) type).isPrimitive() : isAssignable(value.getClass(), type, null);
} | Tests if the given value can be assigned to the target type following the Java generics rules.
@param value the value to be checked.
@param type the target type.
@return {@code true} if {@code value} is an instance of {@code type}. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,275 | [
"value",
"type"
] | true | 4 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
newLinkedHashSetWithExpectedSize | @SuppressWarnings("NonApiType") // acts as a direct substitute for a constructor call
public static <E extends @Nullable Object> LinkedHashSet<E> newLinkedHashSetWithExpectedSize(
int expectedSize) {
return new LinkedHashSet<>(Maps.capacity(expectedSize));
} | Creates a {@code LinkedHashSet} instance, with a high enough "initial capacity" that it
<i>should</i> hold {@code expectedSize} elements without growth. This behavior cannot be
broadly guaranteed, but it is observed to be true for OpenJDK 1.7. It also can't be guaranteed
that the method isn't inadvertently <i>oversizin... | java | android/guava/src/com/google/common/collect/Sets.java | 360 | [
"expectedSize"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
getShortClassName | public static String getShortClassName(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
return getShortClassName(cls.getName());
} | Gets the class name minus the package name from a {@link Class}.
<p>
This method simply gets the name using {@code Class.getName()} and then calls {@link #getShortClassName(String)}. See
relevant notes there.
</p>
@param cls the class to get the short name for.
@return the class name without the package name or an empt... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 1,019 | [
"cls"
] | String | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
get_parse_time_mapped_ti_count | def get_parse_time_mapped_ti_count(self) -> int:
"""
Return the number of mapped task instances that can be created on DAG run creation.
This only considers literal mapped arguments, and would return *None*
when any non-literal values are used for mapping.
:raise NotFullyPopula... | Return the number of mapped task instances that can be created on DAG run creation.
This only considers literal mapped arguments, and would return *None*
when any non-literal values are used for mapping.
:raise NotFullyPopulated: If non-literal mapped arguments are encountered.
:raise NotMapped: If the operator is ne... | python | airflow-core/src/airflow/serialization/serialized_objects.py | 2,173 | [
"self"
] | int | true | 2 | 6.72 | apache/airflow | 43,597 | unknown | false |
from | public static <K, V> CacheLoader<K, V> from(Function<K, V> function) {
return new FunctionToCacheLoader<>(function);
} | Returns a cache loader that uses {@code function} to load keys, and without supporting either
reloading or bulk loading. This is most useful when you can pass a lambda expression. Otherwise
it is useful mostly when you already have an existing function instance.
<p>The returned object is serializable if {@code function... | java | android/guava/src/com/google/common/cache/CacheLoader.java | 141 | [
"function"
] | true | 1 | 6.96 | google/guava | 51,352 | javadoc | false | |
throwUnexpectedAbsoluteUrlError | function throwUnexpectedAbsoluteUrlError(path: string, url: string): never {
throw new RuntimeError(
RuntimeErrorCode.INVALID_LOADER_ARGUMENTS,
ngDevMode &&
`Image loader has detected a \`<img>\` tag with an invalid \`ngSrc\` attribute: ${url}. ` +
`This image loader expects \`ngSrc\` to be a re... | Internal helper function that makes it easier to introduce custom image loaders for the
`NgOptimizedImage` directive. It is enough to specify a URL builder function to obtain full DI
configuration for a given loader: a DI token corresponding to the actual loader function, plus DI
tokens managing preconnect check functi... | typescript | packages/common/src/directives/ng_optimized_image/image_loaders/image_loader.ts | 131 | [
"path",
"url"
] | true | 2 | 7.6 | angular/angular | 99,544 | jsdoc | false | |
addMonths | public static Date addMonths(final Date date, final int amount) {
return add(date, Calendar.MONTH, amount);
} | Adds a number of months to a date returning a new object.
The original {@link Date} is unchanged.
@param date the date, not null.
@param amount the amount to add, may be negative.
@return the new {@link Date} with the amount added.
@throws NullPointerException if the date is null. | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 289 | [
"date",
"amount"
] | Date | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
create | public static AdminClient create(Properties props) {
return (AdminClient) Admin.create(props);
} | Create a new Admin with the given configuration.
@param props The configuration.
@return The new KafkaAdminClient. | java | clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java | 38 | [
"props"
] | AdminClient | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
setCount | @CanIgnoreReturnValue
public Builder<E> setCount(E element, int count) {
requireNonNull(contents); // see the comment on the field
if (count == 0 && !isLinkedHash) {
contents = new ObjectCountLinkedHashMap<E>(contents);
isLinkedHash = true;
// to preserve insertion order through ... | Adds or removes the necessary occurrences of an element such that the element attains the
desired count.
@param element the element to add or remove occurrences of
@param count the desired count of the element in this multiset
@return this {@code Builder} object
@throws NullPointerException if {@code element} is null
@... | java | android/guava/src/com/google/common/collect/ImmutableMultiset.java | 569 | [
"element",
"count"
] | true | 5 | 7.76 | google/guava | 51,352 | javadoc | false | |
_get_result_dtype | def _get_result_dtype(self, dtype: np.dtype) -> np.dtype:
"""
Get the desired dtype of a result based on the
input dtype and how it was computed.
Parameters
----------
dtype : np.dtype
Returns
-------
np.dtype
The desired dtype of the... | Get the desired dtype of a result based on the
input dtype and how it was computed.
Parameters
----------
dtype : np.dtype
Returns
-------
np.dtype
The desired dtype of the result. | python | pandas/core/groupby/ops.py | 286 | [
"self",
"dtype"
] | np.dtype | true | 6 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
determineConstructorsFromBeanPostProcessors | protected Constructor<?> @Nullable [] determineConstructorsFromBeanPostProcessors(@Nullable Class<?> beanClass, String beanName)
throws BeansException {
if (beanClass != null && hasInstantiationAwareBeanPostProcessors()) {
for (SmartInstantiationAwareBeanPostProcessor bp : getBeanPostProcessorCache().smartInst... | Determine candidate constructors to use for the given bean, checking all registered
{@link SmartInstantiationAwareBeanPostProcessor SmartInstantiationAwareBeanPostProcessors}.
@param beanClass the raw class of the bean
@param beanName the name of the bean
@return the candidate constructors, or {@code null} if none spec... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,316 | [
"beanClass",
"beanName"
] | true | 4 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
group | public String group() {
return this.group;
} | Get the name of the group.
@return the group name; never null | java | clients/src/main/java/org/apache/kafka/common/MetricNameTemplate.java | 87 | [] | String | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
has_task | def has_task(self, task_instance: TaskInstance) -> bool:
"""
Check if a task is either queued or running in this executor.
:param task_instance: TaskInstance
:return: True if the task is known to this executor
"""
return (
task_instance.id in self.queued_task... | Check if a task is either queued or running in this executor.
:param task_instance: TaskInstance
:return: True if the task is known to this executor | python | airflow-core/src/airflow/executors/base_executor.py | 237 | [
"self",
"task_instance"
] | bool | true | 4 | 7.92 | apache/airflow | 43,597 | sphinx | false |
getWritableJsonToWrite | private @Nullable WritableJson getWritableJsonToWrite(@Nullable T extracted, JsonValueWriter valueWriter) {
BiConsumer<T, BiConsumer<?, ?>> pairs = this.pairs;
if (pairs != null) {
return (out) -> valueWriter.writePairs((outPairs) -> pairs.accept(extracted, outPairs));
}
Members<T> members = this.member... | Writes the given instance using details configure by this member.
@param instance the instance to write
@param valueWriter the JSON value writer to use | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 662 | [
"extracted",
"valueWriter"
] | WritableJson | true | 3 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
compressLongestRunOfZeroes | private static void compressLongestRunOfZeroes(int[] hextets) {
int bestRunStart = -1;
int bestRunLength = -1;
int runStart = -1;
for (int i = 0; i < hextets.length + 1; i++) {
if (i < hextets.length && hextets[i] == 0) {
if (runStart < 0) {
runStart = i;
}
} else i... | Identify and mark the longest run of zeroes in an IPv6 address.
<p>Only runs of two or more hextets are considered. In case of a tie, the leftmost run wins. If
a qualifying run is found, its hextets are replaced by the sentinel value -1.
@param hextets {@code int[]} mutable array of eight 16-bit hextets | java | android/guava/src/com/google/common/net/InetAddresses.java | 506 | [
"hextets"
] | void | true | 8 | 7.04 | google/guava | 51,352 | javadoc | false |
fetchCommittedOffsets | public Map<TopicPartition, OffsetAndMetadata> fetchCommittedOffsets(final Set<TopicPartition> partitions,
final Timer timer) {
if (partitions.isEmpty()) return Collections.emptyMap();
final Generation generationForOffsetRequest = g... | Fetch the current committed offsets from the coordinator for a set of partitions.
@param partitions The partitions to fetch offsets for
@return A map from partition to the committed offset or null if the operation timed out | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 963 | [
"partitions",
"timer"
] | true | 9 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
getKnownIndexedChildren | private Set<String> getKnownIndexedChildren(IterableConfigurationPropertySource source,
ConfigurationPropertyName root) {
Set<String> knownIndexedChildren = new HashSet<>();
for (ConfigurationPropertyName name : source.filter(root::isAncestorOf)) {
ConfigurationPropertyName choppedName = name.chop(root.getNum... | Bind indexed elements to the supplied collection.
@param name the name of the property to bind
@param target the target bindable
@param elementBinder the binder to use for elements
@param aggregateType the aggregate type, may be a collection or an array
@param elementType the element type
@param result the destination ... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java | 129 | [
"source",
"root"
] | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false | |
isNestedType | private boolean isNestedType(String propertyName, Class<?> propertyType) {
Class<?> declaringClass = propertyType.getDeclaringClass();
if (declaringClass != null && isNested(declaringClass, this.type)) {
return true;
}
Field field = ReflectionUtils.findField(this.type, propertyName);
return (field !=... | Specify whether the specified property refer to a nested type. A nested type
represents a sub-namespace that need to be fully resolved. Nested types are
either inner classes or annotated with {@link NestedConfigurationProperty}.
@param propertyName the name of the property
@param propertyType the type of the property
@... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java | 314 | [
"propertyName",
"propertyType"
] | true | 4 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
bind | public <T> BindResult<T> bind(String name, Bindable<T> target, @Nullable BindHandler handler) {
return bind(ConfigurationPropertyName.of(name), target, handler);
} | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources}.
@param name the configuration property name to bind
@param target the target bindable
@param handler the bind handler (may be {@code null})
@param <T> the bound type
@return the binding result (never {@c... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 273 | [
"name",
"target",
"handler"
] | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false | |
filterPropertyDescriptorsForDependencyCheck | protected PropertyDescriptor[] filterPropertyDescriptorsForDependencyCheck(BeanWrapper bw) {
List<PropertyDescriptor> pds = new ArrayList<>(Arrays.asList(bw.getPropertyDescriptors()));
pds.removeIf(this::isExcludedFromDependencyCheck);
return pds.toArray(new PropertyDescriptor[0]);
} | Extract a filtered set of PropertyDescriptors from the given BeanWrapper,
excluding ignored dependency types or properties defined on ignored dependency interfaces.
@param bw the BeanWrapper the bean was created with
@return the filtered PropertyDescriptors
@see #isExcludedFromDependencyCheck | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,602 | [
"bw"
] | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
words | function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined : pattern;
if (pattern === undefined) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
} | Splits `string` into an array of its words.
@static
@memberOf _
@since 3.0.0
@category String
@param {string} [string=''] The string to inspect.
@param {RegExp|string} [pattern] The pattern to match words.
@param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
@returns {Array} Returns the words o... | javascript | lodash.js | 15,329 | [
"string",
"pattern",
"guard"
] | false | 5 | 7.36 | lodash/lodash | 61,490 | jsdoc | false | |
isCyclical | private static boolean isCyclical(final Class<?> cls) {
for (final TypeVariable<?> typeParameter : cls.getTypeParameters()) {
for (final Type bound : typeParameter.getBounds()) {
if (bound.getTypeName().contains(cls.getName())) {
return true;
}
... | Tests whether the class contains a cyclical reference in the qualified name of a class. If any of the type parameters of A class is extending X class
which is in scope of A class, then it forms cycle.
@param cls the class to test.
@return whether the class contains a cyclical reference. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,257 | [
"cls"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
maxValue | @CanIgnoreReturnValue
public C maxValue() {
throw new NoSuchElementException();
} | Returns the maximum value of type {@code C}, if it has one. The maximum value is the unique
value for which {@link Comparable#compareTo(Object)} never returns a negative value for any
input of type {@code C}.
<p>The default implementation throws {@code NoSuchElementException}.
@return the maximum value of type {@code C... | java | android/guava/src/com/google/common/collect/DiscreteDomain.java | 336 | [] | C | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
parseArray | public static <T, Context> List<T> parseArray(XContentParser parser, Context context, ContextParser<Context, T> itemParser)
throws IOException {
final XContentParser.Token currentToken = parser.currentToken();
if (currentToken.isValue()
|| currentToken == XContentParser.Token.VALUE_N... | Declares a set of fields of which at most one must appear for parsing to succeed
E.g. <code>declareExclusiveFieldSet("foo", "bar");</code> means that only one of 'foo'
or 'bar' must be present, and if both appear then an exception will be thrown. Note
that this does not make 'foo' or 'bar' required - see {@link #decla... | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/AbstractObjectParser.java | 414 | [
"parser",
"context",
"itemParser"
] | true | 8 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false | |
device | def device(*array_list, remove_none=True, remove_types=(str,)):
"""Hardware device where the array data resides on.
If the hardware device is not the same for all arrays, an error is raised.
Parameters
----------
*array_list : arrays
List of array instances from NumPy or an array API compa... | Hardware device where the array data resides on.
If the hardware device is not the same for all arrays, an error is raised.
Parameters
----------
*array_list : arrays
List of array instances from NumPy or an array API compatible library.
remove_none : bool, default=True
Whether to ignore None objects passed ... | python | sklearn/utils/_array_api.py | 170 | [
"remove_none",
"remove_types"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
create_endpoint | def create_endpoint(
self,
config: dict,
wait_for_completion: bool = True,
check_interval: int = 30,
max_ingestion_time: int | None = None,
):
"""
Create an endpoint from configuration.
When you create a serverless endpoint, SageMaker provisions and m... | Create an endpoint from configuration.
When you create a serverless endpoint, SageMaker provisions and manages
the compute resources for you. Then, you can make inference requests to
the endpoint and receive model predictions in response. SageMaker scales
the compute resources up and down as needed to handle your requ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 493 | [
"self",
"config",
"wait_for_completion",
"check_interval",
"max_ingestion_time"
] | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false | |
bindProperty | @Nullable Object bindProperty(String propertyName, Bindable<?> target); | Bind the given property.
@param propertyName the property name (in lowercase dashed form, e.g.
{@code first-name})
@param target the target bindable
@return the bound value or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DataObjectPropertyBinder.java | 37 | [
"propertyName",
"target"
] | Object | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
from | static @Nullable Origin from(@Nullable Object source) {
if (source instanceof Origin origin) {
return origin;
}
Origin origin = null;
if (source instanceof OriginProvider originProvider) {
origin = originProvider.getOrigin();
}
if (origin == null && source instanceof Throwable throwable) {
return f... | Find the {@link Origin} that an object originated from. Checks if the source object
is an {@link Origin} or {@link OriginProvider} and also searches exception stacks.
@param source the source object or {@code null}
@return an {@link Origin} or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/origin/Origin.java | 61 | [
"source"
] | Origin | true | 5 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
loadClass | @Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
if (!this.hasJarUrls) {
return super.loadClass(name, resolve);
}
Optimizations.enable(true);
try {
try {
definePackageIfNecessary(name);
}
catch (IllegalArgumentException ex) {
tolerateRaceC... | Create a new {@link LaunchedClassLoader} instance.
@param urls the URLs from which to load classes and resources
@param parent the parent class loader for delegation | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlClassLoader.java | 94 | [
"name",
"resolve"
] | true | 3 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false | |
IndexableDisplayName | function IndexableDisplayName({displayName, id}: Props): React.Node {
const {searchIndex, searchResults, searchText} = useContext(TreeStateContext);
const isSearchResult = useMemo(() => {
return searchResults.includes(id);
}, [id, searchResults]);
const isCurrentResult =
searchIndex !== null && id === s... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/Components/IndexableDisplayName.js | 24 | [] | false | 8 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
apply | R apply(I input) throws T; | Applies this function.
@param input the input for the function
@return the result of the function
@throws T Thrown when the function fails. | java | src/main/java/org/apache/commons/lang3/Functions.java | 217 | [
"input"
] | R | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
generate_client_defaults | def generate_client_defaults(cls) -> dict[str, Any]:
"""
Generate `client_defaults` section that only includes values differing from schema defaults.
This optimizes serialization size by avoiding redundant storage of schema defaults.
Uses OPERATOR_DEFAULTS as the source of truth for tas... | Generate `client_defaults` section that only includes values differing from schema defaults.
This optimizes serialization size by avoiding redundant storage of schema defaults.
Uses OPERATOR_DEFAULTS as the source of truth for task default values.
:return: client_defaults dictionary with only non-schema values | python | airflow-core/src/airflow/serialization/serialized_objects.py | 1,938 | [
"cls"
] | dict[str, Any] | true | 11 | 6.72 | apache/airflow | 43,597 | unknown | false |
days | public long days() {
return timeUnit.toDays(duration);
} | @return the number of {@link #timeUnit()} units this value contains | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 162 | [] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
truePredicate | @SuppressWarnings("unchecked")
static <E extends Throwable> FailableIntPredicate<E> truePredicate() {
return TRUE;
} | Gets the TRUE singleton.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailableIntPredicate.java | 57 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
liftToBlock | function liftToBlock(nodes: readonly Node[]): Statement {
Debug.assert(every(nodes, isStatementOrBlock), "Cannot lift nodes to a Block.");
return singleOrUndefined(nodes) as Statement || createBlock(nodes as readonly Statement[]);
} | Lifts a NodeArray containing only Statement nodes to a block.
@param nodes The NodeArray. | typescript | src/compiler/factory/nodeFactory.ts | 6,959 | [
"nodes"
] | true | 2 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
parseSimple | private static Duration parseSimple(String text, DurationFormat.@Nullable Unit fallbackUnit) {
try {
Matcher matcher = SIMPLE_PATTERN.matcher(text);
Assert.state(matcher.matches(), "Does not match simple duration pattern");
String suffix = matcher.group(2);
DurationFormat.Unit parsingUnit = (fallbackUnit ... | Detect the style then parse the value to return a duration.
@param value the value to parse
@param unit the duration unit to use if the value doesn't specify one ({@code null}
will default to ms)
@return the parsed duration
@throws IllegalArgumentException if the value is not a known style or cannot be
parsed | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatterUtils.java | 165 | [
"text",
"fallbackUnit"
] | Duration | true | 4 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
hashCode | @Override
public int hashCode() {
int result = partition;
result = 31 * result + (leader != null ? leader.hashCode() : 0);
result = 31 * result + (replicas != null ? replicas.hashCode() : 0);
result = 31 * result + (isr != null ? isr.hashCode() : 0);
result = 31 * result + (e... | Return the last known eligible leader replicas of the partition. Note that the ordering of the result is unspecified. | java | clients/src/main/java/org/apache/kafka/common/TopicPartitionInfo.java | 140 | [] | true | 6 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
getBeansOfType | @Override
@SuppressWarnings("unchecked")
public <T> Map<String, T> getBeansOfType(
@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException {
String[] beanNames = getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
Map<String, T> result = CollectionUtil... | Check whether the specified bean would need to be eagerly initialized
in order to determine its type.
@param factoryBeanName a factory-bean reference that the bean definition
defines a factory method for
@return whether eager initialization is necessary | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 731 | [
"type",
"includeNonSingletons",
"allowEagerInit"
] | true | 9 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
of | public static ConditionMessage of(String message, Object... args) {
if (ObjectUtils.isEmpty(args)) {
return new ConditionMessage(message);
}
return new ConditionMessage(String.format(message, args));
} | Factory method to create a new {@link ConditionMessage} with a specific message.
@param message the source message (may be a format string if {@code args} are
specified)
@param args format arguments for the message
@return a new {@link ConditionMessage} instance | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | 150 | [
"message"
] | ConditionMessage | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
records | public Map<TopicPartition, List<ConsumerRecord<K, V>>> records() {
return Collections.unmodifiableMap(records);
} | @return all of the non-control messages for this fetch, grouped by partition | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetch.java | 85 | [] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
getAggregateTemplateLoader | protected @Nullable TemplateLoader getAggregateTemplateLoader(List<TemplateLoader> templateLoaders) {
return switch (templateLoaders.size()) {
case 0 -> {
logger.debug("No FreeMarker TemplateLoaders specified");
yield null;
}
case 1 -> templateLoaders.get(0);
default -> {
TemplateLoader[] load... | Return a {@link TemplateLoader} based on the given {@code TemplateLoader} list.
<p>If more than one TemplateLoader has been registered, a FreeMarker
{@link MultiTemplateLoader} will be created.
@param templateLoaders the final List of {@code TemplateLoader} instances
@return the aggregate TemplateLoader | java | spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java | 414 | [
"templateLoaders"
] | TemplateLoader | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
detectAndParse | public static Duration detectAndParse(String value) {
return detectAndParse(value, null);
} | Detect the style then parse the value to return a duration.
@param value the value to parse
@return the parsed duration
@throws IllegalArgumentException if the value is not a known style or cannot be
parsed | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatterUtils.java | 133 | [
"value"
] | Duration | true | 1 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false |
getDescription | @Override
protected String getDescription() {
Filter filter = getFilter();
Assert.notNull(filter, "'filter' must not be null");
return "filter " + getOrDeduceName(filter);
} | Return if filter mappings should be matched after any declared Filter mappings of
the ServletContext.
@return if filter mappings are matched after | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java | 223 | [] | String | true | 1 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
to_markdown | def to_markdown(
self,
buf: FilePath | WriteBuffer[str] | None = None,
*,
mode: str = "wt",
index: bool = True,
storage_options: StorageOptions | None = None,
**kwargs,
) -> str | None:
"""
Print DataFrame in Markdown-friendly format.
... | Print DataFrame in Markdown-friendly format.
Parameters
----------
buf : str, Path or StringIO-like, optional, default None
Buffer to write to. If None, the output is returned as a string.
mode : str, optional
Mode in which file is opened, "wt" by default.
index : bool, optional, default True
Add index (ro... | python | pandas/core/frame.py | 2,881 | [
"self",
"buf",
"mode",
"index",
"storage_options"
] | str | None | true | 3 | 7.92 | pandas-dev/pandas | 47,362 | numpy | false |
getContent | private FileDataBlock getContent() throws IOException {
FileDataBlock content = this.content;
if (content == null) {
long pos = Integer.toUnsignedLong(this.centralRecord.offsetToLocalHeader());
checkNotZip64Extended(pos);
ZipLocalFileHeaderRecord localHeader = ZipLocalFileHeaderRecord.load(ZipContent.... | Open a {@link DataBlock} providing access to raw contents of the entry (not
including the local file header).
<p>
To release resources, the {@link #close()} method of the data block should be
called explicitly or by try-with-resources.
@return the contents of the entry
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 798 | [] | FileDataBlock | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
getPublicMethod | public static Method getPublicMethod(final Class<?> cls, final String methodName, final Class<?>... parameterTypes) throws NoSuchMethodException {
final Method declaredMethod = cls.getMethod(methodName, parameterTypes);
if (isPublic(declaredMethod.getDeclaringClass())) {
return declaredMetho... | Gets the desired Method much like {@code Class.getMethod}, however it ensures that the returned Method is from a
public class or interface and not from an anonymous inner class. This means that the Method is invokable and doesn't
fall foul of Java bug (<a href="https://bugs.java.com/bugdatabase/view_bug.do?bug_id=40719... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 860 | [
"cls",
"methodName"
] | Method | true | 5 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
closeInternal | private void closeInternal(final Duration timeout) {
long timeoutMs = timeout.toMillis();
log.trace("Signaling the consumer network thread to close in {}ms", timeoutMs);
running = false;
closeTimeout = timeout;
wakeup();
try {
join();
} catch (Interru... | Starts the closing process.
<p/>
This method is called from the application thread, but our resources are owned by the network thread. As such,
we don't actually close any of those resources here, immediately, on the application thread. Instead, we just
update our internal state on the application thread. When the netw... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java | 376 | [
"timeout"
] | void | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false |
assert | function assert(...args) {
innerOk(assert, ...args);
} | Pure assertion tests whether a value is truthy, as determined
by !!value.
@param {...any} args
@returns {void} | javascript | lib/assert.js | 185 | [] | false | 1 | 6.16 | nodejs/node | 114,839 | jsdoc | false | |
randomBytes | public byte[] randomBytes(final int count) {
Validate.isTrue(count >= 0, "Count cannot be negative.");
final byte[] result = new byte[count];
random().nextBytes(result);
return result;
} | Generates an array of random bytes.
@param count the size of the returned array.
@return the random byte array.
@throws IllegalArgumentException if {@code count} is negative
@since 3.16.0 | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 315 | [
"count"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
autodetect_docker_context | def autodetect_docker_context():
"""
Auto-detects which docker context to use.
:return: name of the docker context to use
"""
result = run_command(
["docker", "context", "ls", "--format=json"],
capture_output=True,
check=False,
text=True,
)
if result.returnco... | Auto-detects which docker context to use.
:return: name of the docker context to use | python | dev/breeze/src/airflow_breeze/utils/docker_command_utils.py | 684 | [] | false | 6 | 7.6 | apache/airflow | 43,597 | unknown | false | |
wrapCacheValue | private @Nullable Object wrapCacheValue(Method method, @Nullable Object cacheValue) {
if (method.getReturnType() == Optional.class &&
(cacheValue == null || cacheValue.getClass() != Optional.class)) {
return Optional.ofNullable(cacheValue);
}
return cacheValue;
} | Find a cached value only for {@link CacheableOperation} that passes the condition.
@param contexts the cacheable operations
@return a {@link Cache.ValueWrapper} holding the cached value,
or {@code null} if none is found | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 627 | [
"method",
"cacheValue"
] | Object | true | 4 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
min | public static double min(final double a, final double b, final double c) {
return min(min(a, b), c);
} | Gets the minimum of three {@code double} values.
<p>NaN is only returned if all numbers are NaN as per IEEE-754r.</p>
@param a value 1
@param b value 2
@param c value 3
@return the smallest of the values | java | src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java | 193 | [
"a",
"b",
"c"
] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
get_all_output_and_tangent_nodes | def get_all_output_and_tangent_nodes(
g: fx.Graph,
) -> dict[DifferentiableAOTOutput, tuple[fx.Node, Optional[fx.Node]]]:
"""Get all output nodes and their corresponding tangent nodes from a joint graph.
Similar to get_all_input_and_grad_nodes, but returns output nodes paired with
their tangent nodes (... | Get all output nodes and their corresponding tangent nodes from a joint graph.
Similar to get_all_input_and_grad_nodes, but returns output nodes paired with
their tangent nodes (if they exist). This function traverses the graph to find
all differentiable outputs and matches them with their corresponding tangent
inputs... | python | torch/_functorch/_aot_autograd/fx_utils.py | 96 | [
"g"
] | dict[DifferentiableAOTOutput, tuple[fx.Node, Optional[fx.Node]]] | true | 10 | 7.92 | pytorch/pytorch | 96,034 | google | false |
seq_concat_seq | def seq_concat_seq(a, b):
"""Concatenate two sequences: ``a + b``.
Returns:
Sequence: The return value will depend on the largest sequence
- if b is larger and is a tuple, the return value will be a tuple.
- if a is larger and is a list, the return value will be a list,
"""
... | Concatenate two sequences: ``a + b``.
Returns:
Sequence: The return value will depend on the largest sequence
- if b is larger and is a tuple, the return value will be a tuple.
- if a is larger and is a list, the return value will be a list, | python | celery/utils/functional.py | 383 | [
"a",
"b"
] | false | 3 | 7.28 | celery/celery | 27,741 | unknown | false | |
of | static Options of(Option... values) {
return new Options(values);
} | Factory method used to create a new {@link Options} instance with specific
values.
@param values the option values
@return a new {@link Options} instance with the given values | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/Command.java | 254 | [] | Options | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
configureSocketChannel | private void configureSocketChannel(SocketChannel socketChannel, int sendBufferSize, int receiveBufferSize)
throws IOException {
socketChannel.configureBlocking(false);
Socket socket = socketChannel.socket();
socket.setKeepAlive(true);
if (sendBufferSize != Selectable.USE_DEF... | Begin connecting to the given address and add the connection to this nioSelector associated with the given id
number.
<p>
Note that this call only initiates the connection, which will be completed on a future {@link #poll(long)}
call. Check {@link #connected()} to see which (if any) connections have completed after a g... | java | clients/src/main/java/org/apache/kafka/common/network/Selector.java | 284 | [
"socketChannel",
"sendBufferSize",
"receiveBufferSize"
] | void | true | 3 | 6.72 | apache/kafka | 31,560 | javadoc | false |
compare | @Override
public int compare(final Object o1, final Object o2) {
if (o1 == o2) {
return 0;
}
if (o1 == null) {
return 1;
}
if (o2 == null) {
return -1;
}
final String string1 = o1.toString();
final String string2 = o... | Constructs a new instance.
@deprecated Will be private in 4.0.0. | java | src/main/java/org/apache/commons/lang3/compare/ObjectToStringComparator.java | 54 | [
"o1",
"o2"
] | true | 7 | 6 | apache/commons-lang | 2,896 | javadoc | false | |
_create_join_index | def _create_join_index(
self,
index: Index,
other_index: Index,
indexer: npt.NDArray[np.intp] | None,
how: JoinHow = "left",
) -> Index:
"""
Create a join index by rearranging one index to match another
Parameters
----------
index : In... | Create a join index by rearranging one index to match another
Parameters
----------
index : Index
index being rearranged
other_index : Index
used to supply values not found in index
indexer : np.ndarray[np.intp] or None
how to rearrange index
how : str
Replacement is only necessary if indexer based on ... | python | pandas/core/reshape/merge.py | 1,470 | [
"self",
"index",
"other_index",
"indexer",
"how"
] | Index | true | 7 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
equal | def equal(x1, x2):
"""
Return (x1 == x2) element-wise.
Unlike `numpy.equal`, this comparison is performed by first
stripping whitespace characters from the end of the string. This
behavior is provided for backward-compatibility with numarray.
Parameters
----------
x1, x2 : array_like ... | Return (x1 == x2) element-wise.
Unlike `numpy.equal`, this comparison is performed by first
stripping whitespace characters from the end of the string. This
behavior is provided for backward-compatibility with numarray.
Parameters
----------
x1, x2 : array_like of str or unicode
Input arrays of the same shape.
... | python | numpy/_core/defchararray.py | 62 | [
"x1",
"x2"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
getChars | public char[] getChars(char[] destination) {
final int len = length();
if (destination == null || destination.length < len) {
destination = new char[len];
}
return ArrayUtils.arraycopy(buffer, 0, destination, 0, len);
} | Copies the character array into the specified array.
@param destination the destination array, null will cause an array to be created
@return the input array, unless that was null or too small | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,919 | [
"destination"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
filter | public FailableStream<T> filter(final FailablePredicate<T, ?> predicate) {
assertNotTerminated();
stream = stream.filter(Failable.asPredicate(predicate));
return this;
} | Returns a FailableStream consisting of the elements of this stream that match the given FailablePredicate.
<p>
This is an intermediate operation.
</p>
@param predicate a non-interfering, stateless predicate to apply to each element to determine if it should be
included.
@return the new stream | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 363 | [
"predicate"
] | true | 1 | 6.72 | apache/commons-lang | 2,896 | javadoc | false | |
visitVariableStatement | function visitVariableStatement(node: VariableStatement): VisitResult<Statement | undefined> {
if (!shouldHoistVariableDeclarationList(node.declarationList)) {
return visitNode(node, visitor, isStatement);
}
let statements: Statement[] | undefined;
// `using` and `awai... | Visits a variable statement, hoisting declared names to the top-level module body.
Each declaration is rewritten into an assignment expression.
@param node The node to visit. | typescript | src/compiler/transformers/module/system.ts | 868 | [
"node"
] | true | 8 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
withFrameFilter | public StandardStackTracePrinter withFrameFilter(BiPredicate<Integer, StackTraceElement> predicate) {
Assert.notNull(predicate, "'predicate' must not be null");
return new StandardStackTracePrinter(this.options, this.maximumLength, this.lineSeparator, this.filter,
this.frameFilter.and(predicate), this.formatter... | Return a new {@link StandardStackTracePrinter} from this one that will only include
frames that match the given predicate.
@param predicate the predicate used to filter frames
@return a new {@link StandardStackTracePrinter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 213 | [
"predicate"
] | StandardStackTracePrinter | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
create_call_function_ex | def create_call_function_ex(
has_kwargs: bool, push_null: bool, ignore_314_kwargs_push: bool = False
) -> list[Instruction]:
"""
Assumes that in 3.14+, if has_kwargs=False, there is NOT a NULL
on the TOS for the kwargs. This utility function will add a PUSH_NULL.
If the caller has already pushed a ... | Assumes that in 3.14+, if has_kwargs=False, there is NOT a NULL
on the TOS for the kwargs. This utility function will add a PUSH_NULL.
If the caller has already pushed a NULL for the kwargs, then set ignore_314_kwargs_push=True
so we don't push another NULL for the kwargs. | python | torch/_dynamo/bytecode_transformation.py | 400 | [
"has_kwargs",
"push_null",
"ignore_314_kwargs_push"
] | list[Instruction] | true | 7 | 6 | pytorch/pytorch | 96,034 | unknown | false |
unitIjkToDigit | public int unitIjkToDigit() {
// should be call on a normalized object
if (Math.min(i, Math.min(j, k)) < 0 || Math.max(i, Math.max(j, k)) > 1) {
return Direction.INVALID_DIGIT.digit();
}
return i << 2 | j << 1 | k;
} | Determines the H3 digit corresponding to a unit vector in ijk coordinates.
@return The H3 digit (0-6) corresponding to the ijk unit vector, or
INVALID_DIGIT on failure. | java | libs/h3/src/main/java/org/elasticsearch/h3/CoordIJK.java | 313 | [] | true | 3 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
from_env_var | def from_env_var(cls, env_var: str) -> Self:
"""
Create an in-memory cache from an environment variable.
Args:
env_var (str): Name of the environment variable containing cache data.
Returns:
InMemoryCache: An instance populated from the environment variable.
... | Create an in-memory cache from an environment variable.
Args:
env_var (str): Name of the environment variable containing cache data.
Returns:
InMemoryCache: An instance populated from the environment variable.
Raises:
CacheError: If the environment variable is malformed or contains invalid data. | python | torch/_inductor/cache.py | 106 | [
"cls",
"env_var"
] | Self | true | 6 | 7.52 | pytorch/pytorch | 96,034 | google | false |
iterator | public static Iterator<Calendar> iterator(final Date focus, final int rangeStyle) {
return iterator(toCalendar(focus), rangeStyle);
} | Constructs an {@link Iterator} over each day in a date
range defined by a focus date and range style.
<p>For instance, passing Thursday, July 4, 2002 and a
{@code RANGE_MONTH_SUNDAY} will return an {@link Iterator}
that starts with Sunday, June 30, 2002 and ends with Saturday, August 3,
2002, returning a Calendar insta... | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,067 | [
"focus",
"rangeStyle"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
contains | public static boolean contains(final boolean[] array, final boolean valueToFind) {
return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
} | Checks if the value is in the given array.
<p>
The method returns {@code false} if a {@code null} array is passed in.
</p>
@param array the array to search.
@param valueToFind the value to find.
@return {@code true} if the array contains the object. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1,575 | [
"array",
"valueToFind"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
forMethod | public static ResourceElementResolver forMethod(String methodName, Class<?> parameterType) {
return new ResourceMethodResolver(defaultResourceNameForMethod(methodName), true,
methodName, parameterType);
} | Create a new {@link ResourceMethodResolver} for the specified method
using a resource name that infers from the method name.
@param methodName the method name
@param parameterType the parameter type.
@return a new {@link ResourceMethodResolver} instance | java | spring-context/src/main/java/org/springframework/context/annotation/ResourceElementResolver.java | 89 | [
"methodName",
"parameterType"
] | ResourceElementResolver | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
_unsafe_acquire_lock_with_timeout | def _unsafe_acquire_lock_with_timeout(lock: Lock, timeout: float | None = None) -> None:
"""Acquire a threading.Lock with timeout without automatic release (unsafe).
This function acquires a lock with timeout support but does NOT automatically
release it. The caller is responsible for releasing the lock ex... | Acquire a threading.Lock with timeout without automatic release (unsafe).
This function acquires a lock with timeout support but does NOT automatically
release it. The caller is responsible for releasing the lock explicitly.
Use this only when you need manual control over lock lifetime.
Args:
lock: The threading.... | python | torch/_inductor/runtime/caching/locks.py | 84 | [
"lock",
"timeout"
] | None | true | 3 | 8 | pytorch/pytorch | 96,034 | google | false |
containsAll | public boolean containsAll(Iterable<? extends C> values) {
if (Iterables.isEmpty(values)) {
return true;
}
// this optimizes testing equality of two range-backed sets
if (values instanceof SortedSet) {
SortedSet<? extends C> set = (SortedSet<? extends C>) values;
Comparator<?> compara... | Returns {@code true} if every element in {@code values} is {@linkplain #contains contained} in
this range. | java | android/guava/src/com/google/common/collect/Range.java | 428 | [
"values"
] | true | 7 | 6 | google/guava | 51,352 | javadoc | false | |
addError | @Override
public void addError(Traceable traceable, Throwable throwable) {
final var span = Span.fromContextOrNull(spans.get(traceable.getSpanId()));
if (span != null) {
span.recordException(throwable);
}
} | Most of the examples of how to use the OTel API look something like this, where the span context
is automatically propagated:
<pre>{@code
Span span = tracer.spanBuilder("parent").startSpan();
try (Scope scope = parentSpan.makeCurrent()) {
// ...do some stuff, possibly creating further spans
} finally {
span.end... | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracer.java | 348 | [
"traceable",
"throwable"
] | void | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
reverse | public static void reverse(final short[] array) {
if (array != null) {
reverse(array, 0, array.length);
}
} | Reverses the order of the given array.
<p>
This method does nothing for a {@code null} input array.
</p>
@param array the array to reverse, may be {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,697 | [
"array"
] | void | true | 2 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
initialize_auth_manager | def initialize_auth_manager() -> BaseAuthManager:
"""
Initialize auth manager.
* import user manager class
* instantiate it and return it
"""
auth_manager_cls = conf.getimport(section="core", key="auth_manager")
if not auth_manager_cls:
raise AirflowConfigException(
"No... | Initialize auth manager.
* import user manager class
* instantiate it and return it | python | airflow-core/src/airflow/configuration.py | 874 | [] | BaseAuthManager | true | 2 | 6.72 | apache/airflow | 43,597 | unknown | false |
copyProperties | private static void copyProperties(Object source, Object target, @Nullable Class<?> editable,
String @Nullable ... ignoreProperties) throws BeansException {
Assert.notNull(source, "Source must not be null");
Assert.notNull(target, "Target must not be null");
Class<?> actualEditable = target.getClass();
if ... | Copy the property values of the given source bean into the given target bean.
<p>Note: The source and target classes do not have to match or even be derived
from each other, as long as the properties match. Any bean properties that the
source bean exposes but the target bean does not will silently be ignored.
<p>As of ... | java | spring-beans/src/main/java/org/springframework/beans/BeanUtils.java | 796 | [
"source",
"target",
"editable"
] | void | true | 13 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
processAcknowledgements | private PollResult processAcknowledgements(long currentTimeMs) {
List<UnsentRequest> unsentRequests = new ArrayList<>();
AtomicBoolean isAsyncSent = new AtomicBoolean();
for (Map.Entry<Integer, Tuple<AcknowledgeRequestState>> requestStates : acknowledgeRequestStates.entrySet()) {
int... | Process acknowledgeRequestStates and prepares a list of acknowledgements to be sent in the poll().
@param currentTimeMs the current time in ms.
@return the PollResult containing zero or more acknowledgements. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 348 | [
"currentTimeMs"
] | PollResult | true | 10 | 7.76 | apache/kafka | 31,560 | javadoc | false |
unescapeEcmaScript | public static final String unescapeEcmaScript(final String input) {
return UNESCAPE_ECMASCRIPT.translate(input);
} | Unescapes any EcmaScript literals found in the {@link String}.
<p>For example, it will turn a sequence of {@code '\'} and {@code 'n'}
into a newline character, unless the {@code '\'} is preceded by another
{@code '\'}.</p>
@see #unescapeJava(String)
@param input the {@link String} to unescape, may be null
@return A ne... | java | src/main/java/org/apache/commons/lang3/StringEscapeUtils.java | 696 | [
"input"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
bodyEmpty | static bool bodyEmpty(const ASTContext *Context, const CompoundStmt *Body) {
bool Invalid = false;
const StringRef Text = Lexer::getSourceText(
CharSourceRange::getCharRange(Body->getLBracLoc().getLocWithOffset(1),
Body->getRBracLoc()),
Context->getSourceManager(), Co... | Returns false if the body has any non-whitespace character. | cpp | clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp | 201 | [] | true | 2 | 6.88 | llvm/llvm-project | 36,021 | doxygen | false | |
legfromroots | def legfromroots(roots):
"""
Generate a Legendre 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 Legendre form, where the :math:`r_n` are the roots specified in `roots`.
If a zero has multiplicity n,... | Generate a Legendre 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 Legendre 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/legendre.py | 267 | [
"roots"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
getExistingRootWebApplicationContext | private @Nullable ApplicationContext getExistingRootWebApplicationContext(ServletContext servletContext) {
Object context = servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
if (context instanceof ApplicationContext applicationContext) {
return applicationContext;
}
r... | Called to run a fully configured {@link SpringApplication}.
@param application the application to run
@return the {@link WebApplicationContext} | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializer.java | 208 | [
"servletContext"
] | ApplicationContext | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
toString | public String toString() {
String elrString = elr != null ? elr.stream().map(Node::toString).collect(Collectors.joining(", ")) : "N/A";
String lastKnownElrString = lastKnownElr != null ? lastKnownElr.stream().map(Node::toString).collect(Collectors.joining(", ")) : "N/A";
return "(partition=" + p... | Return the last known eligible leader replicas of the partition. Note that the ordering of the result is unspecified. | java | clients/src/main/java/org/apache/kafka/common/TopicPartitionInfo.java | 117 | [] | String | true | 3 | 6.72 | apache/kafka | 31,560 | javadoc | false |
randomAlphanumeric | @Deprecated
public static String randomAlphanumeric(final int count) {
return secure().nextAlphanumeric(count);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of Latin alphabetic characters (a-z, A-Z) and the digits 0-9.
</p>
@param count the length of random string to create.
@return the random string.
@throws IllegalArgumentException if {@code count} < ... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 459 | [
"count"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
get_choice | def get_choice(self) -> Choice:
"""
Returns the chosen option based on the value of autoheuristic_use.
If self.name is one of the comma separated strings in autoheuristic_use,
it queries a learned heuristic to make a decision. Otherwise, it returns the fallback option.
"""
... | Returns the chosen option based on the value of autoheuristic_use.
If self.name is one of the comma separated strings in autoheuristic_use,
it queries a learned heuristic to make a decision. Otherwise, it returns the fallback option. | python | torch/_inductor/autoheuristic/autoheuristic.py | 113 | [
"self"
] | Choice | true | 6 | 6 | pytorch/pytorch | 96,034 | unknown | false |
getInvocationDescription | protected String getInvocationDescription(MethodInvocation invocation) {
Object target = invocation.getThis();
Assert.state(target != null, "Target must not be null");
String className = target.getClass().getName();
return "method '" + invocation.getMethod().getName() + "' of class [" + className + "]";
} | Return a description for the given method invocation.
@param invocation the invocation to describe
@return the description | java | spring-aop/src/main/java/org/springframework/aop/interceptor/SimpleTraceInterceptor.java | 78 | [
"invocation"
] | String | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
getIfAvailable | default @Nullable T getIfAvailable() throws BeansException {
try {
return getObject();
}
catch (NoUniqueBeanDefinitionException ex) {
throw ex;
}
catch (NoSuchBeanDefinitionException ex) {
return null;
}
} | Return an instance (possibly shared or independent) of the object
managed by this factory.
@return an instance of the bean, or {@code null} if not available
@throws BeansException in case of creation errors
@see #getObject() | java | spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java | 120 | [] | T | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
addExceptionFiltersMetadata | function addExceptionFiltersMetadata(
...filters: (Function | ExceptionFilter)[]
): MethodDecorator & ClassDecorator {
return (
target: any,
key?: string | symbol,
descriptor?: TypedPropertyDescriptor<any>,
) => {
const isFilterValid = <T extends Function | Record<string, any>>(
filter: T,
... | Decorator that binds exception filters to the scope of the controller or
method, depending on its context.
When `@UseFilters` is used at the controller level, the filter will be
applied to every handler (method) in the controller.
When `@UseFilters` is used at the individual handler level, the filter
will apply only to... | typescript | packages/common/decorators/core/exception-filters.decorator.ts | 32 | [
"...filters"
] | true | 4 | 6.24 | nestjs/nest | 73,973 | jsdoc | false | |
_should_fetch_jwks | def _should_fetch_jwks(self) -> bool:
"""
Check if we need to fetch the JWKS based on the last fetch time and the refresh interval.
If the JWKS URL is local, we only fetch it once. For remote JWKS URLs we fetch it based
on the refresh interval if refreshing has been enabled with a minim... | Check if we need to fetch the JWKS based on the last fetch time and the refresh interval.
If the JWKS URL is local, we only fetch it once. For remote JWKS URLs we fetch it based
on the refresh interval if refreshing has been enabled with a minimum interval between
attempts. The fetcher functions set the fetched_at tim... | python | airflow-core/src/airflow/api_fastapi/auth/tokens.py | 174 | [
"self"
] | bool | true | 6 | 6 | apache/airflow | 43,597 | unknown | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.