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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
maybe_droplevels | def maybe_droplevels(index: Index, key) -> Index:
"""
Attempt to drop level or levels from the given index.
Parameters
----------
index: Index
key : scalar or tuple
Returns
-------
Index
"""
# drop levels
original_index = index
if isinstance(key, tuple):
# C... | Attempt to drop level or levels from the given index.
Parameters
----------
index: Index
key : scalar or tuple
Returns
-------
Index | python | pandas/core/indexes/multi.py | 4,378 | [
"index",
"key"
] | Index | true | 4 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
withHashes | public StandardStackTracePrinter withHashes(@Nullable ToIntFunction<StackTraceElement> frameHasher) {
return new StandardStackTracePrinter(this.options, this.maximumLength, this.lineSeparator, this.filter,
this.frameFilter, this.formatter, this.frameFormatter, frameHasher);
} | Return a new {@link StandardStackTracePrinter} from this one that changes if hashes
should be generated and printed for each stacktrace.
@param hashes if hashes should be added
@return a new {@link StandardStackTracePrinter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 276 | [
"frameHasher"
] | StandardStackTracePrinter | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
setText | public void setText(String text, boolean html) throws MessagingException {
Assert.notNull(text, "Text must not be null");
MimePart partToUse;
if (isMultipart()) {
partToUse = getMainPart();
}
else {
partToUse = this.mimeMessage;
}
if (html) {
setHtmlTextToMimePart(partToUse, text);
}
else {
... | Set the given text directly as content in non-multipart mode
or as default body part in multipart mode.
The "html" flag determines the content type to apply.
<p><b>NOTE:</b> Invoke {@link #addInline} <i>after</i> {@code setText};
else, mail readers might not be able to resolve inline references correctly.
@param text t... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 806 | [
"text",
"html"
] | void | true | 3 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
setCurrentProxiedBeanName | static void setCurrentProxiedBeanName(@Nullable String beanName) {
if (beanName != null) {
currentProxiedBeanName.set(beanName);
}
else {
currentProxiedBeanName.remove();
}
} | Set the name of the currently proxied bean instance.
@param beanName the name of the bean, or {@code null} to reset it | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/ProxyCreationContext.java | 54 | [
"beanName"
] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
partition | public static <T extends @Nullable Object> UnmodifiableIterator<List<T>> partition(
Iterator<T> iterator, int size) {
return partitionImpl(iterator, size, false);
} | Divides an iterator into unmodifiable sublists of the given size (the final list may be
smaller). For example, partitioning an iterator containing {@code [a, b, c, d, e]} with a
partition size of 3 yields {@code [[a, b, c], [d, e]]} -- an outer iterator containing two
inner lists of three and two elements, all in the o... | java | android/guava/src/com/google/common/collect/Iterators.java | 602 | [
"iterator",
"size"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
detectMapValueReplacement | private @Nullable ConfigurationMetadataProperty detectMapValueReplacement(String fullId) {
int lastDot = fullId.lastIndexOf('.');
if (lastDot == -1) {
return null;
}
ConfigurationMetadataProperty metadata = this.allProperties.get(fullId.substring(0, lastDot));
if (metadata != null && isMapType(metadata)) {... | Analyse the {@link ConfigurableEnvironment environment} and attempt to rename
legacy properties if a replacement exists.
@return a report of the migration | java | core/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java | 170 | [
"fullId"
] | ConfigurationMetadataProperty | true | 4 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
set | @CanIgnoreReturnValue
protected boolean set(@ParametricNullness V value) {
Object valueToSet = value == null ? NULL : value;
if (casValue(this, null, valueToSet)) {
complete(this, /* callInterruptTask= */ false);
return true;
}
return false;
} | Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or
set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns,
the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was
accepted (in which case it returns ... | java | android/guava/src/com/google/common/util/concurrent/AbstractFuture.java | 487 | [
"value"
] | true | 3 | 8.08 | google/guava | 51,352 | javadoc | false | |
codegen_block_ptr | def codegen_block_ptr(
self,
name: str,
var: str,
indexing: Union[BlockPtrOptions, TensorDescriptorOptions],
other="",
) -> tuple[str, str]:
"""Generate a block pointer or tensor descriptor for Triton kernel operations.
This method creates either a block poin... | Generate a block pointer or tensor descriptor for Triton kernel operations.
This method creates either a block pointer (for regular Triton operations) or
a tensor descriptor (for TMA operations) based on the indexing type. It handles
caching and reuse of descriptors for performance optimization.
Args:
name: The n... | python | torch/_inductor/codegen/triton.py | 3,139 | [
"self",
"name",
"var",
"indexing",
"other"
] | tuple[str, str] | true | 24 | 6.32 | pytorch/pytorch | 96,034 | google | false |
requireNonEmpty | public static <T> T requireNonEmpty(final T obj) {
return requireNonEmpty(obj, "object");
} | Checks that the specified object reference is not {@code null} or empty per {@link #isEmpty(Object)}. Use this
method for validation, for example:
<pre>
public Foo(Bar bar) {
this.bar = Objects.requireNonEmpty(bar);
}
</pre>
@param <T> the type of the reference.
@param obj the object reference to check for nullity.... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 1,186 | [
"obj"
] | T | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
get_type_hint_captures | def get_type_hint_captures(fn):
"""
Get a dictionary containing type resolution mappings necessary to resolve types
for the literal annotations on 'fn'. These are not considered to be closed-over by fn
and must be obtained separately (e.g. using this function).
Args:
fn: A callable.
Ret... | Get a dictionary containing type resolution mappings necessary to resolve types
for the literal annotations on 'fn'. These are not considered to be closed-over by fn
and must be obtained separately (e.g. using this function).
Args:
fn: A callable.
Returns:
A Dict[str, Any] containing a mapping from the literal... | python | torch/_jit_internal.py | 486 | [
"fn"
] | false | 12 | 7.2 | pytorch/pytorch | 96,034 | google | false | |
getTokenLocation | @Override
public XContentLocation getTokenLocation() {
JsonLocation loc = parser.getTokenLocation();
if (loc == null) {
return null;
}
return new XContentLocation(loc.getLineNr(), loc.getColumnNr());
} | Handle parser exception depending on type.
This converts known exceptions to XContentParseException and rethrows them. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentParser.java | 308 | [] | XContentLocation | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
of | public static <L, M, R> Triple<L, M, R> of(final L left, final M middle, final R right) {
return ImmutableTriple.of(left, middle, right);
} | Obtains an immutable triple of three objects inferring the generic types.
@param <L> the left element type.
@param <M> the middle element type.
@param <R> the right element type.
@param left the left element, may be null.
@param middle the middle element, may be null.
@param right the right element, may be null.
@ret... | java | src/main/java/org/apache/commons/lang3/tuple/Triple.java | 79 | [
"left",
"middle",
"right"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
forUriString | public static InetAddress forUriString(String hostAddr) {
InetAddress addr = forUriStringOrNull(hostAddr, /* parseScope= */ true);
if (addr == null) {
throw formatIllegalArgumentException("Not a valid URI IP literal: '%s'", hostAddr);
}
return addr;
} | Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL, encoded in
the format specified by RFC 3986 section 3.2.2.
<p>This method is similar to {@link InetAddresses#forString(String)}, however, it requires that
IPv6 addresses are surrounded by square brackets.
<p>This method is the inverse o... | java | android/guava/src/com/google/common/net/InetAddresses.java | 608 | [
"hostAddr"
] | InetAddress | true | 2 | 7.6 | google/guava | 51,352 | javadoc | false |
normalizeUpperToObject | private static Type[] normalizeUpperToObject(final Type[] bounds) {
return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
} | Delegates to {@link #normalizeUpperBounds(Type[])} unless {@code bounds} is empty in which case return an array with the element {@code Object.class}.
@param bounds bounds an array of types representing the upper bounds of either {@link WildcardType} or {@link TypeVariable}, not {@code null}.
@return result from {@link... | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,375 | [
"bounds"
] | true | 2 | 7.52 | apache/commons-lang | 2,896 | javadoc | false | |
splitPreserveAllTokens | public static String[] splitPreserveAllTokens(final String str) {
return splitWorker(str, null, -1, true);
} | Splits the provided text into an array, using whitespace as the separator, preserving all tokens, including empty tokens created by adjacent separators.
This is an alternative to using StringTokenizer. Whitespace is defined by {@link Character#isWhitespace(char)}.
<p>
The separator is not included in the returned Strin... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,435 | [
"str"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
definePackage | @Override
protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException {
return (!this.exploded) ? super.definePackage(name, man, url) : definePackageForExploded(name, man, url);
} | Create a new {@link LaunchedClassLoader} instance.
@param exploded if the underlying archive is exploded
@param rootArchive the root archive or {@code null}
@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/launch/LaunchedClassLoader.java | 114 | [
"name",
"man",
"url"
] | Package | true | 2 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
clean_nn_module_stack_and_source_fn | def clean_nn_module_stack_and_source_fn(
graph_module: torch.fx.GraphModule, is_inline_builtin=False
) -> torch.fx.GraphModule:
"""
Clean up nn_module_stack metadata by removing export_root references.
Removes the _export_root module references from nn_module_stack metadata
in graph nodes, which ar... | Clean up nn_module_stack metadata by removing export_root references.
Removes the _export_root module references from nn_module_stack metadata
in graph nodes, which are artifacts from the export process. Fixes two patterns:
1. Keys: Removes "__export_root_" and "__modules['_export_root']_" prefixes
- Normal case: ... | python | torch/_dynamo/functional_export.py | 78 | [
"graph_module",
"is_inline_builtin"
] | torch.fx.GraphModule | true | 16 | 6.32 | pytorch/pytorch | 96,034 | google | false |
set_fill_value | def set_fill_value(a, fill_value):
"""
Set the filling value of a, if a is a masked array.
This function changes the fill value of the masked array `a` in place.
If `a` is not a masked array, the function returns silently, without
doing anything.
Parameters
----------
a : array_like
... | Set the filling value of a, if a is a masked array.
This function changes the fill value of the masked array `a` in place.
If `a` is not a masked array, the function returns silently, without
doing anything.
Parameters
----------
a : array_like
Input array.
fill_value : dtype
Filling value. A consistency test... | python | numpy/ma/core.py | 508 | [
"a",
"fill_value"
] | false | 2 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
value | public XContentBuilder value(BigInteger value) throws IOException {
if (value == null) {
return nullValue();
}
generator.writeNumber(value);
return this;
} | @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 | 686 | [
"value"
] | XContentBuilder | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
reportException | boolean reportException(Throwable failure); | Report a startup failure to the user.
@param failure the source failure
@return {@code true} if the failure was reported or {@code false} if default
reporting should occur. | java | core/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionReporter.java | 42 | [
"failure"
] | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
refreshBeanFactory | @Override
protected final void refreshBeanFactory() throws IllegalStateException {
if (!this.refreshed.compareAndSet(false, true)) {
throw new IllegalStateException(
"GenericApplicationContext does not support multiple refresh attempts: just call 'refresh' once");
}
this.beanFactory.setSerializationId(ge... | Do nothing: We hold a single internal BeanFactory and rely on callers
to register beans through our public methods (or the BeanFactory's).
@see #registerBeanDefinition | java | spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java | 289 | [] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
getNamespaceMemberName | function getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression {
const qualifiedName = createPropertyAccessExpression(ns, nodeIsSynthesized(name) ? name : cloneNode(name));
setTextRange(qualifiedName, name);
let ... | Gets a namespace-qualified name for use in expressions.
@param ns The namespace identifier.
@param name The name.
@param allowComments A value indicating whether comments may be emitted for the name.
@param allowSourceMaps A value indicating whether source maps may be emitted for the name. | typescript | src/compiler/factory/nodeFactory.ts | 6,836 | [
"ns",
"name",
"allowComments?",
"allowSourceMaps?"
] | true | 5 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
ofCustom | public static LevelConfiguration ofCustom(String name) {
Assert.hasText(name, "'name' must not be empty");
return new LevelConfiguration(name, null);
} | Create a new {@link LevelConfiguration} instance for a custom level name.
@param name the log level name
@return a new {@link LevelConfiguration} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java | 246 | [
"name"
] | LevelConfiguration | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
completeEventsExceptionallyOnClose | private long completeEventsExceptionallyOnClose(Collection<?> events) {
long count = 0;
for (Object o : events) {
if (!(o instanceof CompletableEvent))
continue;
CompletableEvent<?> event = (CompletableEvent<?>) o;
if (event.future().isDone())
... | For all the {@link CompletableEvent}s in the collection, if they're not already complete, invoke
{@link CompletableFuture#completeExceptionally(Throwable)}.
@param events Collection of objects, assumed to be subclasses of {@link ApplicationEvent} or
{@link BackgroundEvent}, but will only perform completio... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/CompletableEventReaper.java | 186 | [
"events"
] | true | 4 | 7.28 | apache/kafka | 31,560 | javadoc | false | |
delete_old_records | def delete_old_records(
cls,
task_id: str,
dag_id: str,
num_to_keep: int = conf.getint("core", "max_num_rendered_ti_fields_per_task", fallback=0),
session: Session = NEW_SESSION,
) -> None:
"""
Keep only Last X (num_to_keep) number of records for a task by del... | Keep only Last X (num_to_keep) number of records for a task by deleting others.
In the case of data for a mapped task either all of the rows or none of the rows will be deleted, so
we don't end up with partial data for a set of mapped Task Instances left in the database.
:param task_id: Task ID
:param dag_id: Dag ID
... | python | airflow-core/src/airflow/models/renderedtifields.py | 257 | [
"cls",
"task_id",
"dag_id",
"num_to_keep",
"session"
] | None | true | 2 | 6.72 | apache/airflow | 43,597 | sphinx | false |
unless | public boolean unless(String unlessExpression, AnnotatedElementKey methodKey, EvaluationContext evalContext) {
return (Boolean.TRUE.equals(getExpression(this.unlessCache, methodKey, unlessExpression).getValue(
evalContext, Boolean.class)));
} | Create an {@link EvaluationContext}.
@param caches the current caches
@param method the method
@param args the method arguments
@param target the target object
@param targetClass the target class
@param result the return value (can be {@code null}) or
{@link #NO_RESULT} if there is no return at this time
@return the ev... | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationExpressionEvaluator.java | 114 | [
"unlessExpression",
"methodKey",
"evalContext"
] | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false | |
value | public XContentBuilder value(Float value) throws IOException {
return (value == null) ? nullValue() : value(value.floatValue());
} | @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 | 533 | [
"value"
] | XContentBuilder | true | 2 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
asList | public static List<Byte> asList(byte... backingArray) {
if (backingArray.length == 0) {
return Collections.emptyList();
}
return new ByteArrayAsList(backingArray);
} | Returns a fixed-size list backed by the specified array, similar to {@link
Arrays#asList(Object[])}. The list supports {@link List#set(int, Object)}, but any attempt to
set a value to {@code null} will result in a {@link NullPointerException}.
<p>The returned list maintains the values, but not the identities, of {@code... | java | android/guava/src/com/google/common/primitives/Bytes.java | 249 | [] | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false | |
getDependentFiles | public Collection<Path> getDependentFiles() {
Set<Path> paths = new HashSet<>(keyConfig.getDependentFiles());
paths.addAll(trustConfig.getDependentFiles());
return paths;
} | @return A collection of files that are used by this SSL configuration. If the contents of these files change, then any
subsequent call to {@link #createSslContext()} (or similar methods) may create a context with different behaviour.
It is recommended that these files be monitored for changes, and a new ssl-context is ... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslConfiguration.java | 107 | [] | true | 1 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false | |
resolveEmbeddedValue | protected @Nullable String resolveEmbeddedValue(String value) {
return (this.embeddedValueResolver != null ? this.embeddedValueResolver.resolveStringValue(value) : value);
} | Resolve the given embedded value through this instance's {@link StringValueResolver}.
@param value the value to resolve
@return the resolved value, or always the original value if no resolver is available
@see #setEmbeddedValueResolver | java | spring-context/src/main/java/org/springframework/context/support/EmbeddedValueResolutionSupport.java | 47 | [
"value"
] | String | true | 2 | 7.2 | spring-projects/spring-framework | 59,386 | javadoc | false |
enable_memray_trace | def enable_memray_trace(component: MemrayTraceComponents) -> Callable[[Callable[PS, RT]], Callable[PS, RT]]:
"""
Conditionally track memory using memray based on configuration.
Args:
component: Enum value of the component for configuration lookup
"""
def decorator(func: Callable[PS, RT]) -... | Conditionally track memory using memray based on configuration.
Args:
component: Enum value of the component for configuration lookup | python | airflow-core/src/airflow/utils/memray_utils.py | 44 | [
"component"
] | Callable[[Callable[PS, RT]], Callable[PS, RT]] | true | 2 | 6.24 | apache/airflow | 43,597 | google | false |
cacheIfAbsent | boolean cacheIfAbsent(boolean useCaches, URL jarFileUrl, JarFile jarFile) {
if (!useCaches) {
return false;
}
return this.cache.putIfAbsent(jarFileUrl, jarFile);
} | Cache the given {@link JarFile} if caching can be used and there is no existing
entry.
@param useCaches if caches can be used
@param jarFileUrl the jar file URL
@param jarFile the jar file
@return {@code true} if that file was added to the cache | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFiles.java | 92 | [
"useCaches",
"jarFileUrl",
"jarFile"
] | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
compareNodeCoreModuleSpecifiers | function compareNodeCoreModuleSpecifiers(a: string, b: string, importingFile: SourceFile | FutureSourceFile, program: Program): Comparison {
if (startsWith(a, "node:") && !startsWith(b, "node:")) return shouldUseUriStyleNodeCoreModules(importingFile, program) ? Comparison.LessThan : Comparison.GreaterThan;
if... | @returns `Comparison.LessThan` if `a` is better than `b`. | typescript | src/services/codefixes/importFixes.ts | 1,469 | [
"a",
"b",
"importingFile",
"program"
] | true | 7 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
_get_trimming_maximums | def _get_trimming_maximums(
rn,
cn,
max_elements,
max_rows=None,
max_cols=None,
scaling_factor: float = 0.8,
) -> tuple[int, int]:
"""
Recursively reduce the number of rows and columns to satisfy max elements.
Parameters
----------
rn, cn : int
The number of input ro... | Recursively reduce the number of rows and columns to satisfy max elements.
Parameters
----------
rn, cn : int
The number of input rows / columns
max_elements : int
The number of allowable elements
max_rows, max_cols : int, optional
Directly specify an initial maximum rows or columns before compression.
sca... | python | pandas/io/formats/style_render.py | 1,738 | [
"rn",
"cn",
"max_elements",
"max_rows",
"max_cols",
"scaling_factor"
] | tuple[int, int] | true | 8 | 6.48 | pandas-dev/pandas | 47,362 | numpy | false |
maybeAutoCommitSyncBeforeRebalance | public CompletableFuture<Void> maybeAutoCommitSyncBeforeRebalance(final long deadlineMs) {
if (!autoCommitEnabled()) {
return CompletableFuture.completedFuture(null);
}
CompletableFuture<Void> result = new CompletableFuture<>();
OffsetCommitRequestState requestState =
... | Commit consumed offsets if auto-commit is enabled, regardless of the auto-commit interval.
This is used for committing offsets before rebalance. This will retry committing
the latest offsets until the request succeeds, fails with a fatal error, or the timeout
expires. Note that:
<ul>
<li>Considers {@link Errors#STA... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 330 | [
"deadlineMs"
] | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
CursorBase | CursorBase(CursorBase&&) = default; | Check if this cursor has a size limit imposed on it.
@methodset Configuration | cpp | folly/io/Cursor.h | 844 | [] | true | 2 | 6.64 | facebook/folly | 30,157 | doxygen | false | |
validateAddress | protected void validateAddress(InternetAddress address) throws AddressException {
if (isValidateAddresses()) {
address.validate();
}
} | Validate the given mail address.
Called by all of MimeMessageHelper's address setters and adders.
<p>The default implementation invokes {@link InternetAddress#validate()},
provided that address validation is activated for the helper instance.
@param address the address to validate
@throws AddressException if validation... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 539 | [
"address"
] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
tigger_workflow | def tigger_workflow(workflow_name: str, repo: str, branch: str = "main", **kwargs):
"""
Trigger a GitHub Actions workflow using the `gh` CLI.
:param workflow_name: The name of the workflow to trigger.
:param repo: Workflow repository example: 'apache/airflow'
:param branch: The branch to run the wo... | Trigger a GitHub Actions workflow using the `gh` CLI.
:param workflow_name: The name of the workflow to trigger.
:param repo: Workflow repository example: 'apache/airflow'
:param branch: The branch to run the workflow on.
:param kwargs: Additional parameters to pass to the workflow. | python | dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py | 31 | [
"workflow_name",
"repo",
"branch"
] | true | 6 | 7.04 | apache/airflow | 43,597 | sphinx | false | |
moduleNameIsEqualTo | function moduleNameIsEqualTo(a: StringLiteralLike | Identifier, b: StringLiteralLike | Identifier): boolean {
return a.kind === SyntaxKind.Identifier
? b.kind === SyntaxKind.Identifier && a.escapedText === b.escapedText
: b.kind === SyntaxKind.StringLiteral && a.text === b.text;
... | @returns The line index marked as preceding the diagnostic, or -1 if none was. | typescript | src/compiler/program.ts | 3,294 | [
"a",
"b"
] | true | 4 | 7.04 | microsoft/TypeScript | 107,154 | jsdoc | false | |
setupIndex | private void setupIndex() throws IOException {
directory = new ByteBuffersDirectory();
FieldType keywordFieldType = new FieldType(KeywordFieldMapper.Defaults.FIELD_TYPE);
keywordFieldType.setStored(true);
keywordFieldType.freeze();
try (IndexWriter iw = new IndexWriter(directory,... | Layouts for the input blocks.
<ul>
<li>{@code in_order} is how {@link LuceneSourceOperator} produces them to read in
the most efficient possible way. We </li>
<li>{@code shuffled} is chunked the same size as {@link LuceneSourceOperator} but
loads in a shuffled order, like a hypothetical {@link TopNOperator} tha... | java | benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/ValuesSourceReaderBenchmark.java | 499 | [] | void | true | 3 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
standardHashCode | protected int standardHashCode() {
K k = getKey();
V v = getValue();
return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
} | A sensible definition of {@link #hashCode()} in terms of {@link #getKey()} and {@link
#getValue()}. If you override either of these methods, you may wish to override {@link
#hashCode()} to forward to this implementation.
@since 7.0 | java | android/guava/src/com/google/common/collect/ForwardingMapEntry.java | 112 | [] | true | 3 | 6.72 | google/guava | 51,352 | javadoc | false | |
keySize | public int keySize() {
if (magic() == RecordBatch.MAGIC_VALUE_V0)
return buffer.getInt(KEY_SIZE_OFFSET_V0);
else
return buffer.getInt(KEY_SIZE_OFFSET_V1);
} | The length of the key in bytes
@return the size in bytes of the key (0 if the key is null) | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 152 | [] | true | 2 | 7.44 | apache/kafka | 31,560 | javadoc | false | |
get | static SecurityInfo get(ZipContent content) {
if (!content.hasJarSignatureFile()) {
return NONE;
}
try {
return load(content);
}
catch (IOException ex) {
throw new UncheckedIOException(ex);
}
} | Get the {@link SecurityInfo} for the given {@link ZipContent}.
@param content the zip content
@return the security info | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/SecurityInfo.java | 64 | [
"content"
] | SecurityInfo | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
abort | public void abort(RuntimeException exception) {
if (!finalState.compareAndSet(null, FinalState.ABORTED))
throw new IllegalStateException("Batch has already been completed in final state " + finalState.get());
log.trace("Aborting batch for partition {}", topicPartition, exception);
c... | Abort the batch and complete the future and callbacks.
@param exception The exception to use to complete the future and awaiting callbacks. | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java | 195 | [
"exception"
] | void | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false |
readArgumentIndex | private int readArgumentIndex(final String pattern, final ParsePosition pos) {
final int start = pos.getIndex();
seekNonWs(pattern, pos);
final StringBuilder result = new StringBuilder();
boolean error = false;
for (; !error && pos.getIndex() < pattern.length(); next(pos)) {
... | Reads the argument index from the current format element
@param pattern pattern to parse
@param pos current parse position
@return argument index | java | src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java | 408 | [
"pattern",
"pos"
] | true | 11 | 7.28 | apache/commons-lang | 2,896 | javadoc | false | |
replaceEach | public static String replaceEach(final String text, final String[] searchList, final String[] replacementList) {
return replaceEach(text, searchList, replacementList, false, 0);
} | Replaces all occurrences of Strings within another String.
<p>
A {@code null} reference passed to this method is a no-op, or if any "search string" or "string to replace" is null, that replace will be ignored. This
will not repeat. For repeating replaces, call the overloaded method.
</p>
<pre>
StringUtils.replaceEach(... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 6,362 | [
"text",
"searchList",
"replacementList"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
checkCircularity | function checkCircularity(stackIndex: number, nodeStack: BinaryExpression[], node: BinaryExpression) {
if (Debug.shouldAssert(AssertionLevel.Aggressive)) {
while (stackIndex >= 0) {
Debug.assert(nodeStack[stackIndex] !== node, "Circular traversal detected.");
stac... | Handles a frame that is already done.
@returns The `done` state. | typescript | src/compiler/factory/utilities.ts | 1,400 | [
"stackIndex",
"nodeStack",
"node"
] | false | 3 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
get_standard_colors | def get_standard_colors(
num_colors: int,
colormap: Colormap | None = None,
color_type: str = "default",
*,
color: dict[str, Color] | Color | Sequence[Color] | None = None,
) -> dict[str, Color] | list[Color]:
"""
Get standard colors based on `colormap`, `color_type` or `color` inputs.
... | Get standard colors based on `colormap`, `color_type` or `color` inputs.
Parameters
----------
num_colors : int
Minimum number of colors to be returned.
Ignored if `color` is a dictionary.
colormap : :py:class:`matplotlib.colors.Colormap`, optional
Matplotlib colormap.
When provided, the resulting colo... | python | pandas/plotting/_matplotlib/style.py | 59 | [
"num_colors",
"colormap",
"color_type",
"color"
] | dict[str, Color] | list[Color] | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
iterator | @Override
public Iterator<T> iterator() {
return this.services.iterator();
} | Create a new {@link Loader} that will obtain AOT services from the given
{@link SpringFactoriesLoader} and {@link ListableBeanFactory}.
@param springFactoriesLoader the spring factories loader
@param beanFactory the bean factory
@return a new {@link Loader} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java | 144 | [] | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
doLongValue | @Override
public long doLongValue() throws IOException {
try {
return parser.getLongValue();
} catch (IOException e) {
throw handleParserException(e);
}
} | Handle parser exception depending on type.
This converts known exceptions to XContentParseException and rethrows them. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentParser.java | 272 | [] | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
output_layout | def output_layout(self, flexible: bool = True) -> Layout:
"""
Handle output layout generation for matrix multiplication.
Args:
out_dtype: Optional output dtype. If not provided, infer from inputs
flexible: If True, return FlexibleLayout, otherwise FixedLayout
"""... | Handle output layout generation for matrix multiplication.
Args:
out_dtype: Optional output dtype. If not provided, infer from inputs
flexible: If True, return FlexibleLayout, otherwise FixedLayout | python | torch/_inductor/kernel_inputs.py | 286 | [
"self",
"flexible"
] | Layout | true | 3 | 6.24 | pytorch/pytorch | 96,034 | google | false |
nextPrint | public String nextPrint(final int count) {
return next(count, 32, 126, false, false);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of characters which match the POSIX [:print:] regular expression character
class. This class includes all visible ASCII characters and spaces (i.e. anything except control characters).
</p>
@param coun... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 971 | [
"count"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
appendIndex | private ConfigurationPropertyName appendIndex(ConfigurationPropertyName root, int i) {
return root.append((i < INDEXES.length) ? INDEXES[i] : "[" + i + "]");
} | 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 | 159 | [
"root",
"i"
] | ConfigurationPropertyName | true | 2 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
addYears | public static Date addYears(final Date date, final int amount) {
return add(date, Calendar.YEAR, amount);
} | Adds a number of years 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 | 328 | [
"date",
"amount"
] | Date | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
ifUnique | default void ifUnique(Consumer<T> dependencyConsumer) throws BeansException {
T dependency = getIfUnique();
if (dependency != null) {
dependencyConsumer.accept(dependency);
}
} | Consume an instance (possibly shared or independent) of the object
managed by this factory, if unique.
@param dependencyConsumer a callback for processing the target object
if unique (not called otherwise)
@throws BeansException in case of creation errors
@since 5.0
@see #getIfUnique() | java | spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java | 207 | [
"dependencyConsumer"
] | void | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
hermcompanion | def hermcompanion(c):
"""Return the scaled companion matrix of c.
The basis polynomials are scaled so that the companion matrix is
symmetric when `c` is a Hermite basis polynomial. This provides
better eigenvalue estimates than the unscaled case and for basis
polynomials the eigenvalues are guarant... | Return the scaled companion matrix of c.
The basis polynomials are scaled so that the companion matrix is
symmetric when `c` is a Hermite basis polynomial. This provides
better eigenvalue estimates than the unscaled case and for basis
polynomials the eigenvalues are guaranteed to be real if
`numpy.linalg.eigvalsh` is ... | python | numpy/polynomial/hermite.py | 1,438 | [
"c"
] | false | 3 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
getOrigin | @Override
public @Nullable Origin getOrigin(String name) {
Object value = super.getProperty(name);
if (value instanceof OriginTrackedValue originTrackedValue) {
return originTrackedValue.getOrigin();
}
return null;
} | Create a new {@link OriginTrackedMapPropertySource} instance.
@param name the property source name
@param source the underlying map source
@param immutable if the underlying source is immutable and guaranteed not to change
@since 2.2.0 | java | core/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedMapPropertySource.java | 74 | [
"name"
] | Origin | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
dropna | def dropna(self, how: AnyAll = "any") -> Self:
"""
Return Index without NA/NaN values.
Parameters
----------
how : {'any', 'all'}, default 'any'
If the Index is a MultiIndex, drop the value when any or all levels
are NaN.
Returns
-------
... | Return Index without NA/NaN values.
Parameters
----------
how : {'any', 'all'}, default 'any'
If the Index is a MultiIndex, drop the value when any or all levels
are NaN.
Returns
-------
Index
Returns an Index object after removing NA/NaN values.
See Also
--------
Index.fillna : Fill NA/NaN values with t... | python | pandas/core/indexes/base.py | 2,781 | [
"self",
"how"
] | Self | true | 3 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
withAliases | default ConfigurationPropertySource withAliases(ConfigurationPropertyNameAliases aliases) {
return new AliasedConfigurationPropertySource(this, aliases);
} | Return a variant of this source that supports name aliases.
@param aliases a function that returns a stream of aliases for any given name
@return a {@link ConfigurationPropertySource} instance supporting name aliases | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySource.java | 76 | [
"aliases"
] | ConfigurationPropertySource | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
create_processing_job | def create_processing_job(
self,
config: dict,
wait_for_completion: bool = True,
check_interval: int = 30,
max_ingestion_time: int | None = None,
):
"""
Use Amazon SageMaker Processing to analyze data and evaluate models.
With Processing, you can use ... | Use Amazon SageMaker Processing to analyze data and evaluate models.
With Processing, you can use a simplified, managed experience on
SageMaker to run your data processing workloads, such as feature
engineering, data validation, model evaluation, and model
interpretation.
.. seealso::
- :external+boto3:py:meth:`S... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 419 | [
"self",
"config",
"wait_for_completion",
"check_interval",
"max_ingestion_time"
] | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false | |
poll | public void poll(final long timeoutMs, final long currentTimeMs, boolean onClose) {
trySend(currentTimeMs);
long pollTimeoutMs = timeoutMs;
if (!unsentRequests.isEmpty()) {
pollTimeoutMs = Math.min(retryBackoffMs, pollTimeoutMs);
}
this.client.poll(pollTimeoutMs, cur... | This method will try to send the unsent requests, poll for responses,
and check the disconnected nodes.
@param timeoutMs timeout time
@param currentTimeMs current time
@param onClose True when the network thread is closing. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java | 159 | [
"timeoutMs",
"currentTimeMs",
"onClose"
] | void | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false |
canConnect | boolean canConnect(Node node, long now) {
return connectionStates.canConnect(node.idString(), now);
} | Begin connecting to the given node, return true if we are already connected and ready to send to that node.
@param node The node to check
@param now The current timestamp
@return True if we are ready to send to the given node | java | clients/src/main/java/org/apache/kafka/clients/NetworkClient.java | 374 | [
"node",
"now"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
map | def map(self, mapper, na_action: Literal["ignore"] | None = None):
"""
Map values using an input mapping or function.
Parameters
----------
mapper : function, dict, or Series
Mapping correspondence.
na_action : {None, 'ignore'}
If 'ignore', propag... | Map values using an input mapping or function.
Parameters
----------
mapper : function, dict, or Series
Mapping correspondence.
na_action : {None, 'ignore'}
If 'ignore', propagate NA values, without passing them to the
mapping correspondence.
Returns
-------
Union[Index, MultiIndex]
The output of the ... | python | pandas/core/indexes/base.py | 6,489 | [
"self",
"mapper",
"na_action"
] | true | 11 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false | |
parseInt | function parseInt(string, radix, guard) {
if (guard || radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
} | Converts `string` to an integer of the specified radix. If `radix` is
`undefined` or `0`, a `radix` of `10` is used unless `value` is a
hexadecimal, in which case a `radix` of `16` is used.
**Note:** This method aligns with the
[ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
@static
@memberOf _
@s... | javascript | lodash.js | 14,584 | [
"string",
"radix",
"guard"
] | false | 6 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
record | public void record() {
if (shouldRecord()) {
recordInternal(1.0d, time.milliseconds(), true);
}
} | Record an occurrence, this is just short-hand for {@link #record(double) record(1.0)} | java | clients/src/main/java/org/apache/kafka/common/metrics/Sensor.java | 183 | [] | void | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
formatTimeStamp | private static WritableJson formatTimeStamp(long timeStamp) {
return (out) -> out.append(new BigDecimal(timeStamp).movePointLeft(3).toPlainString());
} | GELF requires "seconds since UNIX epoch with optional <b>decimal places for
milliseconds</b>". To comply with this requirement, we format a POSIX timestamp
with millisecond precision as e.g. "1725459730385" -> "1725459730.385"
@param timeStamp the timestamp of the log message
@return the timestamp formatted as string w... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java | 123 | [
"timeStamp"
] | WritableJson | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
Operator | Operator(Operator&&) noexcept = default; | compose() - Must be implemented by child class to compose a new Generator
out of a given generator. This function left intentionally unimplemented. | cpp | folly/gen/Core-inl.h | 94 | [] | true | 2 | 6.48 | facebook/folly | 30,157 | doxygen | false | |
notEmpty | public static <T> T[] notEmpty(final T[] array) {
return notEmpty(array, DEFAULT_NOT_EMPTY_ARRAY_EX_MESSAGE);
} | <p>Validates that the specified argument array is neither {@code null}
nor a length of zero (no elements); otherwise throwing an exception.
<pre>Validate.notEmpty(myArray);</pre>
<p>The message in the exception is "The validated array is
empty".
@param <T> the array type.
@param array the array to check, val... | java | src/main/java/org/apache/commons/lang3/Validate.java | 960 | [
"array"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
append | public StrBuilder append(final String format, final Object... objs) {
return append(String.format(format, objs));
} | Calls {@link String#format(String, Object...)} and appends the result.
@param format the format string
@param objs the objects to use in the format string
@return {@code this} to enable chaining
@see String#format(String, Object...)
@since 3.2 | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 675 | [
"format"
] | StrBuilder | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
triggerUpdate | function triggerUpdate() {
const hooks = getHooksContextOrNull();
// Rerun storyFn if updates were triggered synchronously, force rerender otherwise
if (hooks != null && hooks.currentPhase !== 'NONE') {
hooks.hasUpdates = true;
} else {
try {
addons.getChannel().emit(FORCE_RE_RENDER);
} catch ... | Returns a mutable ref object.
@example
```ts
const ref = useRef(0);
ref.current = 1;
```
@template T The type of the ref object.
@param {T} initialValue The initial value of the ref object.
@returns {{ current: T }} The mutable ref object. | typescript | code/core/src/preview-api/modules/addons/hooks.ts | 368 | [] | false | 5 | 8.88 | storybookjs/storybook | 88,865 | jsdoc | false | |
headers | Iterable<Header> headers(String key); | Returns all headers for the given key, in the order they were added in, if present.
The iterator does not support {@link java.util.Iterator#remove()}.
@param key to return the headers for; must not be null.
@return all headers for the given key, in the order they were added in, if NO headers are present an empty iterab... | java | clients/src/main/java/org/apache/kafka/common/header/Headers.java | 71 | [
"key"
] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
destroy | @Override
public void destroy() {
if (this.cacheManager != null) {
this.cacheManager.close();
}
} | Specify properties for the to-be-created {@code CacheManager}.
<p>Default is {@code null} (i.e. no special properties to apply).
@see javax.cache.spi.CachingProvider#getCacheManager(URI, ClassLoader, Properties) | java | spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheManagerFactoryBean.java | 99 | [] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
open_instance_resource | def open_instance_resource(
self, resource: str, mode: str = "rb", encoding: str | None = "utf-8"
) -> t.IO[t.AnyStr]:
"""Open a resource file relative to the application's instance folder
:attr:`instance_path`. Unlike :meth:`open_resource`, files in the
instance folder can be opened... | Open a resource file relative to the application's instance folder
:attr:`instance_path`. Unlike :meth:`open_resource`, files in the
instance folder can be opened for writing.
:param resource: Path to the resource relative to :attr:`instance_path`.
:param mode: Open the file in this mode.
:param encoding: Open the fil... | python | src/flask/app.py | 446 | [
"self",
"resource",
"mode",
"encoding"
] | t.IO[t.AnyStr] | true | 2 | 6.72 | pallets/flask | 70,946 | sphinx | false |
unsubscribe | public void unsubscribe() {
acquireAndEnsureOpen();
try {
fetcher.clearBufferedDataForUnassignedPartitions(Collections.emptySet());
if (this.coordinator != null) {
this.coordinator.onLeavePrepare();
this.coordinator.maybeLeaveGroup(CloseOptions.Gro... | Internal helper method for {@link #subscribe(Pattern)} and
{@link #subscribe(Pattern, ConsumerRebalanceListener)}
<p>
Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
The pattern matching will be done periodically against all topics existing at the time of check.
This can be co... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java | 577 | [] | void | true | 2 | 6.24 | apache/kafka | 31,560 | javadoc | false |
computeChecksum | private long computeChecksum() {
return Crc32C.compute(buffer, ATTRIBUTES_OFFSET, buffer.limit() - ATTRIBUTES_OFFSET);
} | Gets the base timestamp of the batch which is used to calculate the record timestamps from the deltas.
@return The base timestamp | java | clients/src/main/java/org/apache/kafka/common/record/DefaultRecordBatch.java | 398 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
startInlineUnsafe | startInlineUnsafe() && {
folly::Promise<lift_unit_t<StorageType>> p;
auto sf = p.getSemiFuture();
std::move(*this).startInlineImpl(
[promise = std::move(p)](Try<StorageType>&& result) mutable {
promise.setTry(std::move(result));
},
folly::CancellationToken{},
FOLL... | Task. Refer to TaskWithExecuter::start() for more information. | cpp | folly/coro/Task.h | 389 | [] | true | 3 | 6.08 | facebook/folly | 30,157 | doxygen | false | |
getResolvableConstructor | @SuppressWarnings("unchecked")
public static <T> Constructor<T> getResolvableConstructor(Class<T> clazz) {
Constructor<T> ctor = findPrimaryConstructor(clazz);
if (ctor != null) {
return ctor;
}
Constructor<?>[] ctors = clazz.getConstructors();
if (ctors.length == 1) {
// A single public constructor
... | Return a resolvable constructor for the provided class, either a primary or single
public constructor with arguments, a single non-public constructor with arguments
or simply a default constructor.
<p>Callers have to be prepared to resolve arguments for the returned constructor's
parameters, if any.
@param clazz the cl... | java | spring-beans/src/main/java/org/springframework/beans/BeanUtils.java | 235 | [
"clazz"
] | true | 6 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false | |
buildInternalBeanFactory | protected DefaultListableBeanFactory buildInternalBeanFactory(ConfigurableBeanFactory containingFactory) {
// Set parent so that references (up container hierarchies) are correctly resolved.
DefaultListableBeanFactory internalBeanFactory = new DefaultListableBeanFactory(containingFactory);
// Required so that al... | Build an internal BeanFactory for resolving target beans.
@param containingFactory the containing BeanFactory that originally defines the beans
@return an independent internal BeanFactory to hold copies of some target beans | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java | 142 | [
"containingFactory"
] | DefaultListableBeanFactory | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
allocatedSizeInBytes | @Override
public OptionalLong allocatedSizeInBytes(Path path) {
assert Files.isRegularFile(path) : path;
String fileName = "\\\\?\\" + path;
AtomicInteger lpFileSizeHigh = new AtomicInteger();
final int lpFileSizeLow = kernel.GetCompressedFileSizeW(fileName, lpFileSizeHigh::set);
... | Install exec system call filtering on Windows.
<p>
Process creation is restricted with {@code SetInformationJobObject/ActiveProcessLimit}.
<p>
Note: This is not intended as a real sandbox. It is another level of security, mostly intended to annoy
security researchers and make their lives more difficult in achieving "re... | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/WindowsNativeAccess.java | 129 | [
"path"
] | OptionalLong | true | 3 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
getMonthDisplayNames | String[] getMonthDisplayNames(final int style) {
// Unfortunately standalone month names are not available in DateFormatSymbols,
// so we have to extract them.
final Map<String, Integer> displayNames = calendar.getDisplayNames(Calendar.MONTH, style, locale);
if (displayNames == null) {
... | Gets month names in the requested style.
@param style Must be a valid {@link Calendar#getDisplayNames(int, int, Locale)} month style.
@return Styled names of months | java | src/main/java/org/apache/commons/lang3/time/CalendarUtils.java | 160 | [
"style"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
check_axis_name_return_reason | def check_axis_name_return_reason(
name: str, allow_underscore: bool = False
) -> tuple[bool, str]:
"""Check if the given axis name is valid, and a message explaining why if not.
Valid axes names are python identifiers except keywords, and should not start or end with an underscore.
... | Check if the given axis name is valid, and a message explaining why if not.
Valid axes names are python identifiers except keywords, and should not start or end with an underscore.
Args:
name (str): the axis name to check
allow_underscore (bool): whether axis names are allowed to start with an underscore
Ret... | python | functorch/einops/_parsing.py | 165 | [
"name",
"allow_underscore"
] | tuple[bool, str] | true | 9 | 7.76 | pytorch/pytorch | 96,034 | google | false |
parseTemplateHead | function parseTemplateHead(isTaggedTemplate: boolean): TemplateHead {
if (!isTaggedTemplate && scanner.getTokenFlags() & TokenFlags.IsInvalid) {
reScanTemplateToken(/*isTaggedTemplate*/ false);
}
const fragment = parseLiteralLikeNode(token());
Debug.assert(fragment.kind ... | 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 | 3,739 | [
"isTaggedTemplate"
] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
clone | @Override
public Object clone() {
try {
return cloneReset();
} catch (final CloneNotSupportedException ex) {
return null;
}
} | Creates a new instance of this Tokenizer. The new instance is reset so
that it will be at the start of the token list.
If a {@link CloneNotSupportedException} is caught, return {@code null}.
@return a new instance of this Tokenizer which has been reset. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 450 | [] | Object | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
targetTypeNecessary | private boolean targetTypeNecessary(ResolvableType beanType, @Nullable Class<?> beanClass) {
if (beanType.hasGenerics()) {
return true;
}
if (beanClass != null && this.registeredBean.getMergedBeanDefinition().getFactoryMethodName() != null) {
return true;
}
return (beanClass != null && !beanType.toClass... | Extract the target class of a public {@link FactoryBean} based on its
constructor. If the implementation does not resolve the target class
because it itself uses a generic, attempt to extract it from the bean type.
@param factoryBeanType the factory bean type
@param beanType the bean type
@return the target class to us... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragments.java | 155 | [
"beanType",
"beanClass"
] | true | 5 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
run | def run(self, header, body, partial_args, app=None, interval=None,
countdown=1, max_retries=None, eager=False,
task_id=None, kwargs=None, **options):
"""Execute the chord.
Executing the chord means executing the header and sending the
result to the body. In case of an em... | Execute the chord.
Executing the chord means executing the header and sending the
result to the body. In case of an empty header, the body is
executed immediately.
Arguments:
header (group): The header to execute.
body (Signature): The body to execute.
partial_args (tuple): Arguments to pass to the header... | python | celery/canvas.py | 2,205 | [
"self",
"header",
"body",
"partial_args",
"app",
"interval",
"countdown",
"max_retries",
"eager",
"task_id",
"kwargs"
] | false | 8 | 7.2 | celery/celery | 27,741 | google | false | |
get_waiter | def get_waiter(self, waiterName: str) -> botocore.waiter.Waiter:
"""
Get an AWS Batch service waiter.
:param waiterName: The name of the waiter. The name should match
the name (including the casing) of the key name in the waiter
model file (typically this is CamelCasing... | Get an AWS Batch service waiter.
:param waiterName: The name of the waiter. The name should match
the name (including the casing) of the key name in the waiter
model file (typically this is CamelCasing).
:return: a waiter object for the named AWS Batch service
.. note::
AWS Batch might not have any wait... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/batch_client.py | 71 | [
"self",
"waiterName"
] | botocore.waiter.Waiter | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
removeExactly | @CanIgnoreReturnValue
public boolean removeExactly(@Nullable Object element, int occurrences) {
if (occurrences == 0) {
return true;
}
CollectPreconditions.checkPositive(occurrences, "occurrences");
AtomicInteger existingCounter = safeGet(countMap, element);
if (existingCounter == null) {
... | Removes exactly the specified number of occurrences of {@code element}, or makes no change if
this is not possible.
<p>This method, in contrast to {@link #remove(Object, int)}, has no effect when the element
count is smaller than {@code occurrences}.
@param element the element to remove
@param occurrences the number of... | java | android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java | 334 | [
"element",
"occurrences"
] | true | 7 | 7.76 | google/guava | 51,352 | javadoc | false | |
loadDefaults | @Override
protected void loadDefaults(LoggingInitializationContext initializationContext, @Nullable LogFile logFile) {
String location = getPackagedConfigFile((logFile != null) ? "log4j2-file.xml" : "log4j2.xml");
load(initializationContext, location, logFile);
} | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 258 | [
"initializationContext",
"logFile"
] | void | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_tensor_storages | def get_tensor_storages(tensor: torch.Tensor) -> set[StorageWeakRef]:
"""
Get storage references from a tensor.
Handles regular tensors. Raises NotImplementedError for sparse tensors
and traceable wrapper subclasses.
Args:
tensor: The tensor to extract storages from
Returns:
S... | Get storage references from a tensor.
Handles regular tensors. Raises NotImplementedError for sparse tensors
and traceable wrapper subclasses.
Args:
tensor: The tensor to extract storages from
Returns:
Set of StorageWeakRef objects for the tensor's storage(s) | python | torch/_dynamo/variables/higher_order_ops.py | 432 | [
"tensor"
] | set[StorageWeakRef] | true | 6 | 7.6 | pytorch/pytorch | 96,034 | google | false |
refreshForAotProcessing | public void refreshForAotProcessing(RuntimeHints runtimeHints) {
if (logger.isDebugEnabled()) {
logger.debug("Preparing bean factory for AOT processing");
}
prepareRefresh();
obtainFreshBeanFactory();
prepareBeanFactory(this.beanFactory);
postProcessBeanFactory(this.beanFactory);
invokeBeanFactoryPostP... | Load or refresh the persistent representation of the configuration up to
a point where the underlying bean factory is ready to create bean
instances.
<p>This variant of {@link #refresh()} is used by Ahead of Time (AOT)
processing that optimizes the application context, typically at build time.
<p>In this mode, only {@l... | java | spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java | 406 | [
"runtimeHints"
] | void | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
formatPeriod | public static String formatPeriod(final long startMillis, final long endMillis, final String format, final boolean padWithZeros,
final TimeZone timezone) {
Validate.isTrue(startMillis <= endMillis, "startMillis must not be greater than endMillis");
// Used to optimize for differences under ... | <p>Formats the time gap as a string, using the specified format.
Padding the left-hand side side of numbers with zeroes is optional and
the time zone may be specified.
<p>When calculating the difference between months/days, it chooses to
calculate months first. So when working out the number of months and
days between ... | java | src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java | 529 | [
"startMillis",
"endMillis",
"format",
"padWithZeros",
"timezone"
] | String | true | 23 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
getMessage | private static String getMessage(PropertySource<?> propertySource, @Nullable ConfigDataResource location,
String propertyName, @Nullable Origin origin) {
StringBuilder message = new StringBuilder("Inactive property source '");
message.append(propertySource.getName());
if (location != null) {
message.append(... | Create a new {@link InactiveConfigDataAccessException} instance.
@param propertySource the inactive property source
@param location the {@link ConfigDataResource} of the property source or
{@code null} if the source was not loaded from {@link ConfigData}.
@param propertyName the name of the property
@param origin the o... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/InactiveConfigDataAccessException.java | 64 | [
"propertySource",
"location",
"propertyName",
"origin"
] | String | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
add | private static Date add(final Date date, final int calendarField, final int amount) {
validateDateNotNull(date);
final Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(calendarField, amount);
return c.getTime();
} | Adds to a date returning a new object.
The original {@link Date} is unchanged.
@param date the date, not null.
@param calendarField the calendar field to add to.
@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 | 220 | [
"date",
"calendarField",
"amount"
] | Date | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
_compute_n_patches | def _compute_n_patches(i_h, i_w, p_h, p_w, max_patches=None):
"""Compute the number of patches that will be extracted in an image.
Read more in the :ref:`User Guide <image_feature_extraction>`.
Parameters
----------
i_h : int
The image height
i_w : int
The image with
p_h : ... | Compute the number of patches that will be extracted in an image.
Read more in the :ref:`User Guide <image_feature_extraction>`.
Parameters
----------
i_h : int
The image height
i_w : int
The image with
p_h : int
The height of a patch
p_w : int
The width of a patch
max_patches : int or float, default=... | python | sklearn/feature_extraction/image.py | 259 | [
"i_h",
"i_w",
"p_h",
"p_w",
"max_patches"
] | false | 10 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
ordinalIndexOf | private static int ordinalIndexOf(final CharSequence str, final CharSequence searchStr, final int ordinal, final boolean lastIndex) {
if (str == null || searchStr == null || ordinal <= 0) {
return INDEX_NOT_FOUND;
}
if (searchStr.length() == 0) {
return lastIndex ? str.le... | Finds the n-th index within a String, handling {@code null}. This method uses {@link String#indexOf(String)} if possible.
<p>
Note that matches may overlap.
<p>
<p>
A {@code null} CharSequence will return {@code -1}.
</p>
@param str the CharSequence to check, may be null.
@param searchStr the CharSequence to find... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,489 | [
"str",
"searchStr",
"ordinal",
"lastIndex"
] | true | 9 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
set_task_instance_state | def set_task_instance_state(
self,
*,
task_id: str,
map_indexes: Collection[int] | None = None,
run_id: str | None = None,
state: TaskInstanceState,
upstream: bool = False,
downstream: bool = False,
future: bool = False,
past: bool = False,... | Set the state of a TaskInstance and clear downstream tasks in failed or upstream_failed state.
:param task_id: Task ID of the TaskInstance
:param map_indexes: Only set TaskInstance if its map_index matches.
If None (default), all mapped TaskInstances of the task are set.
:param run_id: The run_id of the TaskInstan... | python | airflow-core/src/airflow/serialization/serialized_objects.py | 3,220 | [
"self",
"task_id",
"map_indexes",
"run_id",
"state",
"upstream",
"downstream",
"future",
"past",
"commit",
"session"
] | list[TaskInstance] | true | 11 | 6.96 | apache/airflow | 43,597 | sphinx | false |
getFieldOrDefault | private Object getFieldOrDefault(BoundField field) {
Object value = this.values[field.index];
if (value != null)
return value;
else if (field.def.hasDefaultValue)
return field.def.defaultValue;
else if (field.def.type.isNullable())
return null;
... | Return the value of the given pre-validated field, or if the value is missing return the default value.
@param field The field for which to get the default value
@throws SchemaException if the field has no value and has no default. | java | clients/src/main/java/org/apache/kafka/common/protocol/types/Struct.java | 53 | [
"field"
] | Object | true | 4 | 6.72 | apache/kafka | 31,560 | javadoc | false |
replaceImpl | private void replaceImpl(final int startIndex, final int endIndex, final int removeLen, final String insertStr, final int insertLen) {
final int newSize = size - removeLen + insertLen;
if (insertLen != removeLen) {
ensureCapacity(newSize);
System.arraycopy(buffer, endIndex, buffe... | Internal method to delete a range without validation.
@param startIndex the start index, must be valid
@param endIndex the end index (exclusive), must be valid
@param removeLen the length to remove (endIndex - startIndex), must be valid
@param insertStr the string to replace with, null means delete range
@param ins... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,684 | [
"startIndex",
"endIndex",
"removeLen",
"insertStr",
"insertLen"
] | void | true | 3 | 6.4 | apache/commons-lang | 2,896 | javadoc | false |
median | @SafeVarargs
public static <T extends Comparable<? super T>> T median(final T... items) {
Validate.notEmpty(items);
Validate.noNullElements(items);
final TreeSet<T> sort = new TreeSet<>();
Collections.addAll(sort, items);
return (T) sort.toArray()[(sort.size() - 1) / 2];
... | Finds the "best guess" middle value among comparables. If there is an even number of total values, the lower of the two middle values will be returned.
@param <T> type of values processed by this method.
@param items to compare.
@return T at middle position.
@throws NullPointerException if items is {@code null}.
... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 1,076 | [] | T | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
_generate_env_for_docker_compose_file_if_needed | def _generate_env_for_docker_compose_file_if_needed(env: dict[str, str]):
"""
Generates docker-compose env file if needed.
:param env: dictionary of env variables to use for docker-compose and docker env files.
Writes env files for docker and docker compose to make sure the envs will b... | Generates docker-compose env file if needed.
:param env: dictionary of env variables to use for docker-compose and docker env files.
Writes env files for docker and docker compose to make sure the envs will be passed
to docker-compose/docker when running commands.
The list of variables might change over time, and we... | python | dev/breeze/src/airflow_breeze/params/shell_params.py | 732 | [
"env"
] | true | 6 | 7.12 | apache/airflow | 43,597 | sphinx | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.