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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hashCodeMulti | @Deprecated
public static int hashCodeMulti(final Object... objects) {
int hash = 1;
if (objects != null) {
for (final Object object : objects) {
final int tmpHash = Objects.hashCode(object);
hash = hash * 31 + tmpHash;
}
}
retu... | Gets the hash code for multiple objects.
<p>
This allows a hash code to be rapidly calculated for a number of objects. The hash code for a single object is the <em>not</em> same as
{@link #hashCode(Object)}. The hash code for multiple objects is the same as that calculated by an {@link ArrayList} containing the specifi... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 752 | [] | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
trace | def trace(x, /, *, offset=0, dtype=None):
"""
Returns the sum along the specified diagonals of a matrix
(or a stack of matrices) ``x``.
This function is Array API compatible, contrary to
:py:func:`numpy.trace`.
Parameters
----------
x : (...,M,N) array_like
Input array having s... | Returns the sum along the specified diagonals of a matrix
(or a stack of matrices) ``x``.
This function is Array API compatible, contrary to
:py:func:`numpy.trace`.
Parameters
----------
x : (...,M,N) array_like
Input array having shape (..., M, N) and whose innermost two
dimensions form MxN matrices.
offset ... | python | numpy/linalg/_linalg.py | 3,163 | [
"x",
"offset",
"dtype"
] | false | 1 | 6.24 | numpy/numpy | 31,054 | numpy | false | |
remove | @Override
public void remove() {
checkState(current != null, "no calls to next() since the last call to remove()");
if (current != next) { // after call to next()
previous = current.previousSibling;
nextIndex--;
} else { // after call to previous()
next = current.nextSiblin... | Constructs a new iterator over all values for the specified key starting at the specified
index. This constructor is optimized so that it starts at either the head or the tail,
depending on which is closer to the specified index. This allows adds to the tail to be done
in constant time.
@throws IndexOutOfBoundsExceptio... | java | android/guava/src/com/google/common/collect/LinkedListMultimap.java | 543 | [] | void | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
read_query | def read_query(
self,
sql: str,
index_col: str | list[str] | None = None,
coerce_float: bool = True,
parse_dates=None,
params=None,
chunksize: int | None = None,
dtype: DtypeArg | None = None,
dtype_backend: DtypeBackend | Literal["numpy"] = "numpy... | Read SQL query into a DataFrame.
Parameters
----------
sql : str
SQL query to be executed.
index_col : string, optional, default: None
Column name to use as index for the returned DataFrame object.
coerce_float : bool, default True
Raises NotImplementedError
params : list, tuple or dict, optional, default:... | python | pandas/io/sql.py | 2,253 | [
"self",
"sql",
"index_col",
"coerce_float",
"parse_dates",
"params",
"chunksize",
"dtype",
"dtype_backend"
] | DataFrame | Iterator[DataFrame] | true | 4 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
declaresInterruptedEx | private static boolean declaresInterruptedEx(Method method) {
for (Class<?> exType : method.getExceptionTypes()) {
// debate: == or isAssignableFrom?
if (exType == InterruptedException.class) {
return true;
}
}
return false;
} | Creates a TimeLimiter instance using the given executor service to execute method calls.
<p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
up, any time callers spend waiting for a thread may count toward their time limit, and in this
case the call may even time out before th... | java | android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java | 251 | [
"method"
] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
failure_message_from_response | def failure_message_from_response(response: dict[str, Any]) -> str | None:
"""
Get failure message from response dictionary.
:param response: response from AWS API
:return: failure message
"""
cluster_status = response["NotebookExecution"]
return cluster_status.g... | Get failure message from response dictionary.
:param response: response from AWS API
:return: failure message | python | providers/amazon/src/airflow/providers/amazon/aws/sensors/emr.py | 404 | [
"response"
] | str | None | true | 1 | 6.56 | apache/airflow | 43,597 | sphinx | false |
getInt7SQVectorScorerSupplier | Optional<RandomVectorScorerSupplier> getInt7SQVectorScorerSupplier(
VectorSimilarityType similarityType,
IndexInput input,
QuantizedByteVectorValues values,
float scoreCorrectionConstant
); | Returns an optional containing an int7 scalar quantized vector score supplier
for the given parameters, or an empty optional if a scorer is not supported.
@param similarityType the similarity type
@param input the index input containing the vector data;
offset of the first vector is 0,
the length must be (maxOrd ... | java | libs/simdvec/src/main/java/org/elasticsearch/simdvec/VectorScorerFactory.java | 39 | [
"similarityType",
"input",
"values",
"scoreCorrectionConstant"
] | true | 1 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false | |
corr | def corr(
self,
other: Series,
method: CorrelationMethod = "pearson",
min_periods: int | None = None,
) -> Series:
"""
Compute correlation between each group and another Series.
Parameters
----------
other : Series
Series to comput... | Compute correlation between each group and another Series.
Parameters
----------
other : Series
Series to compute correlation with.
method : {'pearson', 'kendall', 'spearman'}, default 'pearson'
Method of correlation to use.
min_periods : int, optional
Minimum number of observations required per pair of co... | python | pandas/core/groupby/generic.py | 1,666 | [
"self",
"other",
"method",
"min_periods"
] | Series | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
unmodifiableEntries | private static <K extends @Nullable Object, V extends @Nullable Object>
Collection<Entry<K, V>> unmodifiableEntries(Collection<Entry<K, V>> entries) {
if (entries instanceof Set) {
return Maps.unmodifiableEntrySet((Set<Entry<K, V>>) entries);
}
return new Maps.UnmodifiableEntries<>(Collections.u... | Returns an unmodifiable view of the specified collection of entries. The {@link Entry#setValue}
operation throws an {@link UnsupportedOperationException}. If the specified collection is a
{@code Set}, the returned collection is also a {@code Set}.
@param entries the entries for which to return an unmodifiable view
@ret... | java | android/guava/src/com/google/common/collect/Multimaps.java | 1,051 | [
"entries"
] | true | 2 | 7.76 | google/guava | 51,352 | javadoc | false | |
initialize | def initialize(self) -> None:
"""
Initialize the bundle.
This method is called by the DAG processor and worker before the bundle is used,
and allows for deferring expensive operations until that point in time. This will
only be called when Airflow needs the bundle files on disk ... | Initialize the bundle.
This method is called by the DAG processor and worker before the bundle is used,
and allows for deferring expensive operations until that point in time. This will
only be called when Airflow needs the bundle files on disk - some uses only need
to call the `view_url` method, which can run without... | python | airflow-core/src/airflow/dag_processing/bundles/base.py | 278 | [
"self"
] | None | true | 2 | 6 | apache/airflow | 43,597 | unknown | false |
appendln | public StrBuilder appendln(final StringBuffer str) {
return append(str).appendNewLine();
} | Appends a string buffer followed by a new line to this string builder.
Appending null will call {@link #appendNull()}.
@param str the string buffer to append
@return {@code this} instance.
@since 2.3 | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,104 | [
"str"
] | StrBuilder | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
toString | @Override
public String toString() {
if (tokens == null) {
return "StrTokenizer[not tokenized yet]";
}
return "StrTokenizer" + getTokenList();
} | Gets the String content that the tokenizer is parsing.
@return the string content being parsed. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 1,105 | [] | String | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
resolve | @Nullable
public String resolve(IngestDocument ingestDocument) {
if (fieldReference != null) {
String value = ingestDocument.getFieldValue(fieldReference, String.class, true);
if (value == null) {
value = getStringFieldValueInDottedNotation(ingestD... | Resolves the field reference from the provided ingest document or returns the static value if this value source doesn't represent
a field reference.
@param ingestDocument
@return the resolved field reference or static value | java | modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/RerouteProcessor.java | 276 | [
"ingestDocument"
] | String | true | 3 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false |
create_task | def create_task(
self, source_location_arn: str, destination_location_arn: str, **create_task_kwargs
) -> str:
"""
Create a Task between the specified source and destination LocationArns.
.. seealso::
- :external+boto3:py:meth:`DataSync.Client.create_task`
:para... | Create a Task between the specified source and destination LocationArns.
.. seealso::
- :external+boto3:py:meth:`DataSync.Client.create_task`
:param source_location_arn: Source LocationArn. Must exist already.
:param destination_location_arn: Destination LocationArn. Must exist already.
:param create_task_kwargs:... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/datasync.py | 137 | [
"self",
"source_location_arn",
"destination_location_arn"
] | str | true | 1 | 6.24 | apache/airflow | 43,597 | sphinx | false |
toPrimitive | public static long[] toPrimitive(final Long[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_LONG_ARRAY;
}
final long[] result = new long[array.length];
for (int i = 0; i < array.length; i++) {
result... | Converts an array of object Longs to primitives.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array a {@link Long} array, may be {@code null}.
@return a {@code long} array, {@code null} if null array input.
@throws NullPointerException if an array element is {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 9,104 | [
"array"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
write_file | def write_file(self) -> None:
"""
Export DataFrame object to Stata dta format.
This method writes the contents of a pandas DataFrame to a `.dta` file
compatible with Stata. It includes features for handling value labels,
variable types, and metadata like timestamps and data labe... | Export DataFrame object to Stata dta format.
This method writes the contents of a pandas DataFrame to a `.dta` file
compatible with Stata. It includes features for handling value labels,
variable types, and metadata like timestamps and data labels. The output
file can then be read and used in Stata or other compatible... | python | pandas/io/stata.py | 2,835 | [
"self"
] | None | true | 4 | 8.56 | pandas-dev/pandas | 47,362 | unknown | false |
neverEntitled | private void neverEntitled(Class<?> callerClass, Supplier<String> operationDescription) {
var requestingClass = requestingClass(callerClass);
if (policyManager.isTriviallyAllowed(requestingClass)) {
return;
}
ModuleEntitlements entitlements = policyManager.getEntitlements(re... | @param operationDescription is only called when the operation is not trivially allowed, meaning the check is about to fail;
therefore, its performance is not a major concern. | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyCheckerImpl.java | 125 | [
"callerClass",
"operationDescription"
] | void | true | 2 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
findPrimaryConstructor | public static <T> @Nullable Constructor<T> findPrimaryConstructor(Class<T> clazz) {
Assert.notNull(clazz, "Class must not be null");
if (KOTLIN_REFLECT_PRESENT && KotlinDetector.isKotlinType(clazz)) {
return KotlinDelegate.findPrimaryConstructor(clazz);
}
if (clazz.isRecord()) {
try {
// Use the canon... | Return the primary constructor of the provided class. For Kotlin classes, this
returns the Java constructor corresponding to the Kotlin primary constructor
(as defined in the Kotlin specification). For Java records, this returns the
canonical constructor. Otherwise, this simply returns {@code null}.
@param clazz the cl... | java | spring-beans/src/main/java/org/springframework/beans/BeanUtils.java | 278 | [
"clazz"
] | true | 6 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
format | @Override
public <B extends Appendable> B format(final Calendar calendar, final B buf) {
return printer.format(calendar, buf);
} | Formats a {@link Calendar} object into the supplied {@link StringBuffer}.
@param calendar the calendar to format.
@param buf the buffer to format into.
@return the specified string buffer.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 419 | [
"calendar",
"buf"
] | B | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
printRootCauseStackTrace | @SuppressWarnings("resource")
public static void printRootCauseStackTrace(final Throwable throwable, final PrintStream printStream) {
if (throwable == null) {
return;
}
Objects.requireNonNull(printStream, "printStream");
getRootCauseStackTraceList(throwable).forEach(print... | Prints a compact stack trace for the root cause of a throwable.
<p>The compact stack trace starts with the root cause and prints
stack frames up to the place where it was caught and wrapped.
Then it prints the wrapped exception and continues with stack frames
until the wrapper exception is caught and wrapped again, etc... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 743 | [
"throwable",
"printStream"
] | void | true | 2 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
stableQuickSort | private static void stableQuickSort(TDigestIntArray order, TDigestDoubleArray values, int start, int end, int limit) {
// the while loop implements tail-recursion to avoid excessive stack calls on nasty cases
while (end - start > limit) {
// pivot by a random element
int pivotIn... | Stabilized quick sort on an index array. This is a normal quick sort that uses the
original index as a secondary key. Since we are really just sorting an index array
we can do this nearly for free.
@param order The pre-allocated index array
@param values The values to sort
@param start The beginning of the values to ... | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/Sort.java | 61 | [
"order",
"values",
"start",
"end",
"limit"
] | void | true | 13 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
select_column | def select_column(
self,
key: str,
column: str,
start: int | None = None,
stop: int | None = None,
):
"""
return a single column from the table. This is generally only useful to
select an indexable
.. warning::
Pandas uses PyTables... | return a single column from the table. This is generally only useful to
select an indexable
.. warning::
Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be u... | python | pandas/io/pytables.py | 970 | [
"self",
"key",
"column",
"start",
"stop"
] | true | 2 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
equals | @Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TopicIdPartition that = (TopicIdPartition) o;
return topicId.equals(that.topicId) &&
topic... | @return Topic partition representing this instance. | java | clients/src/main/java/org/apache/kafka/common/TopicIdPartition.java | 81 | [
"o"
] | true | 5 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
isEmpty | @Override
public boolean isEmpty() {
/*
* Sum per-segment modCounts to avoid mis-reporting when elements are concurrently added and
* removed in one segment while checking another, in which case the table was never actually
* empty at any point. (The sum ensures accuracy up through at least 1<<31 p... | Concrete implementation of {@link Segment} for weak keys and {@link Dummy} values. | java | android/guava/src/com/google/common/collect/MapMakerInternalMap.java | 2,315 | [] | true | 6 | 7.04 | google/guava | 51,352 | javadoc | false | |
stack | def stack(arrays, axis=0, out=None, *, dtype=None, casting="same_kind"):
"""
Join a sequence of arrays along a new axis.
The ``axis`` parameter specifies the index of the new axis in the
dimensions of the result. For example, if ``axis=0`` it will be the first
dimension and if ``axis=-1`` it will b... | Join a sequence of arrays along a new axis.
The ``axis`` parameter specifies the index of the new axis in the
dimensions of the result. For example, if ``axis=0`` it will be the first
dimension and if ``axis=-1`` it will be the last dimension.
Parameters
----------
arrays : sequence of ndarrays
Each array must ha... | python | numpy/_core/shape_base.py | 379 | [
"arrays",
"axis",
"out",
"dtype",
"casting"
] | false | 3 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
createHoistedVariableForClass | function createHoistedVariableForClass(name: string | PrivateIdentifier | undefined, node: PrivateIdentifier | ClassStaticBlockDeclaration, suffix?: string): Identifier {
const { className } = getPrivateIdentifierEnvironment().data;
const prefix: GeneratedNamePart | string = className ? { prefix: "_",... | If the name is a computed property, this function transforms it, then either returns an expression which caches the
value of the result or the expression itself if the value is either unused or safe to inline into multiple locations
@param shouldHoist Does the expression need to be reused? (ie, for an initializer or ... | typescript | src/compiler/transformers/classFields.ts | 2,953 | [
"name",
"node",
"suffix?"
] | true | 6 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
initWithCommittedOffsetsIfNeeded | private CompletableFuture<Void> initWithCommittedOffsetsIfNeeded(Set<TopicPartition> initializingPartitions,
long deadlineMs) {
if (initializingPartitions.isEmpty()) {
return CompletableFuture.completedFuture(null);
}
... | Fetch the committed offsets for partitions that require initialization. This will trigger an OffsetFetch
request and update positions in the subscription state once a response is received.
@param initializingPartitions Set of partitions to update with a position. This same set will be kept
... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java | 364 | [
"initializingPartitions",
"deadlineMs"
] | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
get_chunk | def get_chunk(self, size: int | None = None) -> pd.DataFrame:
"""
Reads lines from Xport file and returns as dataframe
Parameters
----------
size : int, defaults to None
Number of lines to read. If None, reads whole file.
Returns
-------
Dat... | Reads lines from Xport file and returns as dataframe
Parameters
----------
size : int, defaults to None
Number of lines to read. If None, reads whole file.
Returns
-------
DataFrame | python | pandas/io/sas/sas_xport.py | 424 | [
"self",
"size"
] | pd.DataFrame | true | 2 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
acknowledgeOnClose | public CompletableFuture<Void> acknowledgeOnClose(final Map<TopicIdPartition, NodeAcknowledgements> acknowledgementsMap,
final long deadlineMs) {
final Cluster cluster = metadata.fetch();
final AtomicInteger resultCount = new AtomicInteger();
... | Enqueue the final AcknowledgeRequestState used to commit the final acknowledgements and
close the share sessions.
@param acknowledgementsMap The acknowledgements to commit
@param deadlineMs Time until which the request will be retried if it fails with
an expected retriable error.
@re... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 662 | [
"acknowledgementsMap",
"deadlineMs"
] | true | 10 | 7.52 | apache/kafka | 31,560 | javadoc | false | |
move_cutlass_compiled_cache | def move_cutlass_compiled_cache() -> None:
"""Move CUTLASS compiled cache file to the cache directory if it exists."""
if not try_import_cutlass.cache_info().currsize > 0:
return
import cutlass_cppgen # type: ignore[import-not-found]
# Check if the CACHE_FILE attribute exists in cutlass_cppge... | Move CUTLASS compiled cache file to the cache directory if it exists. | python | torch/_inductor/codegen/cuda/cutlass_utils.py | 39 | [] | None | true | 4 | 7.2 | pytorch/pytorch | 96,034 | unknown | false |
validate | public List<ConfigValue> validate(Map<String, String> props) {
return new ArrayList<>(validateAll(props).values());
} | 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 | 562 | [
"props"
] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
close | @Override
public void close() throws IOException {
lock.lock();
try {
client.close();
} finally {
lock.unlock();
}
} | Check whether there is pending request. This includes both requests that
have been transmitted (i.e. in-flight requests) and those which are awaiting transmission.
@return A boolean indicating whether there is pending request | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java | 545 | [] | void | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false |
max | public static int max(int a, final int b, final int c) {
if (b > a) {
a = b;
}
if (c > a) {
a = c;
}
return a;
} | Gets the maximum of three {@code int} values.
@param a value 1.
@param b value 2.
@param c value 3.
@return the largest of the values. | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,003 | [
"a",
"b",
"c"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
array_equal | def array_equal(a1, a2, equal_nan=False):
"""
True if two arrays have the same shape and elements, False otherwise.
Parameters
----------
a1, a2 : array_like
Input arrays.
equal_nan : bool
Whether to compare NaN's as equal. If the dtype of a1 and a2 is
complex, values wi... | True if two arrays have the same shape and elements, False otherwise.
Parameters
----------
a1, a2 : array_like
Input arrays.
equal_nan : bool
Whether to compare NaN's as equal. If the dtype of a1 and a2 is
complex, values will be considered equal if either the real or the
imaginary component of a give... | python | numpy/_core/numeric.py | 2,463 | [
"a1",
"a2",
"equal_nan"
] | false | 7 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
findProvider | private @Nullable TemplateAvailabilityProvider findProvider(String view, Environment environment,
ClassLoader classLoader, ResourceLoader resourceLoader) {
for (TemplateAvailabilityProvider candidate : this.providers) {
if (candidate.isTemplateAvailable(view, environment, classLoader, resourceLoader)) {
ret... | Get the provider that can be used to render the given view.
@param view the view to render
@param environment the environment
@param classLoader the class loader
@param resourceLoader the resource loader
@return a {@link TemplateAvailabilityProvider} or null | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java | 156 | [
"view",
"environment",
"classLoader",
"resourceLoader"
] | TemplateAvailabilityProvider | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
createEnvironment | private ConfigurableEnvironment createEnvironment(Class<? extends ConfigurableEnvironment> type) {
try {
Constructor<? extends ConfigurableEnvironment> constructor = type.getDeclaredConstructor();
ReflectionUtils.makeAccessible(constructor);
return constructor.newInstance();
}
catch (Exception ex) {
r... | Converts the given {@code environment} to the given {@link StandardEnvironment}
type. If the environment is already of the same type, no conversion is performed
and it is returned unchanged.
@param environment the Environment to convert
@param type the type to convert the Environment to
@return the converted Environmen... | java | core/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java | 90 | [
"type"
] | ConfigurableEnvironment | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
wrapper | def wrapper(fn: Callable[_P, _R]) -> Callable[_P, _R]:
"""Wrap the function to enable memoization with replay and record.
Args:
fn: The function to wrap.
Returns:
A wrapped version of the function.
"""
# If caching is disabled... | Wrap the function to enable memoization with replay and record.
Args:
fn: The function to wrap.
Returns:
A wrapped version of the function. | python | torch/_inductor/runtime/caching/interfaces.py | 188 | [
"fn"
] | Callable[_P, _R] | true | 2 | 8.24 | pytorch/pytorch | 96,034 | google | false |
visitTopLevelImportEqualsDeclaration | function visitTopLevelImportEqualsDeclaration(node: ImportEqualsDeclaration): VisitResult<Statement | undefined> {
Debug.assert(isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
let statements: Statement[] | undefin... | Visits an ImportEqualsDeclaration node.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 1,553 | [
"node"
] | true | 7 | 6.32 | microsoft/TypeScript | 107,154 | jsdoc | false | |
canSendRequest | private boolean canSendRequest(String node, long now) {
return connectionStates.isReady(node, now) && selector.isChannelReady(node) &&
inFlightRequests.canSendMore(node);
} | Are we connected and ready and able to send more requests to the given connection?
@param node The node
@param now the current timestamp | java | clients/src/main/java/org/apache/kafka/clients/NetworkClient.java | 530 | [
"node",
"now"
] | true | 3 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
addConstructorArg | private Map<RestApiVersion, Integer> addConstructorArg(BiConsumer<?, ?> consumer, ParseField parseField) {
boolean required = consumer == REQUIRED_CONSTRUCTOR_ARG_MARKER;
if (RestApiVersion.minimumSupported().matches(parseField.getForRestApiVersion())) {
constructorArgInfos.computeIfAbsent... | Add a constructor argument
@param consumer Either {@link #REQUIRED_CONSTRUCTOR_ARG_MARKER} or {@link #REQUIRED_CONSTRUCTOR_ARG_MARKER}
@param parseField Parse field
@return The argument position | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ConstructingObjectParser.java | 376 | [
"consumer",
"parseField"
] | true | 3 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false | |
cacheExceptionIfEventExpired | private void cacheExceptionIfEventExpired(CompletableFuture<Void> result, long deadlineMs) {
result.whenComplete((__, error) -> {
boolean updatePositionsExpired = time.milliseconds() >= deadlineMs;
if (error != null && updatePositionsExpired) {
cachedUpdatePositionsExcept... | Save exception that may occur while updating fetch positions. Note that since the update fetch positions
is triggered asynchronously, errors may be found when the triggering UpdateFetchPositionsEvent has already
expired. In that case, the exception is saved in memory, to be thrown when processing the following
UpdateFe... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java | 318 | [
"result",
"deadlineMs"
] | void | true | 3 | 6.56 | apache/kafka | 31,560 | javadoc | false |
modifierVisitor | function modifierVisitor(node: Node): VisitResult<Node | undefined> {
if (isDecorator(node)) return undefined;
if (modifierToFlag(node.kind) & ModifierFlags.TypeScriptModifier) {
return undefined;
}
else if (currentNamespace && node.kind === SyntaxKind.ExportKeyword) {
... | Specialized visitor that visits the immediate children of a class with TypeScript syntax.
@param node The node to visit. | typescript | src/compiler/transformers/ts.ts | 625 | [
"node"
] | true | 6 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
generate_blob | def generate_blob(self, gso_table: dict[str, tuple[int, int]]) -> bytes:
"""
Generates the binary blob of GSOs that is written to the dta file.
Parameters
----------
gso_table : dict
Ordered dictionary (str, vo)
Returns
-------
gso : bytes
... | Generates the binary blob of GSOs that is written to the dta file.
Parameters
----------
gso_table : dict
Ordered dictionary (str, vo)
Returns
-------
gso : bytes
Binary content of dta file to be placed between strl tags
Notes
-----
Output format depends on dta version. 117 uses two uint32s to
express v and... | python | pandas/io/stata.py | 3,300 | [
"self",
"gso_table"
] | bytes | true | 5 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
reorder_pre_hook_nodes_to_schedule_asap | def reorder_pre_hook_nodes_to_schedule_asap(self) -> None:
"""
In this function, we schedule the pre hooks as soon as possible. This
does not match eager behavior (schedule pre hook right before its
registered node), but it can make acc grad be scheduled properly when
the pre hoo... | In this function, we schedule the pre hooks as soon as possible. This
does not match eager behavior (schedule pre hook right before its
registered node), but it can make acc grad be scheduled properly when
the pre hooks are registered to them. After reordering acc grad node, we
will reorder the pre hooks again to mimic... | python | torch/_dynamo/compiled_autograd.py | 1,222 | [
"self"
] | None | true | 10 | 6 | pytorch/pytorch | 96,034 | unknown | false |
convertIfNecessary | public <T> @Nullable T convertIfNecessary(@Nullable String propertyName, @Nullable Object oldValue,
Object newValue, @Nullable Class<T> requiredType) throws IllegalArgumentException {
return convertIfNecessary(propertyName, oldValue, newValue, requiredType, TypeDescriptor.valueOf(requiredType));
} | Convert the value to the required type for the specified property.
@param propertyName name of the property
@param oldValue the previous value, if available (may be {@code null})
@param newValue the proposed new value
@param requiredType the type we must convert to
(or {@code null} if not known, for example in case of ... | java | spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java | 95 | [
"propertyName",
"oldValue",
"newValue",
"requiredType"
] | T | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
calculate_dagrun_date_fields | def calculate_dagrun_date_fields(
self,
dag: SerializedDAG,
last_automated_dag_run: None | DataInterval,
) -> None:
"""
Calculate ``next_dagrun`` and `next_dagrun_create_after``.
:param dag: The DAG object
:param last_automated_dag_run: DataInterval (or datet... | Calculate ``next_dagrun`` and `next_dagrun_create_after``.
:param dag: The DAG object
:param last_automated_dag_run: DataInterval (or datetime) of most recent run of this dag, or none
if not yet scheduled. | python | airflow-core/src/airflow/models/dag.py | 702 | [
"self",
"dag",
"last_automated_dag_run"
] | None | true | 4 | 6.24 | apache/airflow | 43,597 | sphinx | false |
leaving | private void leaving() {
clearTaskAndPartitionAssignment();
subscriptionState.unsubscribe();
transitionToSendingLeaveGroup(false);
} | Leaves the group.
<p>
This method does the following:
<ol>
<li>Transitions member state to {@link MemberState#PREPARE_LEAVING}.</li>
<li>Requests the invocation of the revocation callback or lost callback.</li>
<li>Once the callback completes, it clears the current and target assignment, unsubscribes from
... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 971 | [] | void | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false |
processCommonDefinitionAnnotations | public static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd) {
processCommonDefinitionAnnotations(abd, abd.getMetadata());
} | Register all relevant annotation post processors in the given registry.
@param registry the registry to operate on
@param source the configuration source element (already extracted)
that this registration was triggered from. May be {@code null}.
@return a Set of BeanDefinitionHolders, containing all bean definitions
th... | java | spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java | 227 | [
"abd"
] | void | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
parenthesizeExpressionOfComputedPropertyName | function parenthesizeExpressionOfComputedPropertyName(expression: Expression): Expression {
return isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression;
} | Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended
order of operations.
@param binaryOperator The operator for the BinaryExpression.
@param operand The operand for the BinaryExpression.
@param isLeftSideOfBinary A value indicating whether the operand is the left side... | typescript | src/compiler/factory/parenthesizerRules.ts | 320 | [
"expression"
] | true | 2 | 6.16 | microsoft/TypeScript | 107,154 | jsdoc | false | |
setSpanAttributes | private void setSpanAttributes(TraceContext traceContext, @Nullable Map<String, Object> spanAttributes, SpanBuilder spanBuilder) {
setSpanAttributes(spanAttributes, spanBuilder);
final String xOpaqueId = traceContext.getHeader(Task.X_OPAQUE_ID_HTTP_HEADER);
if (xOpaqueId != null) {
... | Most of the examples of how to use the OTel API look something like this, where the span context
is automatically propagated:
<pre>{@code
Span span = tracer.spanBuilder("parent").startSpan();
try (Scope scope = parentSpan.makeCurrent()) {
// ...do some stuff, possibly creating further spans
} finally {
span.end... | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracer.java | 339 | [
"traceContext",
"spanAttributes",
"spanBuilder"
] | void | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
CopySourceButton | function CopySourceButton({source, symbolicatedSourcePromise}: Props) {
const symbolicatedSource = React.use(symbolicatedSourcePromise);
if (symbolicatedSource == null) {
const [, sourceURL, line, column] = source;
const handleCopy = withPermissionsCheck(
{permissions: ['clipboardWrite']},
() =>... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSourcePanel.js | 68 | [] | false | 2 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
formatUTC | public static String formatUTC(final long millis, final String pattern, final Locale locale) {
return format(new Date(millis), pattern, UTC_TIME_ZONE, locale);
} | Formats a date/time into a specific pattern using the UTC time zone.
@param millis the date to format expressed in milliseconds.
@param pattern the pattern to use to format the date, not null.
@param locale the locale to use, may be {@code null}.
@return the formatted date. | java | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | 398 | [
"millis",
"pattern",
"locale"
] | String | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
initialize | public static <T> T initialize(final ConcurrentInitializer<T> initializer)
throws ConcurrentException {
return initializer != null ? initializer.get() : null;
} | Invokes the specified {@link ConcurrentInitializer} and returns the
object produced by the initializer. This method just invokes the {@code
get()} method of the given {@link ConcurrentInitializer}. It is
<strong>null</strong>-safe: if the argument is <strong>null</strong>, result is also
<strong>null</strong>.
@param <... | java | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | 287 | [
"initializer"
] | T | true | 2 | 7.36 | apache/commons-lang | 2,896 | javadoc | false |
arrayPush | function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
} | Appends the elements of `values` to `array`.
@private
@param {Array} array The array to modify.
@param {Array} values The values to append.
@returns {Array} Returns `array`. | javascript | lodash.js | 666 | [
"array",
"values"
] | false | 2 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
unmodifiableSetMultimap | public static <K extends @Nullable Object, V extends @Nullable Object>
SetMultimap<K, V> unmodifiableSetMultimap(SetMultimap<K, V> delegate) {
if (delegate instanceof UnmodifiableSetMultimap || delegate instanceof ImmutableSetMultimap) {
return delegate;
}
return new UnmodifiableSetMultimap<>(de... | Returns an unmodifiable view of the specified {@code SetMultimap}. Query operations on the
returned multimap "read through" to the specified multimap, and attempts to modify the returned
multimap, either directly or through the multimap's views, result in an {@code
UnsupportedOperationException}.
<p>The returned multim... | java | android/guava/src/com/google/common/collect/Multimaps.java | 916 | [
"delegate"
] | true | 3 | 7.44 | google/guava | 51,352 | javadoc | false | |
from_positional | def from_positional(
cls, tensor: torch.Tensor, levels: list[DimEntry], has_device: bool
) -> Union[_Tensor, torch.Tensor]:
"""
Create a functorch Tensor from a regular PyTorch tensor with specified dimension levels.
This is the primary way to create Tensor objects with first-class ... | Create a functorch Tensor from a regular PyTorch tensor with specified dimension levels.
This is the primary way to create Tensor objects with first-class dimensions.
Args:
tensor: The underlying PyTorch tensor
levels: List of DimEntry objects specifying the dimension structure
has_device: Whether the ten... | python | functorch/dim/__init__.py | 983 | [
"cls",
"tensor",
"levels",
"has_device"
] | Union[_Tensor, torch.Tensor] | true | 7 | 7.92 | pytorch/pytorch | 96,034 | google | false |
arraySample | function arraySample(array) {
var length = array.length;
return length ? array[baseRandom(0, length - 1)] : undefined;
} | A specialized version of `_.sample` for arrays.
@private
@param {Array} array The array to sample.
@returns {*} Returns the random element. | javascript | lodash.js | 2,459 | [
"array"
] | false | 2 | 6.16 | lodash/lodash | 61,490 | jsdoc | false | |
baseAt | function baseAt(object, paths) {
var index = -1,
length = paths.length,
result = Array(length),
skip = object == null;
while (++index < length) {
result[index] = skip ? undefined : get(object, paths[index]);
}
return result;
} | The base implementation of `_.at` without support for individual paths.
@private
@param {Object} object The object to iterate over.
@param {string[]} paths The property paths to pick.
@returns {Array} Returns the picked elements. | javascript | lodash.js | 2,613 | [
"object",
"paths"
] | false | 3 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
newline | private void newline() {
if (this.indent == null) {
return;
}
this.out.append("\n");
this.out.append(this.indent.repeat(this.stack.size()));
} | Encodes {@code value} to this stringer.
@param value the value to encode
@return this stringer.
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONStringer.java | 344 | [] | void | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
listTransactions | default ListTransactionsResult listTransactions() {
return listTransactions(new ListTransactionsOptions());
} | List active transactions in the cluster. See
{@link #listTransactions(ListTransactionsOptions)} for more details.
@return The result | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,739 | [] | ListTransactionsResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
unique | def unique(ar1, return_index=False, return_inverse=False):
"""
Finds the unique elements of an array.
Masked values are considered the same element (masked). The output array
is always a masked array. See `numpy.unique` for more details.
See Also
--------
numpy.unique : Equivalent function... | Finds the unique elements of an array.
Masked values are considered the same element (masked). The output array
is always a masked array. See `numpy.unique` for more details.
See Also
--------
numpy.unique : Equivalent function for ndarrays.
Examples
--------
>>> import numpy as np
>>> a = [1, 2, 1000, 2, 3]
>>> mas... | python | numpy/ma/extras.py | 1,267 | [
"ar1",
"return_index",
"return_inverse"
] | false | 3 | 6 | numpy/numpy | 31,054 | unknown | false | |
json_serialize | def json_serialize(value: Any) -> str | None:
"""
JSON serializer replicating current watchtower behavior.
This provides customers with an accessible import,
`airflow.providers.amazon.aws.log.cloudwatch_task_handler.json_serialize`
:param value: the object to serialize
:return: string represen... | JSON serializer replicating current watchtower behavior.
This provides customers with an accessible import,
`airflow.providers.amazon.aws.log.cloudwatch_task_handler.json_serialize`
:param value: the object to serialize
:return: string representation of `value` | python | providers/amazon/src/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py | 70 | [
"value"
] | str | None | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
executeInitializrMetadataRetrieval | private ClassicHttpResponse executeInitializrMetadataRetrieval(String url) {
HttpGet request = new HttpGet(url);
request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_META_DATA));
return execute(request, URI.create(url), "retrieve metadata");
} | Retrieves the meta-data of the service at the specified URL.
@param url the URL
@return the response | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java | 178 | [
"url"
] | ClassicHttpResponse | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
read | public long read() throws IOException {
if (receive == null) {
receive = new NetworkReceive(maxReceiveSize, id, memoryPool);
}
long bytesReceived = receive(this.receive);
if (this.receive.requiredMemoryAmountKnown() && !this.receive.memoryAllocated() && isInMutableState()) ... | Returns the port to which this channel's socket is connected or 0 if the socket has never been connected.
If the socket was connected prior to being closed, then this method will continue to return the
connected port number after the socket is closed. | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 407 | [] | true | 5 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
unescapeHtml4 | public static final String unescapeHtml4(final String input) {
return UNESCAPE_HTML4.translate(input);
} | Unescapes a string containing entity escapes to a string
containing the actual Unicode characters corresponding to the
escapes. Supports HTML 4.0 entities.
<p>For example, the string {@code "<Français>"}
will become {@code "<Français>"}</p>
<p>If an entity is unrecognized, it is left alone, and inserted
ve... | java | src/main/java/org/apache/commons/lang3/StringEscapeUtils.java | 729 | [
"input"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
configureBean | public void configureBean(Object beanInstance) {
if (this.beanFactory == null) {
if (logger.isDebugEnabled()) {
logger.debug("BeanFactory has not been set on " + ClassUtils.getShortName(getClass()) + ": " +
"Make sure this configurer runs in a Spring container. Unable to configure bean of type [" +
... | Configure the bean instance.
<p>Subclasses can override this to provide custom configuration logic.
Typically called by an aspect, for all bean instances matched by a pointcut.
@param beanInstance the bean instance to configure (must <b>not</b> be {@code null}) | java | spring-beans/src/main/java/org/springframework/beans/factory/wiring/BeanConfigurerSupport.java | 122 | [
"beanInstance"
] | void | true | 15 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
create | public static URL create(File file, JarEntry nestedEntry) {
return create(file, (nestedEntry != null) ? nestedEntry.getName() : null);
} | Create a new jar URL.
@param file the jar file
@param nestedEntry the nested entry or {@code null}
@return a jar file URL | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrl.java | 50 | [
"file",
"nestedEntry"
] | URL | true | 2 | 7.68 | spring-projects/spring-boot | 79,428 | javadoc | false |
toString | @Override
public String toString() {
return "Call(callName=" + callName + ", deadlineMs=" + deadlineMs +
", tries=" + tries + ", nextAllowedTryMs=" + nextAllowedTryMs + ")";
} | Handle an UnsupportedVersionException.
@param exception The exception.
@return True if the exception can be handled; false otherwise. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 999 | [] | String | true | 1 | 6.24 | apache/kafka | 31,560 | javadoc | false |
validState | public static void validState(final boolean expression, final String message, final Object... values) {
if (!expression) {
throw new IllegalStateException(getMessage(message, values));
}
} | Validate that the stateful condition is {@code true}; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary boolean expression, such as validating a
primitive number or using your own custom validation expression.
<pre>Validate.validState(this.isOk()... | java | src/main/java/org/apache/commons/lang3/Validate.java | 1,268 | [
"expression",
"message"
] | void | true | 2 | 6.24 | apache/commons-lang | 2,896 | javadoc | false |
_get_relevant_map_indexes | def _get_relevant_map_indexes(
*,
task: Operator,
run_id: str,
map_index: int,
relative: Operator,
ti_count: int | None,
session: Session,
) -> int | range | None:
"""
Infer the map indexes of a relative that's "relevant" to this ti.
The bulk of the logic mainly exists to solve ... | Infer the map indexes of a relative that's "relevant" to this ti.
The bulk of the logic mainly exists to solve the problem described by
the following example, where 'val' must resolve to different values,
depending on where the reference is being used::
@task
def this_task(v): # This is self.task.
re... | python | airflow-core/src/airflow/models/taskinstance.py | 2,206 | [
"task",
"run_id",
"map_index",
"relative",
"ti_count",
"session"
] | int | range | None | true | 4 | 8.16 | apache/airflow | 43,597 | sphinx | false |
_check_non_neg_array | def _check_non_neg_array(self, X, reset_n_features, whom):
"""check X format
check X format and make sure no negative value in X.
Parameters
----------
X : array-like or sparse matrix
"""
dtype = [np.float64, np.float32] if reset_n_features else self.component... | check X format
check X format and make sure no negative value in X.
Parameters
----------
X : array-like or sparse matrix | python | sklearn/decomposition/_lda.py | 553 | [
"self",
"X",
"reset_n_features",
"whom"
] | false | 2 | 6.24 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
device_name | def device_name(self) -> Optional[str]:
"""
Get the device name information.
Returns:
A tuple of (gpu_name, vendor, model)
"""
if self._device_name is None:
device = self.device()
if self.device_type == "cuda":
device_propertie... | Get the device name information.
Returns:
A tuple of (gpu_name, vendor, model) | python | torch/_inductor/kernel_inputs.py | 94 | [
"self"
] | Optional[str] | true | 3 | 7.76 | pytorch/pytorch | 96,034 | unknown | false |
read_query | def read_query(
self,
sql: str,
index_col: str | list[str] | None = None,
coerce_float: bool = True,
parse_dates=None,
params=None,
chunksize: int | None = None,
dtype: DtypeArg | None = None,
dtype_backend: DtypeBackend | Literal["numpy"] = "numpy... | Read SQL query into a DataFrame.
Parameters
----------
sql : str
SQL query to be executed.
index_col : string, optional, default: None
Column name to use as index for the returned DataFrame object.
coerce_float : bool, default True
Attempt to convert values of non-string, non-numeric objects (like
deci... | python | pandas/io/sql.py | 1,801 | [
"self",
"sql",
"index_col",
"coerce_float",
"parse_dates",
"params",
"chunksize",
"dtype",
"dtype_backend"
] | DataFrame | Iterator[DataFrame] | true | 3 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
toIntegerObject | public static Integer toIntegerObject(final boolean bool) {
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
} | Converts a boolean to an Integer using the convention that
{@code true} is {@code 1} and {@code false} is {@code 0}.
<pre>
BooleanUtils.toIntegerObject(true) = Integer.valueOf(1)
BooleanUtils.toIntegerObject(false) = Integer.valueOf(0)
</pre>
@param bool the boolean to convert
@return one if {@code true}, zero if... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 941 | [
"bool"
] | Integer | true | 2 | 7.36 | apache/commons-lang | 2,896 | javadoc | false |
restore_to_event | def restore_to_event(
self,
node: fx.Node,
prev_event: Optional[PGEvent],
next_event: Optional[PGEvent],
) -> None:
"""Restore node to timeline after failed merge attempt."""
event = self.node_to_event[node]
# Reinsert into linked list
event.insert_be... | Restore node to timeline after failed merge attempt. | python | torch/_inductor/fx_passes/overlap_preserving_bucketer.py | 655 | [
"self",
"node",
"prev_event",
"next_event"
] | None | true | 6 | 6 | pytorch/pytorch | 96,034 | unknown | false |
createStrategyMap | private static Map<State, AbstractStateStrategy> createStrategyMap() {
final Map<State, AbstractStateStrategy> map = new EnumMap<>(State.class);
map.put(State.CLOSED, new StateStrategyClosed());
map.put(State.OPEN, new StateStrategyOpen());
return map;
} | Creates the map with strategy objects. It allows access for a strategy for a given
state.
@return the strategy map | java | src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java | 292 | [] | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false | |
loadConfiguration | @Override
protected void loadConfiguration(LoggingInitializationContext initializationContext, String location,
@Nullable LogFile logFile) {
load(initializationContext, location, logFile);
} | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 264 | [
"initializationContext",
"location",
"logFile"
] | void | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
start | def start(self, c: Consumer) -> None:
"""Initialize delayed delivery for all broker URLs.
Attempts to set up delayed delivery for each broker URL in the configuration.
Failures are logged but don't prevent attempting remaining URLs.
Args:
c: The Celery consumer instance
... | Initialize delayed delivery for all broker URLs.
Attempts to set up delayed delivery for each broker URL in the configuration.
Failures are logged but don't prevent attempting remaining URLs.
Args:
c: The Celery consumer instance
Raises:
ValueError: If configuration validation fails | python | celery/worker/consumer/delayed_delivery.py | 63 | [
"self",
"c"
] | None | true | 3 | 6.56 | celery/celery | 27,741 | google | false |
common_type | def common_type(*arrays):
"""
Return a scalar type which is common to the input arrays.
The return type will always be an inexact (i.e. floating point) scalar
type, even if all the arrays are integer arrays. If one of the inputs is
an integer array, the minimum precision type that is returned is a
... | Return a scalar type which is common to the input arrays.
The return type will always be an inexact (i.e. floating point) scalar
type, even if all the arrays are integer arrays. If one of the inputs is
an integer array, the minimum precision type that is returned is a
64-bit floating point dtype.
All input arrays exc... | python | numpy/lib/_type_check_impl.py | 658 | [] | false | 8 | 7.2 | numpy/numpy | 31,054 | numpy | false | |
difference | public static <K extends @Nullable Object, V extends @Nullable Object>
SortedMapDifference<K, V> difference(
SortedMap<K, ? extends V> left, Map<? extends K, ? extends V> right) {
checkNotNull(left);
checkNotNull(right);
Comparator<? super K> comparator = orNaturalOrder(left.comparator());
... | Computes the difference between two sorted maps, using the comparator of the left map, or
{@code Ordering.natural()} if the left map uses the natural ordering of its elements. This
difference is an immutable snapshot of the state of the maps at the time this method is called.
It will never change, even if the maps chan... | java | android/guava/src/com/google/common/collect/Maps.java | 531 | [
"left",
"right"
] | true | 1 | 6.88 | google/guava | 51,352 | javadoc | false | |
isAfter | public boolean isAfter(final T element) {
if (element == null) {
return false;
}
return comparator.compare(element, minimum) < 0;
} | Checks whether this range is after the specified element.
@param element the element to check for, null returns false.
@return true if this range is entirely after the specified element. | java | src/main/java/org/apache/commons/lang3/Range.java | 419 | [
"element"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PreparedTxnState that = (PreparedTxnState) o;
return producerId == that.producerId && epoch == that.epoch;
} | Returns a serialized string representation of this transaction state.
The format is "producerId:epoch" for an initialized state, or an empty string
for an uninitialized state (where producerId and epoch are both -1).
@return a serialized string representation | java | clients/src/main/java/org/apache/kafka/clients/producer/PreparedTxnState.java | 113 | [
"o"
] | true | 5 | 6.08 | apache/kafka | 31,560 | javadoc | false | |
asSupplier | public static <O> Supplier<O> asSupplier(final FailableSupplier<O, ?> supplier) {
return () -> get(supplier);
} | Converts the given {@link FailableSupplier} into a standard {@link Supplier}.
@param <O> the type supplied by the suppliers
@param supplier a {@link FailableSupplier}
@return a standard {@link Supplier}
@since 3.10 | java | src/main/java/org/apache/commons/lang3/Functions.java | 451 | [
"supplier"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
formatOutput | function formatOutput(generator: Generator): string {
const output = generator.options?.generator.output
return output ? dim(` to .${path.sep}${path.relative(process.cwd(), parseEnvValue(output))}`) : ''
} | Creates and formats the success message for the given generator to print to
the console after generation finishes.
@param time time in milliseconds it took for the generator to run. | typescript | packages/internals/src/cli/getGeneratorSuccessMessage.ts | 31 | [
"generator"
] | true | 2 | 6.48 | prisma/prisma | 44,834 | jsdoc | false | |
deduceBindMethod | static org.springframework.boot.context.properties.bind.BindMethod deduceBindMethod(Bindable<Object> bindable) {
return deduceBindMethod(BindConstructorProvider.DEFAULT.getBindConstructor(bindable, false));
} | Deduce the {@code BindMethod} that should be used for the given {@link Bindable}.
@param bindable the source bindable
@return the bind method to use | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java | 309 | [
"bindable"
] | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getTrustDiagnosticFailure | public String getTrustDiagnosticFailure(
X509Certificate[] chain,
PeerType peerType,
SSLSession session,
String contextName,
@Nullable Map<String, List<X509Certificate>> trustedIssuers
) {
final String peerAddress = Optional.ofNullable(session).map(SSLSession::getPeer... | @param contextName The descriptive name of this SSL context (e.g. "xpack.security.transport.ssl")
@param trustedIssuers A Map of DN to Certificate, for the issuers that were trusted in the context in which this failure occurred
(see {@link javax.net.ssl.X509TrustManager#getAcceptedIssuers()}) | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslDiagnostics.java | 194 | [
"chain",
"peerType",
"session",
"contextName",
"trustedIssuers"
] | String | true | 15 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
_is_dtype_compat | def _is_dtype_compat(self, other: Index) -> Categorical:
"""
*this is an internal non-public method*
provide a comparison between the dtype of self and other (coercing if
needed)
Parameters
----------
other : Index
Returns
-------
Catego... | *this is an internal non-public method*
provide a comparison between the dtype of self and other (coercing if
needed)
Parameters
----------
other : Index
Returns
-------
Categorical
Raises
------
TypeError if the dtypes are not compatible | python | pandas/core/indexes/category.py | 226 | [
"self",
"other"
] | Categorical | true | 7 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false |
doProcess | protected abstract T doProcess(); | Run AOT processing.
@return the result of the processing. | java | spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java | 91 | [] | T | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false |
getServicesObjectAllocator | function getServicesObjectAllocator(): ObjectAllocator {
return {
getNodeConstructor: () => NodeObject,
getTokenConstructor: () => TokenObject,
getIdentifierConstructor: () => IdentifierObject,
getPrivateIdentifierConstructor: () => PrivateIdentifierObject,
getSourceF... | Returns whether or not the given node has a JSDoc "inheritDoc" tag on it.
@param node the Node in question.
@returns `true` if `node` has a JSDoc "inheritDoc" tag on it, otherwise `false`. | typescript | src/services/services.ts | 1,326 | [] | true | 1 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
between | public static <A extends Comparable<A>> Predicate<A> between(final A b, final A c) {
return a -> is(a).between(b, c);
} | Creates a predicate to test if {@code [b <= a <= c]} or {@code [b >= a >= c]} where the {@code a} is the tested object.
@param b the object to compare to the tested object
@param c the object to compare to the tested object
@param <A> type of the test object
@return a predicate for true if the tested object is between ... | java | src/main/java/org/apache/commons/lang3/compare/ComparableUtils.java | 136 | [
"b",
"c"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
is_integer_dtype | def is_integer_dtype(arr_or_dtype) -> bool:
"""
Check whether the provided array or dtype is of an integer dtype.
Unlike in `is_any_int_dtype`, timedelta64 instances will return False.
The nullable Integer dtypes (e.g. pandas.Int64Dtype) are also considered
as integer by this function.
Parame... | Check whether the provided array or dtype is of an integer dtype.
Unlike in `is_any_int_dtype`, timedelta64 instances will return False.
The nullable Integer dtypes (e.g. pandas.Int64Dtype) are also considered
as integer by this function.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtyp... | python | pandas/core/dtypes/common.py | 729 | [
"arr_or_dtype"
] | bool | true | 3 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false |
density | def density(w):
"""Compute density of a sparse vector.
Parameters
----------
w : {ndarray, sparse matrix}
The input data can be numpy ndarray or a sparse matrix.
Returns
-------
float
The density of w, between 0 and 1.
Examples
--------
>>> from scipy import sp... | Compute density of a sparse vector.
Parameters
----------
w : {ndarray, sparse matrix}
The input data can be numpy ndarray or a sparse matrix.
Returns
-------
float
The density of w, between 0 and 1.
Examples
--------
>>> from scipy import sparse
>>> from sklearn.utils.extmath import density
>>> X = sparse.r... | python | sklearn/utils/extmath.py | 138 | [
"w"
] | false | 4 | 6.32 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
find | static @Nullable Command find(Collection<? extends Command> commands, String name) {
for (Command command : commands) {
if (command.getName().equals(name)) {
return command;
}
}
return null;
} | Static method that can be used to find a single command from a collection.
@param commands the commands to search
@param name the name of the command to find
@return a {@link Command} instance or {@code null}. | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/Command.java | 147 | [
"commands",
"name"
] | Command | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
unregister | private void unregister(KafkaMbean mbean) {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
try {
if (server.isRegistered(mbean.name()))
server.unregisterMBean(mbean.name());
} catch (JMException e) {
throw new KafkaException("Error unregi... | @param metricName
@return standard JMX MBean name in the following format domainName:type=metricType,key1=val1,key2=val2 | java | clients/src/main/java/org/apache/kafka/common/metrics/JmxReporter.java | 199 | [
"mbean"
] | void | true | 3 | 6.64 | apache/kafka | 31,560 | javadoc | false |
readFile | function readFile(path, options, callback) {
callback ||= options;
validateFunction(callback, 'cb');
options = getOptions(options, { flag: 'r' });
ReadFileContext ??= require('internal/fs/read/context');
const context = new ReadFileContext(callback, options.encoding);
context.isUserFd = isFd(path); // File ... | Asynchronously reads the entire contents of a file.
@param {string | Buffer | URL | number} path
@param {{
encoding?: string | null;
flag?: string;
signal?: AbortSignal;
} | string} [options]
@param {(
err?: Error,
data?: string | Buffer
) => any} callback
@returns {void} | javascript | lib/fs.js | 357 | [
"path",
"options",
"callback"
] | false | 4 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
equals | @Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
return false;
}
return ObjectUtils.nullSafeEquals(this.value, ((OriginTrackedValue) obj).value);
} | Return the tracked value.
@return the tracked value | java | core/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java | 57 | [
"obj"
] | true | 3 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
isVariableDeclaratorListTerminator | function isVariableDeclaratorListTerminator(): boolean {
// If we can consume a semicolon (either explicitly, or with ASI), then consider us done
// with parsing the list of variable declarators.
if (canParseSemicolon()) {
return true;
}
// in the case where w... | 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,052 | [] | true | 4 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
splitByWholeSeparatorPreserveAllTokens | public static String[] splitByWholeSeparatorPreserveAllTokens(final String str, final String separator) {
return splitByWholeSeparatorWorker(str, separator, -1, true);
} | Splits the provided text into an array, separator string specified.
<p>
The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For more control over the
split use the StrTokenizer class.
</p>
<p>
A {@code null} input String returns {@code null}. A {@c... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,307 | [
"str",
"separator"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
availableLocaleList | public static List<Locale> availableLocaleList() {
return SyncAvoid.AVAILABLE_LOCALE_ULIST;
} | Obtains an unmodifiable and sorted list of installed locales.
<p>
This method is a wrapper around {@link Locale#getAvailableLocales()}. It is more efficient, as the JDK method must create a new array each time it is
called.
</p>
@return the unmodifiable and sorted list of available locales. | java | src/main/java/org/apache/commons/lang3/LocaleUtils.java | 103 | [] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
toZonedDateTime | public static ZonedDateTime toZonedDateTime(final Date date) {
return toZonedDateTime(date, TimeZone.getDefault());
} | Converts a {@link Date} to a {@link ZonedDateTime}.
@param date the Date to convert, not null.
@return a new ZonedDateTime.
@since 3.19.0 | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,685 | [
"date"
] | ZonedDateTime | 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.