function_name stringlengths 1 57 | function_code stringlengths 20 4.99k | documentation stringlengths 50 2k | language stringclasses 5
values | file_path stringlengths 8 166 | line_number int32 4 16.7k | parameters listlengths 0 20 | return_type stringlengths 0 131 | has_type_hints bool 2
classes | complexity int32 1 51 | quality_score float32 6 9.68 | repo_name stringclasses 34
values | repo_stars int32 2.9k 242k | docstring_style stringclasses 7
values | is_async bool 2
classes |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
get | function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
} | Gets the value at `path` of `object`. If the resolved value is
`undefined`, the `defaultValue` is returned in its place.
@static
@memberOf _
@since 3.7.0
@category Object
@param {Object} object The object to query.
@param {Array|string} path The path of the property to get.
@param {*} [defaultValue] The value returned ... | javascript | lodash.js | 13,233 | [
"object",
"path",
"defaultValue"
] | false | 3 | 7.6 | lodash/lodash | 61,490 | jsdoc | false | |
lastIndexOf | public int lastIndexOf(final StrMatcher matcher, int startIndex) {
startIndex = startIndex >= size ? size - 1 : startIndex;
if (matcher == null || startIndex < 0) {
return -1;
}
final char[] buf = buffer;
final int endIndex = startIndex + 1;
for (int i = start... | Searches the string builder using the matcher to find the last
match searching from the given index.
<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
@param star... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,392 | [
"matcher",
"startIndex"
] | true | 6 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
_sizeof_fmt | def _sizeof_fmt(num: float, size_qualifier: str) -> str:
"""
Return size in human readable format.
Parameters
----------
num : int
Size in bytes.
size_qualifier : str
Either empty, or '+' (if lower bound).
Returns
-------
str
Size in human readable format.
... | Return size in human readable format.
Parameters
----------
num : int
Size in bytes.
size_qualifier : str
Either empty, or '+' (if lower bound).
Returns
-------
str
Size in human readable format.
Examples
--------
>>> _sizeof_fmt(23028, "")
'22.5 KB'
>>> _sizeof_fmt(23028, "+")
'22.5+ KB' | python | pandas/io/formats/info.py | 324 | [
"num",
"size_qualifier"
] | str | true | 3 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
build | public ImmutableRangeMap<K, V> build() {
sort(entries, Range.<K>rangeLexOrdering().onKeys());
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(entries.size());
ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<>(entries.size());
for (int i = 0; i < ent... | Returns an {@code ImmutableRangeMap} containing the associations previously added to this
builder.
@throws IllegalArgumentException if any two ranges inserted into this builder overlap | java | android/guava/src/com/google/common/collect/ImmutableRangeMap.java | 154 | [] | true | 5 | 6.08 | google/guava | 51,352 | javadoc | false | |
equals | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ByteBufferLegacyRecordBatch that = (ByteBufferLegacyRecordBatch) o;
return Objects.equals(buffer, t... | LegacyRecordBatch does not implement this iterator and would hence fallback to the normal iterator.
@return An iterator over the records contained within this batch | java | clients/src/main/java/org/apache/kafka/common/record/AbstractLegacyRecordBatch.java | 525 | [
"o"
] | true | 4 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
getAutoConfigurationEntry | protected AutoConfigurationEntry getAutoConfigurationEntry(AnnotationMetadata annotationMetadata) {
if (!isEnabled(annotationMetadata)) {
return EMPTY_ENTRY;
}
AnnotationAttributes attributes = getAttributes(annotationMetadata);
List<String> configurations = getCandidateConfigurations(annotationMetadata, att... | Return the {@link AutoConfigurationEntry} based on the {@link AnnotationMetadata}
of the importing {@link Configuration @Configuration} class.
@param annotationMetadata the annotation metadata of the configuration class
@return the auto-configurations that should be imported | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java | 142 | [
"annotationMetadata"
] | AutoConfigurationEntry | true | 2 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false |
maybe_convert_dtype | def maybe_convert_dtype(data, copy: bool, tz: tzinfo | None = None):
"""
Convert data based on dtype conventions, issuing
errors where appropriate.
Parameters
----------
data : np.ndarray or pd.Index
copy : bool
tz : tzinfo or None, default None
Returns
-------
data : np.nd... | Convert data based on dtype conventions, issuing
errors where appropriate.
Parameters
----------
data : np.ndarray or pd.Index
copy : bool
tz : tzinfo or None, default None
Returns
-------
data : np.ndarray or pd.Index
copy : bool
Raises
------
TypeError : PeriodDType data is passed | python | pandas/core/arrays/datetimes.py | 2,653 | [
"data",
"copy",
"tz"
] | true | 8 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
transformMethodBody | function transformMethodBody(node: MethodDeclaration | AccessorDeclaration | ConstructorDeclaration): FunctionBody | undefined {
Debug.assertIsDefined(node.body);
const savedCapturedSuperProperties = capturedSuperProperties;
const savedHasSuperElementAccess = hasSuperElementAccess;
... | Visits an ArrowFunction.
This function will be called when one of the following conditions are met:
- The node is marked async
@param node The node to visit. | typescript | src/compiler/transformers/es2017.ts | 649 | [
"node"
] | true | 10 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
List | function List() {
const [items, setItems] = useState(['one', 'two', 'three']);
const inputRef = useRef(null);
const addItem = () => {
const input = ((inputRef.current: any): HTMLInputElement);
const text = input.value;
input.value = '';
if (text) {
setItems([...items, text]);
}
};
... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shell/src/e2e-apps/ListApp.js | 17 | [] | false | 2 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
getMessageInterpolator | private MessageInterpolator getMessageInterpolator() {
try {
return Validation.byDefaultProvider().configure().getDefaultMessageInterpolator();
}
catch (ValidationException ex) {
MessageInterpolator fallback = getFallback();
if (fallback != null) {
return fallback;
}
throw ex;
}
} | Creates a new {@link MessageInterpolatorFactory} that will produce a
{@link MessageInterpolator} that uses the given {@code messageSource} to resolve
any message parameters before final interpolation.
@param messageSource message source to be used by the interpolator
@since 2.6.0 | java | core/spring-boot/src/main/java/org/springframework/boot/validation/MessageInterpolatorFactory.java | 78 | [] | MessageInterpolator | true | 3 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
getClassLoader | public ClassLoader getClassLoader() {
if (this.resourceLoader != null) {
ClassLoader classLoader = this.resourceLoader.getClassLoader();
Assert.state(classLoader != null, "No classloader found");
return classLoader;
}
ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
Assert.state(classLoade... | Either the ClassLoader that will be used in the ApplicationContext (if
{@link #setResourceLoader(ResourceLoader) resourceLoader} is set), or the context
class loader (if not null), or the loader of the Spring {@link ClassUtils} class.
@return a ClassLoader (never null) | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 715 | [] | ClassLoader | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
equalsIgnoreCase | public boolean equalsIgnoreCase(final StrBuilder other) {
if (this == other) {
return true;
}
if (this.size != other.size) {
return false;
}
final char[] thisBuf = this.buffer;
final char[] otherBuf = other.buffer;
for (int i = size - 1; i ... | Checks the contents of this builder against another to see if they
contain the same character content ignoring case.
@param other the object to check, null returns false
@return true if the builders contain the same characters in the same order | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,894 | [
"other"
] | true | 6 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
toArray | public static float[] toArray(Collection<? extends Number> collection) {
if (collection instanceof FloatArrayAsList) {
return ((FloatArrayAsList) collection).toFloatArray();
}
Object[] boxedArray = collection.toArray();
int len = boxedArray.length;
float[] array = new float[len];
for (int... | Returns an array containing each value of {@code collection}, converted to a {@code float}
value in the manner of {@link Number#floatValue}.
<p>Elements are copied from the argument collection as if by {@code collection.toArray()}.
Calling this method is as thread-safe as calling that method.
@param collection a collec... | java | android/guava/src/com/google/common/primitives/Floats.java | 537 | [
"collection"
] | true | 3 | 8.08 | google/guava | 51,352 | javadoc | false | |
valueToPromise | function valueToPromise<T>(thing: T): PrismaPromise<T> {
if (typeof thing['then'] === 'function') {
return thing as PrismaPromise<T>
}
return Promise.resolve(thing) as PrismaPromise<T>
} | Creates a factory, that allows creating PrismaPromises, bound to a specific transactions
@param transaction
@returns | typescript | packages/client/src/runtime/core/request/createPrismaPromise.ts | 76 | [
"thing"
] | true | 2 | 6.8 | prisma/prisma | 44,834 | jsdoc | false | |
_backprop | def _backprop(
self, X, y, sample_weight, activations, deltas, coef_grads, intercept_grads
):
"""Compute the MLP loss function and its corresponding derivatives
with respect to each parameter: weights and bias vectors.
Parameters
----------
X : {array-like, sparse ma... | Compute the MLP loss function and its corresponding derivatives
with respect to each parameter: weights and bias vectors.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The input data.
y : ndarray of shape (n_samples,)
The target values.
sample_weight : array-like of s... | python | sklearn/neural_network/_multilayer_perceptron.py | 301 | [
"self",
"X",
"y",
"sample_weight",
"activations",
"deltas",
"coef_grads",
"intercept_grads"
] | false | 8 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getConnectionDetails | public <S> Map<Class<?>, ConnectionDetails> getConnectionDetails(S source, boolean required)
throws ConnectionDetailsFactoryNotFoundException, ConnectionDetailsNotFoundException {
List<Registration<S, ?>> registrations = getRegistrations(source, required);
Map<Class<?>, ConnectionDetails> result = new LinkedHash... | Return a {@link Map} of {@link ConnectionDetails} interface type to
{@link ConnectionDetails} instance created from the factories associated with the
given source.
@param <S> the source type
@param source the source
@param required if a connection details result is required
@return a map of {@link ConnectionDetails} in... | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/service/connection/ConnectionDetailsFactories.java | 82 | [
"source",
"required"
] | true | 4 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
indexable | def indexable(*iterables):
"""Make arrays indexable for cross-validation.
Checks consistent length, passes through None, and ensures that everything
can be indexed by converting sparse matrices to csr and converting
non-iterable objects to arrays.
Parameters
----------
*iterables : {lists,... | Make arrays indexable for cross-validation.
Checks consistent length, passes through None, and ensures that everything
can be indexed by converting sparse matrices to csr and converting
non-iterable objects to arrays.
Parameters
----------
*iterables : {lists, dataframes, ndarrays, sparse matrices}
List of object... | python | sklearn/utils/validation.py | 490 | [] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_asfreq_compat | def _asfreq_compat(index: FreqIndexT, freq) -> FreqIndexT:
"""
Helper to mimic asfreq on (empty) DatetimeIndex and TimedeltaIndex.
Parameters
----------
index : PeriodIndex, DatetimeIndex, or TimedeltaIndex
freq : DateOffset
Returns
-------
same type as index
"""
if len(ind... | Helper to mimic asfreq on (empty) DatetimeIndex and TimedeltaIndex.
Parameters
----------
index : PeriodIndex, DatetimeIndex, or TimedeltaIndex
freq : DateOffset
Returns
-------
same type as index | python | pandas/core/resample.py | 3,117 | [
"index",
"freq"
] | FreqIndexT | true | 6 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
chebvander | def chebvander(x, deg):
"""Pseudo-Vandermonde matrix of given degree.
Returns the pseudo-Vandermonde matrix of degree `deg` and sample points
`x`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., i] = T_i(x),
where ``0 <= i <= deg``. The leading indices of `V` index the elements of
... | Pseudo-Vandermonde matrix of given degree.
Returns the pseudo-Vandermonde matrix of degree `deg` and sample points
`x`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., i] = T_i(x),
where ``0 <= i <= deg``. The leading indices of `V` index the elements of
`x` and the last index is the degree of the Cheby... | python | numpy/polynomial/chebyshev.py | 1,354 | [
"x",
"deg"
] | false | 4 | 6.24 | numpy/numpy | 31,054 | numpy | false | |
isOsMatch | static boolean isOsMatch(final String osName, final String osVersion, final String osNamePrefix, final String osVersionPrefix) {
if (osName == null || osVersion == null) {
return false;
}
return isOsNameMatch(osName, osNamePrefix) && isOsVersionMatch(osVersion, osVersionPrefix);
... | Tests whether the operating system matches.
<p>
This method is package private instead of private to support unit test invocation.
</p>
@param osName the actual OS name.
@param osVersion the actual OS version.
@param osNamePrefix the prefix for the expected OS name.
@param osVersionPrefix the prefix f... | java | src/main/java/org/apache/commons/lang3/SystemUtils.java | 2,416 | [
"osName",
"osVersion",
"osNamePrefix",
"osVersionPrefix"
] | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
_validate_names | def _validate_names(names: Sequence[Hashable] | None) -> None:
"""
Raise ValueError if the `names` parameter contains duplicates or has an
invalid data type.
Parameters
----------
names : array-like or None
An array containing a list of the names used for the output DataFrame.
Rais... | Raise ValueError if the `names` parameter contains duplicates or has an
invalid data type.
Parameters
----------
names : array-like or None
An array containing a list of the names used for the output DataFrame.
Raises
------
ValueError
If names are not unique or are not ordered (e.g. set). | python | pandas/io/parsers/readers.py | 234 | [
"names"
] | None | true | 5 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
printStackTrace | @Override
public void printStackTrace(PrintWriter pw) {
synchronized (pw) {
super.printStackTrace(pw);
if (this.relatedCauses != null) {
for (Throwable relatedCause : this.relatedCauses) {
pw.println("Related cause:");
relatedCause.printStackTrace(pw);
}
}
}
} | Return the related causes, if any.
@return the array of related causes, or {@code null} if none | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java | 182 | [
"pw"
] | void | true | 2 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
tz | def tz(self) -> tzinfo | None:
"""
Return the timezone.
Returns
-------
zoneinfo.ZoneInfo,, datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None
Returns None when the array is tz-naive.
See Also
--------
DatetimeIndex.tz_lo... | Return the timezone.
Returns
-------
zoneinfo.ZoneInfo,, datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None
Returns None when the array is tz-naive.
See Also
--------
DatetimeIndex.tz_localize : Localize tz-naive DatetimeIndex to a
given time zone, or remove timezone from a tz-aware Datet... | python | pandas/core/arrays/datetimes.py | 594 | [
"self"
] | tzinfo | None | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | unknown | false |
equals | @Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof ChildBeanDefinition that &&
ObjectUtils.nullSafeEquals(this.parentName, that.parentName) && super.equals(other)));
} | Create a new ChildBeanDefinition as deep copy of the given
bean definition.
@param original the original bean definition to copy from | java | spring-beans/src/main/java/org/springframework/beans/factory/support/ChildBeanDefinition.java | 157 | [
"other"
] | true | 4 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false | |
endsWithAny | @Deprecated
public static boolean endsWithAny(final CharSequence sequence, final CharSequence... searchStrings) {
return Strings.CS.endsWithAny(sequence, searchStrings);
} | Tests if a CharSequence ends with any of the provided case-sensitive suffixes.
<pre>
StringUtils.endsWithAny(null, null) = false
StringUtils.endsWithAny(null, new String[] {"abc"}) = false
StringUtils.endsWithAny("abcxyz", null) = false
StringUtils.endsWithAny("abcxyz", new String[] {""})... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 1,730 | [
"sequence"
] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
poll | public List<RequestSpec<K>> poll() {
List<RequestSpec<K>> requests = new ArrayList<>();
collectLookupRequests(requests);
collectFulfillmentRequests(requests);
return requests;
} | Check whether any requests need to be sent. This should be called immediately
after the driver is constructed and then again after each request returns
(i.e. after {@link #onFailure(long, RequestSpec, Throwable)} or
{@link #onResponse(long, RequestSpec, AbstractResponse, Node)}).
@return A list of requests that need to... | java | clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminApiDriver.java | 212 | [] | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
create_replication_task | def create_replication_task(
self,
replication_task_id: str,
source_endpoint_arn: str,
target_endpoint_arn: str,
replication_instance_arn: str,
migration_type: str,
table_mappings: dict,
**kwargs,
) -> str:
"""
Create DMS replication ta... | Create DMS replication task.
.. seealso::
- :external+boto3:py:meth:`DatabaseMigrationService.Client.create_replication_task`
:param replication_task_id: Replication task id
:param source_endpoint_arn: Source endpoint ARN
:param target_endpoint_arn: Target endpoint ARN
:param replication_instance_arn: Replication... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/dms.py | 114 | [
"self",
"replication_task_id",
"source_endpoint_arn",
"target_endpoint_arn",
"replication_instance_arn",
"migration_type",
"table_mappings"
] | str | true | 1 | 6.08 | apache/airflow | 43,597 | sphinx | false |
getAnnotationValue | private Object getAnnotationValue(AnnotationValue annotationValue) {
Object value = annotationValue.getValue();
if (value instanceof List) {
List<Object> values = new ArrayList<>();
((List<?>) value).forEach((v) -> values.add(((AnnotationValue) v).getValue()));
return values;
}
return value;
} | Collect the annotations that are annotated or meta-annotated with the specified
{@link TypeElement annotation}.
@param element the element to inspect
@param annotationType the annotation to discover
@return the annotations that are annotated or meta-annotated with this annotation | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 329 | [
"annotationValue"
] | Object | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
getPropertyHandler | protected @Nullable PropertyHandler getPropertyHandler(String propertyName) throws BeansException {
Assert.notNull(propertyName, "Property name must not be null");
AbstractNestablePropertyAccessor nestedPa = getPropertyAccessorForPropertyPath(propertyName);
return nestedPa.getLocalPropertyHandler(getFinalPath(nes... | Return the {@link PropertyHandler} for the specified {@code propertyName}, navigating
if necessary. Return {@code null} if not found rather than throwing an exception.
@param propertyName the property to obtain the descriptor for
@return the property descriptor for the specified property,
or {@code null} if not found
@... | java | spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java | 730 | [
"propertyName"
] | PropertyHandler | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
registerJobsAndTriggers | @SuppressWarnings("NullAway") // Dataflow analysis limitation
protected void registerJobsAndTriggers() throws SchedulerException {
TransactionStatus transactionStatus = null;
if (this.transactionManager != null) {
transactionStatus = this.transactionManager.getTransaction(TransactionDefinition.withDefaults());
... | Register jobs and triggers (within a transaction, if possible). | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java | 197 | [] | void | true | 12 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false |
asReader | public Reader asReader() {
return new StrBuilderReader();
} | Gets the contents of this builder as a Reader.
<p>
This method allows the contents of the builder to be read
using any standard method that expects a Reader.
</p>
<p>
To use, simply create a {@link StrBuilder}, populate it with
data, call {@code asReader}, and then read away.
</p>
<p>
The internal character array is sh... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,485 | [] | Reader | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
array_str | def array_str(a, max_line_width=None, precision=None, suppress_small=None):
"""
Return a string representation of the data in an array.
The data in the array is returned as a single string. This function is
similar to `array_repr`, the difference being that `array_repr` also
returns information on... | Return a string representation of the data in an array.
The data in the array is returned as a single string. This function is
similar to `array_repr`, the difference being that `array_repr` also
returns information on the kind of array and its data type.
Parameters
----------
a : ndarray
Input array.
max_line_w... | python | numpy/_core/arrayprint.py | 1,734 | [
"a",
"max_line_width",
"precision",
"suppress_small"
] | false | 1 | 6 | numpy/numpy | 31,054 | numpy | false | |
extract | @SuppressWarnings("unchecked")
private void extract(String name, Map<String, Object> result, Object value) {
if (value instanceof Map<?, ?> map) {
if (CollectionUtils.isEmpty(map)) {
result.put(name, value);
return;
}
flatten(name, result, (Map<String, Object>) value);
}
else if (value instanceo... | Flatten the map keys using period separator.
@param map the map that should be flattened
@return the flattened map | java | core/spring-boot/src/main/java/org/springframework/boot/support/SpringApplicationJsonEnvironmentPostProcessor.java | 130 | [
"name",
"result",
"value"
] | void | true | 5 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
notmasked_edges | def notmasked_edges(a, axis=None):
"""
Find the indices of the first and last unmasked values along an axis.
If all values are masked, return None. Otherwise, return a list
of two tuples, corresponding to the indices of the first and last
unmasked values respectively.
Parameters
---------... | Find the indices of the first and last unmasked values along an axis.
If all values are masked, return None. Otherwise, return a list
of two tuples, corresponding to the indices of the first and last
unmasked values respectively.
Parameters
----------
a : array_like
The input array.
axis : int, optional
Axis... | python | numpy/ma/extras.py | 1,925 | [
"a",
"axis"
] | false | 3 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
get_indexer_dict | def get_indexer_dict(
label_list: list[np.ndarray], keys: list[Index]
) -> dict[Hashable, npt.NDArray[np.intp]]:
"""
Returns
-------
dict:
Labels mapped to indexers.
"""
shape = tuple(len(x) for x in keys)
group_index = get_group_index(label_list, shape, sort=True, xnull=True)
... | Returns
-------
dict:
Labels mapped to indexers. | python | pandas/core/sorting.py | 599 | [
"label_list",
"keys"
] | dict[Hashable, npt.NDArray[np.intp]] | true | 4 | 6.4 | pandas-dev/pandas | 47,362 | unknown | false |
getCacheOperationMetadata | protected CacheOperationMetadata getCacheOperationMetadata(
CacheOperation operation, Method method, Class<?> targetClass) {
CacheOperationCacheKey cacheKey = new CacheOperationCacheKey(operation, method, targetClass);
CacheOperationMetadata metadata = this.metadataCache.get(cacheKey);
if (metadata == null) {... | Return the {@link CacheOperationMetadata} for the specified operation.
<p>Resolve the {@link CacheResolver} and the {@link KeyGenerator} to be
used for the operation.
@param operation the operation
@param method the method on which the operation is invoked
@param targetClass the target type
@return the resolved metadat... | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 337 | [
"operation",
"method",
"targetClass"
] | CacheOperationMetadata | true | 5 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
get_or_create_glue_job | def get_or_create_glue_job(self) -> str | None:
"""
Get (or creates) and returns the Job name.
.. seealso::
- :external+boto3:py:meth:`Glue.Client.create_job`
:return:Name of the Job
"""
if self.job_name is None:
raise ValueError("job_name must b... | Get (or creates) and returns the Job name.
.. seealso::
- :external+boto3:py:meth:`Glue.Client.create_job`
:return:Name of the Job | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue.py | 486 | [
"self"
] | str | None | true | 3 | 6.4 | apache/airflow | 43,597 | unknown | false |
maybeThrowSslAuthenticationException | private void maybeThrowSslAuthenticationException() {
if (handshakeException != null)
throw handshakeException;
} | SSL exceptions are propagated as authentication failures so that clients can avoid
retries and report the failure. If `flush` is true, exceptions are propagated after
any pending outgoing bytes are flushed to ensure that the peer is notified of the failure. | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 940 | [] | void | true | 2 | 6.8 | apache/kafka | 31,560 | javadoc | false |
optionEquals | function optionEquals<K extends keyof FormatCodeSettings>(optionName: K, optionValue: FormatCodeSettings[K]): (context: FormattingContext) => boolean {
return context => context.options && context.options[optionName] === optionValue;
} | 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 | 469 | [
"optionName",
"optionValue"
] | true | 2 | 6.16 | microsoft/TypeScript | 107,154 | jsdoc | false | |
advance | @CanIgnoreReturnValue
public static int advance(Iterator<?> iterator, int numberToAdvance) {
checkNotNull(iterator);
checkArgument(numberToAdvance >= 0, "numberToAdvance must be nonnegative");
int i;
for (i = 0; i < numberToAdvance && iterator.hasNext(); i++) {
iterator.next();
}
return... | Calls {@code next()} on {@code iterator}, either {@code numberToAdvance} times or until {@code
hasNext()} returns {@code false}, whichever comes first.
@return the number of elements the iterator was advanced
@since 13.0 (since 3.0 as {@code Iterators.skip}) | java | android/guava/src/com/google/common/collect/Iterators.java | 934 | [
"iterator",
"numberToAdvance"
] | true | 3 | 6.4 | google/guava | 51,352 | javadoc | false | |
roll | def roll(a, shift, axis=None):
"""
Roll array elements along a given axis.
Elements that roll beyond the last position are re-introduced at
the first.
Parameters
----------
a : array_like
Input array.
shift : int or tuple of ints
The number of places by which elements a... | Roll array elements along a given axis.
Elements that roll beyond the last position are re-introduced at
the first.
Parameters
----------
a : array_like
Input array.
shift : int or tuple of ints
The number of places by which elements are shifted. If a tuple,
then `axis` must be a tuple of the same size, ... | python | numpy/_core/numeric.py | 1,218 | [
"a",
"shift",
"axis"
] | false | 9 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
process | private void process(final CurrentLagEvent event) {
try {
final TopicPartition topicPartition = event.partition();
final IsolationLevel isolationLevel = event.isolationLevel();
final Long lag = subscriptions.partitionLag(topicPartition, isolationLevel);
final Opt... | 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 | 651 | [
"event"
] | void | true | 5 | 6.24 | apache/kafka | 31,560 | javadoc | false |
isEligible | protected boolean isEligible(Class<?> targetClass) {
Boolean eligible = this.eligibleBeans.get(targetClass);
if (eligible != null) {
return eligible;
}
if (this.advisor == null) {
return false;
}
eligible = AopUtils.canApply(this.advisor, targetClass);
this.eligibleBeans.put(targetClass, eligible);
... | Check whether the given class is eligible for advising with this
post-processor's {@link Advisor}.
<p>Implements caching of {@code canApply} results per bean target class.
@param targetClass the class to check against
@see AopUtils#canApply(Advisor, Class) | java | spring-aop/src/main/java/org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor.java | 162 | [
"targetClass"
] | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
getlincoef | def getlincoef(e, xset): # e = a*x+b ; x in xset
"""
Obtain ``a`` and ``b`` when ``e == "a*x+b"``, where ``x`` is a symbol in
xset.
>>> getlincoef('2*x + 1', {'x'})
(2, 1, 'x')
>>> getlincoef('3*x + x*2 + 2 + 1', {'x'})
(5, 3, 'x')
>>> getlincoef('0', {'x'})
(0, 0, None)
>>> ge... | Obtain ``a`` and ``b`` when ``e == "a*x+b"``, where ``x`` is a symbol in
xset.
>>> getlincoef('2*x + 1', {'x'})
(2, 1, 'x')
>>> getlincoef('3*x + x*2 + 2 + 1', {'x'})
(5, 3, 'x')
>>> getlincoef('0', {'x'})
(0, 0, None)
>>> getlincoef('0*x', {'x'})
(0, 0, 'x')
>>> getlincoef('x*x', {'x'})
(None, None, None)
This can b... | python | numpy/f2py/crackfortran.py | 2,280 | [
"e",
"xset"
] | false | 12 | 6.48 | numpy/numpy | 31,054 | unknown | false | |
rebootstrap | public synchronized void rebootstrap() {
log.info("Rebootstrapping with {}", this.bootstrapAddresses);
this.bootstrap(this.bootstrapAddresses);
} | @return a mapping from topic names to topic IDs for all topics with valid IDs in the cache | java | clients/src/main/java/org/apache/kafka/clients/Metadata.java | 313 | [] | void | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
isAssignable | private static boolean isAssignable(final Type type, final TypeVariable<?> toTypeVariable, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type == null) {
return true;
}
// only a null type can be assigned to null type which
// would have cause the previous to return t... | Tests if the subject type may be implicitly cast to the target type variable following the Java generics rules.
@param type the subject type to be assigned to the target type.
@param toTypeVariable the target type variable.
@param typeVarAssigns a map with type variables.
@return {@code true} if {@code type} ... | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,148 | [
"type",
"toTypeVariable",
"typeVarAssigns"
] | true | 10 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
truncate | public static String truncate(CharSequence seq, int maxLength, String truncationIndicator) {
checkNotNull(seq);
// length to truncate the sequence to, not including the truncation indicator
int truncationLength = maxLength - truncationIndicator.length();
// in this worst case, this allows a maxLength ... | Truncates the given character sequence to the given maximum length. If the length of the
sequence is greater than {@code maxLength}, the returned string will be exactly {@code
maxLength} chars in length and will end with the given {@code truncationIndicator}. Otherwise,
the sequence will be returned as a string with no... | java | android/guava/src/com/google/common/base/Ascii.java | 550 | [
"seq",
"maxLength",
"truncationIndicator"
] | String | true | 3 | 7.28 | google/guava | 51,352 | javadoc | false |
getVersionString | private @Nullable String getVersionString(@Nullable String version, boolean format, @Nullable String fallback) {
if (version == null) {
return fallback;
}
return format ? " (v" + version + ")" : version;
} | Return the application title that should be used for the source class. By default
will use {@link Package#getImplementationTitle()}.
@param sourceClass the source class
@return the application title | java | core/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java | 162 | [
"version",
"format",
"fallback"
] | String | true | 3 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
toString | @Override
public String toString() {
return Long.toString(sum());
} | Returns the String representation of the {@link #sum}.
@return the String representation of the {@link #sum} | java | android/guava/src/com/google/common/cache/LongAdder.java | 151 | [] | String | true | 1 | 6.96 | google/guava | 51,352 | javadoc | false |
falsePredicate | @SuppressWarnings("unchecked")
// method name cannot be "false".
public static <T> Predicate<T> falsePredicate() {
return (Predicate<T>) FALSE;
} | Gets the Predicate singleton that always returns false.
@param <T> the type of the input to the predicate.
@return the Predicate singleton. | java | src/main/java/org/apache/commons/lang3/function/Predicates.java | 38 | [] | true | 1 | 7.2 | apache/commons-lang | 2,896 | javadoc | false | |
repeat | public static String repeat(String string, int count) {
checkNotNull(string); // eager for GWT.
if (count <= 1) {
checkArgument(count >= 0, "invalid count: %s", count);
return (count == 0) ? "" : string;
}
// IF YOU MODIFY THE CODE HERE, you must update StringsRepeatBenchmark
int len =... | Returns a string consisting of a specific number of concatenated copies of an input string. For
example, {@code repeat("hey", 3)} returns the string {@code "heyheyhey"}.
@param string any non-null string
@param count the number of times to repeat it; a nonnegative integer
@return a string containing {@code string} repe... | java | android/guava/src/com/google/common/base/Strings.java | 144 | [
"string",
"count"
] | String | true | 5 | 7.92 | google/guava | 51,352 | javadoc | false |
hideInternalStackFrames | function hideInternalStackFrames(error) {
overrideStackTrace.set(error, (error, stackFrames) => {
let frames = stackFrames;
if (typeof stackFrames === 'object') {
frames = ArrayPrototypeFilter(
stackFrames,
(frm) => !StringPrototypeStartsWith(frm.getFileName() || '',
... | Returns true if `err.name` and `err.message` are equal to engine-specific
values indicating max call stack size has been exceeded.
"Maximum call stack size exceeded" in V8.
@param {Error} err
@returns {boolean} | javascript | lib/internal/errors.js | 961 | [
"error"
] | false | 3 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
getParameterNames | @Override
public String @Nullable [] getParameterNames(Constructor<?> ctor) {
if (this.raiseExceptions) {
throw new UnsupportedOperationException("An advice method can never be a constructor");
}
else {
// we return null rather than throw an exception so that we behave well
// in a chain-of-responsibili... | An advice method can never be a constructor in Spring.
@return {@code null}
@throws UnsupportedOperationException if
{@link #setRaiseExceptions(boolean) raiseExceptions} has been set to {@code true} | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 287 | [
"ctor"
] | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
findTemplateSource | @Override
public @Nullable Object findTemplateSource(String name) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("Looking for FreeMarker template with name [" + name + "]");
}
Resource resource = this.resourceLoader.getResource(this.templateLoaderPath + name);
return (resource.exists() ? r... | Create a new {@code SpringTemplateLoader}.
@param resourceLoader the Spring ResourceLoader to use
@param templateLoaderPath the template loader path to use | java | spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java | 70 | [
"name"
] | Object | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
isotonic_regression | def isotonic_regression(
y, *, sample_weight=None, y_min=None, y_max=None, increasing=True
):
"""Solve the isotonic regression model.
Read more in the :ref:`User Guide <isotonic>`.
Parameters
----------
y : array-like of shape (n_samples,)
The data.
sample_weight : array-like of s... | Solve the isotonic regression model.
Read more in the :ref:`User Guide <isotonic>`.
Parameters
----------
y : array-like of shape (n_samples,)
The data.
sample_weight : array-like of shape (n_samples,), default=None
Weights on each point of the regression.
If None, weight is set to 1 (equal weights).
y_... | python | sklearn/isotonic.py | 110 | [
"y",
"sample_weight",
"y_min",
"y_max",
"increasing"
] | false | 8 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
assignRoundRobin | private void assignRoundRobin(List<TopicPartition> unassignedPartitions) {
Iterator<String> unfilledConsumerIter = unfilledMembersWithUnderMinQuotaPartitions.iterator();
// Round-Robin filling remaining members up to the expected numbers of maxQuota, otherwise, to minQuota
for (Topi... | Constructs a constrained assignment builder.
@param partitionsPerTopic The partitions for each subscribed topic
@param rackInfo Rack information for consumers and racks
@param consumerToOwnedPartitions Each consumer's previously owned and still-subscribed partiti... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java | 781 | [
"unassignedPartitions"
] | void | true | 9 | 6.08 | apache/kafka | 31,560 | javadoc | false |
generateBitVector | @SafeVarargs
public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final E... values) {
Validate.noNullElements(values);
return generateBitVector(enumClass, Arrays.asList(values));
} | Creates a long bit vector representation of the given array of Enum values.
<p>This generates a value that is usable by {@link EnumUtils#processBitVector}.</p>
<p>Do not use this method if you have more than 64 values in your Enum, as this
would create a value greater than a long can hold.</p>
@param enumClass the clas... | java | src/main/java/org/apache/commons/lang3/EnumUtils.java | 97 | [
"enumClass"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
getValue | @Deprecated
@Override
public T getValue() {
return this.value;
} | Gets the value.
@return the value, may be null.
@deprecated Use {@link #get()}. | java | src/main/java/org/apache/commons/lang3/mutable/MutableObject.java | 92 | [] | T | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
toString | @Override
public String toString() {
return String.format(FMT_TO_STRING, Integer.valueOf(System.identityHashCode(this)), getObject());
} | Returns a string representation for this object. This string also
contains a string representation of the object managed by this
initializer.
@return a string for this object | java | src/main/java/org/apache/commons/lang3/concurrent/ConstantInitializer.java | 134 | [] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
hasUpperCase | private boolean hasUpperCase() {
for (char c : chars) {
if (Ascii.isUpperCase(c)) {
return true;
}
}
return false;
} | Returns an equivalent {@code Alphabet} except it ignores case. | java | android/guava/src/com/google/common/io/BaseEncoding.java | 557 | [] | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false | |
main | def main(
function: Callable[[IO[str]], Iterable[tuple[int, str]]],
source_path: str,
output_format: str,
) -> bool:
"""
Main entry point of the script.
Parameters
----------
function : Callable
Function to execute for the specified validation type.
source_path : str
... | Main entry point of the script.
Parameters
----------
function : Callable
Function to execute for the specified validation type.
source_path : str
Source path representing path to a file/directory.
output_format : str
Output format of the error message.
file_extensions_to_check : str
Comma separated va... | python | scripts/validate_unwanted_patterns.py | 399 | [
"function",
"source_path",
"output_format"
] | bool | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
getNext | @ParametricNullness
public static <T extends @Nullable Object> T getNext(
Iterator<? extends T> iterator, @ParametricNullness T defaultValue) {
return iterator.hasNext() ? iterator.next() : defaultValue;
} | Returns the next element in {@code iterator} or {@code defaultValue} if the iterator is empty.
The {@link Iterables} analog to this method is {@link Iterables#getFirst}.
@param defaultValue the default value to return if the iterator is empty
@return the next element of {@code iterator} or the default value
@since 7.0 | java | android/guava/src/com/google/common/collect/Iterators.java | 891 | [
"iterator",
"defaultValue"
] | T | true | 2 | 7.76 | google/guava | 51,352 | javadoc | false |
computedPropertyLayer | function computedPropertyLayer(field: ComputedField, result: object): CompositeProxyLayer {
return cacheProperties(addProperty(field.name, () => field.compute(result)))
} | Given a part of a query result, it's model name and a list of extension,
applies computed fields to the results. Fields are computed lazily on a first access,
after that the result of computation is cached. In case `select` is used, all dependencies
of the computed fields would be excluded from final result, unless the... | typescript | packages/client/src/runtime/core/extensions/applyResultExtensions.ts | 80 | [
"field",
"result"
] | true | 1 | 6.64 | prisma/prisma | 44,834 | jsdoc | false | |
forcePut | @CanIgnoreReturnValue
@Override
public @Nullable V forcePut(@ParametricNullness K key, @ParametricNullness V value) {
return put(key, value, true);
} | Returns {@code true} if this BiMap contains an entry whose value is equal to {@code value} (or,
equivalently, if this inverse view contains a key that is equal to {@code value}).
<p>Due to the property that values in a BiMap are unique, this will tend to execute in
faster-than-linear time.
@param value the object to se... | java | android/guava/src/com/google/common/collect/HashBiMap.java | 324 | [
"key",
"value"
] | V | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false |
of | static LibraryCoordinates of(@Nullable String groupId, @Nullable String artifactId, @Nullable String version) {
return new DefaultLibraryCoordinates(groupId, artifactId, version);
} | Factory method to create {@link LibraryCoordinates} with the specified values.
@param groupId the group ID
@param artifactId the artifact ID
@param version the version
@return a new {@link LibraryCoordinates} instance | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryCoordinates.java | 55 | [
"groupId",
"artifactId",
"version"
] | LibraryCoordinates | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
autoLink | function autoLink($) {
$('.doc-container code:not(:header code)').each(function() {
const $code = $(this);
const html = $code.html();
if (/^_\.\w+$/.test(html)) {
const id = html.split('.')[1];
$code.replaceWith(`<a href="#${ id }"><code>_.${ id }</code></a>`);
}
});
} | Converts Lodash method references into documentation links.
Searches for inline code references matching `_.word` (e.g., `_.map`, `_.filter`)
in documentation body text and wraps them in anchor links. Excludes code within
headers as those already have proper anchors.
@private
@param {Object} $ The Cheerio object.
@exam... | javascript | lib/main/build-site.js | 48 | [
"$"
] | false | 2 | 6.16 | lodash/lodash | 61,490 | jsdoc | false | |
fromString | public static AclOperation fromString(String str) throws IllegalArgumentException {
try {
return AclOperation.valueOf(str.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
return UNKNOWN;
}
} | Parse the given string as an ACL operation.
@param str The string to parse.
@return The AclOperation, or UNKNOWN if the string could not be matched. | java | clients/src/main/java/org/apache/kafka/common/acl/AclOperation.java | 140 | [
"str"
] | AclOperation | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false |
dstack | def dstack(tup):
"""
Stack arrays in sequence depth wise (along third axis).
This is equivalent to concatenation along the third axis after 2-D arrays
of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape
`(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by
`dsp... | Stack arrays in sequence depth wise (along third axis).
This is equivalent to concatenation along the third axis after 2-D arrays
of shape `(M,N)` have been reshaped to `(M,N,1)` and 1-D arrays of shape
`(N,)` have been reshaped to `(1,N,1)`. Rebuilds arrays divided by
`dsplit`.
This function makes most sense for arr... | python | numpy/lib/_shape_base_impl.py | 656 | [
"tup"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
stat | function stat(filename) {
// Guard against internal bugs where a non-string filename is passed in by mistake.
assert(typeof filename === 'string');
filename = path.toNamespacedPath(filename);
if (statCache !== null) {
const result = statCache.get(filename);
if (result !== undefined) { return result; }
... | Get a path's properties, using an in-memory cache to minimize lookups.
@param {string} filename Absolute path to the file
@returns {number} | javascript | lib/internal/modules/cjs/loader.js | 260 | [
"filename"
] | false | 5 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
handleBindError | private <T> @Nullable T handleBindError(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler,
Context context, Exception error) {
try {
Object result = handler.onFailure(name, target, context, error);
return context.getConverter().convert(result, target);
}
catch (Exception ex) {
if... | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param h... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 408 | [
"name",
"target",
"handler",
"context",
"error"
] | T | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
isAtLeastOneCondVarChanged | static bool isAtLeastOneCondVarChanged(const Decl *Func, const Stmt *LoopStmt,
const Stmt *Cond, ASTContext *Context) {
if (isVarThatIsPossiblyChanged(Func, LoopStmt, Cond, Context))
return true;
return llvm::any_of(Cond->children(), [&](const Stmt *Child) {
return Ch... | Return whether at least one variable of `Cond` changed in `LoopStmt`. | cpp | clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp | 117 | [] | true | 3 | 6.72 | llvm/llvm-project | 36,021 | doxygen | false | |
visitAwaitExpression | function visitAwaitExpression(node: AwaitExpression): Expression {
// do not downlevel a top-level await as it is module syntax...
if (inTopLevelContext()) {
return visitEachChild(node, visitor, context);
}
return setOriginalNode(
setTextRange(
... | Visits an AwaitExpression node.
This function will be called any time a ES2017 await expression is encountered.
@param node The node to visit. | typescript | src/compiler/transformers/es2017.ts | 394 | [
"node"
] | true | 2 | 7.04 | microsoft/TypeScript | 107,154 | jsdoc | false | |
resolve | private List<ConfigDataResolutionResult> resolve(ConfigDataLocationResolverContext locationResolverContext,
@Nullable Profiles profiles, List<ConfigDataLocation> locations) {
List<ConfigDataResolutionResult> resolved = new ArrayList<>(locations.size());
for (ConfigDataLocation location : locations) {
resolved... | Resolve and load the given list of locations, filtering any that have been
previously loaded.
@param activationContext the activation context
@param locationResolverContext the location resolver context
@param loaderContext the loader context
@param locations the locations to resolve
@return a map of the loaded locatio... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataImporter.java | 95 | [
"locationResolverContext",
"profiles",
"locations"
] | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
toLongArray | public long[] toLongArray() {
return bitSet.toLongArray();
} | Returns a new byte array containing all the bits in this bit set.
<p>
More precisely, if:
</p>
<ol>
<li>{@code long[] longs = s.toLongArray();}</li>
<li>then {@code longs.length == (s.length()+63)/64} and</li>
<li>{@code s.get(n) == ((longs[n/64] & (1L<<(n%64))) != 0)}</li>
<li>for all {@code n < 64 * longs.length}.</l... | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 564 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
extract_weights | def extract_weights(mod: nn.Module) -> tuple[tuple[Tensor, ...], list[str]]:
"""
This function removes all the Parameters from the model and
return them as a tuple as well as their original attribute names.
The weights must be re-loaded with `load_weights` before the model
can be used again.
Not... | This function removes all the Parameters from the model and
return them as a tuple as well as their original attribute names.
The weights must be re-loaded with `load_weights` before the model
can be used again.
Note that this function modifies the model in place and after this
call, mod.parameters() will be empty. | python | benchmarks/functional_autograd_benchmark/utils.py | 48 | [
"mod"
] | tuple[tuple[Tensor, ...], list[str]] | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
handleTimeoutFailure | private void handleTimeoutFailure(long now, Throwable cause) {
if (log.isDebugEnabled()) {
log.debug("{} timed out at {} after {} attempt(s)", this, now, tries,
new Exception(prettyPrintException(cause)));
}
if (cause instanceof TimeoutException) {... | Handle a failure.
<p>
Depending on what the exception is and how many times we have already tried, we may choose to
fail the Call, or retry it. It is important to print the stack traces here in some cases,
since they are not necessarily preserved in ApiVersionException objects.
@param now The current time in mill... | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 953 | [
"now",
"cause"
] | void | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false |
munchIfFull | private void munchIfFull() {
if (buffer.remaining() < 8) {
// buffer is full; not enough room for a primitive. We have at least one full chunk.
munch();
}
} | Computes a hash code based on the data that have been provided to this hasher. This is called
after all chunks are handled with {@link #process} and any leftover bytes that did not make a
complete chunk are handled with {@link #processRemaining}. | java | android/guava/src/com/google/common/hash/AbstractStreamingHasher.java | 205 | [] | void | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false |
checkName | private BackgroundInitializer<?> checkName(final String name) {
final BackgroundInitializer<?> init = initializers.get(name);
if (init == null) {
throw new NoSuchElementException("No child initializer with name " + name);
}
return init;
} | Checks whether an initializer with the given name exists. If not,
throws an exception. If it exists, the associated child initializer
is returned.
@param name the name to check.
@return the initializer with this name.
@throws NoSuchElementException if the name is unknown. | java | src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java | 142 | [
"name"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
initialize | @Override
protected MultiBackgroundInitializerResults initialize() throws Exception {
final Map<String, BackgroundInitializer<?>> inits;
synchronized (this) {
// create a snapshot to operate on
inits = new HashMap<>(childInitializers);
}
// start the child ini... | Creates the results object. This implementation starts all child {@code
BackgroundInitializer} objects. Then it collects their results and
creates a {@link MultiBackgroundInitializerResults} object with this
data. If a child initializer throws a checked exceptions, it is added to
the results object. Unchecked exception... | java | src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java | 319 | [] | MultiBackgroundInitializerResults | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
initMacSandbox | private void initMacSandbox() {
// write rules to a temporary file, which will be passed to sandbox_init()
Path rules;
try {
rules = createTempRulesFile();
Files.write(rules, Collections.singleton(SANDBOX_RULES));
} catch (IOException e) {
throw new Un... | Installs exec system call filtering on MacOS.
<p>
Two different methods of filtering are used. Since MacOS is BSD based, process creation
is first restricted with {@code setrlimit(RLIMIT_NPROC)}.
<p>
Additionally, on Mac OS X Leopard or above, a custom {@code sandbox(7)} ("Seatbelt") profile is installed that
denies th... | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/MacNativeAccess.java | 105 | [] | void | true | 3 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
asList | public static List<Long> asList(long... backingArray) {
if (backingArray.length == 0) {
return Collections.emptyList();
}
return new LongArrayAsList(backingArray);
} | Returns a fixed-size list backed by the specified array, similar to {@link
Arrays#asList(Object[])}. The list supports {@link List#set(int, Object)}, but any attempt to
set a value to {@code null} will result in a {@link NullPointerException}.
<p>The returned list maintains the values, but not the identities, of {@code... | java | android/guava/src/com/google/common/primitives/Longs.java | 709 | [] | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false | |
is_array_like | def is_array_like(obj: object) -> bool:
"""
Check if the object is array-like.
For an object to be considered array-like, it must be list-like and
have a `dtype` attribute.
Parameters
----------
obj : The object to check
Returns
-------
is_array_like : bool
Whether `ob... | Check if the object is array-like.
For an object to be considered array-like, it must be list-like and
have a `dtype` attribute.
Parameters
----------
obj : The object to check
Returns
-------
is_array_like : bool
Whether `obj` has array-like properties.
Examples
--------
>>> is_array_like(np.array([1, 2, 3]))
... | python | pandas/core/dtypes/inference.py | 227 | [
"obj"
] | bool | true | 2 | 8 | pandas-dev/pandas | 47,362 | numpy | false |
toChar | public static char toChar(final String str) {
Validate.notEmpty(str, "The String must not be empty");
return str.charAt(0);
} | Converts the String to a char using the first character, throwing
an exception on empty Strings.
<pre>
CharUtils.toChar("A") = 'A'
CharUtils.toChar("BA") = 'B'
CharUtils.toChar(null) throws IllegalArgumentException
CharUtils.toChar("") throws IllegalArgumentException
</pre>
@param str the character to conve... | java | src/main/java/org/apache/commons/lang3/CharUtils.java | 316 | [
"str"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
close | @Override
public void close() {
try {
generator.close();
} catch (IOException e) {
throw new IllegalStateException("Failed to close the XContentBuilder", e);
}
} | Returns a version used for serialising a response.
@return a compatible version | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 1,286 | [] | void | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
_insert_update_blklocs_and_blknos | def _insert_update_blklocs_and_blknos(self, loc) -> None:
"""
When inserting a new Block at location 'loc', we update our
_blklocs and _blknos.
"""
# Accessing public blklocs ensures the public versions are initialized
if loc == self.blklocs.shape[0]:
# np.ap... | When inserting a new Block at location 'loc', we update our
_blklocs and _blknos. | python | pandas/core/internals/managers.py | 1,559 | [
"self",
"loc"
] | None | true | 4 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
adapt | static ConfigurationPropertyName adapt(CharSequence name, char separator,
@Nullable Function<CharSequence, CharSequence> elementValueProcessor) {
Assert.notNull(name, "Name must not be null");
if (name.isEmpty()) {
return EMPTY;
}
Elements elements = new ElementsParser(name, separator).parse(elementValueP... | Create a {@link ConfigurationPropertyName} by adapting the given source. The name
is split into elements around the given {@code separator}. This method is more
lenient than {@link #of} in that it allows mixed case names and '{@code _}'
characters. Other invalid characters are stripped out during parsing.
<p>
The {@cod... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 736 | [
"name",
"separator",
"elementValueProcessor"
] | ConfigurationPropertyName | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_loc | def get_loc(self, key) -> int | slice | np.ndarray:
"""
Get integer location, slice or boolean mask for requested label.
The `get_loc` method is used to retrieve the integer index, a slice for
slicing objects, or a boolean mask indicating the presence of the label
in the `Interv... | Get integer location, slice or boolean mask for requested label.
The `get_loc` method is used to retrieve the integer index, a slice for
slicing objects, or a boolean mask indicating the presence of the label
in the `IntervalIndex`.
Parameters
----------
key : label
The value or range to find in the IntervalIndex... | python | pandas/core/indexes/interval.py | 742 | [
"self",
"key"
] | int | slice | np.ndarray | true | 11 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
emit_state_change_metric | def emit_state_change_metric(self, new_state: TaskInstanceState) -> None:
"""
Send a time metric representing how much time a given state transition took.
The previous state and metric name is deduced from the state the task was put in.
:param new_state: The state that has just been se... | Send a time metric representing how much time a given state transition took.
The previous state and metric name is deduced from the state the task was put in.
:param new_state: The state that has just been set for this task.
We do not use `self.state`, because sometimes the state is updated directly in the DB and... | python | airflow-core/src/airflow/models/taskinstance.py | 1,201 | [
"self",
"new_state"
] | None | true | 7 | 7.04 | apache/airflow | 43,597 | sphinx | false |
exists | def exists(self, path):
"""
Test if path exists.
Test if `path` exists as (and in this order):
- a local file.
- a remote URL that has been downloaded and stored locally in the
`DataSource` directory.
- a remote URL that has not been downloaded, but is valid a... | Test if path exists.
Test if `path` exists as (and in this order):
- a local file.
- a remote URL that has been downloaded and stored locally in the
`DataSource` directory.
- a remote URL that has not been downloaded, but is valid and
accessible.
Parameters
----------
path : str or pathlib.Path
Can be a loca... | python | numpy/lib/_datasource.py | 427 | [
"self",
"path"
] | false | 4 | 6.24 | numpy/numpy | 31,054 | numpy | false | |
notAvailable | public ConditionMessage notAvailable(String item) {
return because(item + " is not available");
} | Indicates something is not available. For example {@code notAvailable("time")}
results in the message "time is not available".
@param item the item that is not available
@return a built {@link ConditionMessage} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | 291 | [
"item"
] | ConditionMessage | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
isServletEnvironment | private boolean isServletEnvironment(Class<?> conversionType, ClassLoader classLoader) {
try {
Class<?> webEnvironmentClass = ClassUtils.forName(CONFIGURABLE_WEB_ENVIRONMENT_CLASS, classLoader);
return webEnvironmentClass.isAssignableFrom(conversionType);
}
catch (Throwable ex) {
return false;
}
} | Converts the given {@code environment} to the given {@link StandardEnvironment}
type. If the environment is already of the same type, no conversion is performed
and it is returned unchanged.
@param environment the Environment to convert
@param type the type to convert the Environment to
@return the converted Environmen... | java | core/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java | 110 | [
"conversionType",
"classLoader"
] | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
when | public Source<T> when(Predicate<T> predicate) {
Assert.notNull(predicate, "'predicate' must not be null");
return new Source<>(this.supplier, this.predicate.and(predicate));
} | Return a filtered version of the source that won't map values that don't match
the given predicate.
@param predicate the predicate used to filter values
@return a new filtered source instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 277 | [
"predicate"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
offload_activation_fw | def offload_activation_fw(graph: fx.Graph) -> None:
"""
Insert CPU offload operations in the forward pass graph.
Offload operations are placed after the last effective use of each tensor marked
for offloading. This ensures the tensor is no longer needed on the GPU before
transferring it to CPU memo... | Insert CPU offload operations in the forward pass graph.
Offload operations are placed after the last effective use of each tensor marked
for offloading. This ensures the tensor is no longer needed on the GPU before
transferring it to CPU memory.
NOTE: An alternative approach would offload tensors immediately after g... | python | torch/_functorch/_activation_offloading/activation_offloading.py | 75 | [
"graph"
] | None | true | 8 | 6.64 | pytorch/pytorch | 96,034 | google | false |
parse | private static long parse(final String initialInput, final String normalized, final String suffix, String settingName) {
final String s = normalized.substring(0, normalized.length() - suffix.length()).trim();
try {
final long value = Long.parseLong(s);
if (value < -1) {
... | @param sValue Value to parse, which may be {@code null}.
@param defaultValue Value to return if {@code sValue} is {@code null}.
@param settingName Name of the parameter or setting. On invalid input, this value is included in the exception message. Otherwise,
this parameter is unused.
@return ... | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 409 | [
"initialInput",
"normalized",
"suffix",
"settingName"
] | true | 4 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
disconnected | public void disconnected(String id, long now) {
NodeConnectionState nodeState = nodeState(id);
nodeState.lastConnectAttemptMs = now;
updateReconnectBackoff(nodeState);
if (nodeState.state == ConnectionState.CONNECTING) {
updateConnectionSetupTimeout(nodeState);
co... | Enter the disconnected state for the given node.
@param id the connection we have disconnected
@param now the current time in ms | java | clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java | 181 | [
"id",
"now"
] | void | true | 3 | 7.2 | apache/kafka | 31,560 | javadoc | false |
dateTimeFormat | public DateTimeFormatters dateTimeFormat(@Nullable String pattern) {
this.dateTimeFormatter = isIso(pattern) ? DateTimeFormatter.ISO_LOCAL_DATE_TIME
: (isIsoOffset(pattern) ? DateTimeFormatter.ISO_OFFSET_DATE_TIME : formatter(pattern));
return this;
} | Configures the date-time format using the given {@code pattern}.
@param pattern the pattern for formatting date-times
@return {@code this} for chained method invocation | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/DateTimeFormatters.java | 76 | [
"pattern"
] | DateTimeFormatters | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
serializeParams | function serializeParams(params: unknown): string {
return toUrlParams(params, false);
} | Converts params into a URL-encoded query string.
@param params data to serialize
@returns A URL-encoded string representing the provided data. | typescript | packages/grafana-data/src/utils/url.ts | 106 | [
"params"
] | true | 1 | 6.32 | grafana/grafana | 71,362 | jsdoc | false | |
create_pidlock | def create_pidlock(pidfile):
"""Create and verify pidfile.
If the pidfile already exists the program exits with an error message,
however if the process it refers to isn't running anymore, the pidfile
is deleted and the program continues.
This function will automatically install an :mod:`atexit` h... | Create and verify pidfile.
If the pidfile already exists the program exits with an error message,
however if the process it refers to isn't running anymore, the pidfile
is deleted and the program continues.
This function will automatically install an :mod:`atexit` handler
to release the lock at exit, you can skip thi... | python | celery/platforms.py | 244 | [
"pidfile"
] | false | 1 | 7.52 | celery/celery | 27,741 | unknown | false | |
isExcludedFromDependencyCheck | public static boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) {
Method wm = pd.getWriteMethod();
if (wm == null) {
return false;
}
if (!wm.getDeclaringClass().getName().contains("$$")) {
// Not a CGLIB method so it's OK.
return false;
}
// It was declared by CGLIB, but we might still w... | Determine whether the given bean property is excluded from dependency checks.
<p>This implementation excludes properties defined by CGLIB.
@param pd the PropertyDescriptor of the bean property
@return whether the bean property is excluded | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java | 92 | [
"pd"
] | true | 3 | 7.2 | spring-projects/spring-framework | 59,386 | javadoc | false | |
findIndex | function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(a... | This method is like `_.find` except that it returns the index of the first
element `predicate` returns truthy for instead of the element itself.
@static
@memberOf _
@since 1.1.0
@category Array
@param {Array} array The array to inspect.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@param... | javascript | lodash.js | 7,352 | [
"array",
"predicate",
"fromIndex"
] | false | 5 | 7.52 | lodash/lodash | 61,490 | jsdoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.