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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
extract | @Nullable T extract(@Nullable Object instance); | Extract the value from the given instance.
@param instance the source instance
@return the extracted value or {@link #SKIP} | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 705 | [
"instance"
] | T | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
initCloneArray | function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = arr... | Initializes an array clone.
@private
@param {Array} array The array to clone.
@returns {Array} Returns the initialized clone. | javascript | lodash.js | 6,251 | [
"array"
] | false | 4 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
process | private void process(final ShareUnsubscribeEvent event) {
if (requestManagers.shareHeartbeatRequestManager.isEmpty()) {
KafkaException error = new KafkaException("Group membership manager not present when processing an unsubscribe event");
event.future().completeExceptionally(error);
... | Process event indicating that the consumer unsubscribed from all topics. This will make
the consumer release its assignment and send a request to leave the share group.
@param event Unsubscribe event containing a future that will complete when the callback
execution for releasing the assignment completes, ... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 559 | [
"event"
] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
pullAllWith | function pullAllWith(array, values, comparator) {
return (array && array.length && values && values.length)
? basePullAll(array, values, undefined, comparator)
: array;
} | This method is like `_.pullAll` except that it accepts `comparator` which
is invoked to compare elements of `array` to `values`. The comparator is
invoked with two arguments: (arrVal, othVal).
**Note:** Unlike `_.differenceWith`, this method mutates `array`.
@static
@memberOf _
@since 4.6.0
@category Array
@param {Arra... | javascript | lodash.js | 7,881 | [
"array",
"values",
"comparator"
] | false | 5 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
_get_resampler | def _get_resampler(self, obj: NDFrame) -> Resampler:
"""
Return my resampler or raise if we have an invalid axis.
Parameters
----------
obj : Series or DataFrame
Returns
-------
Resampler
Raises
------
TypeError if incompatible a... | Return my resampler or raise if we have an invalid axis.
Parameters
----------
obj : Series or DataFrame
Returns
-------
Resampler
Raises
------
TypeError if incompatible axis | python | pandas/core/resample.py | 2,494 | [
"self",
"obj"
] | Resampler | true | 4 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
writeFile | function writeFile(path, data, options, callback) {
callback ||= options;
validateFunction(callback, 'cb');
options = getOptions(options, {
encoding: 'utf8',
mode: 0o666,
flag: 'w',
flush: false,
});
const flag = options.flag || 'w';
const flush = options.flush ?? false;
validateBoolean(f... | Asynchronously writes data to the file.
@param {string | Buffer | URL | number} path
@param {string | Buffer | TypedArray | DataView} data
@param {{
encoding?: string | null;
mode?: number;
flag?: string;
signal?: AbortSignal;
flush?: boolean;
} | string} [options]
@param {(err?: Error) => any} callback
@re... | javascript | lib/fs.js | 2,320 | [
"path",
"data",
"options",
"callback"
] | false | 8 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
keySet | @Override
public ImmutableSet<K> keySet() {
ImmutableSet<K> result = keySet;
return (result == null) ? keySet = createKeySet() : result;
} | Returns an immutable set of the keys in this map, in the same order that they appear in {@link
#entrySet}. | java | android/guava/src/com/google/common/collect/ImmutableMap.java | 950 | [] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
magnitude | private static double magnitude(double x, double y, double z) {
return Math.sqrt(square(x) + square(y) + square(z));
} | Calculate the magnitude of 3D coordinates.
@param x The first 3D coordinate.
@param y The second 3D coordinate.
@param z The third 3D coordinate.
@return The magnitude of the provided coordinates. | java | libs/h3/src/main/java/org/elasticsearch/h3/Vec3d.java | 230 | [
"x",
"y",
"z"
] | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false | |
invokeAnd | public <R> InvocationResult<R> invokeAnd(Function<C, @Nullable R> invoker) {
Supplier<@Nullable R> supplier = () -> invoker.apply(this.callbackInstance);
return invoke(this.callbackInstance, supplier);
} | Invoke the callback instance where the callback method returns a result.
@param invoker the invoker used to invoke the callback
@param <R> the result type
@return the result of the invocation (may be {@link InvocationResult#noResult}
if the callback was not invoked) | java | core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java | 270 | [
"invoker"
] | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false | |
configure | @Override
protected void configure(FilterRegistration.Dynamic registration) {
super.configure(registration);
EnumSet<DispatcherType> dispatcherTypes = determineDispatcherTypes();
Set<String> servletNames = new LinkedHashSet<>();
for (ServletRegistrationBean<?> servletRegistrationBean : this.servletRegistration... | Configure registration settings. Subclasses can override this method to perform
additional configuration if required.
@param registration the registration | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java | 241 | [
"registration"
] | void | true | 5 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
createInternal | static KafkaAdminClient createInternal(AdminClientConfig config,
AdminMetadataManager metadataManager,
KafkaClient client,
Time time) {
Metrics metrics = null;
String clientId... | Pretty-print an exception.
@param throwable The exception.
@return A compact human-readable string. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 576 | [
"config",
"metadataManager",
"client",
"time"
] | KafkaAdminClient | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false |
toHtml | public String toHtml(int headerDepth, Function<String, String> idGenerator,
Map<String, String> dynamicUpdateModes) {
boolean hasUpdateModes = !dynamicUpdateModes.isEmpty();
List<ConfigKey> configs = sortedConfigs();
StringBuilder b = new StringBuilder();
b.appen... | Converts this config into an HTML list that can be embedded into docs.
If <code>dynamicUpdateModes</code> is non-empty, a "Dynamic Update Mode" label
will be included in the config details with the value of the update mode. Default
mode is "read-only".
@param headerDepth The top level header depth in the generated HTML... | java | clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java | 1,724 | [
"headerDepth",
"idGenerator",
"dynamicUpdateModes"
] | String | true | 9 | 6.72 | apache/kafka | 31,560 | javadoc | false |
getAndAdd | public float getAndAdd(final Number operand) {
final float last = value;
this.value += operand.floatValue();
return last;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately prior to the addition operation. This method is not thread safe.
@param operand the quantity to add, not null.
@throws NullPointerException if {@code operand} is null.
@return the value associated... | java | src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java | 242 | [
"operand"
] | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false | |
getEarlyBeanReference | protected Object getEarlyBeanReference(String beanName, RootBeanDefinition mbd, Object bean) {
Object exposedObject = bean;
if (!mbd.isSynthetic() && hasInstantiationAwareBeanPostProcessors()) {
for (SmartInstantiationAwareBeanPostProcessor bp : getBeanPostProcessorCache().smartInstantiationAware) {
exposedO... | Obtain a reference for early access to the specified bean,
typically for the purpose of resolving a circular reference.
@param beanName the name of the bean (for error handling purposes)
@param mbd the merged bean definition for the bean
@param bean the raw bean instance
@return the object to expose as bean reference | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 968 | [
"beanName",
"mbd",
"bean"
] | Object | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
hash | static int hash(ByteBuffer buffer, DataBlock dataBlock, long pos, int len, boolean addEndSlash) throws IOException {
if (len == 0) {
return (!addEndSlash) ? EMPTY_HASH : EMPTY_SLASH_HASH;
}
buffer = (buffer != null) ? buffer : ByteBuffer.allocate(BUFFER_SIZE);
byte[] bytes = buffer.array();
int hash = 0;
... | Return a hash for bytes read from a {@link DataBlock}, optionally appending '/'.
@param buffer the buffer to use or {@code null}
@param dataBlock the source data block
@param pos the position in the data block where the string starts
@param len the number of bytes to read from the block
@param addEndSlash if slash shou... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipString.java | 103 | [
"buffer",
"dataBlock",
"pos",
"len",
"addEndSlash"
] | true | 10 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
describe_training_job_with_log_async | async def describe_training_job_with_log_async(
self,
job_name: str,
positions: dict[str, Any],
stream_names: list[str],
instance_count: int,
state: int,
last_description: dict[str, Any],
last_describe_job_call: float,
) -> tuple[int, dict[str, Any], f... | Return the training job info associated with job_name and print CloudWatch logs.
:param job_name: name of the job to check status
:param positions: A list of pairs of (timestamp, skip) which represents the last record
read from each stream.
:param stream_names: A list of the log stream names. The position of the s... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 1,326 | [
"self",
"job_name",
"positions",
"stream_names",
"instance_count",
"state",
"last_description",
"last_describe_job_call"
] | tuple[int, dict[str, Any], float] | true | 12 | 6.8 | apache/airflow | 43,597 | sphinx | false |
debounce | function debounce<P extends any[], R>(fn: (...args: P) => R, time: number) {
let timeoutId: number | NodeJS.Timeout | undefined
return (...args: P): void => {
clearTimeout(timeoutId as NodeJS.Timeout)
timeoutId = setTimeout(() => fn(...args), time)
}
} | Makes that a function is only executed after repeated calls (usually
excessive calls) stop for a defined amount of {@link time}.
@param fn to debounce
@param time to unlock
@returns | typescript | helpers/blaze/debounce.ts | 8 | [
"fn",
"time"
] | false | 1 | 6.08 | prisma/prisma | 44,834 | jsdoc | false | |
Subprocess | Subprocess(Subprocess&&) = default; | Class representing various options: file descriptor behavior, and
whether to use $PATH for searching for the executable,
By default, we don't use $PATH, file descriptors are closed if
the close-on-exec flag is set (fcntl FD_CLOEXEC) and inherited
otherwise. | cpp | folly/Subprocess.h | 577 | [] | true | 2 | 6.48 | facebook/folly | 30,157 | doxygen | false | |
equalJumpTables | static bool equalJumpTables(const JumpTable &JumpTableA,
const JumpTable &JumpTableB,
const BinaryFunction &FunctionA,
const BinaryFunction &FunctionB) {
if (JumpTableA.EntrySize != JumpTableB.EntrySize)
return false;
if (JumpT... | ordering of basic blocks in both binary functions (e.g. DFS). | cpp | bolt/lib/Passes/IdenticalCodeFolding.cpp | 83 | [] | true | 15 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false | |
getBean | @SuppressWarnings("unchecked")
@Override
public <T> T getBean(String name, @Nullable Class<T> requiredType) throws BeansException {
String beanName = BeanFactoryUtils.transformedBeanName(name);
Object bean = obtainBean(beanName);
if (BeanFactoryUtils.isFactoryDereference(name)) {
if (!(bean instanceof Facto... | 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 | 120 | [
"name",
"requiredType"
] | T | true | 10 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
equals | @Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
ItemIgnore that = (ItemIgnore) o;
return this.type == that.type && Objects.equals(this.name, that.name);
} | Create an ignore for a property with the given name.
@param name the name
@return the item ignore | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemIgnore.java | 68 | [
"o"
] | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
swap | public synchronized Object swap(Object newTarget) throws IllegalArgumentException {
Assert.notNull(newTarget, "Target object must not be null");
Object old = this.target;
this.target = newTarget;
return old;
} | Swap the target, returning the old target object.
@param newTarget the new target object
@return the old target object
@throws IllegalArgumentException if the new target is invalid | java | spring-aop/src/main/java/org/springframework/aop/target/HotSwappableTargetSource.java | 82 | [
"newTarget"
] | Object | true | 1 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
get_plain_output_and_tangent_nodes | def get_plain_output_and_tangent_nodes(
graph: fx.Graph,
) -> dict[PlainAOTOutput, tuple[fx.Node, Optional[fx.Node]]]:
"""Get plain output nodes and their corresponding tangent nodes from a joint graph.
Args:
graph: The FX joint graph with descriptors
Returns:
A dictionary mapping each... | Get plain output nodes and their corresponding tangent nodes from a joint graph.
Args:
graph: The FX joint graph with descriptors
Returns:
A dictionary mapping each PlainAOTOutput descriptor to a tuple containing:
- The plain output node
- The tangent (input) node if it exists, None otherwise | python | torch/_functorch/_aot_autograd/fx_utils.py | 187 | [
"graph"
] | dict[PlainAOTOutput, tuple[fx.Node, Optional[fx.Node]]] | true | 1 | 6.56 | pytorch/pytorch | 96,034 | google | false |
_reorder_fw_output | def _reorder_fw_output(self) -> None:
"""
Before the pass, fw_gm returns (*fw_outputs, *intermediates1)
and bw_gm takes (*intermediates2, *grad_fw_outputs) as input.
intermediates1 and intermediates2 share the same node names but
they might be in different order. E.g. this could ... | Before the pass, fw_gm returns (*fw_outputs, *intermediates1)
and bw_gm takes (*intermediates2, *grad_fw_outputs) as input.
intermediates1 and intermediates2 share the same node names but
they might be in different order. E.g. this could happen if there
are inputs that contain symints.
To simplify downstream processin... | python | torch/_higher_order_ops/partitioner.py | 113 | [
"self"
] | None | true | 2 | 8.48 | pytorch/pytorch | 96,034 | unknown | false |
getElementAtRank | private static ValueAndPreviousValue getElementAtRank(ExponentialHistogram histo, long rank) {
long negativeValuesCount = histo.negativeBuckets().valueCount();
long zeroCount = histo.zeroBucket().count();
if (rank < negativeValuesCount) {
if (rank == 0) {
return new V... | Estimates the rank of a given value in the distribution represented by the histogram.
In other words, returns the number of values which are less than (or less-or-equal, if {@code inclusive} is true)
the provided value.
@param histo the histogram to query
@param value the value to estimate the rank for
@param inclusive... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramQuantile.java | 127 | [
"histo",
"rank"
] | ValueAndPreviousValue | true | 7 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false |
_lru_cache | def _lru_cache(fn: Callable[P, R]) -> Callable[P, R]:
"""LRU cache decorator with TypeError fallback.
Provides LRU caching with a fallback mechanism that calls the original
function if caching fails due to unhashable arguments. Uses a cache
size of 64 with typed comparison.
Args:
fn: The f... | LRU cache decorator with TypeError fallback.
Provides LRU caching with a fallback mechanism that calls the original
function if caching fails due to unhashable arguments. Uses a cache
size of 64 with typed comparison.
Args:
fn: The function to be cached.
Returns:
A wrapper function that attempts caching with... | python | torch/_inductor/runtime/caching/utils.py | 18 | [
"fn"
] | Callable[P, R] | true | 1 | 6.72 | pytorch/pytorch | 96,034 | google | false |
wrapValueSupplier | private static <C, V> Function<C, V> wrapValueSupplier(@Nullable Supplier<V> valueSupplier) {
return valueSupplier == null ? c -> { throw new NullPointerException(); } : c -> valueSupplier.get();
} | Creates a new ObjectParser.
@param name the parsers name, used to reference the parser in exceptions and messages.
@param ignoreUnknownFields Should this parser ignore unknown fields? This should generally be set to true only when parsing
responses from external systems, never when parsing requests from users.
@pa... | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java | 204 | [
"valueSupplier"
] | true | 2 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
install_global_by_id | def install_global_by_id(self, prefix: str, value: Any) -> str:
"""
Installs a global if it hasn't been installed already.
This is determined by (prefix, id(value)) pair.
Returns the name of the newly installed global.
"""
# NB: need self.compile_id to distinguish this g... | Installs a global if it hasn't been installed already.
This is determined by (prefix, id(value)) pair.
Returns the name of the newly installed global. | python | torch/_dynamo/output_graph.py | 2,707 | [
"self",
"prefix",
"value"
] | str | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
_ | def _(group: SerializedTaskGroup, run_id: str, *, session: Session) -> int:
"""
Return the number of instances a task in this group should be mapped to at run time.
This considers both literal and non-literal mapped arguments, and the
result is therefore available when all depended tasks have finished.... | Return the number of instances a task in this group should be mapped to at run time.
This considers both literal and non-literal mapped arguments, and the
result is therefore available when all depended tasks have finished. The
return value should be identical to ``parse_time_mapped_ti_count`` if
all mapped arguments ... | python | airflow-core/src/airflow/models/mappedoperator.py | 552 | [
"group",
"run_id",
"session"
] | int | true | 5 | 6.88 | apache/airflow | 43,597 | unknown | false |
getVirtualThreads | @SuppressWarnings("unchecked")
public @Nullable VirtualThreadsInfo getVirtualThreads() {
if (!VIRTUAL_THREAD_SCHEDULER_CLASS_PRESENT) {
return null;
}
try {
Class<PlatformManagedObject> mxbeanClass = (Class<PlatformManagedObject>) ClassUtils
.forName(VIRTUAL_THREAD_SCHEDULER_CLASS, null);
PlatformMa... | Virtual threads information for the process. These values provide details about the
current state of virtual threads, including the number of mounted threads, queued
threads, the parallelism level, and the thread pool size.
@return an instance of {@link VirtualThreadsInfo} containing information about
virtual threads, ... | java | core/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java | 98 | [] | VirtualThreadsInfo | true | 3 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
setAsText | @Override
public void setAsText(String text) throws IllegalArgumentException {
if (!StringUtils.hasText(text)) {
setValue(null);
return;
}
// Check whether we got an absolute file path without "file:" prefix.
// For backwards compatibility, we'll consider those as straight file path.
File file = null;... | Create a new FileEditor, using the given ResourceEditor underneath.
@param resourceEditor the ResourceEditor to use | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/FileEditor.java | 78 | [
"text"
] | void | true | 7 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
parsePostfixTypeOrHigher | function parsePostfixTypeOrHigher(): TypeNode {
const pos = getNodePos();
let type = parseNonArrayType();
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case SyntaxKind.ExclamationToken:
nextToken();
type =... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 4,716 | [] | true | 5 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
prepareScheduler | private Scheduler prepareScheduler(SchedulerFactory schedulerFactory) throws SchedulerException {
if (this.resourceLoader != null) {
// Make given ResourceLoader available for SchedulerFactory configuration.
configTimeResourceLoaderHolder.set(this.resourceLoader);
}
if (this.taskExecutor != null) {
// Ma... | Initialize the given SchedulerFactory, applying locally defined Quartz properties to it.
@param schedulerFactory the SchedulerFactory to initialize | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java | 584 | [
"schedulerFactory"
] | Scheduler | true | 15 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
updateGroupSubscription | private void updateGroupSubscription(Set<String> topics) {
// the leader will begin watching for changes to any of the topics the group is interested in,
// which ensures that all metadata changes will eventually be seen
if (this.subscriptions.groupSubscribe(topics))
metadata.request... | Return the time to the next needed invocation of {@link ConsumerNetworkClient#poll(Timer)}.
@param now current time in milliseconds
@return the maximum time in milliseconds the caller should wait before the next invocation of poll() | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 591 | [
"topics"
] | void | true | 3 | 7.44 | apache/kafka | 31,560 | javadoc | false |
toPath | function toPath(value) {
if (isArray(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
} | Converts `value` to a property path array.
@static
@memberOf _
@since 4.0.0
@category Util
@param {*} value The value to convert.
@returns {Array} Returns the new property path array.
@example
_.toPath('a.b.c');
// => ['a', 'b', 'c']
_.toPath('a[0].b.c');
// => ['a', '0', 'b', 'c'] | javascript | lodash.js | 16,282 | [
"value"
] | false | 3 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
parseUnsignedByte | @CanIgnoreReturnValue
public static byte parseUnsignedByte(String string, int radix) {
int parse = Integer.parseInt(checkNotNull(string), radix);
// We need to throw a NumberFormatException, so we have to duplicate checkedCast. =(
if (parse >> Byte.SIZE == 0) {
return (byte) parse;
} else {
... | Returns the unsigned {@code byte} value represented by a string with the given radix.
@param string the string containing the unsigned {@code byte} representation to be parsed.
@param radix the radix to use while parsing {@code string}
@throws NumberFormatException if the string does not contain a valid unsigned {@code... | java | android/guava/src/com/google/common/primitives/UnsignedBytes.java | 228 | [
"string",
"radix"
] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
_get_task_team_name | def _get_task_team_name(self, task_instance: TaskInstance, session: Session) -> str | None:
"""
Resolve team name for a task instance using the DAG > Bundle > Team relationship chain.
TaskInstance > DagModel (via dag_id) > DagBundleModel (via bundle_name) > Team
:param task_instance: T... | Resolve team name for a task instance using the DAG > Bundle > Team relationship chain.
TaskInstance > DagModel (via dag_id) > DagBundleModel (via bundle_name) > Team
:param task_instance: The TaskInstance to resolve team name for
:param session: Database session for queries
:return: Team name if found or None | python | airflow-core/src/airflow/jobs/scheduler_job_runner.py | 324 | [
"self",
"task_instance",
"session"
] | str | None | true | 3 | 7.92 | apache/airflow | 43,597 | sphinx | false |
newEnumMap | public static <K extends Enum<K>, V extends @Nullable Object> EnumMap<K, V> newEnumMap(
Class<K> type) {
return new EnumMap<>(checkNotNull(type));
} | Creates an {@code EnumMap} instance.
@param type the key type for this map
@return a new, empty {@code EnumMap} | java | android/guava/src/com/google/common/collect/Maps.java | 421 | [
"type"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
writeBlock | private void writeBlock() throws IOException {
if (bufferOffset == 0) {
return;
}
int compressedLength = compressor.compress(buffer, 0, bufferOffset, compressedBuffer, 0);
byte[] bufferToWrite = compressedBuffer;
int compressMethod = 0;
// Store block uncomp... | Compresses buffered data, optionally computes an XXHash32 checksum, and writes the result to the underlying
{@link OutputStream}.
@throws IOException | java | clients/src/main/java/org/apache/kafka/common/compress/Lz4BlockOutputStream.java | 148 | [] | void | true | 4 | 6.24 | apache/kafka | 31,560 | javadoc | false |
log10 | def log10(x):
"""
Compute the logarithm base 10 of `x`.
Return the "principal value" (for a description of this, see
`numpy.log10`) of :math:`log_{10}(x)`. For real `x > 0`, this
is a real number (``log10(0)`` returns ``-inf`` and ``log10(np.inf)``
returns ``inf``). Otherwise, the complex princ... | Compute the logarithm base 10 of `x`.
Return the "principal value" (for a description of this, see
`numpy.log10`) of :math:`log_{10}(x)`. For real `x > 0`, this
is a real number (``log10(0)`` returns ``-inf`` and ``log10(np.inf)``
returns ``inf``). Otherwise, the complex principle value is returned.
Parameters
------... | python | numpy/lib/_scimath_impl.py | 293 | [
"x"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
isTriviallyAllowed | boolean isTriviallyAllowed(Class<?> requestingClass) {
// note: do not log exceptions in here, this could interfere with loading of additionally necessary classes such as ThrowableProxy
if (requestingClass == null) {
generalLogger.trace("Entitlement trivially allowed: no caller frames outsid... | @return true if permission is granted regardless of the entitlement | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java | 384 | [
"requestingClass"
] | true | 4 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false | |
removeLast | @CanIgnoreReturnValue
public E removeLast() {
if (isEmpty()) {
throw new NoSuchElementException();
}
return removeAndGet(getMaxElementIndex());
} | Removes and returns the greatest element of this queue.
@throws NoSuchElementException if the queue is empty | java | android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java | 377 | [] | E | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
lastNode | private @Nullable AvlNode<E> lastNode() {
AvlNode<E> root = rootReference.get();
if (root == null) {
return null;
}
AvlNode<E> node;
if (range.hasUpperBound()) {
// The cast is safe because of the hasUpperBound check.
E endpoint = uncheckedCastNullableTToT(range.getUpperEndpoint())... | Returns the first node in the tree that is in range. | java | android/guava/src/com/google/common/collect/TreeMultiset.java | 423 | [] | true | 8 | 6.88 | google/guava | 51,352 | javadoc | false | |
_describe_with_dom_dow_fix | def _describe_with_dom_dow_fix(self, expression: str) -> str:
"""
Return cron description with fix for DOM+DOW conflicts.
If both DOM and DOW are restricted, explain them as OR.
"""
cron_fields = expression.split()
if len(cron_fields) < 5:
return ExpressionD... | Return cron description with fix for DOM+DOW conflicts.
If both DOM and DOW are restricted, explain them as OR. | python | airflow-core/src/airflow/timetables/_cron.py | 84 | [
"self",
"expression"
] | str | true | 4 | 6 | apache/airflow | 43,597 | unknown | false |
_convert_to_color | def _convert_to_color(cls, color_spec):
"""
Convert ``color_spec`` to an openpyxl v2 Color object.
Parameters
----------
color_spec : str, dict
A 32-bit ARGB hex string, or a dict with zero or more of the
following keys.
'rgb'
... | Convert ``color_spec`` to an openpyxl v2 Color object.
Parameters
----------
color_spec : str, dict
A 32-bit ARGB hex string, or a dict with zero or more of the
following keys.
'rgb'
'indexed'
'auto'
'theme'
'tint'
'index'
'type'
Returns
-------
color : ... | python | pandas/io/excel/_openpyxl.py | 155 | [
"cls",
"color_spec"
] | false | 3 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false | |
_acquire_flock_with_timeout | def _acquire_flock_with_timeout(
flock: BaseFileLock,
timeout: float | None = None,
) -> Generator[None, None, None]:
"""Context manager that safely acquires a FileLock with timeout and automatically releases it.
This function provides a safe way to acquire a file lock with timeout support, ensuring
... | Context manager that safely acquires a FileLock with timeout and automatically releases it.
This function provides a safe way to acquire a file lock with timeout support, ensuring
the lock is always released even if an exception occurs during execution.
Args:
flock: The FileLock object to acquire
timeout: Tim... | python | torch/_inductor/runtime/caching/locks.py | 121 | [
"flock",
"timeout"
] | Generator[None, None, None] | true | 1 | 6.8 | pytorch/pytorch | 96,034 | google | false |
resolveCache | protected Cache resolveCache(CacheOperationInvocationContext<O> context) {
Collection<? extends Cache> caches = context.getOperation().getCacheResolver().resolveCaches(context);
Cache cache = extractFrom(caches);
if (cache == null) {
throw new IllegalStateException("Cache could not have been resolved for " + c... | Resolve the cache to use.
@param context the invocation context
@return the cache to use (never {@code null}) | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractCacheInterceptor.java | 63 | [
"context"
] | Cache | true | 2 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
set_nulls | def set_nulls(
data: np.ndarray | pd.Series,
col: Column,
validity: tuple[Buffer, tuple[DtypeKind, int, str, str]] | None,
allow_modify_inplace: bool = True,
) -> np.ndarray | pd.Series:
"""
Set null values for the data according to the column null kind.
Parameters
----------
data :... | Set null values for the data according to the column null kind.
Parameters
----------
data : np.ndarray or pd.Series
Data to set nulls in.
col : Column
Column object that describes the `data`.
validity : tuple(Buffer, dtype) or None
The return value of ``col.buffers()``. We do not access the ``col.buffers(... | python | pandas/core/interchange/from_dataframe.py | 555 | [
"data",
"col",
"validity",
"allow_modify_inplace"
] | np.ndarray | pd.Series | true | 10 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
description | public String description() {
return this.description;
} | Get the description of the metric.
@return the metric description; never null | java | clients/src/main/java/org/apache/kafka/common/MetricNameTemplate.java | 96 | [] | String | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
createHeaderFilters | function createHeaderFilters (matchOptions = {}) {
const { ignoreHeaders = [], excludeHeaders = [], matchHeaders = [], caseSensitive = false } = matchOptions
return {
ignore: new Set(ignoreHeaders.map(header => caseSensitive ? header : header.toLowerCase())),
exclude: new Set(excludeHeaders.map(header => c... | Creates cached header sets for performance
@param {import('./snapshot-recorder').SnapshotRecorderMatchOptions} matchOptions - Matching options for headers
@returns {HeaderFilters} - Cached sets for ignore, exclude, and match headers | javascript | deps/undici/src/lib/mock/snapshot-utils.js | 18 | [] | false | 4 | 6.16 | nodejs/node | 114,839 | jsdoc | false | |
pendingToString | @Override
protected @Nullable String pendingToString() {
@RetainedLocalRef ListenableFuture<? extends I> localInputFuture = inputFuture;
@RetainedLocalRef F localFunction = function;
String superString = super.pendingToString();
String resultString = "";
if (localInputFuture != null) {
resul... | Template method for subtypes to actually set the result. | java | android/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java | 192 | [] | String | true | 4 | 6.88 | google/guava | 51,352 | javadoc | false |
check_and_run_migrations | def check_and_run_migrations():
"""Check and run migrations if necessary. Only use in a tty."""
with _configured_alembic_environment() as env:
context = env.get_context()
source_heads = set(env.script.get_heads())
db_heads = set(context.get_current_heads())
db_command = None
... | Check and run migrations if necessary. Only use in a tty. | python | airflow-core/src/airflow/utils/db.py | 842 | [] | false | 7 | 6.24 | apache/airflow | 43,597 | unknown | false | |
run_fuzzer_with_seed | def run_fuzzer_with_seed(
seed: int,
template: str = "default",
supported_ops: str | None = None,
) -> FuzzerResult:
"""
Run fuzzer.py with a specific seed.
Args:
seed: The seed value to pass to fuzzer.py
template: The template to use for code generation
supported_ops: C... | Run fuzzer.py with a specific seed.
Args:
seed: The seed value to pass to fuzzer.py
template: The template to use for code generation
supported_ops: Comma-separated ops string with optional weights
Returns:
FuzzerResult dataclass instance | python | tools/experimental/torchfuzz/multi_process_fuzzer.py | 83 | [
"seed",
"template",
"supported_ops"
] | FuzzerResult | true | 13 | 7.68 | pytorch/pytorch | 96,034 | google | false |
subscription | public Set<String> subscription() {
return delegate.subscription();
} | Get the current subscription. Will return the same topics used in the most recent call to
{@link #subscribe(Collection, ConsumerRebalanceListener)}, or an empty set if no such call has been made.
@return The set of topics currently subscribed to | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 651 | [] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
pearsonsCorrelationCoefficient | public double pearsonsCorrelationCoefficient() {
checkState(count() > 1);
if (isNaN(sumOfProductsOfDeltas)) {
return NaN;
}
double xSumOfSquaresOfDeltas = xStats().sumOfSquaresOfDeltas();
double ySumOfSquaresOfDeltas = yStats().sumOfSquaresOfDeltas();
checkState(xSumOfSquaresOfDeltas > 0.0... | Returns the <a href="http://mathworld.wolfram.com/CorrelationCoefficient.html">Pearson's or
product-moment correlation coefficient</a> of the values. The count must greater than one, and
the {@code x} and {@code y} values must both have non-zero population variance (i.e. {@code
xStats().populationVariance() > 0.0 && yS... | java | android/guava/src/com/google/common/math/PairedStats.java | 134 | [] | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false | |
apply_list_or_dict_like | def apply_list_or_dict_like(self) -> DataFrame | Series:
"""
Compute apply in case of a list-like or dict-like.
Returns
-------
result: Series, DataFrame, or None
Result when self.func is a list-like or dict-like, None otherwise.
"""
if self.engine =... | Compute apply in case of a list-like or dict-like.
Returns
-------
result: Series, DataFrame, or None
Result when self.func is a list-like or dict-like, None otherwise. | python | pandas/core/apply.py | 703 | [
"self"
] | DataFrame | Series | true | 6 | 6.88 | pandas-dev/pandas | 47,362 | unknown | false |
maybeUnwrapException | public static Throwable maybeUnwrapException(Throwable t) {
if (t instanceof CompletionException || t instanceof ExecutionException) {
return t.getCause();
} else {
return t;
}
} | Check if a Throwable is a commonly wrapped exception type (e.g. `CompletionException`) and return
the cause if so. This is useful to handle cases where exceptions may be raised from a future or a
completion stage (as might be the case for requests sent to the controller in `ControllerApis`).
@param t The Throwable to c... | java | clients/src/main/java/org/apache/kafka/common/protocol/Errors.java | 541 | [
"t"
] | Throwable | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false |
check_max_runs_and_schedule_interval_compatibility | def check_max_runs_and_schedule_interval_compatibility(
performance_dag_conf: dict[str, str],
) -> None:
"""
Validate max_runs value.
Check if max_runs and schedule_interval values create a valid combination.
:param performance_dag_conf: dict with environment variables as keys and their values as ... | Validate max_runs value.
Check if max_runs and schedule_interval values create a valid combination.
:param performance_dag_conf: dict with environment variables as keys and their values as values
:raises: ValueError:
if max_runs is specified when schedule_interval is not a duration time expression
if max_run... | python | performance/src/performance_dags/performance_dag/performance_dag_utils.py | 342 | [
"performance_dag_conf"
] | None | true | 5 | 6.24 | apache/airflow | 43,597 | sphinx | false |
overlay | public static String overlay(final String str, String overlay, int start, int end) {
if (str == null) {
return null;
}
if (overlay == null) {
overlay = EMPTY;
}
final int len = str.length();
if (start < 0) {
start = 0;
}
... | Overlays part of a String with another String.
<p>
A {@code null} string input returns {@code null}. A negative index is treated as zero. An index greater than the string length is treated as the string
length. The start index is always the smaller of the two indices.
</p>
<pre>
StringUtils.overlay(null, *, *, *) ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,543 | [
"str",
"overlay",
"start",
"end"
] | String | true | 8 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
hideOverlayWeb | function hideOverlayWeb(): void {
timeoutID = null;
if (overlay !== null) {
overlay.remove();
overlay = null;
}
} | 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/backend/views/Highlighter/Highlighter.js | 26 | [] | false | 2 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
toArray | @GwtIncompatible // Array.newInstance(Class, int)
public static <T extends @Nullable Object> T[] toArray(
Iterator<? extends T> iterator, Class<@NonNull T> type) {
List<T> list = Lists.newArrayList(iterator);
return Iterables.<T>toArray(list, type);
} | Copies an iterator's elements into an array. The iterator will be left exhausted: its {@code
hasNext()} method will return {@code false}.
@param iterator the iterator to copy
@param type the type of the elements
@return a newly-allocated array into which all the elements of the iterator have been copied | java | android/guava/src/com/google/common/collect/Iterators.java | 350 | [
"iterator",
"type"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
decrementAndGet | public long decrementAndGet() {
value--;
return value;
} | Decrements this instance's value by 1; this method returns the value associated with the instance
immediately after the decrement operation. This method is not thread safe.
@return the value associated with the instance after it is decremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableLong.java | 157 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
parseDefaults | private Map<String, String> parseDefaults(JSONObject root) throws JSONException {
Map<String, String> result = new HashMap<>();
Iterator<?> keys = root.keys();
while (keys.hasNext()) {
String key = (String) keys.next();
Object o = root.get(key);
if (o instanceof JSONObject child) {
if (child.has(DEFA... | Returns the defaults applicable to the service.
@return the defaults of the service | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java | 163 | [
"root"
] | true | 4 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
clone | @Override
public Object clone() {
return new FluentBitSet((BitSet) bitSet.clone());
} | Cloning this {@link BitSet} produces a new {@link BitSet} that is equal to it. The clone of the bit set is another
bit set that has exactly the same bits set to {@code true} as this bit set.
@return a clone of this bit set
@see #size() | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 191 | [] | Object | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
asanyarray | def asanyarray(a, dtype=None, order=None):
"""
Convert the input to a masked array, conserving subclasses.
If `a` is a subclass of `MaskedArray`, its class is conserved.
No copy is performed if the input is already an `ndarray`.
Parameters
----------
a : array_like
Input data, in a... | Convert the input to a masked array, conserving subclasses.
If `a` is a subclass of `MaskedArray`, its class is conserved.
No copy is performed if the input is already an `ndarray`.
Parameters
----------
a : array_like
Input data, in any form that can be converted to an array.
dtype : dtype, optional
By defau... | python | numpy/ma/core.py | 8,605 | [
"a",
"dtype",
"order"
] | false | 9 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
delay | def delay(delay: int | float | None = None) -> None:
"""
Pause execution for ``delay`` seconds.
:param delay: a delay to pause execution using ``time.sleep(delay)``;
a small 1 second jitter is applied to the delay.
.. note::
This method uses a default random del... | Pause execution for ``delay`` seconds.
:param delay: a delay to pause execution using ``time.sleep(delay)``;
a small 1 second jitter is applied to the delay.
.. note::
This method uses a default random delay, i.e.
``random.uniform(DEFAULT_DELAY_MIN, DEFAULT_DELAY_MAX)``;
using a random interval helps ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/batch_client.py | 552 | [
"delay"
] | None | true | 3 | 6.24 | apache/airflow | 43,597 | sphinx | false |
replaceValueInEntry | private void replaceValueInEntry(int entry, @ParametricNullness V newValue, boolean force) {
checkArgument(entry != ABSENT);
int newValueHash = Hashing.smearedHash(newValue);
int newValueIndex = findEntryByValue(newValue, newValueHash);
if (newValueIndex != ABSENT) {
if (force) {
removeEnt... | Updates the specified entry to point to the new value: removes the old value from the V-to-K
mapping and puts the new one in. The entry does not move in the insertion order of the bimap. | java | android/guava/src/com/google/common/collect/HashBiMap.java | 477 | [
"entry",
"newValue",
"force"
] | void | true | 4 | 6 | google/guava | 51,352 | javadoc | false |
polygrid2d | def polygrid2d(x, y, c):
"""
Evaluate a 2-D polynomial on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * a^i * b^j
where the points ``(a, b)`` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulting point... | Evaluate a 2-D polynomial on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * a^i * b^j
where the points ``(a, b)`` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulting points form a grid with
`x` in the first dimension and `y`... | python | numpy/polynomial/polynomial.py | 906 | [
"x",
"y",
"c"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
upperCase | public static String upperCase(final String str) {
if (str == null) {
return null;
}
return str.toUpperCase();
} | Converts a String to upper case as per {@link String#toUpperCase()}.
<p>
A {@code null} input String returns {@code null}.
</p>
<pre>
StringUtils.upperCase(null) = null
StringUtils.upperCase("") = ""
StringUtils.upperCase("aBc") = "ABC"
</pre>
<p>
<strong>Note:</strong> As described in the documentation for {@link ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 9,009 | [
"str"
] | String | true | 2 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
maybeRejoinStaleMember | public void maybeRejoinStaleMember() {
isPollTimerExpired = false;
if (state == MemberState.STALE) {
log.debug("Expired poll timer has been reset so stale member {} will rejoin the group " +
"when it completes releasing its previous assignment.", memberId);
staleM... | Transition a {@link MemberState#STALE} member to {@link MemberState#JOINING} when it completes
releasing its assignment. This is expected to be used when the poll timer is reset. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 776 | [] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
magic | public byte magic() {
return buffer.get(MAGIC_OFFSET);
} | The magic value (i.e. message format version) of this record
@return the magic value | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 197 | [] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
equals | def equals(self, other: object) -> bool:
"""
Return if another array is equivalent to this array.
Equivalent means that both arrays have the same shape and dtype, and
all values compare equal. Missing values in the same location are
considered equal (in contrast with normal equa... | Return if another array is equivalent to this array.
Equivalent means that both arrays have the same shape and dtype, and
all values compare equal. Missing values in the same location are
considered equal (in contrast with normal equality).
Parameters
----------
other : ExtensionArray
Array to compare to this Arr... | python | pandas/core/arrays/base.py | 1,521 | [
"self",
"other"
] | bool | true | 6 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
cloneReset | Object cloneReset() throws CloneNotSupportedException {
// this method exists to enable 100% test coverage
final StrTokenizer cloned = (StrTokenizer) super.clone();
if (cloned.chars != null) {
cloned.chars = cloned.chars.clone();
}
cloned.reset();
return clone... | Creates a new instance of this Tokenizer. The new instance is reset so that
it will be at the start of the token list.
@return a new instance of this Tokenizer which has been reset.
@throws CloneNotSupportedException if there is a problem cloning. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 466 | [] | Object | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
removeAllOccurences | @Deprecated
public static char[] removeAllOccurences(final char[] array, final char element) {
return (char[]) removeAt(array, indexesOf(array, element));
} | Removes the occurrences of the specified element from the specified char array.
<p>
All subsequent elements are shifted to the left (subtracts one from their indices).
If the array doesn't contain such an element, no elements are removed from the array.
{@code null} will be returned if the input array is {@code null}.
... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5,303 | [
"array",
"element"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
deactivate_deleted_dags | def deactivate_deleted_dags(self, bundle_name: str, present: set[DagFileInfo]) -> None:
"""Deactivate DAGs that come from files that are no longer present in bundle."""
def find_zipped_dags(abs_path: os.PathLike) -> Iterator[str]:
"""
Find dag files in zip file located at abs_pa... | Deactivate DAGs that come from files that are no longer present in bundle. | python | airflow-core/src/airflow/dag_processing/manager.py | 616 | [
"self",
"bundle_name",
"present"
] | None | true | 10 | 6 | apache/airflow | 43,597 | unknown | false |
indexOf | @Deprecated
public static int indexOf(final CharSequence seq, final CharSequence searchSeq) {
return Strings.CS.indexOf(seq, searchSeq);
} | Finds the first index within a CharSequence, handling {@code null}. This method uses {@link String#indexOf(String, int)} if possible.
<p>
A {@code null} CharSequence will return {@code -1}.
</p>
<pre>
StringUtils.indexOf(null, *) = -1
StringUtils.indexOf(*, null) = -1
StringUtils.indexOf("", "") ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 2,542 | [
"seq",
"searchSeq"
] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
_build | def _build(self, values: list[T], node: int, start: int, end: int) -> None:
"""
Build the segment tree recursively.
Args:
values: Original array of values
node: Current node index in the segment tree
start: Start index of the segment
end: End inde... | Build the segment tree recursively.
Args:
values: Original array of values
node: Current node index in the segment tree
start: Start index of the segment
end: End index of the segment | python | torch/_inductor/codegen/segmented_tree.py | 63 | [
"self",
"values",
"node",
"start",
"end"
] | None | true | 3 | 6.88 | pytorch/pytorch | 96,034 | google | false |
wrappersToPrimitives | public static Class<?>[] wrappersToPrimitives(final Class<?>... classes) {
if (classes == null) {
return null;
}
if (classes.length == 0) {
return classes;
}
return ArrayUtils.setAll(new Class[classes.length], i -> wrapperToPrimitive(classes[i]));
} | Converts the specified array of wrapper Class objects to an array of its corresponding primitive Class objects.
<p>
This method invokes {@code wrapperToPrimitive()} for each element of the passed in array.
</p>
@param classes the class array to convert, may be null or empty.
@return an array which contains for each giv... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 1,678 | [] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getExpressionForPropertyName | function getExpressionForPropertyName(member: ClassElement | EnumMember, generateNameForComputedPropertyName: boolean): Expression {
const name = member.name!;
if (isPrivateIdentifier(name)) {
return factory.createIdentifier("");
}
else if (isComputedPropertyName(name)) ... | Gets an expression that represents a property name (for decorated properties or enums).
For a computed property, a name is generated for the node.
@param member The member whose name should be converted into an expression. | typescript | src/compiler/transformers/legacyDecorators.ts | 741 | [
"member",
"generateNameForComputedPropertyName"
] | true | 9 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
defaultIfNull | @Deprecated
public static <T> T defaultIfNull(final T object, final T defaultValue) {
return getIfNull(object, defaultValue);
} | Returns a default value if the object passed is {@code null}.
<pre>
ObjectUtils.defaultIfNull(null, null) = null
ObjectUtils.defaultIfNull(null, "") = ""
ObjectUtils.defaultIfNull(null, "zz") = "zz"
ObjectUtils.defaultIfNull("abc", *) = "abc"
ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 537 | [
"object",
"defaultValue"
] | T | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
autocorr | def autocorr(self, lag: int = 1) -> float:
"""
Compute the lag-N autocorrelation.
This method computes the Pearson correlation between
the Series and its shifted self.
Parameters
----------
lag : int, default 1
Number of lags to apply before performi... | Compute the lag-N autocorrelation.
This method computes the Pearson correlation between
the Series and its shifted self.
Parameters
----------
lag : int, default 1
Number of lags to apply before performing autocorrelation.
Returns
-------
float
The Pearson correlation between self and self.shift(lag).
See A... | python | pandas/core/series.py | 2,908 | [
"self",
"lag"
] | float | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
fenceProducers | FenceProducersResult fenceProducers(Collection<String> transactionalIds,
FenceProducersOptions options); | Fence out all active producers that use any of the provided transactional IDs.
@param transactionalIds The IDs of the producers to fence.
@param options The options to use when fencing the producers.
@return The FenceProducersResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,776 | [
"transactionalIds",
"options"
] | FenceProducersResult | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
createKeySet | @Override
ImmutableSet<K> createKeySet() {
@SuppressWarnings("unchecked")
ImmutableList<K> keyList =
(ImmutableList<K>) new KeysOrValuesAsList(alternatingKeysAndValues, 0, size);
return new KeySet<K>(this, keyList);
} | Returns a hash table for the specified keys and values, and ensures that neither keys nor
values are null. This method may update {@code alternatingKeysAndValues} if there are duplicate
keys. If so, the return value will indicate how many entries are still valid, and will also
include a {@link Builder.DuplicateKey} in ... | java | android/guava/src/com/google/common/collect/RegularImmutableMap.java | 475 | [] | true | 1 | 6.88 | google/guava | 51,352 | javadoc | false | |
removeIgnoreCase | @Deprecated
public static String removeIgnoreCase(final String str, final String remove) {
return Strings.CI.remove(str, remove);
} | Case-insensitive removal of all occurrences of a substring from within the source string.
<p>
A {@code null} source string will return {@code null}. An empty ("") source string will return the empty string. A {@code null} remove string will return
the source string. An empty ("") remove string will return the source st... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,893 | [
"str",
"remove"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
equals | @Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof DefaultIntroductionAdvisor otherAdvisor &&
this.advice.equals(otherAdvisor.advice) &&
this.interfaces.equals(otherAdvisor.interfaces)));
} | Add the specified interface to the list of interfaces to introduce.
@param ifc the interface to introduce | java | spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java | 148 | [
"other"
] | true | 4 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
resolveArtifactId | protected @Nullable String resolveArtifactId() {
if (this.artifactId != null) {
return this.artifactId;
}
if (this.output != null) {
int i = this.output.lastIndexOf('.');
return (i != -1) ? this.output.substring(0, i) : this.output;
}
return null;
} | Resolve the artifactId to use or {@code null} if it should not be customized.
@return the artifactId | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java | 407 | [] | String | true | 4 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
ensure_dtype_objs | def ensure_dtype_objs(
dtype: DtypeArg | dict[Hashable, DtypeArg] | None,
) -> DtypeObj | dict[Hashable, DtypeObj] | None:
"""
Ensure we have either None, a dtype object, or a dictionary mapping to
dtype objects.
"""
if isinstance(dtype, defaultdict):
# "None" not callable [misc]
... | Ensure we have either None, a dtype object, or a dictionary mapping to
dtype objects. | python | pandas/io/parsers/c_parser_wrapper.py | 377 | [
"dtype"
] | DtypeObj | dict[Hashable, DtypeObj] | None | true | 5 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
indexOf | public static int indexOf(final long[] array, final long valueToFind) {
return indexOf(array, valueToFind, 0);
} | Finds the index of the given value in the array.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.
</p>
@param array the array to search for the object, may be {@code null}.
@param valueToFind the value to find.
@return the index of the value within the array, {@link #I... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,661 | [
"array",
"valueToFind"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
listStreamsGroupOffsets | default ListStreamsGroupOffsetsResult listStreamsGroupOffsets(Map<String, ListStreamsGroupOffsetsSpec> groupSpecs) {
return listStreamsGroupOffsets(groupSpecs, new ListStreamsGroupOffsetsOptions());
} | List the streams group offsets available in the cluster for the specified groups with the default options.
<p>
This is a convenience method for
{@link #listStreamsGroupOffsets(Map, ListStreamsGroupOffsetsOptions)} with default options.
@param groupSpecs Map of streams group ids to a spec that specifies the topic partit... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 974 | [
"groupSpecs"
] | ListStreamsGroupOffsetsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
buildHeartbeatRequest | public abstract NetworkClientDelegate.UnsentRequest buildHeartbeatRequest(); | Builds a heartbeat request using the heartbeat state to follow the protocol faithfully.
@return The heartbeat request | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractHeartbeatRequestManager.java | 492 | [] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
addHours | public static Date addHours(final Date date, final int amount) {
return add(date, Calendar.HOUR_OF_DAY, amount);
} | Adds a number of hours 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 | 250 | [
"date",
"amount"
] | Date | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
asExpression | function asExpression<T extends Expression | undefined>(value: string | number | boolean | T): T | StringLiteral | NumericLiteral | BooleanLiteral {
return typeof value === "string" ? createStringLiteral(value) :
typeof value === "number" ? createNumericLiteral(value) :
typeof value =... | Lifts a NodeArray containing only Statement nodes to a block.
@param nodes The NodeArray. | typescript | src/compiler/factory/nodeFactory.ts | 7,146 | [
"value"
] | true | 5 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
parseSemicolon | function parseSemicolon(): boolean {
return tryParseSemicolon() || parseExpected(SyntaxKind.SemicolonToken);
} | 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 | 2,590 | [] | true | 2 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
hexRing | public static String[] hexRing(String h3Address) {
return h3ToStringList(hexRing(stringToH3(h3Address)));
} | Returns the neighbor indexes.
@param h3Address Origin index
@return All neighbor indexes from the origin | java | libs/h3/src/main/java/org/elasticsearch/h3/H3.java | 354 | [
"h3Address"
] | true | 1 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false | |
syntaxError | public JSONException syntaxError(String message) {
return new JSONException(message + this);
} | Returns an exception containing the given message plus the current position and the
entire input string.
@param message the message
@return an exception | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 455 | [
"message"
] | JSONException | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
attach_enctype_error_multidict | def attach_enctype_error_multidict(request: Request) -> None:
"""Patch ``request.files.__getitem__`` to raise a descriptive error
about ``enctype=multipart/form-data``.
:param request: The request to patch.
:meta private:
"""
oldcls = request.files.__class__
class newcls(oldcls): # type: ... | Patch ``request.files.__getitem__`` to raise a descriptive error
about ``enctype=multipart/form-data``.
:param request: The request to patch.
:meta private: | python | src/flask/debughelpers.py | 81 | [
"request"
] | None | true | 2 | 6.56 | pallets/flask | 70,946 | sphinx | false |
faceIjkToCellBoundary | public CellBoundary faceIjkToCellBoundary(final int res) {
// adjust the center point to be in an aperture 33r substrate grid
// these should be composed for speed
this.coord.downAp3();
this.coord.downAp3r();
// if res is Class III we need to add a cw aperture 7 to get to
... | Generates the cell boundary in spherical coordinates for a cell given by this
FaceIJK address at a specified resolution.
@param res The H3 resolution of the cell. | java | libs/h3/src/main/java/org/elasticsearch/h3/FaceIJK.java | 529 | [
"res"
] | CellBoundary | true | 2 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
view | def view(self, cls=None):
"""
Return a view of the Index with the specified dtype or a new Index instance.
This method returns a view of the calling Index object if no arguments are
provided. If a dtype is specified through the `cls` argument, it attempts
to return a view of the... | Return a view of the Index with the specified dtype or a new Index instance.
This method returns a view of the calling Index object if no arguments are
provided. If a dtype is specified through the `cls` argument, it attempts
to return a view of the Index with the specified dtype. Note that viewing
the Index as a diff... | python | pandas/core/indexes/base.py | 1,034 | [
"self",
"cls"
] | false | 7 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false | |
processBitVector | public static <E extends Enum<E>> EnumSet<E> processBitVector(final Class<E> enumClass, final long value) {
return processBitVectors(checkBitVectorable(enumClass), value);
} | Convert a long value created by {@link EnumUtils#generateBitVector} into the set of
enum values that it represents.
<p>If you store this value, beware any changes to the enum that would affect ordinal values.</p>
@param enumClass the class of the enum we are working with, not {@code null}.
@param value the long val... | java | src/main/java/org/apache/commons/lang3/EnumUtils.java | 426 | [
"enumClass",
"value"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
generate_numba_agg_func | def generate_numba_agg_func(
func: Callable[..., Scalar],
nopython: bool,
nogil: bool,
parallel: bool,
) -> Callable[[np.ndarray, np.ndarray, np.ndarray, np.ndarray, int, Any], np.ndarray]:
"""
Generate a numba jitted agg function specified by values from engine_kwargs.
1. jit the user's fu... | Generate a numba jitted agg function specified by values from engine_kwargs.
1. jit the user's function
2. Return a groupby agg function with the jitted function inline
Configurations specified in engine_kwargs apply to both the user's
function _AND_ the groupby evaluation loop.
Parameters
----------
func : function... | python | pandas/core/groupby/numba_.py | 67 | [
"func",
"nopython",
"nogil",
"parallel"
] | Callable[[np.ndarray, np.ndarray, np.ndarray, np.ndarray, int, Any], np.ndarray] | true | 5 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.