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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
read_sas | def read_sas(
filepath_or_buffer: FilePath | ReadBuffer[bytes],
*,
format: str | None = None,
index: Hashable | None = None,
encoding: str | None = None,
chunksize: int | None = None,
iterator: bool = False,
compression: CompressionOptions = "infer",
) -> DataFrame | SASReader:
"""
... | Read SAS files stored as either XPORT or SAS7BDAT format files.
Parameters
----------
filepath_or_buffer : str, path object, or file-like object
String, path object (implementing ``os.PathLike[str]``), or file-like
object implementing a binary ``read()`` function. The string could be a URL.
Valid URL schem... | python | pandas/io/sas/sasreader.py | 92 | [
"filepath_or_buffer",
"format",
"index",
"encoding",
"chunksize",
"iterator",
"compression"
] | DataFrame | SASReader | true | 11 | 8.24 | pandas-dev/pandas | 47,362 | numpy | false |
ABSL_LOCKS_EXCLUDED | ABSL_LOCKS_EXCLUDED(call_mu_) {
ServerCallbackUnary* call = call_.load(std::memory_order_acquire);
if (call == nullptr) {
grpc::internal::MutexLock l(&call_mu_);
call = call_.load(std::memory_order_relaxed);
if (call == nullptr) {
backlog_.finish_wanted = true;
backlog_.status_... | the client will only receive the status and any trailing metadata. | cpp | include/grpcpp/support/server_callback.h | 727 | [] | true | 3 | 6.88 | grpc/grpc | 44,113 | doxygen | false | |
baseHas | function baseHas(object, key) {
return object != null && hasOwnProperty.call(object, key);
} | The base implementation of `_.has` without support for deep paths.
@private
@param {Object} [object] The object to query.
@param {Array|string} key The key to check.
@returns {boolean} Returns `true` if `key` exists, else `false`. | javascript | lodash.js | 3,135 | [
"object",
"key"
] | false | 2 | 6.16 | lodash/lodash | 61,490 | jsdoc | false | |
getIfElseKeywords | function getIfElseKeywords(ifStatement: IfStatement, sourceFile: SourceFile): Node[] {
const keywords: Node[] = [];
// Traverse upwards through all parent if-statements linked by their else-branches.
while (isIfStatement(ifStatement.parent) && ifStatement.parent.elseStatement === ifStatemen... | For lack of a better name, this function takes a throw statement and returns the
nearest ancestor that is a try-block (whose try statement has a catch clause),
function-block, or source file. | typescript | src/services/documentHighlights.ts | 562 | [
"ifStatement",
"sourceFile"
] | true | 8 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toString | @Override
public String toString() {
return toString(true);
} | Create a new child from this path with the specified name.
@param name the name of the child
@return a new {@link MemberPath} instance | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 818 | [] | String | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
add | public Member<T> add(String name) {
return add(name, (instance) -> instance);
} | Add a new member with access to the instance being written.
@param name the member name
@return the added {@link Member} which may be configured further | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 203 | [
"name"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
startTask | private void startTask() {
synchronized (lock) {
if (shutdown) {
throw new RejectedExecutionException("Executor already shutdown");
}
runningTasks++;
}
} | Checks if the executor has been shut down and increments the running task count.
@throws RejectedExecutionException if the executor has been previously shutdown | java | android/guava/src/com/google/common/util/concurrent/DirectExecutorService.java | 110 | [] | void | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false |
nop | @SuppressWarnings("unchecked")
static <E extends Throwable> FailableLongUnaryOperator<E> nop() {
return NOP;
} | Gets the NOP singleton.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailableLongUnaryOperator.java | 51 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
fixExecutableFlag | private void fixExecutableFlag(File dir, String fileName) {
File f = new File(dir, fileName);
if (f.exists()) {
f.setExecutable(true, false);
}
} | Detect if the project should be extracted.
@param request the generation request
@param response the generation response
@return if the project should be extracted | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java | 157 | [
"dir",
"fileName"
] | void | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
powerSet | public static <E> Set<Set<E>> powerSet(Set<E> set) {
return new PowerSet<E>(set);
} | Returns the set of all possible subsets of {@code set}. For example, {@code
powerSet(ImmutableSet.of(1, 2))} returns the set {@code {{}, {1}, {2}, {1, 2}}}.
<p>Elements appear in these subsets in the same iteration order as they appeared in the input
set. The order in which these subsets appear in the outer set is unde... | java | android/guava/src/com/google/common/collect/Sets.java | 1,629 | [
"set"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
deactivate_deleted_dags | def deactivate_deleted_dags(
cls,
bundle_name: str,
rel_filelocs: list[str],
session: Session = NEW_SESSION,
) -> bool:
"""
Set ``is_active=False`` on the DAGs for which the DAG files have been removed.
:param bundle_name: bundle for filelocs
:param r... | Set ``is_active=False`` on the DAGs for which the DAG files have been removed.
:param bundle_name: bundle for filelocs
:param rel_filelocs: relative filelocs for bundle
:param session: ORM Session
:return: True if any DAGs were marked as stale, False otherwise | python | airflow-core/src/airflow/models/dag.py | 568 | [
"cls",
"bundle_name",
"rel_filelocs",
"session"
] | bool | true | 3 | 8.24 | apache/airflow | 43,597 | sphinx | false |
createMaybeNavigableAsMap | final Map<K, Collection<V>> createMaybeNavigableAsMap() {
if (map instanceof NavigableMap) {
return new NavigableAsMap((NavigableMap<K, Collection<V>>) map);
} else if (map instanceof SortedMap) {
return new SortedAsMap((SortedMap<K, Collection<V>>) map);
} else {
return new AsMap(map);
... | Returns an iterator across all key-value map entries, used by {@code entries().iterator()} and
{@code values().iterator()}. The default behavior, which traverses the values for one key, the
values for a second key, and so on, suffices for most {@code AbstractMapBasedMultimap}
implementations.
@return an iterator across... | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 1,279 | [] | true | 3 | 7.44 | google/guava | 51,352 | javadoc | false | |
withFileNameLength | ZipLocalFileHeaderRecord withFileNameLength(short fileNameLength) {
return new ZipLocalFileHeaderRecord(this.versionNeededToExtract, this.generalPurposeBitFlag,
this.compressionMethod, this.lastModFileTime, this.lastModFileDate, this.crc32, this.compressedSize,
this.uncompressedSize, fileNameLength, this.extr... | Return a new {@link ZipLocalFileHeaderRecord} with a new {@link #fileNameLength()}.
@param fileNameLength the new file name length
@return a new {@link ZipLocalFileHeaderRecord} instance | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipLocalFileHeaderRecord.java | 77 | [
"fileNameLength"
] | ZipLocalFileHeaderRecord | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
isConditionMatch | private boolean isConditionMatch(MetadataReader metadataReader) {
if (this.conditionEvaluator == null) {
this.conditionEvaluator =
new ConditionEvaluator(getRegistry(), this.environment, this.resourcePatternResolver);
}
return !this.conditionEvaluator.shouldSkip(metadataReader.getAnnotationMetadata());
} | Determine whether the given class is a candidate component based on any
{@code @Conditional} annotations.
@param metadataReader the ASM ClassReader for the class
@return whether the class qualifies as a candidate component | java | spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java | 554 | [
"metadataReader"
] | true | 2 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
topStep | function topStep<T>(array: ReadonlyArray<T>, compare: (a: T, b: T) => number, result: T[], i: number, m: number): void {
for (const n = result.length; i < m; i++) {
const element = array[i];
if (compare(element, result[n - 1]) < 0) {
result.pop();
const j = findFirstIdxMonotonousOrArrLen(result, e => compare... | Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.
Returns the top N elements from the array.
Faster than sorting the entire array when the array is a lot larger than N.
@param array The unsorted array.
@param compare A sort function for the elements.
@param ... | typescript | src/vs/base/common/arrays.ts | 342 | [
"array",
"compare",
"result",
"i",
"m"
] | true | 3 | 8.24 | microsoft/vscode | 179,840 | jsdoc | false | |
isPlainAccessor | private boolean isPlainAccessor(Method method) {
if (Modifier.isStatic(method.getModifiers()) ||
method.getDeclaringClass() == Object.class || method.getDeclaringClass() == Class.class ||
method.getParameterCount() > 0 || method.getReturnType() == void.class ||
isInvalidReadOnlyPropertyType(method.getRetu... | Create a new CachedIntrospectionResults instance for the given class.
@param beanClass the bean class to analyze
@throws BeansException in case of introspection failure | java | spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java | 345 | [
"method"
] | true | 8 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false | |
fit_transform | def fit_transform(self, y):
"""Fit the label sets binarizer and transform the given label sets.
Parameters
----------
y : iterable of iterables
A set of labels (any orderable and hashable object) for each
sample. If the `classes` parameter is set, `y` will not be... | Fit the label sets binarizer and transform the given label sets.
Parameters
----------
y : iterable of iterables
A set of labels (any orderable and hashable object) for each
sample. If the `classes` parameter is set, `y` will not be
iterated.
Returns
-------
y_indicator : {ndarray, sparse matrix} of shape... | python | sklearn/preprocessing/_label.py | 903 | [
"self",
"y"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
maybe_disable_inference_mode | def maybe_disable_inference_mode() -> Generator[None, None, None]:
"""
Disables torch.inference_mode for the compilation (still on at runtime).
This simplifies the compile stack where we can assume that inference_mode
will always be off.
Since inference_mode is equivalent to no_grad + some optimiza... | Disables torch.inference_mode for the compilation (still on at runtime).
This simplifies the compile stack where we can assume that inference_mode
will always be off.
Since inference_mode is equivalent to no_grad + some optimizations (version
counts etc), we turn on no_grad here. The other optimizations are not
releva... | python | torch/_dynamo/utils.py | 4,951 | [] | Generator[None, None, None] | true | 4 | 6.88 | pytorch/pytorch | 96,034 | unknown | false |
beanNamesForTypeIncludingAncestors | public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, ResolvableType type) {
Assert.notNull(lbf, "ListableBeanFactory must not be null");
String[] result = lbf.getBeanNamesForType(type);
if (lbf instanceof HierarchicalBeanFactory hbf) {
if (hbf.getParentBeanFactory() instanceof Lis... | Get all bean names for the given type, including those defined in ancestor
factories. Will return unique names in case of overridden bean definitions.
<p>Does consider objects created by FactoryBeans, which means that FactoryBeans
will get initialized. If the object created by the FactoryBean doesn't match,
the raw Fac... | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java | 166 | [
"lbf",
"type"
] | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_split_sparse_columns | def _split_sparse_columns(
arff_data: ArffSparseDataType, include_columns: List
) -> ArffSparseDataType:
"""Obtains several columns from sparse ARFF representation. Additionally,
the column indices are re-labelled, given the columns that are not
included. (e.g., when including [1, 2, 3], the columns wil... | Obtains several columns from sparse ARFF representation. Additionally,
the column indices are re-labelled, given the columns that are not
included. (e.g., when including [1, 2, 3], the columns will be relabelled
to [0, 1, 2]).
Parameters
----------
arff_data : tuple
A tuple of three lists of equal size; first list... | python | sklearn/datasets/_arff_parser.py | 22 | [
"arff_data",
"include_columns"
] | ArffSparseDataType | true | 3 | 6.72 | scikit-learn/scikit-learn | 64,340 | numpy | false |
bucket_cap_mb_by_bucket_idx_default | def bucket_cap_mb_by_bucket_idx_default(bucket_id: int) -> float:
"""
Determine the size of a bucket based on its ID.
Args:
bucket_id (int): The ID of the bucket.
Returns:
float: The size of the bucket.
"""
return 2000.0 | Determine the size of a bucket based on its ID.
Args:
bucket_id (int): The ID of the bucket.
Returns:
float: The size of the bucket. | python | torch/_inductor/fx_passes/bucketing.py | 146 | [
"bucket_id"
] | float | true | 1 | 6.88 | pytorch/pytorch | 96,034 | google | false |
getmaskarray | def getmaskarray(arr):
"""
Return the mask of a masked array, or full boolean array of False.
Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and
the mask is not `nomask`, else return a full boolean array of False of
the same shape as `arr`.
Parameters
----------
arr... | Return the mask of a masked array, or full boolean array of False.
Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and
the mask is not `nomask`, else return a full boolean array of False of
the same shape as `arr`.
Parameters
----------
arr : array_like
Input `MaskedArray` for which the mask is... | python | numpy/ma/core.py | 1,463 | [
"arr"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
_insert_update_mgr_locs | def _insert_update_mgr_locs(self, loc) -> None:
"""
When inserting a new Block at location 'loc', we increment
all of the mgr_locs of blocks above that by one.
"""
# Faster version of set(arr) for sequences of small numbers
blknos = np.bincount(self.blknos[loc:]).nonzero(... | When inserting a new Block at location 'loc', we increment
all of the mgr_locs of blocks above that by one. | python | pandas/core/internals/managers.py | 1,547 | [
"self",
"loc"
] | None | true | 2 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
containsAllImpl | static boolean containsAllImpl(Collection<?> self, Collection<?> c) {
for (Object o : c) {
if (!self.contains(o)) {
return false;
}
}
return true;
} | Returns {@code true} if the collection {@code self} contains all of the elements in the
collection {@code c}.
<p>This method iterates over the specified collection {@code c}, checking each element returned
by the iterator in turn to see if it is contained in the specified collection {@code self}. If
all elements are so... | java | android/guava/src/com/google/common/collect/Collections2.java | 301 | [
"self",
"c"
] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
tryParse | public static @Nullable Long tryParse(String string) {
return tryParse(string, 10);
} | Parses the specified string as a signed decimal long value. The ASCII character {@code '-'} (
<code>'\u002D'</code>) is recognized as the minus sign.
<p>Unlike {@link Long#parseLong(String)}, this method returns {@code null} instead of throwing
an exception if parsing fails. Additionally, this method only accepts A... | java | android/guava/src/com/google/common/primitives/Longs.java | 374 | [
"string"
] | Long | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false |
is_authorized | def is_authorized(
self,
*,
method: ResourceMethod | str,
entity_type: AvpEntities,
user: AwsAuthManagerUser,
entity_id: str | None = None,
context: dict | None = None,
) -> bool:
"""
Make an authorization decision against Amazon Verified Permi... | Make an authorization decision against Amazon Verified Permissions.
Check whether the user has permissions to access given resource.
:param method: the method to perform.
The method can also be a string if the action has been defined in a plugin.
In that case, the action can be anything (e.g. can_do).
See... | python | providers/amazon/src/airflow/providers/amazon/aws/auth_manager/avp/facade.py | 83 | [
"self",
"method",
"entity_type",
"user",
"entity_id",
"context"
] | bool | true | 3 | 6.64 | apache/airflow | 43,597 | sphinx | false |
resolveConstructorOrFactoryMethod | @Deprecated(since = "6.1.7")
public Executable resolveConstructorOrFactoryMethod() {
return new ConstructorResolver((AbstractAutowireCapableBeanFactory) getBeanFactory())
.resolveConstructorOrFactoryMethod(getBeanName(), getMergedBeanDefinition());
} | Resolve the constructor or factory method to use for this bean.
@return the {@link java.lang.reflect.Constructor} or {@link java.lang.reflect.Method}
@deprecated in favor of {@link #resolveInstantiationDescriptor()} | java | spring-beans/src/main/java/org/springframework/beans/factory/support/RegisteredBean.java | 214 | [] | Executable | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
getPropertiesFromApplication | private Properties getPropertiesFromApplication(Environment environment, JsonParser parser) {
Properties properties = new Properties();
try {
String property = environment.getProperty("VCAP_APPLICATION", "{}");
Map<String, Object> map = parser.parseMap(property);
extractPropertiesFromApplication(properties... | Create a new {@link CloudFoundryVcapEnvironmentPostProcessor} instance.
@param logFactory the log factory to use
@since 3.0.0 | java | core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java | 143 | [
"environment",
"parser"
] | Properties | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
_huber_loss_and_gradient | def _huber_loss_and_gradient(w, X, y, epsilon, alpha, sample_weight=None):
"""Returns the Huber loss and the gradient.
Parameters
----------
w : ndarray, shape (n_features + 1,) or (n_features + 2,)
Feature vector.
w[:n_features] gives the coefficients
w[-1] gives the scale fact... | Returns the Huber loss and the gradient.
Parameters
----------
w : ndarray, shape (n_features + 1,) or (n_features + 2,)
Feature vector.
w[:n_features] gives the coefficients
w[-1] gives the scale factor and if the intercept is fit w[-2]
gives the intercept factor.
X : ndarray of shape (n_samples, n_f... | python | sklearn/linear_model/_huber.py | 19 | [
"w",
"X",
"y",
"epsilon",
"alpha",
"sample_weight"
] | false | 6 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
saturatedCast | public static char saturatedCast(long value) {
if (value > Character.MAX_VALUE) {
return Character.MAX_VALUE;
}
if (value < Character.MIN_VALUE) {
return Character.MIN_VALUE;
}
return (char) value;
} | Returns the {@code char} nearest in value to {@code value}.
@param value any {@code long} value
@return the same value cast to {@code char} if it is in the range of the {@code char} type,
{@link Character#MAX_VALUE} if it is too large, or {@link Character#MIN_VALUE} if it is too
small | java | android/guava/src/com/google/common/primitives/Chars.java | 99 | [
"value"
] | true | 3 | 7.92 | google/guava | 51,352 | javadoc | false | |
changeSubscription | private boolean changeSubscription(Set<String> topicsToSubscribe) {
if (subscription.equals(topicsToSubscribe))
return false;
subscription = topicsToSubscribe;
return true;
} | This method sets the subscription type if it is not already set (i.e. when it is NONE),
or verifies that the subscription type is equal to the give type when it is set (i.e.
when it is not NONE)
@param type The given subscription type | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 224 | [
"topicsToSubscribe"
] | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
deleteExistingOutput | private void deleteExistingOutput(Path... paths) {
for (Path path : paths) {
try {
FileSystemUtils.deleteRecursively(path);
}
catch (IOException ex) {
throw new UncheckedIOException("Failed to delete existing output in '" + path + "'", ex);
}
}
} | Delete the source, resource, and class output directories. | java | spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java | 101 | [] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
astype | def astype(self, dtype: AstypeArg, copy: bool = True) -> ArrayLike:
"""
Cast to a NumPy array or ExtensionArray with 'dtype'.
Parameters
----------
dtype : str or dtype
Typecode or data-type to which the array is cast.
copy : bool, default True
Wh... | Cast to a NumPy array or ExtensionArray with 'dtype'.
Parameters
----------
dtype : str or dtype
Typecode or data-type to which the array is cast.
copy : bool, default True
Whether to copy the data, even if not necessary. If False,
a copy is made only if the old dtype does not match the
new dtype.
Ret... | python | pandas/core/arrays/base.py | 752 | [
"self",
"dtype",
"copy"
] | ArrayLike | true | 9 | 7.92 | pandas-dev/pandas | 47,362 | numpy | false |
openBufferedStream | public OutputStream openBufferedStream() throws IOException {
OutputStream out = openStream();
return (out instanceof BufferedOutputStream)
? (BufferedOutputStream) out
: new BufferedOutputStream(out);
} | Opens a new buffered {@link OutputStream} for writing to this sink. The returned stream is not
required to be a {@link BufferedOutputStream} in order to allow implementations to simply
delegate to {@link #openStream()} when the stream returned by that method does not benefit from
additional buffering (for example, a {@... | java | android/guava/src/com/google/common/io/ByteSink.java | 86 | [] | OutputStream | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
setLocaleContext | public static void setLocaleContext(@Nullable LocaleContext localeContext, boolean inheritable) {
if (localeContext == null) {
resetLocaleContext();
}
else {
if (inheritable) {
inheritableLocaleContextHolder.set(localeContext);
localeContextHolder.remove();
}
else {
localeContextHolder.set... | Associate the given LocaleContext with the current thread.
<p>The given LocaleContext may be a {@link TimeZoneAwareLocaleContext},
containing a locale with associated time zone information.
@param localeContext the current LocaleContext,
or {@code null} to reset the thread-bound context
@param inheritable whether to ex... | java | spring-context/src/main/java/org/springframework/context/i18n/LocaleContextHolder.java | 98 | [
"localeContext",
"inheritable"
] | void | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
getLastDefinedValue | function getLastDefinedValue<T>(data: T[], index: number): T {
for (let i = index; i > -1; i--) {
if (typeof data[i] !== 'undefined') {
return data[i];
}
}
throw new RuntimeError(
RuntimeErrorCode.LOCALE_DATA_UNDEFINED,
ngDevMode && 'Locale data API: locale data undefined',
);
} | Retrieves the first value that is defined in an array, going backwards from an index position.
To avoid repeating the same data (as when the "format" and "standalone" forms are the same)
add the first value to the locale data arrays, and add other values only if they are different.
@param data The data array to retriev... | typescript | packages/common/src/i18n/locale_data_api.ts | 717 | [
"data",
"index"
] | true | 4 | 8.24 | angular/angular | 99,544 | jsdoc | false | |
scanDecimalEscape | function scanDecimalEscape(): boolean {
Debug.assertEqual(charCodeUnchecked(pos - 1), CharacterCodes.backslash);
const ch = charCodeChecked(pos);
if (ch >= CharacterCodes._1 && ch <= CharacterCodes._9) {
const start = pos;
scanDigits();
... | A stack of scopes for named capturing groups. @see {scanGroupName} | typescript | src/compiler/scanner.ts | 2,923 | [] | true | 3 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getLifecycleProcessor | LifecycleProcessor getLifecycleProcessor() throws IllegalStateException {
if (this.lifecycleProcessor == null) {
throw new IllegalStateException("LifecycleProcessor not initialized - " +
"call 'refresh' before invoking lifecycle methods via the context: " + this);
}
return this.lifecycleProcessor;
} | Return the internal LifecycleProcessor used by the context.
@return the internal LifecycleProcessor (never {@code null})
@throws IllegalStateException if the context has not been initialized yet | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 490 | [] | LifecycleProcessor | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
toString | @Override
public String toString() {
T value = null;
Throwable exception = null;
try {
value = completableFuture.getNow(null);
} catch (CancellationException e) {
// In Java 23, When a CompletableFuture is cancelled, getNow() will throw a CancellationException... | Returns true if completed in any fashion: normally, exceptionally, or via cancellation. | java | clients/src/main/java/org/apache/kafka/common/internals/KafkaFutureImpl.java | 249 | [] | String | true | 6 | 6.56 | apache/kafka | 31,560 | javadoc | false |
validIndex | public static <T extends Collection<?>> T validIndex(final T collection, final int index, final String message, final Object... values) {
Objects.requireNonNull(collection, "collection");
if (index < 0 || index >= collection.size()) {
throw new IndexOutOfBoundsException(getMessage(message, v... | Validates that the index is within the bounds of the argument
collection; otherwise throwing an exception with the specified message.
<pre>Validate.validIndex(myCollection, 2, "The collection index is invalid: ");</pre>
<p>If the collection is {@code null}, then the message of the
exception is "The validated objec... | java | src/main/java/org/apache/commons/lang3/Validate.java | 1,138 | [
"collection",
"index",
"message"
] | T | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
uncompressedIterator | private CloseableIterator<Record> uncompressedIterator() {
final ByteBuffer buffer = this.buffer.duplicate();
buffer.position(RECORDS_OFFSET);
return new RecordIterator() {
@Override
protected Record readNext(long baseOffset, long baseTimestamp, int baseSequence, Long log... | 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 | 298 | [] | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
getAnnotation | public static <A extends Annotation> A getAnnotation(final Method method, final Class<A> annotationCls, final boolean searchSupers,
final boolean ignoreAccess) {
Objects.requireNonNull(method, "method");
Objects.requireNonNull(annotationCls, "annotationCls");
if (!ignoreAccess && !Me... | Gets the annotation object with the given annotation type that is present on the given method or optionally on any equivalent method in super classes and
interfaces. Returns null if the annotation type was not present.
<p>
Stops searching for an annotation once the first annotation of the specified type has been found.... | java | src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | 265 | [
"method",
"annotationCls",
"searchSupers",
"ignoreAccess"
] | A | true | 8 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
send_mime_email | def send_mime_email(
e_from: str,
e_to: str | list[str],
mime_msg: MIMEMultipart,
conn_id: str = "smtp_default",
dryrun: bool = False,
) -> None:
"""
Send a MIME email.
:param e_from: The email address of the sender.
:param e_to: The email address or a list of email addresses of the... | Send a MIME email.
:param e_from: The email address of the sender.
:param e_to: The email address or a list of email addresses of the recipient(s).
:param mime_msg: The MIME message to send.
:param conn_id: The ID of the SMTP connection to use.
:param dryrun: If True, the email will not be sent, but a log message will... | python | airflow-core/src/airflow/utils/email.py | 222 | [
"e_from",
"e_to",
"mime_msg",
"conn_id",
"dryrun"
] | None | true | 11 | 7.04 | apache/airflow | 43,597 | sphinx | false |
memoize | function memoize(func, resolver) {
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
... | Creates a function that memoizes the result of `func`. If `resolver` is
provided, it determines the cache key for storing the result based on the
arguments provided to the memoized function. By default, the first argument
provided to the memoized function is used as the map cache key. The `func`
is invoked with the `th... | javascript | lodash.js | 10,647 | [
"func",
"resolver"
] | false | 8 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
std | def std(
self,
ddof: int = 1,
numeric_only: bool = False,
):
"""
Compute standard deviation of groups, excluding missing values.
Parameters
----------
ddof : int, default 1
Degrees of freedom.
numeric_only : bool, default False
... | Compute standard deviation of groups, excluding missing values.
Parameters
----------
ddof : int, default 1
Degrees of freedom.
numeric_only : bool, default False
Include only `float`, `int` or `boolean` data.
.. versionchanged:: 2.0.0
numeric_only now defaults to ``False``.
Returns
-------
Data... | python | pandas/core/resample.py | 1,533 | [
"self",
"ddof",
"numeric_only"
] | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false | |
asInt | public <R extends Number> Source<Integer> asInt(Adapter<? super T, ? extends R> adapter) {
return as(adapter).as(Number::intValue);
} | Return an adapted version of the source with {@link Integer} type.
@param <R> the resulting type
@param adapter an adapter to convert the current value to a number.
@return a new adapted source instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 187 | [
"adapter"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
isin | def isin(self, values: ArrayLike) -> npt.NDArray[np.bool_]:
"""
Pointwise comparison for set containment in the given values.
Roughly equivalent to `np.array([x in values for x in self])`
Parameters
----------
values : np.ndarray or ExtensionArray
Values to ... | Pointwise comparison for set containment in the given values.
Roughly equivalent to `np.array([x in values for x in self])`
Parameters
----------
values : np.ndarray or ExtensionArray
Values to compare every element in the array against.
Returns
-------
np.ndarray[bool]
With true at indices where value is in... | python | pandas/core/arrays/base.py | 1,573 | [
"self",
"values"
] | npt.NDArray[np.bool_] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
_scrubbed_inductor_config_for_logging | def _scrubbed_inductor_config_for_logging() -> Optional[str]:
"""
Method to parse and scrub uninteresting configs from inductor config
"""
# TypeSafeSerializer for json.dumps()
# Skips complex types as values in config dict
class TypeSafeSerializer(json.JSONEncoder):
def default(self, o... | Method to parse and scrub uninteresting configs from inductor config | python | torch/_dynamo/utils.py | 1,648 | [] | Optional[str] | true | 7 | 6.56 | pytorch/pytorch | 96,034 | unknown | false |
getTarget | @Override
public synchronized Object getTarget() throws Exception {
if (this.lazyTarget == null) {
logger.debug("Initializing lazy target object");
this.lazyTarget = createObject();
}
return this.lazyTarget;
} | Returns the lazy-initialized target object,
creating it on-the-fly if it doesn't exist already.
@see #createObject() | java | spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java | 78 | [] | Object | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
cov | def cov(
self, other: Series, min_periods: int | None = None, ddof: int | None = 1
) -> Series:
"""
Compute covariance between each group and another Series.
Parameters
----------
other : Series
Series to compute covariance with.
min_periods : int... | Compute covariance between each group and another Series.
Parameters
----------
other : Series
Series to compute covariance with.
min_periods : int, optional
Minimum number of observations required per pair of columns to
have a valid result.
ddof : int, optional
Delta degrees of freedom for variance ca... | python | pandas/core/groupby/generic.py | 1,705 | [
"self",
"other",
"min_periods",
"ddof"
] | Series | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
validateIterator | void validateIterator() {
refreshIfEmpty();
if (delegate != originalDelegate) {
throw new ConcurrentModificationException();
}
} | If the delegate changed since the iterator was created, the iterator is no longer valid. | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 456 | [] | void | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
unwrapCacheValue | private @Nullable Object unwrapCacheValue(@Nullable Object cacheValue) {
return (cacheValue instanceof Cache.ValueWrapper wrapper ? wrapper.get() : cacheValue);
} | Find a cached value only for {@link CacheableOperation} that passes the condition.
@param contexts the cacheable operations
@return a {@link Cache.ValueWrapper} holding the cached value,
or {@code null} if none is found | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 623 | [
"cacheValue"
] | Object | true | 2 | 7.84 | spring-projects/spring-framework | 59,386 | javadoc | false |
all | public KafkaFuture<Collection<TransactionListing>> all() {
return allByBrokerId().thenApply(map -> {
List<TransactionListing> allListings = new ArrayList<>();
for (Collection<TransactionListing> listings : map.values()) {
allListings.addAll(listings);
}
... | Get all transaction listings. If any of the underlying requests fail, then the future
returned from this method will also fail with the first encountered error.
@return A future containing the collection of transaction listings. The future completes
when all transaction listings are available and fails after an... | java | clients/src/main/java/org/apache/kafka/clients/admin/ListTransactionsResult.java | 48 | [] | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
hashCode | @Override
public int hashCode() {
int hash = 1;
for (int i = start; i < end; i++) {
hash *= 31;
hash += Double.hashCode(array[i]);
}
return hash;
} | Returns an unspecified hash code for the contents of this immutable array. | java | android/guava/src/com/google/common/primitives/ImmutableDoubleArray.java | 607 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
optimizedTextOrNull | @Override
public final XContentString optimizedTextOrNull() throws IOException {
if (currentToken() == Token.VALUE_NULL) {
return null;
}
return optimizedText();
} | Return the long that {@code stringValue} stores or throws an exception if the
stored value cannot be converted to a long that stores the exact same
value and {@code coerce} is false. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/support/AbstractXContentParser.java | 278 | [] | XContentString | true | 2 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
moduleFinder | InMemoryModuleFinder moduleFinder(Set<String> missingModules) throws IOException {
Path[] modulePath = modulePath();
assert modulePath.length >= 1;
InMemoryModuleFinder moduleFinder = InMemoryModuleFinder.of(missingModules, modulePath);
if (modulePath[0].getFileSystem().provider().getSch... | Returns a module finder capable of finding the modules that are loadable by this embedded
impl class loader.
<p> The module finder returned by this method can be used during resolution in order to
create a configuration. This configuration can subsequently be materialized as a module layer
in which classes and resource... | java | libs/core/src/main/java/org/elasticsearch/core/internal/provider/EmbeddedImplClassLoader.java | 295 | [
"missingModules"
] | InMemoryModuleFinder | true | 2 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
build | public ImmutableRangeSet<C> build() {
ImmutableList.Builder<Range<C>> mergedRangesBuilder =
new ImmutableList.Builder<>(ranges.size());
sort(ranges, rangeLexOrdering());
PeekingIterator<Range<C>> peekingItr = peekingIterator(ranges.iterator());
while (peekingItr.hasNext()) {
Ra... | Returns an {@code ImmutableRangeSet} containing the ranges added to this builder.
@throws IllegalArgumentException if any input ranges have nonempty overlap | java | android/guava/src/com/google/common/collect/ImmutableRangeSet.java | 831 | [] | true | 7 | 6.08 | google/guava | 51,352 | javadoc | false | |
getNameOrUnnamed | static SmallString<64> getNameOrUnnamed(const NamedDecl *ND) {
auto Name = getName(ND);
if (Name.empty())
Name = "<unnamed>";
return Name;
} | Returns the diagnostic-friendly name of the node, or a constant value. | cpp | clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp | 1,947 | [] | true | 2 | 6.88 | llvm/llvm-project | 36,021 | doxygen | false | |
base_dir | def base_dir(self: Self) -> Path:
"""
Get the base directory for the Inductor cache.
Returns:
Path: The base directory path for Inductor cache files.
"""
from torch._inductor.runtime.runtime_utils import default_cache_dir
return Path(default_cache_dir(), "cac... | Get the base directory for the Inductor cache.
Returns:
Path: The base directory path for Inductor cache files. | python | torch/_inductor/cache.py | 411 | [
"self"
] | Path | true | 1 | 6.72 | pytorch/pytorch | 96,034 | unknown | false |
lagroots | def lagroots(c):
"""
Compute the roots of a Laguerre series.
Return the roots (a.k.a. "zeros") of the polynomial
.. math:: p(x) = \\sum_i c[i] * L_i(x).
Parameters
----------
c : 1-D array_like
1-D array of coefficients.
Returns
-------
out : ndarray
Array of ... | Compute the roots of a Laguerre series.
Return the roots (a.k.a. "zeros") of the polynomial
.. math:: p(x) = \\sum_i c[i] * L_i(x).
Parameters
----------
c : 1-D array_like
1-D array of coefficients.
Returns
-------
out : ndarray
Array of the roots of the series. If all the roots are real,
then `out` is... | python | numpy/polynomial/laguerre.py | 1,467 | [
"c"
] | false | 3 | 7.12 | numpy/numpy | 31,054 | numpy | false | |
hashCode | @Override
public int hashCode() {
// See Map.Entry API specification
return Objects.hashCode(getLeft()) ^ Objects.hashCode(getMiddle()) ^ Objects.hashCode(getRight());
} | Returns a suitable hash code.
<p>
The hash code is adapted from the definition in {@code Map.Entry}.
</p>
@return the hash code. | java | src/main/java/org/apache/commons/lang3/tuple/Triple.java | 171 | [] | true | 1 | 7.2 | apache/commons-lang | 2,896 | javadoc | false | |
numRecords | public int numRecords() {
int numRecords = 0;
if (!batches.isEmpty()) {
Iterator<Map.Entry<TopicIdPartition, ShareInFlightBatch<K, V>>> iterator = batches.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<TopicIdPartition, ShareInFlightBatch<K, V>> ent... | @return the total number of non-control messages for this fetch, across all partitions | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetch.java | 92 | [] | true | 5 | 7.6 | apache/kafka | 31,560 | javadoc | false | |
is_string_dtype | def is_string_dtype(arr_or_dtype) -> bool:
"""
Check whether the provided array or dtype is of the string dtype.
If an array is passed with an object dtype, the elements must be
inferred as strings.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to chec... | Check whether the provided array or dtype is of the string dtype.
If an array is passed with an object dtype, the elements must be
inferred as strings.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
boolean
Whether or not the array or dtype is of the str... | python | pandas/core/dtypes/common.py | 611 | [
"arr_or_dtype"
] | bool | true | 4 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
getAndAdd | public short getAndAdd(final Number operand) {
final short last = value;
this.value += operand.shortValue();
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/MutableShort.java | 207 | [
"operand"
] | true | 1 | 6.56 | apache/commons-lang | 2,896 | javadoc | false | |
faceIjkToCellBoundaryClassII | private CellBoundary faceIjkToCellBoundaryClassII(int adjRes) {
final LatLng[] points = new LatLng[Constants.NUM_HEX_VERTS];
final FaceIJK fijk = new FaceIJK(this.face, new CoordIJK(0, 0, 0));
for (int vert = 0; vert < Constants.NUM_HEX_VERTS; vert++) {
fijk.coord.reset(
... | 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 | 557 | [
"adjRes"
] | CellBoundary | true | 2 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
nanmedian | def nanmedian(
values: np.ndarray, *, axis: AxisInt | None = None, skipna: bool = True, mask=None
) -> float | np.ndarray:
"""
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
mask : ndarray[bool], optional
nan-mask if known
Returns
... | Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
mask : ndarray[bool], optional
nan-mask if known
Returns
-------
result : float | ndarray
Unless input is a float array, in which case use the same
precision as the input array.
Examples
--------
>>> from pandas.core i... | python | pandas/core/nanops.py | 731 | [
"values",
"axis",
"skipna",
"mask"
] | float | np.ndarray | true | 25 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
onSend | public ProducerRecord<K, V> onSend(ProducerRecord<K, V> record) {
ProducerRecord<K, V> interceptRecord = record;
for (Plugin<ProducerInterceptor<K, V>> interceptorPlugin : this.interceptorPlugins) {
try {
interceptRecord = interceptorPlugin.get().onSend(interceptRecord);
... | This is called when client sends the record to KafkaProducer, before key and value gets serialized.
The method calls {@link ProducerInterceptor#onSend(ProducerRecord)} method. ProducerRecord
returned from the first interceptor's onSend() is passed to the second interceptor onSend(), and so on in the
interceptor chain. ... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerInterceptors.java | 63 | [
"record"
] | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
_get_executor_get_task_log | def _get_executor_get_task_log(
self, ti: TaskInstance | TaskInstanceHistory
) -> Callable[[TaskInstance | TaskInstanceHistory, int], tuple[list[str], list[str]]]:
"""
Get the get_task_log method from executor of current task instance.
Since there might be multiple executors, so we ... | Get the get_task_log method from executor of current task instance.
Since there might be multiple executors, so we need to get the executor of current task instance instead of getting from default executor.
:param ti: task instance object
:return: get_task_log method of the executor | python | airflow-core/src/airflow/utils/log/file_task_handler.py | 557 | [
"self",
"ti"
] | Callable[[TaskInstance | TaskInstanceHistory, int], tuple[list[str], list[str]]] | true | 5 | 8.08 | apache/airflow | 43,597 | sphinx | false |
nop | @SuppressWarnings("unchecked")
public static <T> Consumer<T> nop() {
return NOP;
} | Gets the NOP Consumer singleton.
@param <T> type type to consume.
@return the NOP Consumer singleton. | java | src/main/java/org/apache/commons/lang3/function/Consumers.java | 54 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
reshape | def reshape(self, *s, **kwargs):
"""
Give a new shape to the array without changing its data.
Returns a masked array containing the same data, but with a new shape.
The result is a view on the original array; if this is not possible, a
ValueError is raised.
Parameters
... | Give a new shape to the array without changing its data.
Returns a masked array containing the same data, but with a new shape.
The result is a view on the original array; if this is not possible, a
ValueError is raised.
Parameters
----------
shape : int or tuple of ints
The new shape should be compatible with th... | python | numpy/ma/core.py | 4,751 | [
"self"
] | false | 2 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
createKeyStore | private static KeyStore createKeyStore(@Nullable String type)
throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
KeyStore store = KeyStore.getInstance(StringUtils.hasText(type) ? type : KeyStore.getDefaultType());
store.load(null);
return store;
} | Create a new {@link PemSslStoreBundle} instance.
@param pemKeyStore the PEM key store
@param pemTrustStore the PEM trust store
@since 3.2.0 | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreBundle.java | 117 | [
"type"
] | KeyStore | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
visitTemplateExpression | function visitTemplateExpression(node: TemplateExpression): Expression {
let expression: Expression = factory.createStringLiteral(node.head.text);
for (const span of node.templateSpans) {
const args = [Debug.checkDefined(visitNode(span.expression, visitor, isExpression))];
... | Visits a TemplateExpression node.
@param node A TemplateExpression node. | typescript | src/compiler/transformers/es2015.ts | 4,804 | [
"node"
] | true | 2 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
registerProcessedProperty | public void registerProcessedProperty(String propertyName) {
if (this.processedProperties == null) {
this.processedProperties = new HashSet<>(4);
}
this.processedProperties.add(propertyName);
} | Register the specified property as "processed" in the sense
of some processor calling the corresponding setter method
outside the PropertyValue(s) mechanism.
<p>This will lead to {@code true} being returned from
a {@link #contains} call for the specified property.
@param propertyName the name of the property. | java | spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java | 334 | [
"propertyName"
] | void | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
reindex | def reindex(
self,
target,
method: ReindexMethod | None = None,
level=None,
limit: int | None = None,
tolerance: float | None = None,
) -> tuple[Index, npt.NDArray[np.intp] | None]:
"""
Create index with target's values.
Parameters
---... | Create index with target's values.
Parameters
----------
target : an iterable
An iterable containing the values to be used for creating the new index.
method : {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}, optional
* default: exact matches only.
* pad / ffill: find the PREVIOUS index value if no ex... | python | pandas/core/indexes/base.py | 4,149 | [
"self",
"target",
"method",
"level",
"limit",
"tolerance"
] | tuple[Index, npt.NDArray[np.intp] | None] | true | 19 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
hashCode | @Override
public int hashCode() {
final char[] buf = buffer;
int hash = 0;
for (int i = size - 1; i >= 0; i--) {
hash = 31 * hash + buf[i];
}
return hash;
} | Gets a suitable hash code for this builder.
@return a hash code | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,973 | [] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
_aggregate_score_dicts | def _aggregate_score_dicts(scores):
"""Aggregate the list of dict to dict of np ndarray
The aggregated output of _aggregate_score_dicts will be a list of dict
of form [{'prec': 0.1, 'acc':1.0}, {'prec': 0.1, 'acc':1.0}, ...]
Convert it to a dict of array {'prec': np.array([0.1 ...]), ...}
Paramete... | Aggregate the list of dict to dict of np ndarray
The aggregated output of _aggregate_score_dicts will be a list of dict
of form [{'prec': 0.1, 'acc':1.0}, {'prec': 0.1, 'acc':1.0}, ...]
Convert it to a dict of array {'prec': np.array([0.1 ...]), ...}
Parameters
----------
scores : list of dict
List of dicts of t... | python | sklearn/model_selection/_validation.py | 2,463 | [
"scores"
] | false | 2 | 7.68 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
producerEpoch | @Override
public short producerEpoch() {
return buffer.getShort(PRODUCER_EPOCH_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 | 194 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
CursorBase | CursorBase(BufType* buf, size_t len) noexcept : crtBuf_(buf), buffer_(buf) {
if (crtBuf_) {
crtPos_ = crtBegin_ = crtBuf_->data();
crtEnd_ = crtBuf_->tail();
if (uintptr_t(crtPos_) + len < uintptr_t(crtEnd_)) {
crtEnd_ = crtPos_ + len;
}
remainingLen_ = len - (crtEnd_ - crtPos_... | Constuct a bounded cursor wrapping an IOBuf.
@param len An upper bound on the number of bytes available to this cursor. | cpp | folly/io/Cursor.h | 94 | [
"len"
] | true | 3 | 7.04 | facebook/folly | 30,157 | doxygen | false | |
ClientReaderWriter | ClientReaderWriter(grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method,
grpc::ClientContext* context)
: channel_(channel),
context_(context),
cq_(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRP... | used to send to the server when starting the call. | cpp | include/grpcpp/support/sync_stream.h | 557 | [] | true | 2 | 6.72 | grpc/grpc | 44,113 | doxygen | false | |
consumingForArray | private static <I extends Iterator<?>> Iterator<I> consumingForArray(@Nullable I... elements) {
return new UnmodifiableIterator<I>() {
int index = 0;
@Override
public boolean hasNext() {
return index < elements.length;
}
@Override
public I next() {
if (!hasNext(... | Returns an Iterator that walks the specified array, nulling out elements behind it. This can
avoid memory leaks when an element is no longer necessary.
<p>This method accepts an array with element type {@code @Nullable T}, but callers must pass an
array whose contents are initially non-null. The {@code @Nullable} annot... | java | android/guava/src/com/google/common/collect/Iterators.java | 468 | [] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
list_keys | def list_keys(
self,
bucket_name: str | None = None,
prefix: str | None = None,
delimiter: str | None = None,
page_size: int | None = None,
max_items: int | None = None,
start_after_key: str | None = None,
from_datetime: datetime | None = None,
to_... | List keys in a bucket under prefix and not containing delimiter.
.. seealso::
- :external+boto3:py:class:`S3.Paginator.ListObjectsV2`
:param bucket_name: the name of the bucket
:param prefix: a key prefix
:param delimiter: the delimiter marks key hierarchy.
:param page_size: pagination size
:param max_items: maxi... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 836 | [
"self",
"bucket_name",
"prefix",
"delimiter",
"page_size",
"max_items",
"start_after_key",
"from_datetime",
"to_datetime",
"object_filter",
"apply_wildcard"
] | list | true | 11 | 7.36 | apache/airflow | 43,597 | sphinx | false |
reconnect | URLConnection reconnect(JarFile jarFile, URLConnection existingConnection) throws IOException {
Boolean useCaches = (existingConnection != null) ? existingConnection.getUseCaches() : null;
URLConnection connection = openConnection(jarFile);
if (useCaches != null && connection != null) {
connection.setUseCaches... | Reconnect to the {@link JarFile}, returning a replacement {@link URLConnection}.
@param jarFile the jar file
@param existingConnection the existing connection
@return a newly opened connection inhering the same {@code useCaches} value as the
existing connection
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFiles.java | 120 | [
"jarFile",
"existingConnection"
] | URLConnection | true | 4 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
asWriter | public Writer asWriter() {
return new StrBuilderWriter();
} | Gets this builder as a Writer that can be written to.
<p>
This method allows you to populate the contents of the builder
using any standard method that takes a Writer.
</p>
<p>
To use, simply create a {@link StrBuilder},
call {@code asWriter}, and populate away. The data is available
at any time using the methods of th... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,554 | [] | Writer | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
scanNumberFragment | function scanNumberFragment(): string {
let start = pos;
let allowSeparator = false;
let isPreviousTokenSeparator = false;
let result = "";
while (true) {
const ch = charCodeUnchecked(pos);
if (ch === CharacterCodes._) {
tokenFlags ... | Returns the char code for the character at the given position within `text`. If
`pos` is outside the bounds set for `text`, `CharacterCodes.EOF` is returned instead. | typescript | src/compiler/scanner.ts | 1,171 | [] | true | 9 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
serialize | public static void serialize(XContentBuilder builder, @Nullable ExponentialHistogram histogram) throws IOException {
if (histogram == null) {
builder.nullValue();
return;
}
builder.startObject();
builder.field(SCALE_FIELD, histogram.scale());
if (histogr... | Serializes an {@link ExponentialHistogram} to the provided {@link XContentBuilder}.
@param builder the XContentBuilder to write to
@param histogram the ExponentialHistogram to serialize
@throws IOException if the XContentBuilder throws an IOException | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramXContent.java | 58 | [
"builder",
"histogram"
] | void | true | 10 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
isNextTokenParentJsxAttribute | function isNextTokenParentJsxAttribute(context: FormattingContext): boolean {
return context.nextTokenParent.kind === SyntaxKind.JsxAttribute || (
context.nextTokenParent.kind === SyntaxKind.JsxNamespacedName && context.nextTokenParent.parent.kind === SyntaxKind.JsxAttribute
);
} | A rule takes a two tokens (left/right) and a particular context
for which you're meant to look at them. You then declare what should the
whitespace annotation be between these tokens via the action param.
@param debugName Name to print
@param left The left side of the comparison
@param right The right side of the... | typescript | src/services/formatting/rules.ts | 779 | [
"context"
] | true | 3 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
attributes | private byte attributes() {
// note we're not using the second byte of attributes
return (byte) buffer.getShort(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 | 402 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
astype | def astype(self, dtype: AstypeArg | None = None, copy: bool = True):
"""
Change the dtype of a SparseArray.
The output will always be a SparseArray. To convert to a dense
ndarray with a certain dtype, use :meth:`numpy.asarray`.
Parameters
----------
dtype : np.d... | Change the dtype of a SparseArray.
The output will always be a SparseArray. To convert to a dense
ndarray with a certain dtype, use :meth:`numpy.asarray`.
Parameters
----------
dtype : np.dtype or ExtensionDtype
For SparseDtype, this changes the dtype of
``self.sp_values`` and the ``self.fill_value``.
Fo... | python | pandas/core/arrays/sparse/array.py | 1,260 | [
"self",
"dtype",
"copy"
] | true | 5 | 8.08 | pandas-dev/pandas | 47,362 | numpy | false | |
describeTopics | default DescribeTopicsResult describeTopics(Collection<String> topicNames) {
return describeTopics(topicNames, new DescribeTopicsOptions());
} | Describe some topics in the cluster, with the default options.
<p>
This is a convenience method for {@link #describeTopics(Collection, DescribeTopicsOptions)} with
default options. See the overload for more details.
@param topicNames The names of the topics to describe.
@return The DescribeTopicsResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 295 | [
"topicNames"
] | DescribeTopicsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
is_object_dtype | def is_object_dtype(arr_or_dtype) -> bool:
"""
Check whether an array-like or dtype is of the object dtype.
This method examines the input to determine if it is of the
object data type. Object dtype is a generic data type that can
hold any Python objects, including strings, lists, and custom
ob... | Check whether an array-like or dtype is of the object dtype.
This method examines the input to determine if it is of the
object data type. Object dtype is a generic data type that can
hold any Python objects, including strings, lists, and custom
objects.
Parameters
----------
arr_or_dtype : array-like or dtype
Th... | python | pandas/core/dtypes/common.py | 143 | [
"arr_or_dtype"
] | bool | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
isSorted | public static boolean isSorted(final boolean[] array) {
if (getLength(array) < 2) {
return true;
}
boolean previous = array[0];
final int n = array.length;
for (int i = 1; i < n; i++) {
final boolean current = array[i];
if (BooleanUtils.compare... | Tests whether whether the provided array is sorted according to natural ordering ({@code false} before {@code true}).
@param array the array to check.
@return whether the array is sorted according to natural ordering.
@since 3.4 | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 3,545 | [
"array"
] | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
applyAsFloat | float applyAsFloat(int value) throws E; | Applies this function to the given argument.
@param value the function argument
@return the function result
@throws E Thrown when the function fails. | java | src/main/java/org/apache/commons/lang3/function/FailableIntToFloatFunction.java | 53 | [
"value"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
sendOffsetCommitRequest | RequestFuture<Void> sendOffsetCommitRequest(final Map<TopicPartition, OffsetAndMetadata> offsets) {
if (offsets.isEmpty())
return RequestFuture.voidSuccess();
Node coordinator = checkAndGetCoordinator();
if (coordinator == null)
return RequestFuture.coordinatorNotAvailab... | Commit offsets for the specified list of topics and partitions. This is a non-blocking call
which returns a request future that can be polled in the case of a synchronous commit or ignored in the
asynchronous case.
NOTE: This is visible only for testing
@param offsets The list of offsets per partition that should be co... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 1,272 | [
"offsets"
] | true | 7 | 8.32 | apache/kafka | 31,560 | javadoc | false | |
readObject | @Serial
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
throw new NotSerializableException("DefaultListableBeanFactory itself is not deserializable - " +
"just a SerializedBeanFactoryReference is");
} | Public method to determine the applicable order value for a given bean.
@param beanName the name of the bean
@param beanInstance the bean instance to check
@return the corresponding order value (default is {@link Ordered#LOWEST_PRECEDENCE})
@since 7.0
@see #getOrder(String) | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 2,404 | [
"ois"
] | void | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
createNativeCaffeineCache | protected com.github.benmanes.caffeine.cache.Cache<Object, Object> createNativeCaffeineCache(String name) {
if (this.cacheLoader != null) {
if (this.cacheLoader instanceof CacheLoader<Object, Object> regularCacheLoader) {
return this.cacheBuilder.build(regularCacheLoader);
}
else {
throw new IllegalS... | Build a common Caffeine Cache instance for the specified cache name,
using the common Caffeine configuration specified on this cache manager.
@param name the name of the cache
@return the native Caffeine Cache instance
@see #createCaffeineCache | java | spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java | 384 | [
"name"
] | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
markPrecedingCommentDirectiveLine | function markPrecedingCommentDirectiveLine(diagnostic: Diagnostic, directives: CommentDirectivesMap) {
const { file, start } = diagnostic;
if (!file) {
return -1;
}
// Start out with the line just before the text
const lineStarts = getLineStarts(file);
... | @returns The line index marked as preceding the diagnostic, or -1 if none was. | typescript | src/compiler/program.ts | 2,960 | [
"diagnostic",
"directives"
] | false | 6 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
validate_fillna_kwargs | def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = True):
"""
Validate the keyword arguments to 'fillna'.
This checks that exactly one of 'value' and 'method' is specified.
If 'method' is specified, this validates that it's a valid method.
Parameters
----------
va... | Validate the keyword arguments to 'fillna'.
This checks that exactly one of 'value' and 'method' is specified.
If 'method' is specified, this validates that it's a valid method.
Parameters
----------
value, method : object
The 'value' and 'method' keyword arguments for 'fillna'.
validate_scalar_dict_value : bool,... | python | pandas/util/_validators.py | 300 | [
"value",
"method",
"validate_scalar_dict_value"
] | true | 11 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
remove | public Object remove(int index) {
if (index < 0 || index >= this.values.size()) {
return null;
}
return this.values.remove(index);
} | Removes and returns the value at {@code index}, or null if the array has no value
at {@code index}.
@param index the index of the value to remove
@return the previous value at {@code index} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 311 | [
"index"
] | Object | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
originalsWithPrefix | public Map<String, Object> originalsWithPrefix(String prefix, boolean strip) {
Map<String, Object> result = new RecordingMap<>(prefix, false);
result.putAll(Utils.entriesWithPrefix(originals, prefix, strip));
return result;
} | Gets all original settings with the given prefix.
@param prefix the prefix to use as a filter
@param strip strip the prefix before adding to the output if set true
@return a Map containing the settings with the prefix | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 290 | [
"prefix",
"strip"
] | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
HTML40_EXTENDED_ESCAPE | public static String[][] HTML40_EXTENDED_ESCAPE() {
return HTML40_EXTENDED_ESCAPE.clone();
} | Mapping to escape additional <a href="https://www.w3.org/TR/REC-html40/sgml/entities.html">character entity
references</a>. Note that this must be used with {@link #ISO8859_1_ESCAPE()} to get the full list of
HTML 4.0 character entities.
@return the mapping table. | java | src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java | 402 | [] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.