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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_arg_trim_zeros | def _arg_trim_zeros(filt):
"""Return indices of the first and last non-zero element.
Parameters
----------
filt : array_like
Input array.
Returns
-------
start, stop : ndarray
Two arrays containing the indices of the first and last non-zero
element in each dimension... | Return indices of the first and last non-zero element.
Parameters
----------
filt : array_like
Input array.
Returns
-------
start, stop : ndarray
Two arrays containing the indices of the first and last non-zero
element in each dimension.
See also
--------
trim_zeros
Examples
--------
>>> import numpy as... | python | numpy/lib/_function_base_impl.py | 1,897 | [
"filt"
] | false | 4 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
replaceAll | public StrBuilder replaceAll(final StrMatcher matcher, final String replaceStr) {
return replace(matcher, replaceStr, 0, size, -1);
} | Replaces all matches within the builder with the replace string.
<p>
Matchers can be used to perform advanced replace behavior.
For example you could write a matcher to replace all occurrences
where the character 'a' is followed by a number.
</p>
@param matcher the matcher to use to find the deletion, null causes no a... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,615 | [
"matcher",
"replaceStr"
] | StrBuilder | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
_replace_with_mask | def _replace_with_mask(
cls,
values: pa.Array | pa.ChunkedArray,
mask: npt.NDArray[np.bool_] | bool,
replacements: ArrayLike | Scalar,
) -> pa.Array | pa.ChunkedArray:
"""
Replace items selected with a mask.
Analogous to pyarrow.compute.replace_with_mask, wit... | Replace items selected with a mask.
Analogous to pyarrow.compute.replace_with_mask, with logic
to fallback to numpy for unsupported types.
Parameters
----------
values : pa.Array or pa.ChunkedArray
mask : npt.NDArray[np.bool_] or bool
replacements : ArrayLike or Scalar
Replacement value(s)
Returns
-------
pa.Arr... | python | pandas/core/arrays/arrow/array.py | 2,545 | [
"cls",
"values",
"mask",
"replacements"
] | pa.Array | pa.ChunkedArray | true | 6 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
describe_pipeline_exec | def describe_pipeline_exec(self, pipeline_exec_arn: str, verbose: bool = False):
"""
Get info about a SageMaker pipeline execution.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.describe_pipeline_execution`
- :external+boto3:py:meth:`SageMaker.Client.list_pipe... | Get info about a SageMaker pipeline execution.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.describe_pipeline_execution`
- :external+boto3:py:meth:`SageMaker.Client.list_pipeline_execution_steps`
:param pipeline_exec_arn: arn of the pipeline execution
:param verbose: Whether to log details about t... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 1,079 | [
"self",
"pipeline_exec_arn",
"verbose"
] | true | 2 | 6.08 | apache/airflow | 43,597 | sphinx | false | |
config_list | def config_list(**configs):
"""Generate configs based on the list of input shapes.
This function will take input shapes specified in a list from user. Besides
that, all other parameters will be cross produced first and each of the
generated list will be merged with the input shapes list.
Reserved A... | Generate configs based on the list of input shapes.
This function will take input shapes specified in a list from user. Besides
that, all other parameters will be cross produced first and each of the
generated list will be merged with the input shapes list.
Reserved Args:
attr_names(reserved): a list of names for ... | python | benchmarks/operator_benchmark/benchmark_utils.py | 134 | [] | false | 6 | 6.24 | pytorch/pytorch | 96,034 | unknown | false | |
orFrom | public Source<T> orFrom(Supplier<? extends @Nullable T> fallback) {
Assert.notNull(fallback, "'fallback' must not be null");
Supplier<@Nullable T> supplier = () -> {
T value = getValue();
return (value != null) ? value : fallback.get();
};
return new Source<>(supplier, this.predicate);
} | Return a source that will use the given supplier to obtain a fallback value to
use in place of {@code null}.
@param fallback the fallback supplier
@return a new {@link Source} instance
@since 4.0.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 172 | [
"fallback"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
fill | public static byte[] fill(final byte[] a, final byte val) {
if (a != null) {
Arrays.fill(a, val);
}
return a;
} | Fills and returns the given array, assigning the given {@code byte} value to each element of the array.
@param a the array to be filled (may be null).
@param val the value to be stored in all elements of the array.
@return the given array.
@see Arrays#fill(byte[],byte) | java | src/main/java/org/apache/commons/lang3/ArrayFill.java | 56 | [
"a",
"val"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
pipe | def pipe(
obj: _T,
func: Callable[Concatenate[_T, P], T] | tuple[Callable[..., T], str],
*args: Any,
**kwargs: Any,
) -> T:
"""
Apply a function ``func`` to object ``obj`` either by passing obj as the
first argument to the function or, in the case that the func is a tuple,
interpret the ... | Apply a function ``func`` to object ``obj`` either by passing obj as the
first argument to the function or, in the case that the func is a tuple,
interpret the first element of the tuple as a function and pass the obj to
that function as a keyword argument whose key is the value of the second
element of the tuple.
Par... | python | pandas/core/common.py | 490 | [
"obj",
"func"
] | T | true | 4 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
pullAll | function pullAll(array, values) {
return (array && array.length && values && values.length)
? basePullAll(array, values)
: array;
} | This method is like `_.pull` except that it accepts an array of values to remove.
**Note:** Unlike `_.difference`, this method mutates `array`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} array The array to modify.
@param {Array} values The values to remove.
@returns {Array} Returns `array`.
@exampl... | javascript | lodash.js | 7,823 | [
"array",
"values"
] | false | 5 | 7.52 | lodash/lodash | 61,490 | jsdoc | false | |
pausedPartitions | public synchronized Set<TopicPartition> pausedPartitions() {
return collectPartitions(TopicPartitionState::isPaused);
} | @return True if subscribed using RE2J pattern. False otherwise. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 393 | [] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
owners | public DescribeDelegationTokenOptions owners(List<KafkaPrincipal> owners) {
this.owners = owners;
return this;
} | If owners is null, all the user owned tokens and tokens where user have Describe permission
will be returned.
@param owners The owners that we want to describe delegation tokens for
@return this instance | java | clients/src/main/java/org/apache/kafka/clients/admin/DescribeDelegationTokenOptions.java | 36 | [
"owners"
] | DescribeDelegationTokenOptions | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
getGenericParameterTypes | @Override
Type[] getGenericParameterTypes() {
Type[] types = constructor.getGenericParameterTypes();
if (types.length > 0 && mayNeedHiddenThis()) {
Class<?>[] rawParamTypes = constructor.getParameterTypes();
if (types.length == rawParamTypes.length
&& rawParamTypes[0] == getD... | If the class is parameterized, such as {@link java.util.ArrayList ArrayList}, this returns
{@code ArrayList<E>}. | java | android/guava/src/com/google/common/reflect/Invokable.java | 434 | [] | true | 5 | 6.56 | google/guava | 51,352 | javadoc | false | |
asJarArchiveEntry | private JarArchiveEntry asJarArchiveEntry(ZipEntry entry) throws ZipException {
if (entry instanceof JarArchiveEntry jarArchiveEntry) {
return jarArchiveEntry;
}
return new JarArchiveEntry(entry);
} | Create a new {@link JarWriter} instance.
@param file the file to write
@param lastModifiedTime an optional last modified time to apply to the written
entries
@throws IOException if the file cannot be opened
@throws FileNotFoundException if the file cannot be found
@since 4.0.0 | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java | 85 | [
"entry"
] | JarArchiveEntry | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
getWildcardDirectoryFromSpec | function getWildcardDirectoryFromSpec(spec: string, useCaseSensitiveFileNames: boolean): { key: CanonicalKey; path: string; flags: WatchDirectoryFlags; } | undefined {
const match = wildcardDirectoryPattern.exec(spec);
if (match) {
// We check this with a few `indexOf` calls because 3 `indexOf`/`last... | Gets directories in a set of include patterns that should be watched for changes. | typescript | src/compiler/commandLineParser.ts | 4,151 | [
"spec",
"useCaseSensitiveFileNames"
] | true | 7 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
reinstall_if_different_sources | def reinstall_if_different_sources(airflow_sources: Path) -> bool:
"""
Prints warning if detected airflow sources are not the ones that Breeze was installed with.
:param airflow_sources: source for airflow code that we are operating on
:return: True if warning was printed.
"""
installation_airfl... | Prints warning if detected airflow sources are not the ones that Breeze was installed with.
:param airflow_sources: source for airflow code that we are operating on
:return: True if warning was printed. | python | dev/breeze/src/airflow_breeze/utils/path_utils.py | 148 | [
"airflow_sources"
] | bool | true | 3 | 8.24 | apache/airflow | 43,597 | sphinx | false |
toObject | public static Boolean[] toObject(final boolean[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_BOOLEAN_OBJECT_ARRAY;
}
return setAll(new Boolean[array.length], i -> array[i] ? Boolean.TRUE : Boolean.FALSE);
} | Converts an array of primitive booleans to objects.
<p>This method returns {@code null} for a {@code null} input array.</p>
@param array a {@code boolean} array.
@return a {@link Boolean} array, {@code null} if null array input. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,672 | [
"array"
] | true | 4 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
prepare_docker_build_cache_command | def prepare_docker_build_cache_command(
image_params: CommonBuildParams,
) -> list[str]:
"""
Constructs docker build_cache command based on the parameters passed.
:param image_params: parameters of the image
:return: Command to run as list of string
"""
final_command = []
final_command... | Constructs docker build_cache command based on the parameters passed.
:param image_params: parameters of the image
:return: Command to run as list of string | python | dev/breeze/src/airflow_breeze/utils/docker_command_utils.py | 364 | [
"image_params"
] | list[str] | true | 2 | 7.76 | apache/airflow | 43,597 | sphinx | false |
applyAsInt | int applyAsInt(int left, int right) throws E; | Applies this operator to the given operands.
@param left the first operand
@param right the second operand
@return the operator result
@throws E if the operation fails | java | src/main/java/org/apache/commons/lang3/function/FailableIntBinaryOperator.java | 39 | [
"left",
"right"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
toArray | public String[] toArray() {
return toList().toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} | Returns a new {@code String[]} containing the tokenizer elements.
@return a new {@code String[]}. | java | src/main/java/org/apache/commons/lang3/util/IterableStringTokenizer.java | 91 | [] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
getBean | @Override
public <T> T getBean(Class<T> requiredType) throws BeansException {
String[] beanNames = getBeanNamesForType(requiredType);
if (beanNames.length == 1) {
return getBean(beanNames[0], requiredType);
}
else if (beanNames.length > 1) {
throw new NoUniqueBeanDefinitionException(requiredType, beanNam... | Add a new singleton bean.
<p>Will overwrite any existing instance for the given name.
@param name the name of the bean
@param bean the bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java | 170 | [
"requiredType"
] | T | true | 3 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
descendingEntryIterator | @Override
Iterator<Entry<Cut<C>, Range<C>>> descendingEntryIterator() {
Collection<Range<C>> candidates;
if (upperBoundWindow.hasUpperBound()) {
candidates =
rangesByLowerBound
.headMap(upperBoundWindow.upperEndpoint(), false)
.descendingMap()
... | upperBoundWindow represents the headMap/subMap/tailMap view of the entire "ranges by upper
bound" map; it's a constraint on the *keys*, and does not affect the values. | java | android/guava/src/com/google/common/collect/TreeRangeSet.java | 403 | [] | true | 6 | 6.56 | google/guava | 51,352 | javadoc | false | |
invoke | protected final <R> InvocationResult<R> invoke(C callbackInstance, Supplier<@Nullable R> supplier) {
if (this.filter.match(this.callbackType, callbackInstance, this.argument, this.additionalArguments)) {
try {
return InvocationResult.of(supplier.get());
}
catch (ClassCastException ex) {
if (!is... | Use a specific filter to determine when a callback should apply. If no explicit
filter is set filter will be attempted using the generic type on the callback
type.
@param filter the filter to use
@return this instance
@since 3.4.8 | java | core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java | 158 | [
"callbackInstance",
"supplier"
] | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
resolveConfigVariables | private Map<String, ?> resolveConfigVariables(Map<String, ?> configProviderProps, Map<String, Object> originals) {
Map<String, String> providerConfigString;
Map<String, ?> configProperties;
Predicate<String> classNameFilter;
Map<String, Object> resolvedOriginals = new HashMap<>();
... | Instantiates given list of config providers and fetches the actual values of config variables from the config providers.
returns a map of config key and resolved values.
@param configProviderProps The map of config provider configs
@param originals The map of raw configs.
@return map of resolved config variab... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 535 | [
"configProviderProps",
"originals"
] | true | 5 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
throwCause | private static Exception throwCause(Exception e, boolean combineStackTraces) throws Exception {
Throwable cause = e.getCause();
if (cause == null) {
throw e;
}
if (combineStackTraces) {
StackTraceElement[] combined =
ObjectArrays.concat(cause.getStackTrace(), e.getStackTrace(), Sta... | 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 | 221 | [
"e",
"combineStackTraces"
] | Exception | true | 5 | 6.88 | google/guava | 51,352 | javadoc | false |
toString | @Override
public String toString() {
MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
if (initialCapacity != UNSET_INT) {
s.add("initialCapacity", initialCapacity);
}
if (concurrencyLevel != UNSET_INT) {
s.add("concurrencyLevel", concurrencyLevel);
}
if (keyStrength... | Returns a string representation for this MapMaker instance. The exact form of the returned
string is not specified. | java | android/guava/src/com/google/common/collect/MapMaker.java | 294 | [] | String | true | 6 | 6.56 | google/guava | 51,352 | javadoc | false |
getSingletonInstance | private synchronized Object getSingletonInstance() {
if (this.singletonInstance == null) {
this.targetSource = freshTargetSource();
if (this.autodetectInterfaces && getProxiedInterfaces().length == 0 && !isProxyTargetClass()) {
// Rely on AOP infrastructure to tell us what interfaces to proxy.
Class<?> ... | Return the singleton instance of this class's proxy object,
lazily creating it if it hasn't been created already.
@return the shared singleton proxy | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java | 300 | [] | Object | true | 6 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
unwrapListeners | function unwrapListeners(arr) {
const ret = arrayClone(arr);
for (let i = 0; i < ret.length; ++i) {
const orig = ret[i].listener;
if (typeof orig === 'function')
ret[i] = orig;
}
return ret;
} | Returns an array listing the events for which
the emitter has registered listeners.
@returns {(string | symbol)[]} | javascript | lib/events.js | 877 | [
"arr"
] | false | 3 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
createJarFileForStream | private JarFile createJarFileForStream(InputStream in, Version version, Consumer<JarFile> closeAction)
throws IOException {
Path local = Files.createTempFile("jar_cache", null);
try {
Files.copy(in, local, StandardCopyOption.REPLACE_EXISTING);
JarFile jarFile = new UrlJarFile(local.toFile(), version, close... | Create a new {@link UrlJarFile} or {@link UrlNestedJarFile} instance.
@param jarFileUrl the jar file URL
@param closeAction the action to call when the file is closed
@return a new {@link JarFile} instance
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java | 95 | [
"in",
"version",
"closeAction"
] | JarFile | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
addPropertyValue | public MutablePropertyValues addPropertyValue(PropertyValue pv) {
for (int i = 0; i < this.propertyValueList.size(); i++) {
PropertyValue currentPv = this.propertyValueList.get(i);
if (currentPv.getName().equals(pv.getName())) {
pv = mergeIfRequired(pv, currentPv);
setPropertyValueAt(pv, i);
return ... | Add a PropertyValue object, replacing any existing one for the
corresponding property or getting merged with it (if applicable).
@param pv the PropertyValue object to add
@return this in order to allow for adding multiple property values in a chain | java | spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java | 173 | [
"pv"
] | MutablePropertyValues | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
on | static <T> Collection<UncheckedFuture<T>> on(final Collection<Future<T>> futures) {
return map(futures).collect(Collectors.toList());
} | Maps the given instances as unchecked.
@param <T> The result type returned by the Futures' {@link #get()} and {@link #get(long, TimeUnit)} methods.
@param futures The Futures to uncheck.
@return a new collection. | java | src/main/java/org/apache/commons/lang3/concurrent/UncheckedFuture.java | 58 | [
"futures"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
escape | public abstract String escape(String string); | Returns the escaped form of a given literal string.
<p>Note that this method may treat input characters differently depending on the specific
escaper implementation.
<ul>
<li>{@link UnicodeEscaper} handles <a href="http://en.wikipedia.org/wiki/UTF-16">UTF-16</a>
correctly, including surrogate character pairs. I... | java | android/guava/src/com/google/common/escape/Escaper.java | 86 | [
"string"
] | String | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false |
H | def H(self):
"""
Returns the (complex) conjugate transpose of `self`.
Equivalent to ``np.transpose(self)`` if `self` is real-valued.
Parameters
----------
None
Returns
-------
ret : matrix object
complex conjugate transpose of `self`... | Returns the (complex) conjugate transpose of `self`.
Equivalent to ``np.transpose(self)`` if `self` is real-valued.
Parameters
----------
None
Returns
-------
ret : matrix object
complex conjugate transpose of `self`
Examples
--------
>>> x = np.matrix(np.arange(12).reshape((3,4)))
>>> z = x - 1j*x; z
matrix([[... | python | numpy/matrixlib/defmatrix.py | 976 | [
"self"
] | false | 3 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
_maybe_convert_platform_interval | def _maybe_convert_platform_interval(values) -> ArrayLike:
"""
Try to do platform conversion, with special casing for IntervalArray.
Wrapper around maybe_convert_platform that alters the default return
dtype in certain cases to be compatible with IntervalArray. For example,
empty lists return with ... | Try to do platform conversion, with special casing for IntervalArray.
Wrapper around maybe_convert_platform that alters the default return
dtype in certain cases to be compatible with IntervalArray. For example,
empty lists return with integer dtype instead of object dtype, which is
prohibited for IntervalArray.
Para... | python | pandas/core/arrays/interval.py | 2,162 | [
"values"
] | ArrayLike | true | 12 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
unsplit | public void unsplit() {
if (splitState != SplitState.SPLIT) {
throw new IllegalStateException("Stopwatch has not been split.");
}
splitState = SplitState.UNSPLIT;
splits.remove(splits.size() - 1);
} | Removes the split.
<p>
This method clears the stop time. The start time is unaffected, enabling timing from the original start point to continue.
</p>
@throws IllegalStateException if this StopWatch has not been split. | java | src/main/java/org/apache/commons/lang3/time/StopWatch.java | 831 | [] | void | true | 2 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
maybePropagateMetadataError | private void maybePropagateMetadataError() {
try {
metadata.maybeThrowAnyException();
} catch (Exception e) {
if (notifyMetadataErrorsViaErrorQueue) {
backgroundEventHandler.add(new ErrorEvent(e));
} else {
metadataError = Optional.of(e... | This method will try to send the unsent requests, poll for responses,
and check the disconnected nodes.
@param timeoutMs timeout time
@param currentTimeMs current time
@param onClose True when the network thread is closing. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java | 172 | [] | void | true | 3 | 6.72 | apache/kafka | 31,560 | javadoc | false |
processDatabase | private void processDatabase(final String name, final Checksum checksum, final CheckedSupplier<InputStream, IOException> source) {
Metadata metadata = state.getDatabases().getOrDefault(name, Metadata.EMPTY);
if (checksum.matches(metadata)) {
updateTimestamp(name, metadata);
retur... | This method fetches the database file for the given database from the passed-in source, then indexes that database
file into the .geoip_databases Elasticsearch index, deleting any old versions of the database from the index if they exist.
@param name The name of the database to be downloaded and indexed into an Elastic... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloader.java | 277 | [
"name",
"checksum",
"source"
] | void | true | 5 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
doParse | @Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
NamedNodeMap attributes = element.getAttributes();
for (int x = 0; x < attributes.getLength(); x++) {
Attr attribute = (Attr) attributes.item(x);
if (isEligibleAttribute(attribute, parserContext)) ... | Parse the supplied {@link Element} and populate the supplied
{@link BeanDefinitionBuilder} as required.
<p>This implementation maps any attributes present on the
supplied element to {@link org.springframework.beans.PropertyValue}
instances, and
{@link BeanDefinitionBuilder#addPropertyValue(String, Object) adds them}
to... | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java | 126 | [
"element",
"parserContext",
"builder"
] | void | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
lastIndexOf | public int lastIndexOf(final StrMatcher matcher) {
return lastIndexOf(matcher, size);
} | Searches the string builder using the matcher to find the last match.
<p>
Matchers can be used to perform advanced searching behavior.
For example you could write a matcher to find the character 'a'
followed by a number.
</p>
@param matcher the matcher to use, null returns -1
@return the last index matched, or -1 if n... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,375 | [
"matcher"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
from_spmatrix | def from_spmatrix(cls, data, index=None, columns=None) -> DataFrame:
"""
Create a new DataFrame from a scipy sparse matrix.
Parameters
----------
data : scipy.sparse.spmatrix
Must be convertible to csc format.
index, columns : Index, optional
Row ... | Create a new DataFrame from a scipy sparse matrix.
Parameters
----------
data : scipy.sparse.spmatrix
Must be convertible to csc format.
index, columns : Index, optional
Row and column labels to use for the resulting DataFrame.
Defaults to a RangeIndex.
Returns
-------
DataFrame
Each column of the Dat... | python | pandas/core/arrays/sparse/accessor.py | 309 | [
"cls",
"data",
"index",
"columns"
] | DataFrame | true | 2 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
multiple_chunks | def multiple_chunks(self, chunk_size=None):
"""
Return ``True`` if you can expect multiple chunks.
NB: If a particular file representation is in memory, subclasses should
always return ``False`` -- there's no good reason to read from memory
in chunks.
"""
return ... | Return ``True`` if you can expect multiple chunks.
NB: If a particular file representation is in memory, subclasses should
always return ``False`` -- there's no good reason to read from memory
in chunks. | python | django/core/files/base.py | 65 | [
"self",
"chunk_size"
] | false | 2 | 6.08 | django/django | 86,204 | unknown | false | |
load | static ZipLocalFileHeaderRecord load(DataBlock dataBlock, long pos) throws IOException {
debug.log("Loading LocalFileHeaderRecord from position %s", pos);
ByteBuffer buffer = ByteBuffer.allocate(MINIMUM_SIZE);
buffer.order(ByteOrder.LITTLE_ENDIAN);
dataBlock.readFully(buffer, pos);
buffer.rewind();
if (buff... | Load the {@link ZipLocalFileHeaderRecord} from the given data block.
@param dataBlock the source data block
@param pos the position of the record
@return a new {@link ZipLocalFileHeaderRecord} instance
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipLocalFileHeaderRecord.java | 111 | [
"dataBlock",
"pos"
] | ZipLocalFileHeaderRecord | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
remainderIsDashes | private boolean remainderIsDashes(Elements elements, int element, int index) {
if (elements.getType(element).isIndexed()) {
return false;
}
int length = elements.getLength(element);
do {
char c = elements.charAt(element, index++);
if (c != '-') {
return false;
}
}
while (index < length);
r... | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 512 | [
"elements",
"element",
"index"
] | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
iterator | @Override
public Iterator<E> iterator() {
Set<E> delegate = delegateOrNull();
if (delegate != null) {
return delegate.iterator();
}
return new Iterator<E>() {
int expectedMetadata = metadata;
int currentIndex = firstEntryIndex();
int indexToRemove = -1;
@Override
p... | Updates the index an iterator is pointing to after a call to remove: returns the index of the
entry that should be looked at after a removal on indexRemoved, with indexBeforeRemove as the
index that *was* the next entry that would be looked at. | java | android/guava/src/com/google/common/collect/CompactHashSet.java | 535 | [] | true | 4 | 6.4 | google/guava | 51,352 | javadoc | false | |
rehydrateCachedInfo | function rehydrateCachedInfo(info: CachedSymbolExportInfo): SymbolExportInfo {
if (info.symbol && info.moduleSymbol) return info as SymbolExportInfo;
const { id, exportKind, targetFlags, isFromPackageJson, moduleFileName } = info;
const [cachedSymbol, cachedModuleSymbol] = symbols.get(id) || ... | Key: node_modules package name (no @types).
Value: path to deepest node_modules folder seen that is
both visible to `usableByFileName` and contains the package.
Later, we can see if a given SymbolExportInfo is shadowed by
a another installation of the same package in a deeper
node_modules folder by seeing if its ... | typescript | src/services/exportInfoMap.ts | 281 | [
"info"
] | true | 13 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
size | public int size() {
return size;
} | Gets the length of the string builder.
<p>
This method is the same as {@link #length()} and is provided to match the
API of Collections.
</p>
@return the length | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,851 | [] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
atLeast | public boolean atLeast(final JavaVersion requiredVersion) {
return this.value >= requiredVersion.value;
} | Tests whether this version of Java is at least the version of Java passed in.
<p>
For example:
</p>
<pre>
{@code
myVersion.atLeast(JavaVersion.JAVA_1_8)
}</pre>
@param requiredVersion the version to check against, not null.
@return true if this version is equal to or greater than the specified version. | java | src/main/java/org/apache/commons/lang3/JavaVersion.java | 380 | [
"requiredVersion"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
buildWiringInfo | protected BeanWiringInfo buildWiringInfo(Object beanInstance, Configurable annotation) {
if (!Autowire.NO.equals(annotation.autowire())) {
// Autowiring by name or by type
return new BeanWiringInfo(annotation.autowire().value(), annotation.dependencyCheck());
}
else if (!annotation.value().isEmpty()) {
/... | Build the {@link BeanWiringInfo} for the given {@link Configurable} annotation.
@param beanInstance the bean instance
@param annotation the Configurable annotation found on the bean class
@return the resolved BeanWiringInfo | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/AnnotationBeanWiringInfoResolver.java | 54 | [
"beanInstance",
"annotation"
] | BeanWiringInfo | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
nonNull | public static <E> Stream<E> nonNull(final Collection<E> collection) {
return of(collection).filter(Objects::nonNull);
} | Streams the non-null elements of a collection.
@param <E> the type of elements in the collection.
@param collection the collection to stream or null.
@return A non-null stream that filters out null elements.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 626 | [
"collection"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
get_window_bounds | def get_window_bounds(
self,
num_values: int = 0,
min_periods: int | None = None,
center: bool | None = None,
closed: str | None = None,
step: int | None = None,
) -> tuple[np.ndarray, np.ndarray]:
"""
Computes the bounds of a window.
Paramete... | Computes the bounds of a window.
Parameters
----------
num_values : int, default 0
number of values that will be aggregated over
window_size : int, default 0
the number of rows in a window
min_periods : int, default None
min_periods passed from the top level rolling API
center : bool, default None
cent... | python | pandas/core/indexers/objects.py | 480 | [
"self",
"num_values",
"min_periods",
"center",
"closed",
"step"
] | tuple[np.ndarray, np.ndarray] | true | 5 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
intToHexDigitMsb0 | public static char intToHexDigitMsb0(final int nibble) {
switch (nibble) {
case 0x0:
return '0';
case 0x1:
return '8';
case 0x2:
return '4';
case 0x3:
return 'c';
case 0x4:
return '2';
case 0x5:
... | Converts the 4 LSB of an int to a hexadecimal digit encoded using the MSB0 bit ordering.
<p>
0 returns '0'
</p>
<p>
1 returns '8'
</p>
<p>
10 returns '5' and so on...
</p>
@param nibble the 4 bits to convert.
@return a hexadecimal digit representing the 4 LSB of {@code nibble}.
@throws IllegalArgumentException if {@cod... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 1,005 | [
"nibble"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
idxmax | def idxmax(
self,
skipna: bool = True,
numeric_only: bool = False,
) -> DataFrame:
"""
Return index of first occurrence of maximum in each group.
Parameters
----------
skipna : bool, default True
Exclude NA values.
numeric_only : b... | Return index of first occurrence of maximum in each group.
Parameters
----------
skipna : bool, default True
Exclude NA values.
numeric_only : bool, default False
Include only `float`, `int` or `boolean` data.
Returns
-------
DataFrame
Indexes of maxima in each column according to the group.
Raises
-----... | python | pandas/core/groupby/generic.py | 2,991 | [
"self",
"skipna",
"numeric_only"
] | DataFrame | true | 1 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
categories | def categories(self) -> Index:
"""
The categories of this categorical.
Setting assigns new values to each category (effectively a rename of
each individual category).
The assigned value has to be a list-like object. All items must be
unique and the number of items in th... | The categories of this categorical.
Setting assigns new values to each category (effectively a rename of
each individual category).
The assigned value has to be a list-like object. All items must be
unique and the number of items in the new categories must be the same
as the number of items in the old categories.
Ra... | python | pandas/core/arrays/categorical.py | 793 | [
"self"
] | Index | true | 1 | 6.64 | pandas-dev/pandas | 47,362 | unknown | false |
listGroups | default ListGroupsResult listGroups() {
return listGroups(new ListGroupsOptions());
} | List the groups available in the cluster with the default options.
<p>This is a convenience method for {@link #listGroups(ListGroupsOptions)} with default options.
See the overload for more details.
@return The ListGroupsResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,070 | [] | ListGroupsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
substituteElementAccessExpression | function substituteElementAccessExpression(node: ElementAccessExpression) {
if (node.expression.kind === SyntaxKind.SuperKeyword) {
return createSuperElementAccessInAsyncMethod(
node.argumentExpression,
node,
);
}
return node;
} | Hooks node substitutions.
@param hint The context for the emitter.
@param node The node to substitute. | typescript | src/compiler/transformers/es2018.ts | 1,424 | [
"node"
] | false | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
visitForOfStatement | function visitForOfStatement(node: ForOfStatement): VisitResult<Statement> {
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & NodeFlags.BlockScoped)) {
const exportStatements = appendExportsOfVariableDeclarationList(/*statements*/ undefined, node.initializer, /*isForIn... | Visits the body of a ForOfStatement to hoist declarations.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 958 | [
"node"
] | true | 5 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
findSingleMainClass | public static @Nullable String findSingleMainClass(File rootDirectory, @Nullable String annotationName)
throws IOException {
SingleMainClassCallback callback = new SingleMainClassCallback(annotationName);
MainClassFinder.doWithMainClasses(rootDirectory, callback);
return callback.getMainClassName();
} | Find a single main class from the given {@code rootDirectory}. A main class
annotated with an annotation with the given {@code annotationName} will be
preferred over a main class with no such annotation.
@param rootDirectory the root directory to search
@param annotationName the name of the annotation that may be prese... | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 111 | [
"rootDirectory",
"annotationName"
] | String | true | 1 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
isIterateeCall | function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(... | Checks if the given arguments are from an iteratee call.
@private
@param {*} value The potential iteratee value argument.
@param {*} index The potential iteratee index or key argument.
@param {*} object The potential iteratee object argument.
@returns {boolean} Returns `true` if the arguments are from an iteratee call,... | javascript | lodash.js | 6,383 | [
"value",
"index",
"object"
] | false | 6 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
eye | def eye(n, M=None, k=0, dtype=float, order='C'):
"""
Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index... | Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index of the diagonal: 0 refers to the main diagonal,
a positive value refers to an upper diag... | python | numpy/matlib.py | 191 | [
"n",
"M",
"k",
"dtype",
"order"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
count | def count(self):
"""
Compute count of group, excluding missing values.
Returns
-------
Series or DataFrame
Count of values within each group.
See Also
--------
Series.groupby : Apply a function groupby to a Series.
DataFrame.groupby :... | Compute count of group, excluding missing values.
Returns
-------
Series or DataFrame
Count of values within each group.
See Also
--------
Series.groupby : Apply a function groupby to a Series.
DataFrame.groupby : Apply a function groupby to each row
or column of a DataFrame.
Examples
--------
>>> ser = pd.S... | python | pandas/core/resample.py | 1,845 | [
"self"
] | false | 4 | 7.68 | pandas-dev/pandas | 47,362 | unknown | false | |
_validate_or_indexify_columns | def _validate_or_indexify_columns(
content: list[np.ndarray], columns: Index | None
) -> Index:
"""
If columns is None, make numbers as column names; Otherwise, validate that
columns have valid length.
Parameters
----------
content : list of np.ndarrays
columns : Index or None
Retu... | If columns is None, make numbers as column names; Otherwise, validate that
columns have valid length.
Parameters
----------
content : list of np.ndarrays
columns : Index or None
Returns
-------
Index
If columns is None, assign positional column index value as columns.
Raises
------
1. AssertionError when content... | python | pandas/core/internals/construction.py | 894 | [
"content",
"columns"
] | Index | true | 10 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
getBeanName | public static String getBeanName(MethodInvocation mi) throws IllegalStateException {
if (!(mi instanceof ProxyMethodInvocation pmi)) {
throw new IllegalArgumentException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
}
String beanName = (String) pmi.getUserAttribute(BEAN_NAME_ATTRIBUTE);
i... | Find the bean name for the given invocation. Assumes that an ExposeBeanNameAdvisor
has been included in the interceptor chain.
@param mi the MethodInvocation that should contain the bean name as an attribute
@return the bean name (never {@code null})
@throws IllegalStateException if the bean name has not been exposed | java | spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java | 70 | [
"mi"
] | String | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
prepare_import | def prepare_import(path: str) -> str:
"""Given a filename this will try to calculate the python path, add it
to the search path and return the actual module name that is expected.
"""
path = os.path.realpath(path)
fname, ext = os.path.splitext(path)
if ext == ".py":
path = fname
if... | Given a filename this will try to calculate the python path, add it
to the search path and return the actual module name that is expected. | python | src/flask/cli.py | 200 | [
"path"
] | str | true | 6 | 6 | pallets/flask | 70,946 | unknown | false |
h3Rotate60ccw | public static long h3Rotate60ccw(long h) {
for (int r = 1, res = H3_get_resolution(h); r <= res; r++) {
h = H3_set_index_digit(h, r, CoordIJK.rotate60ccw(H3_get_index_digit(h, r)));
}
return h;
} | Rotate an H3Index 60 degrees counter-clockwise.
@param h The H3Index. | java | libs/h3/src/main/java/org/elasticsearch/h3/H3Index.java | 303 | [
"h"
] | true | 2 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false | |
threadNamePrefix | public ThreadPoolTaskSchedulerBuilder threadNamePrefix(@Nullable String threadNamePrefix) {
return new ThreadPoolTaskSchedulerBuilder(this.poolSize, this.awaitTermination, this.awaitTerminationPeriod,
threadNamePrefix, this.taskDecorator, this.customizers);
} | Set the prefix to use for the names of newly created threads.
@param threadNamePrefix the thread name prefix to set
@return a new builder instance | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskSchedulerBuilder.java | 116 | [
"threadNamePrefix"
] | ThreadPoolTaskSchedulerBuilder | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
_prepared | def _prepared(self, tasks, partial_args, group_id, root_id, app,
CallableSignature=abstract.CallableSignature,
from_dict=Signature.from_dict,
isinstance=isinstance, tuple=tuple):
"""Recursively unroll the group into a generator of its tasks.
This is... | Recursively unroll the group into a generator of its tasks.
This is used by :meth:`apply_async` and :meth:`apply` to
unroll the group into a list of tasks that can be evaluated.
Note:
This does not change the group itself, it only returns
a generator of the tasks that the group would evaluate to.
Arguments:
... | python | celery/canvas.py | 1,693 | [
"self",
"tasks",
"partial_args",
"group_id",
"root_id",
"app",
"CallableSignature",
"from_dict",
"isinstance",
"tuple"
] | false | 8 | 7.44 | celery/celery | 27,741 | google | false | |
optJSONArray | public JSONArray optJSONArray(String name) {
Object object = opt(name);
return object instanceof JSONArray ? (JSONArray) object : null;
} | Returns the value mapped by {@code name} if it exists and is a {@code
JSONArray}. Returns null otherwise.
@param name the name of the property
@return the value or {@code null} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 612 | [
"name"
] | JSONArray | true | 2 | 8 | spring-projects/spring-boot | 79,428 | javadoc | false |
buildOrThrow | @Override
public ImmutableBiMap<K, V> buildOrThrow() {
switch (size) {
case 0:
return of();
case 1:
// requireNonNull is safe because the first `size` elements have been filled in.
Entry<K, V> onlyEntry = requireNonNull(entries[0]);
return of(onlyEntry.g... | Returns a newly-created immutable bimap, or throws an exception if any key or value was added
more than once. The iteration order of the returned bimap is the order in which entries were
inserted into the builder, unless {@link #orderEntriesByValue} was called, in which case
entries are sorted by value.
@throws Illegal... | java | guava/src/com/google/common/collect/ImmutableBiMap.java | 451 | [] | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false | |
negate | public static Boolean negate(final Boolean bool) {
if (bool == null) {
return null;
}
return bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
} | Negates the specified boolean.
<p>If {@code null} is passed in, {@code null} will be returned.</p>
<p>NOTE: This returns {@code null} and will throw a {@link NullPointerException}
if unboxed to a boolean.</p>
<pre>
BooleanUtils.negate(Boolean.TRUE) = Boolean.FALSE;
BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 262 | [
"bool"
] | Boolean | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
isExcluded | private boolean isExcluded(EndpointId endpointId) {
if (this.exclude.isEmpty()) {
return false;
}
return this.exclude.matches(endpointId);
} | Return {@code true} if the filter matches.
@param endpointId the endpoint ID to check
@return {@code true} if the filter matches
@since 2.6.0 | java | module/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/expose/IncludeExcludeEndpointFilter.java | 136 | [
"endpointId"
] | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
allDescriptions | public KafkaFuture<Map<Integer, Map<String, LogDirDescription>>> allDescriptions() {
return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture<?>[0])).
thenApply(v -> {
Map<Integer, Map<String, LogDirDescription>> descriptions = new HashMap<>(futures.size());
... | Return a future which succeeds only if all the brokers have responded without error.
The result of the future is a map from brokerId to a map from broker log directory path
to a description of that log directory. | java | clients/src/main/java/org/apache/kafka/clients/admin/DescribeLogDirsResult.java | 50 | [] | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
secondsFrac | public double secondsFrac() {
return ((double) nanos()) / C3;
} | @return the number of {@link #timeUnit()} units this value contains | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 186 | [] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
nop | @SuppressWarnings("unchecked")
static <E extends Throwable> FailableDoubleToIntFunction<E> nop() {
return NOP;
} | Gets the NOP singleton.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailableDoubleToIntFunction.java | 41 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
_generate_strided_index | def _generate_strided_index(self, index: sympy.Expr) -> str:
"""
Generate JAX code to compute an index array for strided/complex indexing patterns.
For expressions like `2 * x3 + 32 * x2 + 256 * x1 + 1024 * x0`, we generate
code that computes the flattened index array using broadcasting... | Generate JAX code to compute an index array for strided/complex indexing patterns.
For expressions like `2 * x3 + 32 * x2 + 256 * x1 + 1024 * x0`, we generate
code that computes the flattened index array using broadcasting.
The iteration variables (x0, x1, x2, x3) are already defined as jnp.arange arrays
in the kerne... | python | torch/_inductor/codegen/pallas.py | 984 | [
"self",
"index"
] | str | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
replaceWithNullptr | static void replaceWithNullptr(ClangTidyCheck &Check, SourceManager &SM,
SourceLocation StartLoc, SourceLocation EndLoc) {
const CharSourceRange Range(SourceRange(StartLoc, EndLoc), true);
// Add a space if nullptr follows an alphanumeric character. This happens
// whenever there is... | Returns true if and only if a replacement was made. | cpp | clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp | 93 | [
"StartLoc",
"EndLoc"
] | true | 2 | 6 | llvm/llvm-project | 36,021 | doxygen | false | |
replace | public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) {
return new StrSubstitutor(valueMap, prefix, suffix).replace(source);
} | Replaces all the occurrences of variables in the given source object with
their matching values from the map. This method allows to specify a
custom variable prefix and suffix.
@param <V> the type of the values in the map.
@param source the source text containing the variables to substitute, null returns null.
@param ... | java | src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java | 194 | [
"source",
"valueMap",
"prefix",
"suffix"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
from | static SslManagerBundle from(@Nullable SslStoreBundle storeBundle, @Nullable SslBundleKey key) {
return new DefaultSslManagerBundle(storeBundle, key);
} | Factory method to create a new {@link SslManagerBundle} backed by the given
{@link SslBundle} and {@link SslBundleKey}.
@param storeBundle the SSL store bundle
@param key the key reference
@return a new {@link SslManagerBundle} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java | 125 | [
"storeBundle",
"key"
] | SslManagerBundle | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
replaceEachRepeatedly | public static String replaceEachRepeatedly(final String text, final String[] searchList, final String[] replacementList) {
final int timeToLive = Math.max(ArrayUtils.getLength(searchList), DEFAULT_TTL);
return replaceEach(text, searchList, replacementList, true, timeToLive);
} | Replaces all occurrences of Strings within another String.
<p>
A {@code null} reference passed to this method is a no-op, or if any "search string" or "string to replace" is null, that replace will be ignored.
</p>
<pre>
StringUtils.replaceEachRepeatedly(null, *, *) = nul... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 6,549 | [
"text",
"searchList",
"replacementList"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
ignore_warnings | def ignore_warnings(obj=None, category=Warning):
"""Context manager and decorator to ignore warnings.
Note: Using this (in both variants) will clear all warnings
from all python modules loaded. In case you need to test
cross-module-warning-logging, this is not your tool of choice.
Parameters
-... | Context manager and decorator to ignore warnings.
Note: Using this (in both variants) will clear all warnings
from all python modules loaded. In case you need to test
cross-module-warning-logging, this is not your tool of choice.
Parameters
----------
obj : callable, default=None
callable where you want to ignore... | python | sklearn/utils/_testing.py | 70 | [
"obj",
"category"
] | false | 5 | 7.36 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
mergeIfPossible | @SuppressWarnings("unchecked")
private static void mergeIfPossible(Map<String, Object> source, MutablePropertySources sources,
Map<String, Object> resultingSource) {
PropertySource<?> existingSource = sources.get(NAME);
if (existingSource != null) {
Object underlyingSource = existingSource.getSource();
if... | Add a new {@link DefaultPropertiesPropertySource} or merge with an existing one.
@param source the {@code Map} source
@param sources the existing sources
@since 2.4.4 | java | core/spring-boot/src/main/java/org/springframework/boot/env/DefaultPropertiesPropertySource.java | 100 | [
"source",
"sources",
"resultingSource"
] | void | true | 3 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
isBinaryOpContext | function isBinaryOpContext(context: FormattingContext): boolean {
switch (context.contextNode.kind) {
case SyntaxKind.BinaryExpression:
return (context.contextNode as BinaryExpression).operatorToken.kind !== SyntaxKind.CommaToken;
case SyntaxKind.ConditionalExpression:
case ... | A rule takes a two tokens (left/right) and a particular context
for which you're meant to look at them. You then declare what should the
whitespace annotation be between these tokens via the action param.
@param debugName Name to print
@param left The left side of the comparison
@param right The right side of the... | typescript | src/services/formatting/rules.ts | 501 | [
"context"
] | true | 6 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
detectRuntime | function detectRuntime(): RuntimeName {
// Note: we're currently not taking 'fastly' into account. Why?
const runtimeChecks = [
[isNetlify, 'netlify'],
[isEdgeLight, 'edge-light'],
[isWorkerd, 'workerd'],
[isDeno, 'deno'],
[isBun, 'bun'],
[isNode, 'node'],
] as const
const detectedRunti... | Indicates if running in Cloudflare Workers runtime.
See: https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent | typescript | packages/client/src/runtime/utils/getRuntime.ts | 37 | [] | true | 2 | 6.56 | prisma/prisma | 44,834 | jsdoc | false | |
onEmitNode | function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) {
if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis && isFunctionLike(node)) {
// If we are tracking a captured `this`, keep track of the enclosing function.
const ancesto... | Called by the printer just before a node is printed.
@param hint A hint as to the intended usage of the node.
@param node The node to be printed.
@param emitCallback The callback used to emit the node. | typescript | src/compiler/transformers/es2015.ts | 4,855 | [
"hint",
"node",
"emitCallback"
] | false | 4 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
elementIterator | @Override
Iterator<E> elementIterator() {
throw new AssertionError("should never be called");
} | Sets the number of occurrences of {@code element} to {@code newCount}, but only if the count is
currently {@code expectedOldCount}. If {@code element} does not appear in the multiset exactly
{@code expectedOldCount} times, no changes will be made.
@return {@code true} if the change was successful. This usually indicate... | java | android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java | 502 | [] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
weakKeys | @GwtIncompatible // java.lang.ref.WeakReference
@CanIgnoreReturnValue
public CacheBuilder<K, V> weakKeys() {
return setKeyStrength(Strength.WEAK);
} | Specifies that each key (not value) stored in the cache should be wrapped in a {@link
WeakReference} (by default, strong references are used).
<p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==})
comparison to determine equality of keys. Its {@link Cache#asMap} view will there... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 626 | [] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
try_finally | def try_finally(
self, code_options: dict[str, Any], cleanup: list[Instruction]
) -> list[Instruction]:
"""
Codegen based off of:
load args
enter context
try:
(rest)
finally:
exit context
"""
# NOTE: we assume that TOS i... | Codegen based off of:
load args
enter context
try:
(rest)
finally:
exit context | python | torch/_dynamo/resume_execution.py | 145 | [
"self",
"code_options",
"cleanup"
] | list[Instruction] | true | 5 | 6.4 | pytorch/pytorch | 96,034 | unknown | false |
run | @SuppressWarnings("ShortCircuitBoolean")
@Override
public void run() {
Thread currentThread = Thread.currentThread();
if (currentThread != submitting) {
/*
* requireNonNull is safe because we set `task` before submitting this Runnable to an
* Executor, and we don't null it ... | Thread that called execute(). Set in execute, cleared when delegate.execute() returns. | java | android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java | 378 | [] | void | true | 4 | 6.64 | google/guava | 51,352 | javadoc | false |
afterPropertiesSet | @Override
public void afterPropertiesSet() {
if (this.name == null) {
this.name = this.beanName;
}
if (this.group == null) {
this.group = Scheduler.DEFAULT_GROUP;
}
if (this.jobDetail != null) {
this.jobDataMap.put("jobDetail", this.jobDetail);
}
if (this.startDelay > 0 || this.startTime == null... | Associate a textual description with this trigger. | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java | 238 | [] | void | true | 8 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
setArgumentNamesFromStringArray | public void setArgumentNamesFromStringArray(@Nullable String... argumentNames) {
this.argumentNames = new String[argumentNames.length];
for (int i = 0; i < argumentNames.length; i++) {
String argumentName = argumentNames[i];
this.argumentNames[i] = argumentName != null ? argumentName.strip() : null;
if (!i... | Set by the creator of this advice object if the argument names are known.
<p>This could be for example because they have been explicitly specified in XML
or in an advice annotation.
@param argumentNames list of argument names | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java | 262 | [] | void | true | 9 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
dumps | def dumps(obj: t.Any, **kwargs: t.Any) -> str:
"""Serialize data as JSON.
If :data:`~flask.current_app` is available, it will use its
:meth:`app.json.dumps() <flask.json.provider.JSONProvider.dumps>`
method, otherwise it will use :func:`json.dumps`.
:param obj: The data to serialize.
:param kw... | Serialize data as JSON.
If :data:`~flask.current_app` is available, it will use its
:meth:`app.json.dumps() <flask.json.provider.JSONProvider.dumps>`
method, otherwise it will use :func:`json.dumps`.
:param obj: The data to serialize.
:param kwargs: Arguments passed to the ``dumps`` implementation.
.. versionchanged... | python | src/flask/json/__init__.py | 13 | [
"obj"
] | str | true | 2 | 6.24 | pallets/flask | 70,946 | sphinx | false |
toString | @Override
public String toString() {
return this.path;
} | Determine if this template location exists using the specified
{@link ResourcePatternResolver}.
@param resolver the resolver used to test if the location exists
@return {@code true} if the location exists. | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateLocation.java | 77 | [] | String | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
generateResolverForConstructor | private CodeBlock generateResolverForConstructor(ConstructorDescriptor descriptor) {
CodeBlock parameterTypes = generateParameterTypesCode(descriptor.constructor().getParameterTypes());
return CodeBlock.of("return $T.<$T>forConstructor($L)", BeanInstanceSupplier.class,
descriptor.publicType(), parameterTypes);
... | Generate the instance supplier code.
@param registeredBean the bean to handle
@param instantiationDescriptor the executable to use to create the bean
@return the generated code
@since 6.1.7 | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java | 247 | [
"descriptor"
] | CodeBlock | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
compareParameterTypes | private static int compareParameterTypes(final Executable left, final Executable right, final Class<?>[] actual) {
final float leftCost = getTotalTransformationCost(actual, left);
final float rightCost = getTotalTransformationCost(actual, right);
return Float.compare(leftCost, rightCost);
} | Compares the relative fitness of two Executables in terms of how well they match a set of runtime parameter types, such that a list ordered by the
results of the comparison would return the best match first (least).
@param left the "left" Executable.
@param right the "right" Executable.
@param actual the runtime par... | java | src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java | 122 | [
"left",
"right",
"actual"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
removeAll | public static float[] removeAll(final float[] array, final int... indices) {
return (float[]) removeAll((Object) array, indices);
} | Removes the elements at the specified positions from the specified array. All remaining elements are shifted to the left.
<p>
This method returns a new array with the same elements of the input array except those at the specified positions. The component type of the returned
array is always the same as that of the inpu... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5,080 | [
"array"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
set_multiprocessing_start_method | def set_multiprocessing_start_method():
"""Set multiprocessing start method to 'fork' if not on Linux."""
if platform.system() != "Linux":
try:
multiprocessing.set_start_method("fork")
except RuntimeError:
# The method is already set
pass | Set multiprocessing start method to 'fork' if not on Linux. | python | t/integration/test_tasks.py | 33 | [] | false | 2 | 6.4 | celery/celery | 27,741 | unknown | false | |
buffer_to_ndarray | def buffer_to_ndarray(
buffer: Buffer,
dtype: tuple[DtypeKind, int, str, str],
*,
length: int,
offset: int = 0,
) -> np.ndarray:
"""
Build a NumPy array from the passed buffer.
Parameters
----------
buffer : Buffer
Buffer to build a NumPy array from.
dtype : tuple
... | Build a NumPy array from the passed buffer.
Parameters
----------
buffer : Buffer
Buffer to build a NumPy array from.
dtype : tuple
Data type of the buffer conforming protocol dtypes format.
offset : int, default: 0
Number of elements to offset from the start of the buffer.
length : int, optional
If th... | python | pandas/core/interchange/from_dataframe.py | 466 | [
"buffer",
"dtype",
"length",
"offset"
] | np.ndarray | true | 5 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
poll | boolean poll(Timer timer) {
return poll(timer, true);
} | Fetch the committed offsets for a set of partitions. This is a non-blocking call. The
returned future can be polled to get the actual offsets returned from the broker.
@param partitions The set of partitions to get offsets for.
@return A request future containing the committed offsets. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 1,704 | [
"timer"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
detectDeprecation | public CodeWarnings detectDeprecation(AnnotatedElement... elements) {
for (AnnotatedElement element : elements) {
registerDeprecationIfNecessary(element);
}
return this;
} | Detect the presence of {@link Deprecated} on the specified elements.
@param elements the elements to check
@return {@code this} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/CodeWarnings.java | 64 | [] | CodeWarnings | true | 1 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
codegen | def codegen(
self, output_name: str, input_names: list[str], output_spec: Spec
) -> str:
"""Generate code for masked_select with synthesized inputs to match size.
Constructs an input tensor and mask so that exactly k elements are selected,
where k = output_spec.size[0]. No data-depe... | Generate code for masked_select with synthesized inputs to match size.
Constructs an input tensor and mask so that exactly k elements are selected,
where k = output_spec.size[0]. No data-dependent guards. | python | tools/experimental/torchfuzz/operators/masked_select.py | 44 | [
"self",
"output_name",
"input_names",
"output_spec"
] | str | true | 4 | 6 | pytorch/pytorch | 96,034 | unknown | false |
cond | function cond(pairs) {
var length = pairs == null ? 0 : pairs.length,
toIteratee = getIteratee();
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair... | Creates a function that iterates over `pairs` and invokes the corresponding
function of the first predicate to return truthy. The predicate-function
pairs are invoked with the `this` binding and arguments of the created
function.
@static
@memberOf _
@since 4.0.0
@category Util
@param {Array} pairs The predicate-functio... | javascript | lodash.js | 15,434 | [
"pairs"
] | false | 6 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
shouldDisassemble | static bool shouldDisassemble(const BinaryFunction &BF) {
if (BF.isPseudo())
return false;
if (opts::processAllFunctions())
return true;
return !BF.isIgnored();
} | Return true if the function \p BF should be disassembled. | cpp | bolt/lib/Rewrite/RewriteInstance.cpp | 486 | [] | true | 3 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.