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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
get_loc | def get_loc(self, key) -> int:
"""
Get integer location for requested label.
Parameters
----------
key : int or float
Label to locate. Integer-like floats (e.g. 3.0) are accepted and
treated as the corresponding integer. Non-integer floats and other
... | Get integer location for requested label.
Parameters
----------
key : int or float
Label to locate. Integer-like floats (e.g. 3.0) are accepted and
treated as the corresponding integer. Non-integer floats and other
non-integer labels are not valid and will raise KeyError or
InvalidIndexError.
Returns
... | python | pandas/core/indexes/range.py | 473 | [
"self",
"key"
] | int | true | 5 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
has_crawler | def has_crawler(self, crawler_name) -> bool:
"""
Check if the crawler already exists.
:param crawler_name: unique crawler name per AWS account
:return: Returns True if the crawler already exists and False if not.
"""
self.log.info("Checking if crawler already exists: %s"... | Check if the crawler already exists.
:param crawler_name: unique crawler name per AWS account
:return: Returns True if the crawler already exists and False if not. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue_crawler.py | 50 | [
"self",
"crawler_name"
] | bool | true | 1 | 7.04 | apache/airflow | 43,597 | sphinx | false |
asarray | def asarray(obj, itemsize=None, unicode=None, order=None):
"""
Convert the input to a `~numpy.char.chararray`, copying the data only if
necessary.
Versus a NumPy array of dtype `bytes_` or `str_`, this
class adds the following functionality:
1) values automatically have whitespace removed from... | Convert the input to a `~numpy.char.chararray`, copying the data only if
necessary.
Versus a NumPy array of dtype `bytes_` or `str_`, this
class adds the following functionality:
1) values automatically have whitespace removed from the end
when indexed
2) comparison operators automatically remove whitespace from ... | python | numpy/_core/defchararray.py | 1,357 | [
"obj",
"itemsize",
"unicode",
"order"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
resolve | @Override
public @Nullable NamespaceHandler resolve(String namespaceUri) {
Map<String, Object> handlerMappings = getHandlerMappings();
Object handlerOrClassName = handlerMappings.get(namespaceUri);
if (handlerOrClassName == null) {
return null;
}
else if (handlerOrClassName instanceof NamespaceHandler nam... | Locate the {@link NamespaceHandler} for the supplied namespace URI
from the configured mappings.
@param namespaceUri the relevant namespace URI
@return the located {@link NamespaceHandler}, or {@code null} if none found | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultNamespaceHandlerResolver.java | 113 | [
"namespaceUri"
] | NamespaceHandler | true | 6 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
addAndGet | public float addAndGet(final Number operand) {
this.value += operand.floatValue();
return value;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately after 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 wi... | java | src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java | 127 | [
"operand"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
merge | Object merge(@Nullable Object parent); | Merge the current value set with that of the supplied object.
<p>The supplied object is considered the parent, and values in
the callee's value set must override those of the supplied object.
@param parent the object to merge with
@return the result of the merge operation
@throws IllegalArgumentException if the supplie... | java | spring-beans/src/main/java/org/springframework/beans/Mergeable.java | 49 | [
"parent"
] | Object | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false |
getJSONArray | public JSONArray getJSONArray(String name) throws JSONException {
Object object = get(name);
if (object instanceof JSONArray) {
return (JSONArray) object;
}
else {
throw JSON.typeMismatch(name, object, "JSONArray");
}
} | Returns the value mapped by {@code name} if it exists and is a {@code
JSONArray}.
@param name the name of the property
@return the value
@throws JSONException if the mapping doesn't exist or is not a {@code
JSONArray}. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 596 | [
"name"
] | JSONArray | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
insert | def insert(self, loc: int, item) -> Self:
"""
Insert an item at the given position.
Parameters
----------
loc : int
Index where the `item` needs to be inserted.
item : scalar-like
Value to be inserted.
Returns
-------
Exte... | Insert an item at the given position.
Parameters
----------
loc : int
Index where the `item` needs to be inserted.
item : scalar-like
Value to be inserted.
Returns
-------
ExtensionArray
With `item` inserted at `loc`.
See Also
--------
Index.insert: Make new Index inserting new item at location.
Notes
-... | python | pandas/core/arrays/base.py | 2,446 | [
"self",
"loc",
"item"
] | Self | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
segmentFor | Segment<K, V, E, S> segmentFor(int hash) {
// TODO(fry): Lazily create segments?
return segments[(hash >>> segmentShift) & segmentMask];
} | Returns the segment that should be used for a key with the given hash.
@param hash the hash code for the key
@return the segment | java | android/guava/src/com/google/common/collect/MapMakerInternalMap.java | 1,139 | [
"hash"
] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
freqstr | def freqstr(self) -> str:
"""
Return the frequency object as a string if it's set, otherwise None.
See Also
--------
DatetimeIndex.inferred_freq : Returns a string representing a frequency
generated by infer_freq.
Examples
--------
For Dateti... | Return the frequency object as a string if it's set, otherwise None.
See Also
--------
DatetimeIndex.inferred_freq : Returns a string representing a frequency
generated by infer_freq.
Examples
--------
For DatetimeIndex:
>>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00"], freq="D")
>>> idx.freqstr
'D'
The f... | python | pandas/core/indexes/datetimelike.py | 181 | [
"self"
] | str | true | 4 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
mro_lookup | def mro_lookup(cls, attr, stop=None, monkey_patched=None):
"""Return the first node by MRO order that defines an attribute.
Arguments:
cls (Any): Child class to traverse.
attr (str): Name of attribute to find.
stop (Set[Any]): A set of types that if reached will stop
the sea... | Return the first node by MRO order that defines an attribute.
Arguments:
cls (Any): Child class to traverse.
attr (str): Name of attribute to find.
stop (Set[Any]): A set of types that if reached will stop
the search.
monkey_patched (Sequence): Use one of the stop classes
if the attribu... | python | celery/utils/objects.py | 14 | [
"cls",
"attr",
"stop",
"monkey_patched"
] | false | 8 | 7.28 | celery/celery | 27,741 | google | false | |
ensure_delete_replication_group | def ensure_delete_replication_group(
self,
replication_group_id: str,
initial_sleep_time: float | None = None,
exponential_back_off_factor: float | None = None,
max_retries: int | None = None,
) -> dict:
"""
Delete a replication group ensuring it is either del... | Delete a replication group ensuring it is either deleted or can't be deleted.
:param replication_group_id: ID of replication to delete
:param initial_sleep_time: Initial sleep time in second
If this is not supplied then this is defaulted to class level value
:param exponential_back_off_factor: Multiplication facto... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/elasticache_replication_group.py | 249 | [
"self",
"replication_group_id",
"initial_sleep_time",
"exponential_back_off_factor",
"max_retries"
] | dict | true | 2 | 7.6 | apache/airflow | 43,597 | sphinx | false |
check_query_status | def check_query_status(self, query_execution_id: str, use_cache: bool = False) -> str | None:
"""
Fetch the state of a submitted query.
.. seealso::
- :external+boto3:py:meth:`Athena.Client.get_query_execution`
:param query_execution_id: Id of submitted athena query
... | Fetch the state of a submitted query.
.. seealso::
- :external+boto3:py:meth:`Athena.Client.get_query_execution`
:param query_execution_id: Id of submitted athena query
:return: One of valid query states, or *None* if the response is
malformed. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py | 148 | [
"self",
"query_execution_id",
"use_cache"
] | str | None | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
isWellFormed | public static boolean isWellFormed(byte[] bytes, int off, int len) {
int end = off + len;
checkPositionIndexes(off, end, bytes.length);
// Look for the first non-ASCII character.
for (int i = off; i < end; i++) {
if (bytes[i] < 0) {
return isWellFormedSlowPath(bytes, i, end);
}
}... | Returns whether the given byte array slice is a well-formed UTF-8 byte sequence, as defined by
{@link #isWellFormed(byte[])}. Note that this can be false even when {@code
isWellFormed(bytes)} is true.
@param bytes the input buffer
@param off the offset in the buffer of the first byte to read
@param len the number of by... | java | android/guava/src/com/google/common/base/Utf8.java | 123 | [
"bytes",
"off",
"len"
] | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false | |
removePattern | public static String removePattern(final CharSequence text, final String regex) {
return replacePattern(text, regex, StringUtils.EMPTY);
} | Removes each substring of the source String that matches the given regular expression using the DOTALL option.
This call is a {@code null} safe equivalent to:
<ul>
<li>{@code text.replaceAll("(?s)" + regex, StringUtils.EMPTY)}</li>
<li>{@code Pattern.compile(regex, Pattern.DOTALL).matcher(text).replaceAll(Str... | java | src/main/java/org/apache/commons/lang3/RegExUtils.java | 344 | [
"text",
"regex"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
expires | boolean expires() {
return expiresAfterWrite() || expiresAfterAccess();
} | Creates a new, empty map with the specified strategy, initial capacity and concurrency level. | java | android/guava/src/com/google/common/cache/LocalCache.java | 328 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
initializeCJS | function initializeCJS() {
// This need to be done at runtime in case --expose-internals is set.
let modules = Module.builtinModules = BuiltinModule.getAllBuiltinModuleIds();
if (!getOptionValue('--experimental-quic')) {
modules = modules.filter((i) => i !== 'node:quic');
}
Module.builtinModules = Object... | Prepare to run CommonJS code.
This function is called during pre-execution, before any user code is run.
@returns {void} | javascript | lib/internal/modules/cjs/loader.js | 458 | [] | false | 3 | 7.12 | nodejs/node | 114,839 | jsdoc | false | |
getType | @Override
public @Nullable Class<?> getType(String name, boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException {
String beanName = transformedBeanName(name);
// Check manually registered singletons.
Object beanInstance = getSingleton(beanName, false);
if (beanInstance != null && beanInstance.getC... | Internal extended variant of {@link #isTypeMatch(String, ResolvableType)}
to check whether the bean with the given name matches the specified type. Allow
additional constraints to be applied to ensure that beans are not created early.
@param name the name of the bean to query
@param typeToMatch the type to match agains... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 710 | [
"name",
"allowFactoryBeanInit"
] | true | 16 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
schedule_comm_wait | def schedule_comm_wait(graph: fx.Graph) -> None:
"""
Delay the execution of wait tensors of allreduce until its first user.
This algorithm considers the intermediate users, like split, getitem,
of the wait node and schedule those intermediate users as well.
This will result in a better overlapping ... | Delay the execution of wait tensors of allreduce until its first user.
This algorithm considers the intermediate users, like split, getitem,
of the wait node and schedule those intermediate users as well.
This will result in a better overlapping result. | python | torch/_inductor/fx_passes/ddp_fusion.py | 524 | [
"graph"
] | None | true | 9 | 6 | pytorch/pytorch | 96,034 | unknown | false |
median | def median(self, numeric_only: bool = False, skipna: bool = True) -> NDFrameT:
"""
Compute median of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Parameters
----------
numeric_only : bool, default False
Incl... | Compute median of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
.. versionchanged:: 2.0.0
numeric_only no longer accepts ``None`` and defaults to False... | python | pandas/core/groupby/groupby.py | 2,304 | [
"self",
"numeric_only",
"skipna"
] | NDFrameT | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
customized | private static <E> Consumer<Members<E>> customized(Consumer<Members<E>> members,
@Nullable StructuredLoggingJsonMembersCustomizer<?> customizer) {
return (customizer != null) ? members.andThen(customizeWith(customizer)) : members;
} | Create a new {@link JsonWriterStructuredLogFormatter} instance with the given
members.
@param members a consumer, which should configure the members
@param customizer an optional customizer to apply | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/JsonWriterStructuredLogFormatter.java | 51 | [
"members",
"customizer"
] | true | 2 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
clientInstanceId | @Override
public Uuid clientInstanceId(Duration timeout) {
if (timeout.isNegative()) {
throw new IllegalArgumentException("The timeout cannot be negative.");
}
if (clientTelemetryReporter.isEmpty()) {
throw new IllegalStateException("Telemetry is not enabled. Set con... | Forcefully terminates an ongoing transaction for a given transactional ID.
<p>
This API is intended for well-formed but long-running transactions that are known to the
transaction coordinator. It is primarily designed for supporting 2PC (two-phase commit) workflows,
where a coordinator may need to unilaterally terminat... | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 5,055 | [
"timeout"
] | Uuid | true | 4 | 7.44 | apache/kafka | 31,560 | javadoc | false |
createInnerClass | private static GeneratedClass createInnerClass(GeneratedClass generatedClass, String name, ClassName target) {
return generatedClass.getOrAdd(name, type -> {
type.addJavadoc("Bean definitions for {@link $T}.", target);
type.addModifiers(Modifier.PUBLIC, Modifier.STATIC);
});
} | Return the {@link GeneratedClass} to use for the specified {@code target}.
<p>If the target class is an inner class, a corresponding inner class in
the original structure is created.
@param generationContext the generation context to use
@param target the chosen target class name for the bean definition
@return the gen... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGenerator.java | 140 | [
"generatedClass",
"name",
"target"
] | GeneratedClass | true | 1 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
subscribeInternal | private void subscribeInternal(Collection<String> topics, Optional<ConsumerRebalanceListener> listener) {
acquireAndEnsureOpen();
try {
throwIfGroupIdNotDefined();
if (topics == null)
throw new IllegalArgumentException("Topic collection to subscribe to cannot be n... | Internal helper method for {@link #subscribe(Collection)} and
{@link #subscribe(Collection, ConsumerRebalanceListener)}
<p>
Subscribe to the given list of topics to get dynamically assigned partitions.
<b>Topic subscriptions are not incremental. This list will replace the current
assignment (if there is one).</b> It is... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java | 476 | [
"topics",
"listener"
] | void | true | 6 | 6.4 | apache/kafka | 31,560 | javadoc | false |
getFunctionNames | function getFunctionNames(functionDeclaration: ValidFunctionDeclaration): Node[] {
switch (functionDeclaration.kind) {
case SyntaxKind.FunctionDeclaration:
if (functionDeclaration.name) return [functionDeclaration.name];
// If the function declaration doesn't have a name, it shou... | Gets the symbol for the contextual type of the node if it is not a union or intersection. | typescript | src/services/refactors/convertParamsToDestructuredObject.ts | 704 | [
"functionDeclaration"
] | true | 4 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toString | @Override
public String toString() {
return MoreObjects.toStringHelper(this).add("source", source).add("event", event).toString();
} | Returns the wrapped, 'dead' event, which the system was unable to deliver to any registered
subscriber.
@return the 'dead' event that could not be delivered. | java | android/guava/src/com/google/common/eventbus/DeadEvent.java | 66 | [] | String | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false |
canAcquire | private boolean canAcquire(long nowMicros, long timeoutMicros) {
return queryEarliestAvailable(nowMicros) - timeoutMicros <= nowMicros;
} | Acquires the given number of permits from this {@code RateLimiter} if it can be obtained
without exceeding the specified {@code timeout}, or returns {@code false} immediately (without
waiting) if the permits would not have been granted before the timeout expired.
@param permits the number of permits to acquire
@param t... | java | android/guava/src/com/google/common/util/concurrent/RateLimiter.java | 428 | [
"nowMicros",
"timeoutMicros"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
getRelatedCauses | public Throwable @Nullable [] getRelatedCauses() {
if (this.relatedCauses == null) {
return null;
}
return this.relatedCauses.toArray(new Throwable[0]);
} | Return the related causes, if any.
@return the array of related causes, or {@code null} if none | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java | 149 | [] | true | 2 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
invokeExactStaticMethod | public static Object invokeExactStaticMethod(final Class<?> cls, final String methodName, final Object... args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
final Object[] actuals = ArrayUtils.nullToEmpty(args);
return invokeExactStaticMethod(cls, methodN... | Invokes a {@code static} method whose parameter types match exactly the object types.
<p>
This uses reflection to invoke the method obtained from a call to {@link #getAccessibleMethod(Class, String, Class[])}.
</p>
@param cls invoke static method on this class.
@param methodName get method with this name.
@param... | java | src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | 660 | [
"cls",
"methodName"
] | Object | true | 1 | 6.24 | apache/commons-lang | 2,896 | javadoc | false |
processImports | private void processImports(ConfigurationClass configClass, SourceClass currentSourceClass,
Collection<SourceClass> importCandidates, Predicate<String> filter, boolean checkForCircularImports) {
if (importCandidates.isEmpty()) {
return;
}
if (checkForCircularImports && isChainedImportOnStack(configClass))... | Recursively collect all declared {@code @Import} values. Unlike most
meta-annotations it is valid to have several {@code @Import}s declared with
different values; the usual process of returning values from the first
meta-annotation on a class is not sufficient.
<p>For example, it is common for a {@code @Configuration} ... | java | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java | 579 | [
"configClass",
"currentSourceClass",
"importCandidates",
"filter",
"checkForCircularImports"
] | void | true | 12 | 6.64 | spring-projects/spring-framework | 59,386 | javadoc | false |
becomeSubsumedInto | private void becomeSubsumedInto(CloseableList otherCloseables) {
checkAndUpdateState(OPEN, SUBSUMED);
otherCloseables.add(closeables, directExecutor());
} | Attempts to cancel execution of this step. This attempt will fail if the step has already
completed, has already been cancelled, or could not be cancelled for some other reason. If
successful, and this step has not started when {@code cancel} is called, this step should never
run.
<p>If successful, causes the objects c... | java | android/guava/src/com/google/common/util/concurrent/ClosingFuture.java | 1,108 | [
"otherCloseables"
] | void | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false |
make_ktc_generator | def make_ktc_generator(
template: Union[KernelTemplate, ExternKernelChoice],
cs: Generator[KernelTemplateParams, None, None],
extra_kwargs: dict[str, Any],
overrides: dict[str, Any],
layout: Layout,
inputs: KernelInputs,
) -> Generator[KernelTemplateChoice, None, None]:
"""
Create a gene... | Create a generator of KernelTemplateChoice objects for a given template.
Args:
template: The template object (KernelTemplate or ExternKernelChoice)
cs: Generator of KernelTemplateParams from template heuristic
overrides: Override kwargs for the template
layout: Layout value for the template
inputs:... | python | torch/_inductor/kernel_template_choice.py | 67 | [
"template",
"cs",
"extra_kwargs",
"overrides",
"layout",
"inputs"
] | Generator[KernelTemplateChoice, None, None] | true | 2 | 6.24 | pytorch/pytorch | 96,034 | google | false |
is_multi_agg_with_relabel | def is_multi_agg_with_relabel(**kwargs) -> bool:
"""
Check whether kwargs passed to .agg look like multi-agg with relabeling.
Parameters
----------
**kwargs : dict
Returns
-------
bool
Examples
--------
>>> is_multi_agg_with_relabel(a="max")
False
>>> is_multi_agg_... | Check whether kwargs passed to .agg look like multi-agg with relabeling.
Parameters
----------
**kwargs : dict
Returns
-------
bool
Examples
--------
>>> is_multi_agg_with_relabel(a="max")
False
>>> is_multi_agg_with_relabel(a_max=("a", "max"), a_min=("a", "min"))
True
>>> is_multi_agg_with_relabel()
False | python | pandas/core/apply.py | 1,799 | [] | bool | true | 3 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false |
documentation | public abstract String documentation(); | Documentation of the Type.
@return details about valid values, representation | java | clients/src/main/java/org/apache/kafka/common/protocol/types/Type.java | 112 | [] | String | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
reverse | public static void reverse(final byte[] array) {
if (array != null) {
reverse(array, 0, array.length);
}
} | Reverses the order of the given array.
<p>
This method does nothing for a {@code null} input array.
</p>
@param array the array to reverse, may be {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,388 | [
"array"
] | void | true | 2 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
is_scalar_nan | def is_scalar_nan(x):
"""Test if x is NaN.
This function is meant to overcome the issue that np.isnan does not allow
non-numerical types as input, and that np.nan is not float('nan').
Parameters
----------
x : any type
Any scalar value.
Returns
-------
bool
Returns... | Test if x is NaN.
This function is meant to overcome the issue that np.isnan does not allow
non-numerical types as input, and that np.nan is not float('nan').
Parameters
----------
x : any type
Any scalar value.
Returns
-------
bool
Returns true if x is NaN, and false otherwise.
Examples
--------
>>> import... | python | sklearn/utils/_missing.py | 9 | [
"x"
] | false | 3 | 7.2 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_get_dependency_info | def _get_dependency_info() -> dict[str, JSONSerializable]:
"""
Returns dependency information as a JSON serializable dictionary.
"""
deps = [
"pandas",
# required
"numpy",
"dateutil",
# install / build,
"pip",
"Cython",
# docs
"sphi... | Returns dependency information as a JSON serializable dictionary. | python | pandas/util/_print_versions.py | 63 | [] | dict[str, JSONSerializable] | true | 4 | 6.4 | pandas-dev/pandas | 47,362 | unknown | false |
predict | def predict(self, X):
"""Predict the first class seen in `classes_`.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The input data.
Returns
-------
preds : ndarray of shape (n_samples,)
Predictions of the first clas... | Predict the first class seen in `classes_`.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The input data.
Returns
-------
preds : ndarray of shape (n_samples,)
Predictions of the first class seen in `classes_`. | python | sklearn/utils/_mocking.py | 242 | [
"self",
"X"
] | false | 3 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_reduce | def _reduce(
self, name: str, *, skipna: bool = True, keepdims: bool = False, **kwargs
):
"""
Return a scalar result of performing the reduction operation.
Parameters
----------
name : str
Name of the function, supported values are:
{ any, all... | Return a scalar result of performing the reduction operation.
Parameters
----------
name : str
Name of the function, supported values are:
{ any, all, min, max, sum, mean, median, prod,
std, var, sem, kurt, skew }.
skipna : bool, default True
If True, skip NaN values.
**kwargs
Additional keyword ar... | python | pandas/core/arrays/arrow/array.py | 2,105 | [
"self",
"name",
"skipna",
"keepdims"
] | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
create_activation_checkpointing_logging_structure_payload | def create_activation_checkpointing_logging_structure_payload(
joint_graph: Graph,
joint_graph_node_information: dict[str, Any],
joint_graph_edges: list[tuple[str, str]],
all_recomputable_banned_nodes: list[Node],
expected_runtime: float,
saved_node_idxs: list[int],
recomputable_node_idxs: l... | Creates a structured payload for logging activation checkpointing information.
Args:
joint_graph: The computational graph representing operations.
joint_graph_node_information: Dictionary containing information about nodes in the joint graph.
joint_graph_edges: List of edges in the joint graph represented ... | python | torch/_functorch/_activation_checkpointing/ac_logging_utils.py | 55 | [
"joint_graph",
"joint_graph_node_information",
"joint_graph_edges",
"all_recomputable_banned_nodes",
"expected_runtime",
"saved_node_idxs",
"recomputable_node_idxs",
"memories_banned_nodes",
"normalized_memories_banned_nodes",
"runtimes_banned_nodes",
"min_cut_saved_values"
] | dict[str, Any] | true | 1 | 6.16 | pytorch/pytorch | 96,034 | google | false |
setProducerState | public void setProducerState(long producerId, short producerEpoch, int baseSequence, boolean isTransactional) {
if (isClosed()) {
// Sequence numbers are assigned when the batch is closed while the accumulator is being drained.
// If the resulting ProduceRequest to the partition leader f... | Return the sum of the size of the batch header (always uncompressed) and the records (before compression). | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java | 308 | [
"producerId",
"producerEpoch",
"baseSequence",
"isTransactional"
] | void | true | 2 | 6 | apache/kafka | 31,560 | javadoc | false |
load | static CliToolProvider load(Map<String, String> sysprops, String toolname, String libs) {
Path homeDir = Paths.get(sysprops.get("es.path.home")).toAbsolutePath();
final ClassLoader cliLoader;
if (libs.isBlank()) {
cliLoader = ClassLoader.getSystemClassLoader();
} else {
... | Loads a tool provider from the Elasticsearch distribution.
@param sysprops the system properties of the CLI process
@param toolname the name of the tool to load
@param libs the library directories to load, relative to the Elasticsearch homedir
@return the instance of the loaded tool
@throws AssertionError if the given ... | java | libs/cli/src/main/java/org/elasticsearch/cli/CliToolProvider.java | 53 | [
"sysprops",
"toolname",
"libs"
] | CliToolProvider | true | 4 | 7.76 | elastic/elasticsearch | 75,680 | javadoc | false |
releaseAll | private void releaseAll() {
IOException exceptionChain = null;
exceptionChain = releaseInflators(exceptionChain);
exceptionChain = releaseInputStreams(exceptionChain);
exceptionChain = releaseZipContent(exceptionChain);
exceptionChain = releaseZipContentForManifest(exceptionChain);
if (exceptionChain != nul... | Called by the {@link Cleaner} to free resources.
@see java.lang.Runnable#run() | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFileResources.java | 156 | [] | void | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Options other = (Options) obj;
return this.options.equals(other.options);
} | Returns if the given option is contained in this set.
@param option the option to check
@return {@code true} of the option is present | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java | 201 | [
"obj"
] | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
of | static PemSslStore of(@Nullable String type, @Nullable String alias, @Nullable String password,
List<X509Certificate> certificates, @Nullable PrivateKey privateKey) {
Assert.notEmpty(certificates, "'certificates' must not be empty");
return new PemSslStore() {
@Override
public @Nullable String type() {
... | Factory method that can be used to create a new {@link PemSslStore} with the given
values.
@param type the key store type
@param alias the alias used when setting entries in the {@link KeyStore}
@param password the password used
{@link KeyStore#setKeyEntry(String, java.security.Key, char[], java.security.cert.Certifica... | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStore.java | 157 | [
"type",
"alias",
"password",
"certificates",
"privateKey"
] | PemSslStore | true | 1 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
getSourceDirFromTypeScriptConfig | function getSourceDirFromTypeScriptConfig(): string | undefined {
const tsconfig = getTsconfig()
if (!tsconfig) {
return undefined
}
const { config } = tsconfig
return config.compilerOptions?.rootDir ?? config.compilerOptions?.baseUrl ?? config.compilerOptions?.rootDirs?.[0]
} | Determines the absolute path to the source directory. | typescript | packages/cli/src/utils/client-output-path.ts | 45 | [] | true | 2 | 6.88 | prisma/prisma | 44,834 | jsdoc | false | |
onHeartbeatFailure | public void onHeartbeatFailure(boolean retriable) {
if (!retriable) {
metricsManager.maybeRecordRebalanceFailed();
}
// The leave group request is sent out once (not retried), so we should complete the leave
// operation once the request completes, regardless of the response.... | Notify the member that an error heartbeat response was received.
@param retriable True if the request failed with a retriable error. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 301 | [
"retriable"
] | void | true | 4 | 7.04 | apache/kafka | 31,560 | javadoc | false |
readShort | @CanIgnoreReturnValue // to skip some bytes
@Override
public short readShort() throws IOException {
return (short) readUnsignedShort();
} | Reads a {@code short} as specified by {@link DataInputStream#readShort()}, except using
little-endian byte order.
@return the next two bytes of the input stream, interpreted as a {@code short} in little-endian
byte order.
@throws IOException if an I/O error occurs. | java | android/guava/src/com/google/common/io/LittleEndianDataInputStream.java | 190 | [] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
loadAll | public Map<K, V> loadAll(Iterable<? extends K> keys) throws Exception {
// This will be caught by getAll(), causing it to fall back to multiple calls to
// LoadingCache.get
throw new UnsupportedLoadingOperationException();
} | Computes or retrieves the values corresponding to {@code keys}. This method is called by {@link
LoadingCache#getAll}.
<p>If the returned map doesn't contain all requested {@code keys} then the entries it does
contain will be cached, but {@code getAll} will throw an exception. If the returned map
contains extra keys not... | java | android/guava/src/com/google/common/cache/CacheLoader.java | 125 | [
"keys"
] | true | 1 | 6.88 | google/guava | 51,352 | javadoc | false | |
getPermissionModelFlagsToCopy | function getPermissionModelFlagsToCopy() {
if (permissionModelFlagsToCopy === undefined) {
permissionModelFlagsToCopy = [...permission.availableFlags(), '--permission'];
}
return permissionModelFlagsToCopy;
} | Spawns the specified file as a shell.
@param {string} file
@param {string[]} [args]
@param {{
cwd?: string | URL;
env?: Record<string, string>;
encoding?: string;
timeout?: number;
maxBuffer?: number;
killSignal?: string | number;
uid?: number;
gid?: number;
windowsHide?: boolean;
windowsVerbatimArg... | javascript | lib/child_process.js | 543 | [] | false | 2 | 6.8 | nodejs/node | 114,839 | jsdoc | false | |
owners | public List<KafkaPrincipal> owners() {
return owners;
} | If owners is null, all the user owned tokens and tokens where user have Describe permission
will be returned.
@param owners The owners that we want to describe delegation tokens for
@return this instance | java | clients/src/main/java/org/apache/kafka/clients/admin/DescribeDelegationTokenOptions.java | 41 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
copyInto | @CanIgnoreReturnValue
public final <C extends Collection<? super E>> C copyInto(C collection) {
checkNotNull(collection);
Iterable<E> iterable = getDelegate();
if (iterable instanceof Collection) {
collection.addAll((Collection<E>) iterable);
} else {
for (E item : iterable) {
coll... | Copies all the elements from this fluent iterable to {@code collection}. This is equivalent to
calling {@code Iterables.addAll(collection, this)}.
<p><b>{@code Stream} equivalent:</b> {@code stream.forEachOrdered(collection::add)} or {@code
stream.forEach(collection::add)}.
@param collection the collection to copy elem... | java | android/guava/src/com/google/common/collect/FluentIterable.java | 801 | [
"collection"
] | C | true | 2 | 7.44 | google/guava | 51,352 | javadoc | false |
joining | public static Collector<Object, ?, String> joining(final CharSequence delimiter, final CharSequence prefix, final CharSequence suffix) {
return joining(delimiter, prefix, suffix, Objects::toString);
} | Returns a {@code Collector} that concatenates the input elements, separated by the specified delimiter, with the
specified prefix and suffix, in encounter order.
<p>
This is a variation of {@link Collectors#joining(CharSequence, CharSequence, CharSequence)} that works with any
element class, not just {@code CharSequenc... | java | src/main/java/org/apache/commons/lang3/stream/LangCollectors.java | 181 | [
"delimiter",
"prefix",
"suffix"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
count | def count(self, numeric_only: bool = False):
"""
Calculate the rolling count of non NaN observations.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
-------
Series or DataFrame
... | Calculate the rolling count of non NaN observations.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
-------
Series or DataFrame
Return type is the same as the original object with ``np.float64`` dtype.
See Also
--------
Series.rolling : Calling roll... | python | pandas/core/window/rolling.py | 2,122 | [
"self",
"numeric_only"
] | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false | |
is_keys_unchanged | def is_keys_unchanged(self, current_objects: set[str]) -> bool:
"""
Check for new objects after the inactivity_period and update the sensor state accordingly.
:param current_objects: set of object ids in bucket during last poke.
"""
current_num_objects = len(current_objects)
... | Check for new objects after the inactivity_period and update the sensor state accordingly.
:param current_objects: set of object ids in bucket during last poke. | python | providers/amazon/src/airflow/providers/amazon/aws/sensors/s3.py | 303 | [
"self",
"current_objects"
] | bool | true | 8 | 6.96 | apache/airflow | 43,597 | sphinx | false |
contains | @Override
boolean contains(@Nullable Object element); | Determines whether this multiset contains the specified element.
<p>This method refines {@link Collection#contains} to further specify that it <b>may not</b>
throw an exception in response to {@code element} being null or of the wrong type.
@param element the element to check for
@return {@code true} if this multiset c... | java | android/guava/src/com/google/common/collect/Multiset.java | 388 | [
"element"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
add | protected void add(char[] cbuf, int off, int len) throws IOException {
int pos = off;
if (sawReturn && len > 0) {
// Last call to add ended with a CR; we can handle the line now.
if (finishLine(cbuf[pos] == '\n')) {
pos++;
}
}
int start = pos;
for (int end = off + len; pos... | Process additional characters from the stream. When a line separator is found the contents of
the line and the line separator itself are passed to the abstract {@link #handleLine} method.
@param cbuf the character buffer to process
@param off the offset into the buffer
@param len the number of characters to process
@th... | java | android/guava/src/com/google/common/io/LineBuffer.java | 52 | [
"cbuf",
"off",
"len"
] | void | true | 7 | 6.72 | google/guava | 51,352 | javadoc | false |
generateCodeForInaccessibleConstructor | private CodeBlock generateCodeForInaccessibleConstructor(ConstructorDescriptor descriptor,
Consumer<ReflectionHints> hints) {
Constructor<?> constructor = descriptor.constructor();
CodeWarnings codeWarnings = new CodeWarnings();
codeWarnings.detectDeprecation(constructor.getDeclaringClass(), constructor)
... | Generate the instance supplier code.
@param registeredBean the bean to handle
@param instantiationDescriptor the executable to use to create the bean
@return the generated code
@since 6.1.7 | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java | 198 | [
"descriptor",
"hints"
] | CodeBlock | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
doBackward | @ForOverride
protected abstract A doBackward(B b); | Returns a representation of {@code b} as an instance of type {@code A}. If {@code b} cannot be
converted, an unchecked exception (such as {@link IllegalArgumentException}) should be thrown.
@param b the instance to convert; will never be null
@return the converted instance; <b>must not</b> be null
@throws UnsupportedOp... | java | android/guava/src/com/google/common/base/Converter.java | 186 | [
"b"
] | A | true | 1 | 6 | google/guava | 51,352 | javadoc | false |
distance | private static int distance(final Class<?>[] fromClassArray, final Class<?>[] toClassArray) {
int answer = 0;
if (!ClassUtils.isAssignable(fromClassArray, toClassArray, true)) {
return -1;
}
for (int offset = 0; offset < fromClassArray.length; offset++) {
// Note ... | Computes the aggregate number of inheritance hops between assignable argument class types. Returns -1
if the arguments aren't assignable. Fills a specific purpose for getMatchingMethod and is not generalized.
@param fromClassArray the Class array to calculate the distance from.
@param toClassArray the Class array to ... | java | src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | 80 | [
"fromClassArray",
"toClassArray"
] | true | 7 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
getTypeArguments | private static Map<TypeVariable<?>, Type> getTypeArguments(final ParameterizedType parameterizedType, final Class<?> toClass,
final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
final Class<?> cls = getRawType(parameterizedType);
// make sure they're assignable
if (!isAssignable(cl... | Gets a map of the type arguments of a parameterized type in the context of {@code toClass}.
@param parameterizedType the parameterized type.
@param toClass the class.
@param subtypeVarAssigns a map with type variables.
@return the {@link Map} with type arguments. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 813 | [
"parameterizedType",
"toClass",
"subtypeVarAssigns"
] | true | 6 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
left_shift | def left_shift(a, n):
"""
Shift the bits of an integer to the left.
This is the masked array version of `numpy.left_shift`, for details
see that function.
See Also
--------
numpy.left_shift
Examples
--------
Shift with a masked array:
>>> arr = np.ma.array([10, 20, 30], m... | Shift the bits of an integer to the left.
This is the masked array version of `numpy.left_shift`, for details
see that function.
See Also
--------
numpy.left_shift
Examples
--------
Shift with a masked array:
>>> arr = np.ma.array([10, 20, 30], mask=[False, True, False])
>>> np.ma.left_shift(arr, 1)
masked_array(da... | python | numpy/ma/core.py | 7,409 | [
"a",
"n"
] | false | 3 | 6.16 | numpy/numpy | 31,054 | unknown | false | |
doGetBundle | protected ResourceBundle doGetBundle(String basename, Locale locale) throws MissingResourceException {
ClassLoader classLoader = getBundleClassLoader();
Assert.state(classLoader != null, "No bundle ClassLoader set");
MessageSourceControl control = this.control;
if (control != null) {
try {
return Resour... | Obtain the resource bundle for the given basename and Locale.
@param basename the basename to look for
@param locale the Locale to look for
@return the corresponding ResourceBundle
@throws MissingResourceException if no matching bundle could be found
@see java.util.ResourceBundle#getBundle(String, Locale, ClassLoader)
... | java | spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java | 230 | [
"basename",
"locale"
] | ResourceBundle | true | 5 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
handleApiVersionsResponse | private void handleApiVersionsResponse(List<ClientResponse> responses,
InFlightRequest req, long now, ApiVersionsResponse apiVersionsResponse) {
final String node = req.destination;
if (apiVersionsResponse.data().errorCode() != Errors.NONE.code()) {
... | Handle any completed receives and update the response list with the responses received.
@param responses The list of responses to update
@param now The current time | java | clients/src/main/java/org/apache/kafka/clients/NetworkClient.java | 1,023 | [
"responses",
"req",
"now",
"apiVersionsResponse"
] | void | true | 6 | 7.04 | apache/kafka | 31,560 | javadoc | false |
trimmed | public ImmutableLongArray trimmed() {
return isPartialView() ? new ImmutableLongArray(toArray()) : this;
} | Returns an immutable array containing the same values as {@code this} array. This is logically
a no-op, and in some circumstances {@code this} itself is returned. However, if this instance
is a {@link #subArray} view of a larger array, this method will copy only the appropriate range
of values, resulting in an equivale... | java | android/guava/src/com/google/common/primitives/ImmutableLongArray.java | 634 | [] | ImmutableLongArray | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false |
_apply_defaults_to_encoded_op | def _apply_defaults_to_encoded_op(
cls,
encoded_op: dict[str, Any],
client_defaults: dict[str, Any] | None = None,
) -> dict[str, Any]:
"""
Apply client defaults to encoded operator before deserialization.
Args:
encoded_op: The serialized operator data (a... | Apply client defaults to encoded operator before deserialization.
Args:
encoded_op: The serialized operator data (already includes applied default_args)
client_defaults: SDK-specific defaults from client_defaults section
Note: DAG default_args are already applied during task creation in the SDK,
so encoded_op... | python | airflow-core/src/airflow/serialization/serialized_objects.py | 2,050 | [
"cls",
"encoded_op",
"client_defaults"
] | dict[str, Any] | true | 2 | 6.4 | apache/airflow | 43,597 | google | false |
appendln | public StrBuilder appendln(final StringBuffer str, final int startIndex, final int length) {
return append(str, startIndex, length).appendNewLine();
} | Appends part of a string buffer followed by a new line to this string builder.
Appending null will call {@link #appendNull()}.
@param str the string to append
@param startIndex the start index, inclusive, must be valid
@param length the length to append, must be valid
@return {@code this} instance.
@since 2.3 | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,118 | [
"str",
"startIndex",
"length"
] | StrBuilder | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
partitionCUs | static CUPartitionVector partitionCUs(DWARFContext &DwCtx) {
CUPartitionVector Vec(2);
unsigned Counter = 0;
const DWARFDebugAbbrev *Abbr = DwCtx.getDebugAbbrev();
for (std::unique_ptr<DWARFUnit> &CU : DwCtx.compile_units()) {
Expected<const DWARFAbbreviationDeclarationSet *> AbbrDeclSet =
Abbr->get... | as a source are put in to the same initial bucket. | cpp | bolt/lib/Rewrite/DWARFRewriter.cpp | 547 | [] | true | 8 | 6.88 | llvm/llvm-project | 36,021 | doxygen | false | |
filteredDuration | public long filteredDuration() {
return filteredDuration;
} | Returns the duration ms value being filtered.
@return the current duration filter value in ms (negative value means transactions are not filtered by duration) | java | clients/src/main/java/org/apache/kafka/clients/admin/ListTransactionsOptions.java | 112 | [] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
getOutputPathsForBundle | function getOutputPathsForBundle(options: CompilerOptions, forceDtsPaths: boolean): EmitFileNames {
const outPath = options.outFile!;
const jsFilePath = options.emitDeclarationOnly ? undefined : outPath;
const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
const declara... | Iterates over the source files that are expected to have an emit output.
@param host An EmitHost.
@param action The action to execute.
@param sourceFilesOrTargetSourceFile
If an array, the full list of source files to emit.
Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine... | typescript | src/compiler/emitter.ts | 506 | [
"options",
"forceDtsPaths"
] | true | 7 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
shouldHandle | @Contract("_, null -> false")
private boolean shouldHandle(ApplicationEvent event, @Nullable Object @Nullable [] args) {
if (args == null) {
return false;
}
String condition = getCondition();
if (StringUtils.hasText(condition)) {
Assert.notNull(this.evaluator, "EventExpressionEvaluator must not be null")... | Determine whether the listener method would actually handle the given
event, checking if the condition matches.
@param event the event to process through the listener method
@since 6.1 | java | spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java | 272 | [
"event",
"args"
] | true | 3 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
topDomainUnderRegistrySuffix | public InternetDomainName topDomainUnderRegistrySuffix() {
if (isTopDomainUnderRegistrySuffix()) {
return this;
}
checkState(isUnderRegistrySuffix(), "Not under a registry suffix: %s", name);
return ancestor(registrySuffixIndex() - 1);
} | Returns the portion of this domain name that is one level beneath the {@linkplain
#isRegistrySuffix() registry suffix}. For example, for {@code x.adwords.google.co.uk} it
returns {@code google.co.uk}, since {@code co.uk} is a registry suffix. Similarly, for {@code
myblog.blogspot.com} it returns {@code blogspot.com}, s... | java | android/guava/src/com/google/common/net/InternetDomainName.java | 562 | [] | InternetDomainName | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false |
addAll | @CanIgnoreReturnValue
@Override
public Builder<E> addAll(Iterable<? extends E> elements) {
if (elements instanceof Multiset) {
for (Entry<? extends E> entry : ((Multiset<? extends E>) elements).entrySet()) {
addCopies(entry.getElement(), entry.getCount());
}
} else {
... | Adds each element of {@code elements} to the {@code ImmutableSortedMultiset}.
@param elements the {@code Iterable} to add to the {@code ImmutableSortedMultiset}
@return this {@code Builder} object
@throws NullPointerException if {@code elements} is null or contains a null element | java | android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 637 | [
"elements"
] | true | 2 | 7.28 | google/guava | 51,352 | javadoc | false | |
getComponentType | public final @Nullable TypeToken<?> getComponentType() {
Type componentType = Types.getComponentType(runtimeType);
if (componentType == null) {
return null;
}
return of(componentType);
} | Returns the array component type if this type represents an array ({@code int[]}, {@code T[]},
{@code <? extends Map<String, Integer>[]>} etc.), or else {@code null} is returned. | java | android/guava/src/com/google/common/reflect/TypeToken.java | 585 | [] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
batchesFrom | public Iterable<FileChannelRecordBatch> batchesFrom(final int start) {
return () -> batchIterator(start);
} | Get an iterator over the record batches in the file, starting at a specific position. This is similar to
{@link #batches()} except that callers specify a particular position to start reading the batches from. This
method must be used with caution: the start position passed in must be a known start of a batch.
@param st... | java | clients/src/main/java/org/apache/kafka/common/record/FileRecords.java | 425 | [
"start"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
containsNarrowableReference | function containsNarrowableReference(expr: Expression): boolean {
return isNarrowableReference(expr) || isOptionalChain(expr) && containsNarrowableReference(expr.expression);
} | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 1,289 | [
"expr"
] | true | 3 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
maybeSetInitializationError | private void maybeSetInitializationError(KafkaException error) {
if (initializationError.compareAndSet(null, error))
return;
log.error("Consumer network thread resource initialization error ({}) will be suppressed as an error was already set", error.getMessage(), error);
} | Start the network thread and let it complete its initialization before proceeding. The
{@link ClassicKafkaConsumer} constructor blocks during creation of its {@link NetworkClient}, providing
precedent for waiting here.
In certain cases (e.g. an invalid {@link LoginModule} in {@link SaslConfigs#SASL_JAAS_CONFIG}), an er... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java | 175 | [
"error"
] | void | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
matches | boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata); | Determine if the condition matches.
@param context the condition context
@param metadata the metadata of the {@link org.springframework.core.type.AnnotationMetadata class}
or {@link org.springframework.core.type.MethodMetadata method} being checked
@return {@code true} if the condition matches and the component can be ... | java | spring-context/src/main/java/org/springframework/context/annotation/Condition.java | 59 | [
"context",
"metadata"
] | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
geoToH3 | public static long geoToH3(double lat, double lng, int res) {
checkResolution(res);
return Vec3d.geoToH3(res, toRadians(lat), toRadians(lng));
} | Find the H3 index of the resolution <code>res</code> cell containing the lat/lon (in degrees)
@param lat Latitude in degrees.
@param lng Longitude in degrees.
@param res Resolution, 0 <= res <= 15
@return The H3 index.
@throws IllegalArgumentException latitude, longitude, or resolution are out of range. | java | libs/h3/src/main/java/org/elasticsearch/h3/H3.java | 201 | [
"lat",
"lng",
"res"
] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
newReader | public static BufferedReader newReader(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
} | Returns a buffered reader that reads from a file using the given character set.
<p><b>{@link java.nio.file.Path} equivalent:</b> {@link
java.nio.file.Files#newBufferedReader(java.nio.file.Path, Charset)}.
@param file the file to read from
@param charset the charset used to decode the input stream; see {@link StandardCh... | java | android/guava/src/com/google/common/io/Files.java | 86 | [
"file",
"charset"
] | BufferedReader | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false |
nonNull | public static <E> Stream<E> nonNull(final E array) {
return nonNull(streamOf(array));
} | Streams the non-null element.
@param <E> the type of elements in the collection.
@param array the element to stream or null.
@return A non-null stream that filters out a null element.
@since 3.15.0 | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 638 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
round | def round(self, decimals=0, out=None):
"""
Return each element rounded to the given number of decimals.
Refer to `numpy.around` for full documentation.
See Also
--------
numpy.ndarray.round : corresponding function for ndarrays
numpy.around : equivalent function... | Return each element rounded to the given number of decimals.
Refer to `numpy.around` for full documentation.
See Also
--------
numpy.ndarray.round : corresponding function for ndarrays
numpy.around : equivalent function
Examples
--------
>>> import numpy as np
>>> import numpy.ma as ma
>>> x = ma.array([1.35, 2.5, 1... | python | numpy/ma/core.py | 5,568 | [
"self",
"decimals",
"out"
] | false | 5 | 6.48 | numpy/numpy | 31,054 | unknown | false | |
createIfAbsentUnchecked | public static <K, V> V createIfAbsentUnchecked(final ConcurrentMap<K, V> map,
final K key, final ConcurrentInitializer<V> init) {
try {
return createIfAbsent(map, key, init);
} catch (final ConcurrentException cex) {
throw new ConcurrentRuntimeException(cex.getCause()... | Checks if a concurrent map contains a key and creates a corresponding
value if not, suppressing checked exceptions. This method calls
{@code createIfAbsent()}. If a {@link ConcurrentException} is thrown, it
is caught and re-thrown as a {@link ConcurrentRuntimeException}.
@param <K> the type of the keys of the map
@para... | java | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | 179 | [
"map",
"key",
"init"
] | V | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
writeHeader | private void writeHeader() throws IOException {
ByteUtils.writeUnsignedIntLE(buffer, 0, MAGIC);
bufferOffset = 4;
buffer[bufferOffset++] = flg.toByte();
buffer[bufferOffset++] = bd.toByte();
// TODO write uncompressed content size, update flg.validate()
// compute checks... | Writes the magic number and frame descriptor to the underlying {@link OutputStream}.
@throws IOException | java | clients/src/main/java/org/apache/kafka/common/compress/Lz4BlockOutputStream.java | 120 | [] | void | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
unicodeEscaped | public static String unicodeEscaped(final Character ch) {
return ch != null ? unicodeEscaped(ch.charValue()) : null;
} | Converts the string to the Unicode format '\u0020'.
<p>This format is the Java source code format.</p>
<p>If {@code null} is passed in, {@code null} will be returned.</p>
<pre>
CharUtils.unicodeEscaped(null) = null
CharUtils.unicodeEscaped(' ') = "\u0020"
CharUtils.unicodeEscaped('A') = "\u0041"
</pre>
@param c... | java | src/main/java/org/apache/commons/lang3/CharUtils.java | 534 | [
"ch"
] | String | true | 2 | 7.68 | apache/commons-lang | 2,896 | javadoc | false |
executeQueryRaw | async function executeQueryRaw(executor: Statements, params: SqlQuery): Promise<SqlResultSet> {
const { sql, args } = params
try {
const convertedArgs = convertArgs(args, params.argTypes)
const result = await executor.query(sql, ...convertedArgs)
// Collect all rows - the driver adapter interface requ... | Executes a raw SQL query and returns the result set. | typescript | packages/adapter-ppg/src/ppg.ts | 205 | [
"executor",
"params"
] | true | 2 | 6 | prisma/prisma | 44,834 | jsdoc | true | |
runKernel | int runKernel( InputArray _m1, InputArray _m2, OutputArray _model ) const CV_OVERRIDE
{
Mat m1 = _m1.getMat(), m2 = _m2.getMat();
int i, count = m1.checkVector(2);
const Point2f* M = m1.ptr<Point2f>();
const Point2f* m = m2.ptr<Point2f>();
double LtL[9][9], W[9][1], V[9][9];... | Normalization method:
- $x$ and $y$ coordinates are normalized independently
- first the coordinates are shifted so that the average coordinate is \f$(0,0)\f$
- then the coordinates are scaled so that the average L1 norm is 1, i.e,
the average L1 norm of the \f$x\f$ coordinates is 1 and the average
L1 norm of the ... | cpp | modules/calib3d/src/fundam.cpp | 125 | [
"_m1",
"_m2",
"_model"
] | true | 10 | 6.4 | opencv/opencv | 85,374 | doxygen | false | |
validate_parse_dates_presence | def validate_parse_dates_presence(
parse_dates: bool | list, columns: Sequence[Hashable]
) -> set:
"""
Check if parse_dates are in columns.
If user has provided names for parse_dates, check if those columns
are available.
Parameters
----------
columns : list
List of names of th... | Check if parse_dates are in columns.
If user has provided names for parse_dates, check if those columns
are available.
Parameters
----------
columns : list
List of names of the dataframe.
Returns
-------
The names of the columns which will get parsed later if a list
is given as specification.
Raises
------
Valu... | python | pandas/io/parsers/base_parser.py | 875 | [
"parse_dates",
"columns"
] | set | true | 9 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
Program | Program(
const Context& context,
const VECTOR_CLASS<Device>& devices,
const STRING_CLASS& kernelNames,
cl_int* err = NULL)
{
cl_int error;
::size_t numDevices = devices.size();
cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id... | Create program using builtin kernels.
\param kernelNames Semi-colon separated list of builtin kernel names | cpp | 3rdparty/include/opencl/1.2/CL/cl.hpp | 4,779 | [] | true | 3 | 6.24 | opencv/opencv | 85,374 | doxygen | false | |
_set_categories | def _set_categories(self, categories, fastpath: bool = False) -> None:
"""
Sets new categories inplace
Parameters
----------
fastpath : bool, default False
Don't perform validation of the categories for uniqueness or nulls
Examples
--------
>>... | Sets new categories inplace
Parameters
----------
fastpath : bool, default False
Don't perform validation of the categories for uniqueness or nulls
Examples
--------
>>> c = pd.Categorical(["a", "b"])
>>> c
['a', 'b']
Categories (2, str): ['a', 'b']
>>> c._set_categories(pd.Index(["a", "c"]))
>>> c
['a', 'c']
Cat... | python | pandas/core/arrays/categorical.py | 939 | [
"self",
"categories",
"fastpath"
] | None | true | 6 | 7.52 | pandas-dev/pandas | 47,362 | numpy | false |
log_event_end | def log_event_end(
self,
event_name: str,
time_ns: int,
metadata: dict[str, Any],
start_time_ns: int,
log_pt2_compile_event: bool,
compile_id: Optional[CompileId] = None,
) -> None:
"""
Logs the end of a single event. This function should only ... | Logs the end of a single event. This function should only be
called after log_event_start with the same event_name.
:param event_name: Name of event to appear in trace
:param time_ns: Timestamp in nanoseconds
:param metadata: Any extra metadata associated with this event
:param start_time_ns: The start time timestamp i... | python | torch/_dynamo/utils.py | 1,960 | [
"self",
"event_name",
"time_ns",
"metadata",
"start_time_ns",
"log_pt2_compile_event",
"compile_id"
] | None | true | 7 | 6.64 | pytorch/pytorch | 96,034 | sphinx | false |
max | @ParametricNullness
public static <T extends @Nullable Object> T max(
@ParametricNullness T a, @ParametricNullness T b, Comparator<? super T> comparator) {
return (comparator.compare(a, b) >= 0) ? a : b;
} | Returns the maximum of the two values, according to the given comparator. If the values compare
as equal, the first is returned.
<p>The recommended solution for finding the {@code maximum} of some values depends on the type
of your data and the number of elements you have. Read more in the Guava User Guide article on
<... | java | android/guava/src/com/google/common/collect/Comparators.java | 279 | [
"a",
"b",
"comparator"
] | T | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false |
difference | public static String difference(final String str1, final String str2) {
if (str1 == null) {
return str2;
}
if (str2 == null) {
return str1;
}
final int at = indexOfDifference(str1, str2);
if (at == INDEX_NOT_FOUND) {
return EMPTY;
... | Compares two Strings, and returns the portion where they differ. More precisely, return the remainder of the second String, starting from where it's
different from the first. This means that the difference between "abc" and "ab" is the empty String and not "c".
<p>
For example, {@code difference("i am a machine", "i am... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 1,664 | [
"str1",
"str2"
] | String | true | 4 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
undefinedDependentConfigs | private List<String> undefinedDependentConfigs() {
Set<String> undefinedConfigKeys = new HashSet<>();
for (ConfigKey configKey : configKeys.values()) {
for (String dependent: configKey.dependents) {
if (!configKeys.containsKey(dependent)) {
undefinedConfig... | Validate the current configuration values with the configuration definition.
@param props the current configuration values
@return List of Config, each Config contains the updated configuration information given
the current configuration values. | java | clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java | 603 | [] | true | 2 | 7.44 | apache/kafka | 31,560 | javadoc | false | |
getCandidateConfigurations | protected List<String> getCandidateConfigurations(AnnotationMetadata metadata,
@Nullable AnnotationAttributes attributes) {
ImportCandidates importCandidates = ImportCandidates.load(this.autoConfigurationAnnotation,
getBeanClassLoader());
List<String> configurations = importCandidates.getCandidates();
Asse... | Return the auto-configuration class names that should be considered. By default,
this method will load candidates using {@link ImportCandidates}.
@param metadata the source metadata
@param attributes the {@link #getAttributes(AnnotationMetadata) annotation
attributes}
@return a list of candidate configurations | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java | 200 | [
"metadata",
"attributes"
] | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
_versioned_config | def _versioned_config(
jk_name: str,
this_version: int,
oss_default: bool,
env_var_override: str | None = None,
) -> bool:
"""
A versioned configuration utility that determines boolean settings based on:
1. Environment variable override (highest priority)
2. JustKnobs version comparison ... | A versioned configuration utility that determines boolean settings based on:
1. Environment variable override (highest priority)
2. JustKnobs version comparison in fbcode environments
3. OSS default fallback
This function enables gradual rollouts of features in fbcode by comparing
a local version against a JustKnobs-c... | python | torch/_inductor/runtime/caching/config.py | 17 | [
"jk_name",
"this_version",
"oss_default",
"env_var_override"
] | bool | true | 5 | 7.6 | pytorch/pytorch | 96,034 | google | false |
compile_time_record_function | def compile_time_record_function(name: str) -> Generator[Any, None, None]:
"""
A context manager for compile-time profiling that uses _RecordFunctionFast
for lower overhead than torch.profiler.record_function.
This is intended for use during compilation (dynamo, inductor, etc.) where
we want profil... | A context manager for compile-time profiling that uses _RecordFunctionFast
for lower overhead than torch.profiler.record_function.
This is intended for use during compilation (dynamo, inductor, etc.) where
we want profiling support but with minimal overhead. Moreover, we do not
want the record_function call inside tor... | python | torch/_dynamo/utils.py | 669 | [
"name"
] | Generator[Any, None, None] | true | 3 | 6.24 | pytorch/pytorch | 96,034 | google | false |
instantiate | private Object instantiate(RegisteredBean registeredBean, Executable executable, @Nullable Object[] args) {
if (executable instanceof Constructor<?> constructor) {
if (registeredBean.getBeanFactory() instanceof DefaultListableBeanFactory dlbf &&
registeredBean.getMergedBeanDefinition().hasMethodOverrides()) {... | Resolve arguments for the specified registered bean.
@param registeredBean the registered bean
@return the resolved constructor or factory method arguments | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 345 | [
"registeredBean",
"executable",
"args"
] | Object | true | 8 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
isReusableVariableDeclaration | function isReusableVariableDeclaration(node: Node) {
if (node.kind !== SyntaxKind.VariableDeclaration) {
return false;
}
// Very subtle incremental parsing bug. Consider the following code:
//
// let v = new List < A, B
//
// This is ac... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 3,376 | [
"node"
] | false | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
addFormatters | private void addFormatters(DateTimeFormatters dateTimeFormatters) {
addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
if (JSR_354_PRESENT) {
addFormatter(new CurrencyUnitFormatter());
addFormatter(new MonetaryAmountFormatter());
addFormatterForFieldAnnotation(new Jsr354NumberFor... | Create a new WebConversionService that configures formatters with the provided
date, time, and date-time formats, or registers the default if no custom format is
provided.
@param dateTimeFormatters the formatters to use for date, time, and date-time
formatting
@since 2.3.0 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java | 65 | [
"dateTimeFormatters"
] | void | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.