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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
preLookup | boolean preLookup() {
return currentUsages.updateAndGet(current -> current < 0 ? current : current + 1) > 0;
} | Prepares the database for lookup by incrementing the usage count.
If the usage count is already negative, it indicates that the database is being closed,
and this method will return false to indicate that no lookup should be performed.
@return true if the database is ready for lookup, false if it is being closed | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/DatabaseReaderLazyLoader.java | 101 | [] | true | 2 | 8 | elastic/elasticsearch | 75,680 | javadoc | false | |
to_pytimedelta | def to_pytimedelta(self) -> np.ndarray:
"""
Return an array of native :class:`datetime.timedelta` objects.
Python's standard `datetime` library uses a different representation
timedelta's. This method converts a Series of pandas Timedeltas
to `datetime.timedelta` format with the... | Return an array of native :class:`datetime.timedelta` objects.
Python's standard `datetime` library uses a different representation
timedelta's. This method converts a Series of pandas Timedeltas
to `datetime.timedelta` format with the same length as the original
Series.
Returns
-------
numpy.ndarray
Array of 1D ... | python | pandas/core/indexes/accessors.py | 464 | [
"self"
] | np.ndarray | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | unknown | false |
create_github_issue_url | def create_github_issue_url(title: str, body: str, labels: Iterable[str]) -> str:
"""
Creates URL to create the issue with title, body and labels.
:param title: issue title
:param body: issue body
:param labels: labels for the issue
:return: URL to use to create the issue
"""
from urllib... | Creates URL to create the issue with title, body and labels.
:param title: issue title
:param body: issue body
:param labels: labels for the issue
:return: URL to use to create the issue | python | dev/breeze/src/airflow_breeze/commands/release_management_commands.py | 2,425 | [
"title",
"body",
"labels"
] | str | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
getAllSources | public Set<Object> getAllSources() {
Set<Object> allSources = new LinkedHashSet<>();
if (!CollectionUtils.isEmpty(this.primarySources)) {
allSources.addAll(this.primarySources);
}
if (!CollectionUtils.isEmpty(this.properties.getSources())) {
allSources.addAll(this.properties.getSources());
}
return Co... | Return an immutable set of all the sources that will be added to an
ApplicationContext when {@link #run(String...)} is called. This method combines any
primary sources specified in the constructor with any additional ones that have
been {@link #setSources(Set) explicitly set}.
@return an immutable set of all sources | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 1,189 | [] | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
classOutput | public Builder classOutput(Path classOutput) {
this.classOutput = classOutput;
return this;
} | Set the output directory for generated classes.
@param classOutput the location of generated classes
@return this builder for method chaining | java | spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java | 241 | [
"classOutput"
] | Builder | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
fast_logdet | def fast_logdet(A):
"""Compute logarithm of determinant of a square matrix.
The (natural) logarithm of the determinant of a square matrix
is returned if det(A) is non-negative and well defined.
If the determinant is zero or negative returns -Inf.
Equivalent to : np.log(np.det(A)) but more robust.
... | Compute logarithm of determinant of a square matrix.
The (natural) logarithm of the determinant of a square matrix
is returned if det(A) is non-negative and well defined.
If the determinant is zero or negative returns -Inf.
Equivalent to : np.log(np.det(A)) but more robust.
Parameters
----------
A : array_like of sh... | python | sklearn/utils/extmath.py | 98 | [
"A"
] | false | 2 | 7.52 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
createDefaultPropertyValue | private PropertyValue createDefaultPropertyValue(PropertyTokenHolder tokens) {
TypeDescriptor desc = getPropertyTypeDescriptor(tokens.canonicalName);
if (desc == null) {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Could not determine property type for au... | Retrieve a Property accessor for the given nested property.
Create a new one if not found in the cache.
<p>Note: Caching nested PropertyAccessors is necessary now,
to keep registered custom editors for nested properties.
@param nestedProperty property to create the PropertyAccessor for
@return the PropertyAccessor inst... | java | spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java | 885 | [
"tokens"
] | PropertyValue | true | 2 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
detectAndParse | public static Period detectAndParse(String value) {
return detectAndParse(value, null);
} | Detect the style then parse the value to return a period.
@param value the value to parse
@return the parsed period
@throws IllegalArgumentException if the value is not a known style or cannot be
parsed | java | core/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java | 185 | [
"value"
] | Period | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
delete_cluster | def delete_cluster(
self,
cluster_identifier: str,
skip_final_cluster_snapshot: bool = True,
final_cluster_snapshot_identifier: str | None = None,
):
"""
Delete a cluster and optionally create a snapshot.
.. seealso::
- :external+boto3:py:meth:`Re... | Delete a cluster and optionally create a snapshot.
.. seealso::
- :external+boto3:py:meth:`Redshift.Client.delete_cluster`
:param cluster_identifier: unique identifier of a cluster
:param skip_final_cluster_snapshot: determines cluster snapshot creation
:param final_cluster_snapshot_identifier: name of final clus... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_cluster.py | 99 | [
"self",
"cluster_identifier",
"skip_final_cluster_snapshot",
"final_cluster_snapshot_identifier"
] | true | 3 | 6.08 | apache/airflow | 43,597 | sphinx | false | |
maybeResolveSequences | synchronized void maybeResolveSequences() {
for (Iterator<TopicPartition> iter = partitionsWithUnresolvedSequences.keySet().iterator(); iter.hasNext(); ) {
TopicPartition topicPartition = iter.next();
if (!hasInflightBatches(topicPartition)) {
// The partition has been fu... | Returns the first inflight sequence for a given partition. This is the base sequence of an inflight batch with
the lowest sequence number.
@return the lowest inflight sequence if the transaction manager is tracking inflight requests for this partition.
If there are no inflight requests being tracked for this pa... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 852 | [] | void | true | 5 | 8.08 | apache/kafka | 31,560 | javadoc | false |
execute | def execute(self, context: Context):
"""
Invoke the target AWS Lambda function from Airflow.
:return: The response payload from the function, or an error object.
"""
success_status_codes = [200, 202, 204]
self.log.info("Invoking AWS Lambda function: %s with payload: %s",... | Invoke the target AWS Lambda function from Airflow.
:return: The response payload from the function, or an error object. | python | providers/amazon/src/airflow/providers/amazon/aws/operators/lambda_function.py | 211 | [
"self",
"context"
] | true | 6 | 7.04 | apache/airflow | 43,597 | unknown | false | |
watchMissingFileSystemEntry | function watchMissingFileSystemEntry(): FileWatcher {
return watchFile(
fileOrDirectory,
(_fileName, eventKind, modifiedTime) => {
if (eventKind === FileWatcherEventKind.Created) {
modifiedTime ||= getModifiedTime(fileOrDirecto... | Watch the file or directory that is missing
and switch to existing file or directory when the missing filesystem entry is created | typescript | src/compiler/sys.ts | 1,339 | [] | true | 4 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
remove | public static double[] remove(final double[] array, final int index) {
return (double[]) remove((Object) array, index);
} | Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts one from their
indices).
<p>
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the
returned array... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,767 | [
"array",
"index"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
detect | public static DurationFormat.Style detect(String value) {
Assert.notNull(value, "Value must not be null");
// warning: the order of parsing starts to matter if multiple patterns accept a plain integer (no unit suffix)
if (ISO_8601_PATTERN.matcher(value).matches()) {
return DurationFormat.Style.ISO8601;
}
i... | Detect the style from the given source value.
@param value the source value
@return the duration style
@throws IllegalArgumentException if the value is not a known style | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatterUtils.java | 111 | [
"value"
] | true | 4 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
processInjection | public void processInjection(Object bean) throws BeanCreationException {
Class<?> clazz = bean.getClass();
InjectionMetadata metadata = findAutowiringMetadata(clazz.getName(), clazz, null);
try {
metadata.inject(bean, null, null);
}
catch (BeanCreationException ex) {
throw ex;
}
catch (Throwable ex)... | <em>Native</em> processing method for direct calls with an arbitrary target
instance, resolving all of its fields and methods which are annotated with
one of the configured 'autowired' annotation types.
@param bean the target instance to process
@throws BeanCreationException if autowiring failed
@see #setAutowiredAnnot... | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java | 511 | [
"bean"
] | void | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
_list_of_dict_to_arrays | def _list_of_dict_to_arrays(
data: list[dict],
columns: Index | None,
) -> tuple[np.ndarray, Index]:
"""
Convert list of dicts to numpy arrays
if `columns` is not passed, column names are inferred from the records
- for OrderedDict and dicts, the column names match
the key insertion-order... | Convert list of dicts to numpy arrays
if `columns` is not passed, column names are inferred from the records
- for OrderedDict and dicts, the column names match
the key insertion-order from the first record to the last.
- For other kinds of dict-likes, the keys are lexically sorted.
Parameters
----------
data : ite... | python | pandas/core/internals/construction.py | 835 | [
"data",
"columns"
] | tuple[np.ndarray, Index] | true | 3 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
shouldAddOverrideKeyword | function shouldAddOverrideKeyword(): boolean {
return !!(context.program.getCompilerOptions().noImplicitOverride && declaration && hasAbstractModifier(declaration));
} | (#49811)
Note that there are cases in which the symbol declaration is not present. For example, in the code below both
`MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type
parent):
```ts
type Base = { ax: number; ay: string };
type BaseKeys = keyof Base;
type M... | typescript | src/services/codefixes/helpers.ts | 345 | [] | true | 3 | 8.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
rename_axis | def rename_axis(
self,
mapper: IndexLabel | lib.NoDefault = lib.no_default,
*,
index=lib.no_default,
axis: Axis = 0,
copy: bool | lib.NoDefault = lib.no_default,
inplace: bool = False,
) -> Self | None:
"""
Set the name of the axis for the inde... | Set the name of the axis for the index.
Parameters
----------
mapper : scalar, list-like, optional
Value to set the axis name attribute.
Use either ``mapper`` and ``axis`` to
specify the axis to target with ``mapper``, or ``index``.
index : scalar, list-like, dict-like or function, optional
A scalar,... | python | pandas/core/series.py | 5,451 | [
"self",
"mapper",
"index",
"axis",
"copy",
"inplace"
] | Self | None | true | 1 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
toByte | public static byte toByte(final String str) {
return toByte(str, (byte) 0);
} | Converts a {@link String} to a {@code byte}, returning {@code zero} if the conversion fails.
<p>
If the string is {@code null}, {@code zero} is returned.
</p>
<pre>
NumberUtils.toByte(null) = 0
NumberUtils.toByte("") = 0
NumberUtils.toByte("1") = 1
</pre>
@param str the string to convert, may be null.
@return ... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,358 | [
"str"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
_log_file_processing_stats | def _log_file_processing_stats(self, known_files: dict[str, set[DagFileInfo]]):
"""
Print out stats about how files are getting processed.
:param known_files: a list of file paths that may contain Airflow
DAG definitions
:return: None
"""
# File Path: Path to... | Print out stats about how files are getting processed.
:param known_files: a list of file paths that may contain Airflow
DAG definitions
:return: None | python | airflow-core/src/airflow/dag_processing/manager.py | 687 | [
"self",
"known_files"
] | true | 12 | 8 | apache/airflow | 43,597 | sphinx | false | |
with_row_locks | def with_row_locks(
query: Select[Any],
session: Session,
*,
nowait: bool = False,
skip_locked: bool = False,
key_share: bool = True,
**kwargs,
) -> Select[Any]:
"""
Apply with_for_update to the SQLAlchemy query if row level locking is in use.
This wrapper is needed so we don't ... | Apply with_for_update to the SQLAlchemy query if row level locking is in use.
This wrapper is needed so we don't use the syntax on unsupported database
engines. In particular, MySQL (prior to 8.0) and MariaDB do not support
row locking, where we do not support nor recommend running HA scheduler. If
a user ignores this... | python | airflow-core/src/airflow/utils/sqlalchemy.py | 332 | [
"query",
"session",
"nowait",
"skip_locked",
"key_share"
] | Select[Any] | true | 9 | 8.08 | apache/airflow | 43,597 | sphinx | false |
getNextEvictable | @GuardedBy("this")
ReferenceEntry<K, V> getNextEvictable() {
for (ReferenceEntry<K, V> e : accessQueue) {
int weight = e.getValueReference().getWeight();
if (weight > 0) {
return e;
}
}
throw new AssertionError();
} | Performs eviction if the segment is over capacity. Avoids flushing the entire cache if the
newest entry exceeds the maximum weight all on its own.
@param newest the most recently added entry | java | android/guava/src/com/google/common/cache/LocalCache.java | 2,583 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
toString | @Override
public String toString() {
return "ClientQuotaAlteration.Op(key=" + key + ", value=" + value + ")";
} | @return if set then the existing value is updated,
otherwise if null, the existing value is cleared | java | clients/src/main/java/org/apache/kafka/common/quota/ClientQuotaAlteration.java | 70 | [] | String | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
_hash_pandas_object | def _hash_pandas_object(
self, *, encoding: str, hash_key: str, categorize: bool
) -> npt.NDArray[np.uint64]:
"""
Hook for hash_pandas_object.
Default is to use the values returned by _values_for_factorize.
Parameters
----------
encoding : str
En... | Hook for hash_pandas_object.
Default is to use the values returned by _values_for_factorize.
Parameters
----------
encoding : str
Encoding for data & key when strings.
hash_key : str
Hash_key for string key to encode.
categorize : bool
Whether to first categorize object arrays before hashing. This is more... | python | pandas/core/arrays/base.py | 2,335 | [
"self",
"encoding",
"hash_key",
"categorize"
] | npt.NDArray[np.uint64] | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
_capture_with_reraise | def _capture_with_reraise() -> Generator[list[warnings.WarningMessage], None, None]:
"""Capture warnings in context and re-raise it on exit from the context manager."""
captured_warnings = []
try:
with warnings.catch_warnings(record=True) as captured_warnings:
yield captured_warnings
... | Capture warnings in context and re-raise it on exit from the context manager. | python | airflow-core/src/airflow/dag_processing/dagbag.py | 72 | [] | Generator[list[warnings.WarningMessage], None, None] | true | 3 | 7.04 | apache/airflow | 43,597 | unknown | false |
checkDependentWaitingThreads | private boolean checkDependentWaitingThreads(Thread waitingThread, Thread candidateThread) {
Thread threadToCheck = waitingThread;
while ((threadToCheck = this.lenientWaitingThreads.get(threadToCheck)) != null) {
if (threadToCheck == candidateThread) {
return true;
}
}
return false;
} | Return the (raw) singleton object registered under the given name,
creating and registering a new one if none registered yet.
@param beanName the name of the bean
@param singletonFactory the ObjectFactory to lazily create the singleton
with, if necessary
@return the registered singleton object | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java | 434 | [
"waitingThread",
"candidateThread"
] | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
put | public JSONObject put(String name, Object value) throws JSONException {
if (value == null) {
this.nameValuePairs.remove(name);
return this;
}
if (value instanceof Number) {
// deviate from the original by checking all Numbers, not just floats &
// doubles
JSON.checkDouble(((Number) value).doubleVal... | Maps {@code name} to {@code value}, clobbering any existing name/value mapping with
the same name. If the value is {@code null}, any existing mapping for {@code name}
is removed.
@param name the name of the property
@param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer,
Long, Double, {@link #NU... | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 261 | [
"name",
"value"
] | JSONObject | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
append | public StrBuilder append(final char[] chars) {
if (chars == null) {
return appendNull();
}
final int strLen = chars.length;
if (strLen > 0) {
final int len = length();
ensureCapacity(len + strLen);
System.arraycopy(chars, 0, buffer, len, st... | Appends a char array to the string builder.
Appending null will call {@link #appendNull()}.
@param chars the char array to append
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 367 | [
"chars"
] | StrBuilder | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
initializeUnchecked | public static <T> T initializeUnchecked(final ConcurrentInitializer<T> initializer) {
try {
return initialize(initializer);
} catch (final ConcurrentException cex) {
throw new ConcurrentRuntimeException(cex.getCause());
}
} | Invokes the specified {@link ConcurrentInitializer} and transforms
occurring exceptions to runtime exceptions. This method works like
{@link #initialize(ConcurrentInitializer)}, but if the {@code
ConcurrentInitializer} throws a {@link ConcurrentException}, it is
caught, and the cause is wrapped in a {@link ConcurrentRu... | java | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | 305 | [
"initializer"
] | T | true | 2 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
sniff | final void sniff() throws IOException {
List<Node> sniffedNodes = nodesSniffer.sniff();
if (logger.isDebugEnabled()) {
logger.debug("sniffed nodes: " + sniffedNodes);
}
if (sniffedNodes.isEmpty()) {
logger.warn("no nodes to set, nodes will be updated at the next s... | Schedule sniffing to run as soon as possible if it isn't already running. Once such sniffing round runs
it will also schedule a new round after sniffAfterFailureDelay ms. | java | client/sniffer/src/main/java/org/elasticsearch/client/sniff/Sniffer.java | 208 | [] | void | true | 3 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
private_function_across_module | def private_function_across_module(file_obj: IO[str]) -> Iterable[tuple[int, str]]:
"""
Checking that a private function is not used across modules.
Parameters
----------
file_obj : IO
File-like object containing the Python code to validate.
Yields
------
line_number : int
... | Checking that a private function is not used across modules.
Parameters
----------
file_obj : IO
File-like object containing the Python code to validate.
Yields
------
line_number : int
Line number of the private function that is used across modules.
msg : str
Explanation of the error. | python | scripts/validate_unwanted_patterns.py | 101 | [
"file_obj"
] | Iterable[tuple[int, str]] | true | 12 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
read | def read(self, path: str) -> PrecompileCacheEntry:
"""
Abstract method to read dynamo cache entry and backends from storage.
Args:
path: Path or key to identify where to read the data from
Returns:
A tuple containing (dynamo_cache_entry, backend_content)
... | Abstract method to read dynamo cache entry and backends from storage.
Args:
path: Path or key to identify where to read the data from
Returns:
A tuple containing (dynamo_cache_entry, backend_content) | python | torch/_dynamo/package.py | 967 | [
"self",
"path"
] | PrecompileCacheEntry | true | 1 | 6.56 | pytorch/pytorch | 96,034 | google | false |
logStartupInfo | protected void logStartupInfo(ConfigurableApplicationContext context) {
boolean isRoot = context.getParent() == null;
if (isRoot) {
new StartupInfoLogger(this.mainApplicationClass, context.getEnvironment()).logStarting(getApplicationLog());
}
} | Called to log startup information, subclasses may override to add additional
logging.
@param context the application context
@since 3.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 633 | [
"context"
] | void | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
setdiff1d | def setdiff1d(
x1: Array | complex,
x2: Array | complex,
/,
*,
assume_unique: bool = False,
xp: ModuleType | None = None,
) -> Array:
"""
Find the set difference of two arrays.
Return the unique values in `x1` that are not in `x2`.
Parameters
----------
x1 : array | int... | Find the set difference of two arrays.
Return the unique values in `x1` that are not in `x2`.
Parameters
----------
x1 : array | int | float | complex | bool
Input array.
x2 : array
Input comparison array.
assume_unique : bool
If ``True``, the input arrays are both assumed to be unique, which
can spee... | python | sklearn/externals/array_api_extra/_lib/_funcs.py | 888 | [
"x1",
"x2",
"assume_unique",
"xp"
] | Array | true | 4 | 8.64 | scikit-learn/scikit-learn | 64,340 | numpy | false |
matrix | function matrix<I extends L.List>(lists: L.List<I>): Strict<I[number]>[][] {
// we cannot produce a matrix with empty lists, filter them out
const nonEmptyLists = select(lists, (list) => list.length > 0)
const nonFlatMatrix = _matrix(nonEmptyLists) // first raw matrix
const flattenMatrix = repeat(flatten, times... | Creates the cross-product of a list of lists.
@param lists
@returns | typescript | helpers/blaze/matrix.ts | 29 | [
"lists"
] | true | 1 | 6.88 | prisma/prisma | 44,834 | jsdoc | false | |
configurationAsText | std::string configurationAsText(const ClangTidyOptions &Options) {
std::string Text;
llvm::raw_string_ostream Stream(Text);
llvm::yaml::Output Output(Stream);
// We use the same mapping method for input and output, so we need a non-const
// reference here.
ClangTidyOptions NonConstValue = Options;
Output ... | Parses -line-filter option and stores it to the \c Options. | cpp | clang-tools-extra/clang-tidy/ClangTidyOptions.cpp | 572 | [] | true | 1 | 6 | llvm/llvm-project | 36,021 | doxygen | false | |
devices | def devices(self) -> list[_Device]:
"""
The devices supported by Dask.
For Dask, this always returns ``['cpu', DASK_DEVICE]``.
Returns
-------
devices : list[Device]
The devices supported by Dask.
See Also
--------
__array_namespace_... | The devices supported by Dask.
For Dask, this always returns ``['cpu', DASK_DEVICE]``.
Returns
-------
devices : list[Device]
The devices supported by Dask.
See Also
--------
__array_namespace_info__.capabilities,
__array_namespace_info__.default_device,
__array_namespace_info__.default_dtypes,
__array_namespace... | python | sklearn/externals/array_api_compat/dask/array/_info.py | 391 | [
"self"
] | list[_Device] | true | 1 | 6.48 | scikit-learn/scikit-learn | 64,340 | unknown | false |
equals | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ApplicationPid other) {
return ObjectUtils.nullSafeEquals(this.pid, other.pid);
}
return false;
} | Return the application PID as a {@link Long}.
@return the application PID or {@code null}
@since 3.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java | 80 | [
"obj"
] | true | 3 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
equals | @Override
public boolean equals(Object obj) {
return obj instanceof SubscriptionPattern &&
Objects.equals(pattern, ((SubscriptionPattern) obj).pattern);
} | @return Regular expression pattern compatible with RE2/J. | java | clients/src/main/java/org/apache/kafka/clients/consumer/SubscriptionPattern.java | 54 | [
"obj"
] | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
flushPendingSend | private void flushPendingSend() {
flushPendingBuffer();
if (!buffers.isEmpty()) {
ByteBuffer[] byteBufferArray = buffers.toArray(new ByteBuffer[0]);
addSend(new ByteBufferSend(byteBufferArray, sizeOfBuffers));
clearBuffers();
}
} | Write a record set. The underlying record data will be retained
in the result of {@link #build()}. See {@link BaseRecords#toSend()}.
@param records the records to write | java | clients/src/main/java/org/apache/kafka/common/protocol/SendBuilder.java | 150 | [] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
compare | @Override
public int compare(final Object obj1, final Object obj2) {
return ((Comparable) obj1).compareTo(obj2);
} | Comparable based compare implementation.
@param obj1 left-hand side side of comparison.
@param obj2 right-hand side side of comparison.
@return negative, 0, positive comparison value. | java | src/main/java/org/apache/commons/lang3/Range.java | 48 | [
"obj1",
"obj2"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
checkState | public static void checkState(boolean expression) {
if (!expression) {
throw new IllegalStateException();
}
} | Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
@param expression a boolean expression
@throws IllegalStateException if {@code expression} is false
@see Verify#verify Verify.verify() | java | android/guava/src/com/google/common/base/Preconditions.java | 495 | [
"expression"
] | void | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false |
unicodeEscaped | public static String unicodeEscaped(final char ch) {
return "\\u" +
HEX_DIGITS[ch >> 12 & 15] +
HEX_DIGITS[ch >> 8 & 15] +
HEX_DIGITS[ch >> 4 & 15] +
HEX_DIGITS[ch & 15];
} | Converts the string to the Unicode format '\u0020'.
<p>This format is the Java source code format.</p>
<pre>
CharUtils.unicodeEscaped(' ') = "\u0020"
CharUtils.unicodeEscaped('A') = "\u0041"
</pre>
@param ch the character to convert
@return the escaped Unicode string | java | src/main/java/org/apache/commons/lang3/CharUtils.java | 510 | [
"ch"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
select_one_layer_lstm_function | def select_one_layer_lstm_function(input, hx, params):
r"""Check whether we could use decompose lstm with mkldnn_rnn_layer.
All the below conditions need to be met:
* ``torch._C._get_mkldnn_enabled()`` returns ``True``.
* All the input args are on CPU.
* The dtypes of args are either tor... | r"""Check whether we could use decompose lstm with mkldnn_rnn_layer.
All the below conditions need to be met:
* ``torch._C._get_mkldnn_enabled()`` returns ``True``.
* All the input args are on CPU.
* The dtypes of args are either torch.float or torch.bfloat16.
* Inference.
* ``has_projections`` retu... | python | torch/_decomp/decompositions.py | 3,641 | [
"input",
"hx",
"params"
] | false | 10 | 6.08 | pytorch/pytorch | 96,034 | google | false | |
min | public static char min(char... array) {
checkArgument(array.length > 0);
char min = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
}
}
return min;
} | Returns the least value present in {@code array}.
@param array a <i>nonempty</i> array of {@code char} values
@return the value present in {@code array} that is less than or equal to every other value in
the array
@throws IllegalArgumentException if {@code array} is empty | java | android/guava/src/com/google/common/primitives/Chars.java | 223 | [] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
format | public static String format(final Calendar calendar, final String pattern, final Locale locale) {
return format(calendar, pattern, getTimeZone(calendar), locale);
} | Formats a calendar into a specific pattern in a locale. The TimeZone from the calendar
will be used for formatting.
@param calendar the calendar to format, not null.
@param pattern the pattern to use to format the calendar, not null.
@param locale the locale to use, may be {@code null}.
@return the formatted calenda... | java | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | 225 | [
"calendar",
"pattern",
"locale"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
concurrencyLimit | public SimpleAsyncTaskSchedulerBuilder concurrencyLimit(@Nullable Integer concurrencyLimit) {
return new SimpleAsyncTaskSchedulerBuilder(this.threadNamePrefix, concurrencyLimit, this.virtualThreads,
this.taskTerminationTimeout, this.taskDecorator, this.customizers);
} | Set the concurrency limit.
@param concurrencyLimit the concurrency limit
@return a new builder instance | java | core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java | 90 | [
"concurrencyLimit"
] | SimpleAsyncTaskSchedulerBuilder | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
computeNext | protected abstract @Nullable T computeNext(); | Returns the next element. <b>Note:</b> the implementation must call {@link #endOfData()} when
there are no elements left in the iteration. Failure to do so could result in an infinite loop.
<p>The initial invocation of {@link #hasNext()} or {@link #next()} calls this method, as does
the first invocation of {@code hasNe... | java | android/guava/src/com/google/common/collect/AbstractIterator.java | 111 | [] | T | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
count | def count(self, axis: Axis = 0, numeric_only: bool = False) -> Series:
"""
Count non-NA cells for each column or row.
The values `None`, `NaN`, `NaT`, ``pandas.NA`` are considered NA.
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
If ... | Count non-NA cells for each column or row.
The values `None`, `NaN`, `NaT`, ``pandas.NA`` are considered NA.
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
If 0 or 'index' counts are generated for each column.
If 1 or 'columns' counts are generated for each row.
numeric_only : bool, de... | python | pandas/core/frame.py | 12,703 | [
"self",
"axis",
"numeric_only"
] | Series | true | 5 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
process | private void process(final PausePartitionsEvent event) {
try {
Collection<TopicPartition> partitions = event.partitions();
log.debug("Pausing partitions {}", partitions);
for (TopicPartition partition : partitions) {
subscriptions.pause(partition);
... | Process event indicating whether the AcknowledgeCommitCallbackHandler is configured by the user.
@param event Event containing a boolean to indicate if the callback handler is configured or not. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 621 | [
"event"
] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
setAccessibleWorkaround | static <T extends AccessibleObject> T setAccessibleWorkaround(final T obj) {
if (AccessibleObjects.isAccessible(obj)) {
return obj;
}
final Member m = (Member) obj;
if (isPublic(m) && isPackage(m.getDeclaringClass().getModifiers())) {
try {
obj.set... | Default access superclass workaround.
<p>
When a {@code public} class has a default access superclass with {@code public} members,
these members are accessible. Calling them from compiled code works fine.
Unfortunately, on some JVMs, using reflection to invoke these members
seems to (wrongly) prevent access even when t... | java | src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java | 322 | [
"obj"
] | T | true | 5 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
faceIjkToCellBoundaryClassIII | private CellBoundary faceIjkToCellBoundaryClassIII(int adjRes) {
final LatLng[] points = new LatLng[CellBoundary.MAX_CELL_BNDRY_VERTS];
int numPoints = 0;
final FaceIJK fijk = new FaceIJK(this.face, new CoordIJK(0, 0, 0));
final CoordIJK scratch = new CoordIJK(0, 0, 0);
int lastF... | Generates the cell boundary in spherical coordinates for a cell given by this
FaceIJK address at a specified resolution.
@param res The H3 resolution of the cell. | java | libs/h3/src/main/java/org/elasticsearch/h3/FaceIJK.java | 579 | [
"adjRes"
] | CellBoundary | true | 8 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
matchesSubscribedPattern | public synchronized boolean matchesSubscribedPattern(String topic) {
Pattern pattern = this.subscribedPattern;
if (hasPatternSubscription() && pattern != null)
return pattern.matcher(topic).matches();
return false;
} | Check whether a topic matches a subscribed pattern.
@return true if pattern subscription is in use and the topic matches the subscribed pattern, false otherwise | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 362 | [
"topic"
] | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
binary_repr | def binary_repr(num, width=None):
"""
Return the binary representation of the input number as a string.
For negative numbers, if width is not given, a minus sign is added to the
front. If width is given, the two's complement of the number is
returned, with respect to that width.
In a two's-com... | Return the binary representation of the input number as a string.
For negative numbers, if width is not given, a minus sign is added to the
front. If width is given, the two's complement of the number is
returned, with respect to that width.
In a two's-complement system negative numbers are represented by the two's
c... | python | numpy/_core/numeric.py | 1,990 | [
"num",
"width"
] | false | 10 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
format | @Override
public StringBuffer format(final long millis, final StringBuffer buf) {
final Calendar c = newCalendar();
c.setTimeInMillis(millis);
return (StringBuffer) applyRules(c, (Appendable) buf);
} | Compares two objects for equality.
@param obj the object to compare to.
@return {@code true} if equal. | java | src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java | 1,202 | [
"millis",
"buf"
] | StringBuffer | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
handleNotControllerError | private void handleNotControllerError(AbstractResponse response) throws ApiException {
// When sending requests directly to the follower controller, it might return NOT_LEADER_OR_FOLLOWER error.
if (response.errorCounts().containsKey(Errors.NOT_CONTROLLER)) {
handleNotControllerError(Errors.... | Fail futures in the given Map which were retried due to exceeding quota. We propagate
the initial error back to the caller if the request timed out. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 4,140 | [
"response"
] | void | true | 4 | 6 | apache/kafka | 31,560 | javadoc | false |
stripStart | public static String stripStart(final String str, final String stripChars) {
final int strLen = length(str);
if (strLen == 0) {
return str;
}
int start = 0;
if (stripChars == null) {
while (start != strLen && Character.isWhitespace(str.charAt(start))) {
... | Strips any of a set of characters from the start of a String.
<p>
A {@code null} input String returns {@code null}. An empty string ("") input returns the empty string.
</p>
<p>
If the stripChars String is {@code null}, whitespace is stripped as defined by {@link Character#isWhitespace(char)}.
</p>
<pre>
StringUtils.st... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,998 | [
"str",
"stripChars"
] | String | true | 8 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
mask_zero_div_zero | def mask_zero_div_zero(x, y, result: np.ndarray) -> np.ndarray:
"""
Set results of 0 // 0 to np.nan, regardless of the dtypes
of the numerator or the denominator.
Parameters
----------
x : ndarray
y : ndarray
result : ndarray
Returns
-------
ndarray
The filled resu... | Set results of 0 // 0 to np.nan, regardless of the dtypes
of the numerator or the denominator.
Parameters
----------
x : ndarray
y : ndarray
result : ndarray
Returns
-------
ndarray
The filled result.
Examples
--------
>>> x = np.array([1, 0, -1], dtype=np.int64)
>>> x
array([ 1, 0, -1])
>>> y = 0 # int 0; nu... | python | pandas/core/ops/missing.py | 72 | [
"x",
"y",
"result"
] | np.ndarray | true | 7 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
size | public static int size(Iterator<?> iterator) {
long count = 0L;
while (iterator.hasNext()) {
iterator.next();
count++;
}
return Ints.saturatedCast(count);
} | Returns the number of elements remaining in {@code iterator}. The iterator will be left
exhausted: its {@code hasNext()} method will return {@code false}. | java | android/guava/src/com/google/common/collect/Iterators.java | 170 | [
"iterator"
] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
ignoreLogConfig | private boolean ignoreLogConfig(@Nullable String logConfig) {
return !StringUtils.hasLength(logConfig) || logConfig.startsWith("-D");
} | Initialize the logging system according to preferences expressed through the
{@link Environment} and the classpath.
@param environment the environment
@param classLoader the classloader | java | core/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java | 356 | [
"logConfig"
] | true | 2 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
clearValueReferenceQueue | void clearValueReferenceQueue() {
while (valueReferenceQueue.poll() != null) {}
} | Clears all entries from the key and value reference queues. | java | android/guava/src/com/google/common/cache/LocalCache.java | 2,431 | [] | void | true | 2 | 6.96 | google/guava | 51,352 | javadoc | false |
createDocumentBuilderFactory | protected DocumentBuilderFactory createDocumentBuilderFactory(int validationMode, boolean namespaceAware)
throws ParserConfigurationException {
// This document loader is used for loading application configuration files.
// As a result, attackers would need complete write access to application configuration
/... | Create the {@link DocumentBuilderFactory} instance.
@param validationMode the type of validation: {@link XmlValidationModeDetector#VALIDATION_DTD DTD}
or {@link XmlValidationModeDetector#VALIDATION_XSD XSD})
@param namespaceAware whether the returned factory is to provide support for XML namespaces
@return the JAXP Doc... | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java | 88 | [
"validationMode",
"namespaceAware"
] | DocumentBuilderFactory | true | 4 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
nansum | def nansum(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
min_count: int = 0,
mask: npt.NDArray[np.bool_] | None = None,
) -> npt.NDArray[np.floating] | float | NaTType:
"""
Sum the elements along an axis ignoring NaNs
Parameters
----------
values ... | Sum the elements along an axis ignoring NaNs
Parameters
----------
values : ndarray[dtype]
axis : int, optional
skipna : bool, default True
min_count: int, default 0
mask : ndarray[bool], optional
nan-mask if known
Returns
-------
result : dtype
Examples
--------
>>> from pandas.core import nanops
>>> s = pd.Ser... | python | pandas/core/nanops.py | 599 | [
"values",
"axis",
"skipna",
"min_count",
"mask"
] | npt.NDArray[np.floating] | float | NaTType | true | 3 | 7.84 | pandas-dev/pandas | 47,362 | numpy | false |
poly2cheb | def poly2cheb(pol):
"""
Convert a polynomial to a Chebyshev series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Chebyshev series, ordered
from lowest to... | Convert a polynomial to a Chebyshev series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Chebyshev series, ordered
from lowest to highest degree.
Parameters
----------
pol : ar... | python | numpy/polynomial/chebyshev.py | 345 | [
"pol"
] | false | 2 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
fix | def fix(x, out=None):
"""
Round to nearest integer towards zero.
Round an array of floats element-wise to nearest integer towards zero.
The rounded values have the same data-type as the input.
Parameters
----------
x : array_like
An array to be rounded
out : ndarray, optional
... | Round to nearest integer towards zero.
Round an array of floats element-wise to nearest integer towards zero.
The rounded values have the same data-type as the input.
Parameters
----------
x : array_like
An array to be rounded
out : ndarray, optional
A location into which the result is stored. If provided, it... | python | numpy/lib/_ufunclike_impl.py | 17 | [
"x",
"out"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
entrySet | @Override
public Set<Entry<E>> entrySet() {
Set<Entry<E>> result = entrySet;
if (result == null) {
entrySet = result = createEntrySet();
}
return result;
} | Creates a new instance of this multiset's element set, which will be returned by {@link
#elementSet()}. | java | android/guava/src/com/google/common/collect/AbstractMultiset.java | 164 | [] | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false | |
replaceIn | public boolean replaceIn(final StringBuffer source) {
if (source == null) {
return false;
}
return replaceIn(source, 0, source.length());
} | Replaces all the occurrences of variables within the given source buffer
with their matching values from the resolver.
The buffer is updated with the result.
@param source the buffer to replace in, updated, null returns zero.
@return true if altered. | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 764 | [
"source"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
fromStoreValue | protected @Nullable Object fromStoreValue(@Nullable Object storeValue) {
if (this.allowNullValues && storeValue == NullValue.INSTANCE) {
return null;
}
return storeValue;
} | Convert the given value from the internal store to a user value
returned from the get method (adapting {@code null}).
@param storeValue the store value
@return the value to return to the user | java | spring-context/src/main/java/org/springframework/cache/support/AbstractValueAdaptingCache.java | 86 | [
"storeValue"
] | Object | true | 3 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
fchmod | function fchmod(fd, mode, callback) {
mode = parseFileMode(mode, 'mode');
callback = makeCallback(callback);
if (permission.isEnabled()) {
callback(new ERR_ACCESS_DENIED('fchmod API is disabled when Permission Model is enabled.'));
return;
}
const req = new FSReqCallback();
req.oncomplete = callba... | Sets the permissions on the file.
@param {number} fd
@param {string | number} mode
@param {(err?: Error) => any} callback
@returns {void} | javascript | lib/fs.js | 1,929 | [
"fd",
"mode",
"callback"
] | false | 2 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
from_envvar | def from_envvar(self, variable_name: str, silent: bool = False) -> bool:
"""Loads a configuration from an environment variable pointing to
a configuration file. This is basically just a shortcut with nicer
error messages for this line of code::
app.config.from_pyfile(os.environ['YO... | Loads a configuration from an environment variable pointing to
a configuration file. This is basically just a shortcut with nicer
error messages for this line of code::
app.config.from_pyfile(os.environ['YOURAPPLICATION_SETTINGS'])
:param variable_name: name of the environment variable
:param silent: set to ``Tr... | python | src/flask/config.py | 102 | [
"self",
"variable_name",
"silent"
] | bool | true | 3 | 7.44 | pallets/flask | 70,946 | sphinx | false |
nullCheckedList | private static <E> List<E> nullCheckedList(Object... array) {
for (int i = 0, len = array.length; i < len; i++) {
if (array[i] == null) {
throw new NullPointerException("at index " + i);
}
}
@SuppressWarnings("unchecked")
E[] castedArray = (E[]) array;
return Arrays.asList(casted... | Views the array as an immutable list. The array must have only {@code E} elements.
<p>The array must be internally created. | java | guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java | 213 | [] | true | 3 | 7.04 | google/guava | 51,352 | javadoc | false | |
abbreviate | public static String abbreviate(final String str, final int offset, final int maxWidth) {
return abbreviate(str, ELLIPSIS3, offset, maxWidth);
} | Abbreviates a String using ellipses. This will convert "Now is the time for all good men" into "...is the time for...".
<p>
Works like {@code abbreviate(String, int)}, but allows you to specify a "left edge" offset. Note that this left edge is not necessarily going to be the
leftmost character in the result, or the fir... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 272 | [
"str",
"offset",
"maxWidth"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
toLength | function toLength(value) {
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
} | Converts `value` to an integer suitable for use as the length of an
array-like object.
**Note:** This method is based on
[`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to convert.
@returns {number} Returns the converted ... | javascript | lodash.js | 12,537 | [
"value"
] | false | 2 | 6.96 | lodash/lodash | 61,490 | jsdoc | false | |
pop_header_name | def pop_header_name(
row: list[Hashable], index_col: int | Sequence[int]
) -> tuple[Hashable | None, list[Hashable]]:
"""
Pop the header name for MultiIndex parsing.
Parameters
----------
row : list
The data row to parse for the header name.
index_col : int, list
The index c... | Pop the header name for MultiIndex parsing.
Parameters
----------
row : list
The data row to parse for the header name.
index_col : int, list
The index columns for our data. Assumed to be non-null.
Returns
-------
header_name : str
The extracted header name.
trimmed_row : list
The original data row wi... | python | pandas/io/excel/_util.py | 270 | [
"row",
"index_col"
] | tuple[Hashable | None, list[Hashable]] | true | 4 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
readSchemaFromFileOrDirectory | async function readSchemaFromFileOrDirectory(schemaPath: string): Promise<LookupResult> {
let stats: fs.Stats
try {
stats = await stat(schemaPath)
} catch (e) {
if (e.code === 'ENOENT') {
return { ok: false, error: { kind: 'NotFound', path: schemaPath } }
}
throw e
}
if (stats.isFile())... | Loads the schema, returns null if it is not found
Throws an error if schema is specified explicitly in
any of the available ways (argument, package.json config), but
can not be loaded
@param schemaPathFromArgs
@param schemaPathFromConfig
@param opts
@returns | typescript | packages/internals/src/cli/getSchema.ts | 140 | [
"schemaPath"
] | true | 5 | 7.44 | prisma/prisma | 44,834 | jsdoc | true | |
getAndIncrement | public int getAndIncrement() {
final int last = value;
value++;
return last;
} | Increments this instance's value by 1; this method returns the value associated with the instance
immediately prior to the increment operation. This method is not thread safe.
@return the value associated with the instance before it was incremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableInt.java | 247 | [] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
parseDateWithLeniency | private static Date parseDateWithLeniency(final String dateStr, final Locale locale, final String[] parsePatterns,
final boolean lenient) throws ParseException {
Objects.requireNonNull(dateStr, "str");
Objects.requireNonNull(parsePatterns, "parsePatterns");
final TimeZone tz = TimeZone.... | Parses a string representing a date by trying a variety of different parsers.
<p>The parse will try each parse pattern in turn.
A parse is only deemed successful if it parses the whole of the input string.
If no parse patterns match, a ParseException is thrown.</p>
@param dateStr the date to parse, not null.
@param lo... | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,344 | [
"dateStr",
"locale",
"parsePatterns",
"lenient"
] | Date | true | 4 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
row | @Override
public Map<C, @Nullable V> row(R rowKey) {
checkNotNull(rowKey);
Integer rowIndex = rowKeyToIndex.get(rowKey);
if (rowIndex == null) {
return emptyMap();
} else {
return new Row(rowIndex);
}
} | Returns a view of all mappings that have the given row key. If the row key isn't in {@link
#rowKeySet()}, an empty immutable map is returned.
<p>Otherwise, for each column key in {@link #columnKeySet()}, the returned map associates the
column key with the corresponding value in the table. Changes to the returned map wi... | java | android/guava/src/com/google/common/collect/ArrayTable.java | 686 | [
"rowKey"
] | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false | |
_parse_json_file | def _parse_json_file(file_path: str) -> tuple[dict[str, Any], list[FileSyntaxError]]:
"""
Parse a file in the JSON format.
:param file_path: The location of the file that will be processed.
:return: Tuple with mapping of key and list of values and list of syntax errors
"""
with open(file_path) ... | Parse a file in the JSON format.
:param file_path: The location of the file that will be processed.
:return: Tuple with mapping of key and list of values and list of syntax errors | python | airflow-core/src/airflow/secrets/local_filesystem.py | 135 | [
"file_path"
] | tuple[dict[str, Any], list[FileSyntaxError]] | true | 3 | 8.08 | apache/airflow | 43,597 | sphinx | false |
clientId | @Override
public String clientId() {
return clientId;
} | This method can be used by cases where the caller has an event that needs to both block for completion but
also process background events. For some events, in order to fully process the associated logic, the
{@link ConsumerNetworkThread background thread} needs assistance from the application thread to complete.
If the... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java | 1,341 | [] | String | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
Promise | Promise(Promise&& other) noexcept
: ct_(std::move(other.ct_)),
state_(std::exchange(other.state_, nullptr)) {} | Construct an empty Promise.
This object is not valid use until you initialize it with move assignment. | cpp | folly/coro/Promise.h | 71 | [] | true | 2 | 6.8 | facebook/folly | 30,157 | doxygen | false | |
getOperationContext | protected CacheOperationContext getOperationContext(
CacheOperation operation, Method method, @Nullable Object[] args, Object target, Class<?> targetClass) {
CacheOperationMetadata metadata = getCacheOperationMetadata(operation, method, targetClass);
return new CacheOperationContext(metadata, args, target);
} | Convenience method to return a String representation of this Method
for use in logging. Can be overridden in subclasses to provide a
different identifier for the given method.
@param method the method we're interested in
@param targetClass class the method is on
@return log message identifying this method
@see org.spri... | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 321 | [
"operation",
"method",
"args",
"target",
"targetClass"
] | CacheOperationContext | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
getStrictModeBlockScopeFunctionDeclarationMessage | function getStrictModeBlockScopeFunctionDeclarationMessage(node: Node) {
// Provide specialized messages to help the user understand why we think they're in
// strict mode.
if (getContainingClass(node)) {
return Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_s... | 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 | 2,680 | [
"node"
] | false | 3 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
dehexchar | public static int dehexchar(char hex) {
if (hex >= '0' && hex <= '9') {
return hex - '0';
}
else if (hex >= 'A' && hex <= 'F') {
return hex - 'A' + 10;
}
else if (hex >= 'a' && hex <= 'f') {
return hex - 'a' + 10;
}
else {
return -1;
}
} | Returns the current position and the entire input string.
@return the current position and the entire input string. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 540 | [
"hex"
] | true | 7 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
factoriesAndBeans | public static Loader factoriesAndBeans(ListableBeanFactory beanFactory) {
ClassLoader classLoader = (beanFactory instanceof ConfigurableBeanFactory configurableBeanFactory ?
configurableBeanFactory.getBeanClassLoader() : null);
return factoriesAndBeans(getSpringFactoriesLoader(classLoader), beanFactory);
} | Create a new {@link Loader} that will obtain AOT services from
{@value #FACTORIES_RESOURCE_LOCATION} as well as the given
{@link ListableBeanFactory}.
@param beanFactory the bean factory
@return a new {@link Loader} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java | 119 | [
"beanFactory"
] | Loader | true | 2 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
parsePossibleParenthesizedArrowFunctionExpression | function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction: boolean): ArrowFunction | undefined {
const tokenPos = scanner.getTokenStart();
if (notParenthesizedArrow?.has(tokenPos)) {
return undefined;
}
const result = parseParenthesizedA... | 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 | 5,381 | [
"allowReturnTypeInArrowFunction"
] | true | 4 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
invokeBeanDefiningClosure | protected GroovyBeanDefinitionReader invokeBeanDefiningClosure(Closure<?> callable) {
callable.setDelegate(this);
callable.call();
finalizeDeferredProperties();
return this;
} | When a method argument is only a closure it is a set of bean definitions.
@param callable the closure argument
@return this {@code GroovyBeanDefinitionReader} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java | 452 | [
"callable"
] | GroovyBeanDefinitionReader | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
bindOrCreate | public <T> T bindOrCreate(String name, Class<T> target) {
return bindOrCreate(name, Bindable.of(target));
} | Bind the specified target {@link Class} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance of
the specified target {@link Class} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target class
@param <T> the ... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 302 | [
"name",
"target"
] | T | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
_parse_date_columns | def _parse_date_columns(data_frame: DataFrame, parse_dates) -> DataFrame:
"""
Force non-datetime columns to be read as such.
Supports both string formatted and integer timestamp columns.
"""
parse_dates = _process_parse_dates_argument(parse_dates)
# we want to coerce datetime64_tz dtypes for no... | Force non-datetime columns to be read as such.
Supports both string formatted and integer timestamp columns. | python | pandas/io/sql.py | 139 | [
"data_frame",
"parse_dates"
] | DataFrame | true | 4 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
optLong | public long optLong(int index) {
return optLong(index, 0L);
} | Returns the value at {@code index} if it exists and is a long or can be coerced to
a long. Returns 0 otherwise.
@param index the index to get the value from
@return the {@code value} or {@code 0} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 461 | [
"index"
] | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
createInstance | @Override
protected Object createInstance() {
Assert.state(getServiceType() != null, "Property 'serviceType' is required");
return getObjectToExpose(ServiceLoader.load(getServiceType(), this.beanClassLoader));
} | Delegates to {@link #getObjectToExpose(java.util.ServiceLoader)}.
@return the object to expose | java | spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java | 68 | [] | Object | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
appendCommentRange | function appendCommentRange(pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, _state: any, comments: CommentRange[] = []) {
comments.push({ kind, pos, end, hasTrailingNewLine });
return comments;
} | Invokes a callback for each comment range following the provided position.
Single-line comment ranges include the leading double-slash characters but not the ending
line break. Multi-line comment ranges include the leading slash-asterisk and trailing
asterisk-slash characters.
@param reduce If true, accumulates t... | typescript | src/compiler/scanner.ts | 952 | [
"pos",
"end",
"kind",
"hasTrailingNewLine",
"_state",
"comments"
] | false | 1 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
get_masked_subclass | def get_masked_subclass(*arrays):
"""
Return the youngest subclass of MaskedArray from a list of (masked) arrays.
In case of siblings, the first listed takes over.
"""
if len(arrays) == 1:
arr = arrays[0]
if isinstance(arr, MaskedArray):
rcls = type(arr)
else:
... | Return the youngest subclass of MaskedArray from a list of (masked) arrays.
In case of siblings, the first listed takes over. | python | numpy/ma/core.py | 681 | [] | false | 9 | 6.08 | numpy/numpy | 31,054 | unknown | false | |
resolveName | private void resolveName(ConfigurationMetadataItem item) {
item.setName(item.getId()); // fallback
ConfigurationMetadataSource source = getSource(item);
if (source != null) {
String groupId = source.getGroupId();
String dottedPrefix = groupId + ".";
String id = item.getId();
if (hasLength(groupId) && ... | Resolve the name of an item against this instance.
@param item the item to resolve
@see ConfigurationMetadataProperty#setName(String) | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java | 74 | [
"item"
] | void | true | 4 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
parsePKCS8Encrypted | private static PrivateKey parsePKCS8Encrypted(BufferedReader bReader, char[] keyPassword) throws IOException, GeneralSecurityException {
StringBuilder sb = new StringBuilder();
String line = bReader.readLine();
while (line != null) {
if (PKCS8_ENCRYPTED_FOOTER.equals(line.trim())) {
... | Creates a {@link PrivateKey} from the contents of {@code bReader} that contains an encrypted private key encoded in
PKCS#8
@param bReader the {@link BufferedReader} containing the key file contents
@param keyPassword The password for the encrypted (password protected) key
@return {@link PrivateKey}
@throws IOExcept... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | 378 | [
"bReader",
"keyPassword"
] | PrivateKey | true | 7 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
hasParser | public boolean hasParser(Class<?> categoryClass, String name, RestApiVersion apiVersion) {
final Map<Class<?>, Map<String, Entry>> versionMap = registry.get(apiVersion);
if (versionMap == null) {
return false;
}
final Map<String, Entry> parsers = versionMap.get(categoryClass)... | Returns {@code true} if this registry is able to {@link #parseNamedObject parse} the referenced object, false otherwise.
Note: This method does not throw exceptions, even if the {@link RestApiVersion} or {@code categoryClass} are unknown. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/NamedXContentRegistry.java | 156 | [
"categoryClass",
"name",
"apiVersion"
] | true | 3 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
get_event_buffer | def get_event_buffer(self, dag_ids=None) -> dict[TaskInstanceKey, EventBufferValueType]:
"""
Return and flush the event buffer.
In case dag_ids is specified it will only return and flush events
for the given dag_ids. Otherwise, it returns and flushes all events.
:param dag_ids:... | Return and flush the event buffer.
In case dag_ids is specified it will only return and flush events
for the given dag_ids. Otherwise, it returns and flushes all events.
:param dag_ids: the dag_ids to return events for; returns all if given ``None``.
:return: a dict of events | python | airflow-core/src/airflow/executors/base_executor.py | 494 | [
"self",
"dag_ids"
] | dict[TaskInstanceKey, EventBufferValueType] | true | 5 | 8.24 | apache/airflow | 43,597 | sphinx | false |
containsIgnoreCase | @Deprecated
public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr) {
return Strings.CI.contains(str, searchStr);
} | Tests if CharSequence contains a search CharSequence irrespective of case, handling {@code null}. Case-insensitivity is defined as by
{@link String#equalsIgnoreCase(String)}.
<p>
A {@code null} CharSequence will return {@code false}.
</p>
<pre>
StringUtils.containsIgnoreCase(null, *) = false
StringUtils.containsIgno... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 1,187 | [
"str",
"searchStr"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
getErrorMessage | private String getErrorMessage(Integer partitionsCount, String topic, Integer partition, long maxWaitMs) {
return partitionsCount == null ?
String.format("Topic %s not present in metadata after %d ms.",
topic, maxWaitMs) :
String.format("Partition %d of topic %s with part... | Wait for cluster metadata including partitions for the given topic to be available.
@param topic The topic we want metadata for
@param partition A specific partition expected to exist in metadata, or null if there's no preference
@param nowMs The current time in ms
@param maxWaitMs The maximum time in ms for waiting on... | java | clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java | 1,271 | [
"partitionsCount",
"topic",
"partition",
"maxWaitMs"
] | String | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false |
toHttpCacheControl | public @Nullable CacheControl toHttpCacheControl() {
PropertyMapper map = PropertyMapper.get();
CacheControl control = createCacheControl();
map.from(this::getMustRevalidate).whenTrue().toCall(control::mustRevalidate);
map.from(this::getNoTransform).whenTrue().toCall(control::noTransform);
map.... | Maximum time the response should be cached by shared caches, in seconds
if no duration suffix is not specified. | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebProperties.java | 578 | [] | CacheControl | true | 2 | 7.04 | 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.