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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cartesian_product | def cartesian_product(X: list[np.ndarray]) -> list[np.ndarray]:
"""
Numpy version of itertools.product.
Sometimes faster (for large inputs)...
Parameters
----------
X : list-like of list-likes
Returns
-------
product : list of ndarrays
Examples
--------
>>> cartesian_p... | Numpy version of itertools.product.
Sometimes faster (for large inputs)...
Parameters
----------
X : list-like of list-likes
Returns
-------
product : list of ndarrays
Examples
--------
>>> cartesian_product([list("ABC"), [1, 2]])
[array(['A', 'A', 'B', 'B', 'C', 'C'], dtype='<U1'), array([1, 2, 1, 2, 1, 2])]
See A... | python | pandas/core/indexes/multi.py | 4,451 | [
"X"
] | list[np.ndarray] | true | 8 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
forField | public static ResourceElementResolver forField(String fieldName) {
return new ResourceFieldResolver(fieldName, true, fieldName);
} | Create a new {@link ResourceFieldResolver} for the specified field.
@param fieldName the field name
@return a new {@link ResourceFieldResolver} instance | java | spring-context/src/main/java/org/springframework/context/annotation/ResourceElementResolver.java | 68 | [
"fieldName"
] | ResourceElementResolver | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
show_versions | def show_versions(as_json: str | bool = False) -> None:
"""
Provide useful information, important for bug reports.
It comprises info about hosting operation system, pandas version,
and versions of other installed relative packages.
Parameters
----------
as_json : str or bool, default False... | Provide useful information, important for bug reports.
It comprises info about hosting operation system, pandas version,
and versions of other installed relative packages.
Parameters
----------
as_json : str or bool, default False
* If False, outputs info in a human readable form to the console.
* If str, it ... | python | pandas/util/_print_versions.py | 96 | [
"as_json"
] | None | true | 7 | 8.24 | pandas-dev/pandas | 47,362 | numpy | false |
newTreeSet | @SuppressWarnings("NonApiType") // acts as a direct substitute for a constructor call
public static <E extends @Nullable Object> TreeSet<E> newTreeSet(
Comparator<? super E> comparator) {
return new TreeSet<>(checkNotNull(comparator));
} | Creates a <i>mutable</i>, empty {@code TreeSet} instance with the given comparator.
<p><b>Note:</b> if mutability is not required, use {@code
ImmutableSortedSet.orderedBy(comparator).build()} instead.
<p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead,
use the {@code TreeSet} co... | java | android/guava/src/com/google/common/collect/Sets.java | 438 | [
"comparator"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
addConsoleCtrlHandler | public boolean addConsoleCtrlHandler(ConsoleCtrlHandler handler) {
return kernel.SetConsoleCtrlHandler(dwCtrlType -> {
if (logger.isDebugEnabled()) {
logger.debug("console control handler received event [{}]", dwCtrlType);
}
return handler.handle(dwCtrlType);
... | Adds a Console Ctrl Handler for Windows. On non-windows this is a noop.
@return true if the handler is correctly set | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/WindowsFunctions.java | 58 | [
"handler"
] | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false | |
brokersById | public Map<Integer, Node> brokersById() {
return holder().brokers;
} | Get all brokers returned in metadata response
@return the brokers | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java | 233 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
trigger_dag | def trigger_dag(
dag_id: str,
*,
triggered_by: DagRunTriggeredByType,
triggering_user_name: str | None = None,
run_after: datetime | None = None,
run_id: str | None = None,
conf: dict | str | None = None,
logical_date: datetime | None = None,
replace_microseconds: bool = True,
se... | Triggers execution of DAG specified by dag_id.
:param dag_id: DAG ID
:param triggered_by: the entity which triggers the dag_run
:param triggering_user_name: the user name who triggers the dag_run
:param run_after: the datetime before which dag won't run
:param run_id: ID of the dag_run
:param conf: configuration
:para... | python | airflow-core/src/airflow/api/common/trigger_dag.py | 128 | [
"dag_id",
"triggered_by",
"triggering_user_name",
"run_after",
"run_id",
"conf",
"logical_date",
"replace_microseconds",
"session"
] | DagRun | None | true | 4 | 8.08 | apache/airflow | 43,597 | sphinx | false |
var | def var(
self,
ddof: int = 1,
engine: Literal["cython", "numba"] | None = None,
engine_kwargs: dict[str, bool] | None = None,
numeric_only: bool = False,
skipna: bool = True,
):
"""
Compute variance of groups, excluding missing values.
For mul... | Compute variance of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex.
Parameters
----------
ddof : int, default 1
Degrees of freedom.
engine : str, default None
* ``'cython'`` : Runs the operation through C-extensions from cython.
* ``'numba'`` : Runs the op... | python | pandas/core/groupby/groupby.py | 2,520 | [
"self",
"ddof",
"engine",
"engine_kwargs",
"numeric_only",
"skipna"
] | true | 3 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false | |
update | function update<T extends Node>(updated: Mutable<T>, original: T): T {
if (updated !== original) {
setOriginal(updated, original);
setTextRange(updated, original);
}
return updated;
} | Lifts a NodeArray containing only Statement nodes to a block.
@param nodes The NodeArray. | typescript | src/compiler/factory/nodeFactory.ts | 7,179 | [
"updated",
"original"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
negate | default FailableDoublePredicate<E> negate() {
return t -> !test(t);
} | Returns a predicate that negates this predicate.
@return a predicate that negates this predicate. | java | src/main/java/org/apache/commons/lang3/function/FailableDoublePredicate.java | 79 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
create | Reader create(Reader reader); | Wraps the given Reader with a CharFilter.
@param reader reader to be wrapped
@return a reader wrapped with CharFilter | java | libs/plugin-analysis-api/src/main/java/org/elasticsearch/plugin/analysis/CharFilterFactory.java | 28 | [
"reader"
] | Reader | true | 1 | 6.48 | elastic/elasticsearch | 75,680 | javadoc | false |
set_head_dim_values | def set_head_dim_values(
kernel_options: dict[str, Any], qk_head_dim, v_head_dim, graph_sizevars
):
"""
Mutates kernel options, adding head dimension calculations.
Args:
kernel_options: Dictionary to populate with options
qk_head_dim: Query/Key head dimension
v_head_dim: Value h... | Mutates kernel options, adding head dimension calculations.
Args:
kernel_options: Dictionary to populate with options
qk_head_dim: Query/Key head dimension
v_head_dim: Value head dimension
graph_sizevars: Graph size variables object with guard_int method | python | torch/_inductor/kernel/flex/common.py | 305 | [
"kernel_options",
"qk_head_dim",
"v_head_dim",
"graph_sizevars"
] | true | 2 | 6.24 | pytorch/pytorch | 96,034 | google | false | |
filteredProducerIds | public Set<Long> filteredProducerIds() {
return filteredProducerIds;
} | Returns the set of producerIds that are being filtered or empty if none have been specified.
@return the current set of filtered states (empty means that no producerIds are filtered and
all transactions will be returned) | java | clients/src/main/java/org/apache/kafka/clients/admin/ListTransactionsOptions.java | 103 | [] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
trim | private void trim() {
int left = 0;
int right = 2 * k - 1;
int minThresholdPosition = 0;
// The leftmost position at which the greatest of the k lower elements
// -- the new value of threshold -- might be found.
int iterations = 0;
int maxIterations = IntMath.log2(right - left, RoundingMod... | Quickselects the top k elements from the 2k elements in the buffer. O(k) expected time, O(k log
k) worst case. | java | android/guava/src/com/google/common/collect/TopKSelector.java | 164 | [] | void | true | 7 | 7.2 | google/guava | 51,352 | javadoc | false |
hermgauss | def hermgauss(deg):
"""
Gauss-Hermite quadrature.
Computes the sample points and weights for Gauss-Hermite quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[-\\inf, \\inf]`
with the weight function :mat... | Gauss-Hermite quadrature.
Computes the sample points and weights for Gauss-Hermite quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[-\\inf, \\inf]`
with the weight function :math:`f(x) = \\exp(-x^2)`.
Parameters
----------
d... | python | numpy/polynomial/hermite.py | 1,590 | [
"deg"
] | false | 2 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
_disable_dynamo | def _disable_dynamo(
fn: Callable[_P, _T] | None = None, recursive: bool = True
) -> Callable[_P, _T] | Callable[[Callable[_P, _T]], Callable[_P, _T]]:
"""
This API should be only used inside torch, external users should still use
torch._dynamo.disable. The main goal of this API is to avoid circular
... | This API should be only used inside torch, external users should still use
torch._dynamo.disable. The main goal of this API is to avoid circular
imports issues that is common while using _dynamo.disable inside torch
itself.
This API avoids it by lazily importing torch._dynamo from the import time to
the invocation of ... | python | torch/_compile.py | 28 | [
"fn",
"recursive"
] | Callable[_P, _T] | Callable[[Callable[_P, _T]], Callable[_P, _T]] | true | 4 | 6 | pytorch/pytorch | 96,034 | unknown | false |
getFirstBucketMidpoint | private static double getFirstBucketMidpoint(ExponentialHistogram.Buckets buckets) {
CopyableBucketIterator iterator = buckets.iterator();
if (iterator.hasNext()) {
return ExponentialScaleUtils.getPointOfLeastRelativeError(iterator.peekIndex(), iterator.scale());
} else {
... | Estimates the rank of a given value in the distribution represented by the histogram.
In other words, returns the number of values which are less than (or less-or-equal, if {@code inclusive} is true)
the provided value.
@param histo the histogram to query
@param value the value to estimate the rank for
@param inclusive... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramQuantile.java | 160 | [
"buckets"
] | true | 2 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
calculateFilenamesForLocale | protected List<String> calculateFilenamesForLocale(String basename, Locale locale) {
List<String> result = new ArrayList<>(3);
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
StringBuilder temp = new StringBuilder(basename);
temp.append('_... | Calculate the filenames for the given bundle basename and Locale,
appending language code, country code, and variant code.
<p>For example, basename "messages", Locale "de_AT_oo" → "messages_de_AT_OO",
"messages_de_AT", "messages_de".
<p>Follows the rules defined by {@link java.util.Locale#toString()}.
@param basen... | java | spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java | 373 | [
"basename",
"locale"
] | true | 6 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
emptyArray | @SuppressWarnings("unchecked")
public static <L, M, R> MutableTriple<L, M, R>[] emptyArray() {
return (MutableTriple<L, M, R>[]) EMPTY_ARRAY;
} | Returns the empty array singleton that can be assigned without compiler warning.
@param <L> the left element type.
@param <M> the middle element type.
@param <R> the right element type.
@return the empty array singleton that can be assigned without compiler warning.
@since 3.10 | java | src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java | 55 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
max | public static short max(final short... array) {
// Validates input
validateArray(array);
// Finds and returns max
short max = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
}
}
retur... | Returns the maximum value in an array.
@param array an array, must not be null or empty.
@return the maximum value in the array.
@throws NullPointerException if {@code array} is {@code null}.
@throws IllegalArgumentException if {@code array} is empty.
@since 3.4 Changed signature from max(short[]) to max(short...). | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,063 | [] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
is_datetime64_dtype | def is_datetime64_dtype(arr_or_dtype) -> bool:
"""
Check whether an array-like or dtype is of the datetime64 dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype to check.
Returns
-------
boolean
Whether or not the array-like or dtype ... | Check whether an array-like or dtype is of the datetime64 dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype to check.
Returns
-------
boolean
Whether or not the array-like or dtype is of the datetime64 dtype.
See Also
--------
api.types.is_datetime64_ns_dtype: Check whet... | python | pandas/core/dtypes/common.py | 289 | [
"arr_or_dtype"
] | bool | true | 2 | 8 | pandas-dev/pandas | 47,362 | numpy | false |
indexIn | public int indexIn(CharSequence sequence) {
return indexIn(sequence, 0);
} | Returns the index of the first matching BMP character in a character sequence, or {@code -1} if
no matching character is present.
<p>The default implementation iterates over the sequence in forward order calling {@link
#matches} for each character.
@param sequence the character sequence to examine from the beginning
@r... | java | android/guava/src/com/google/common/base/CharMatcher.java | 544 | [
"sequence"
] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
create_queue | def create_queue(self, queue_name: str, attributes: dict | None = None) -> dict:
"""
Create queue using connection object.
.. seealso::
- :external+boto3:py:meth:`SQS.Client.create_queue`
:param queue_name: name of the queue.
:param attributes: additional attributes... | Create queue using connection object.
.. seealso::
- :external+boto3:py:meth:`SQS.Client.create_queue`
:param queue_name: name of the queue.
:param attributes: additional attributes for the queue (default: None)
:return: dict with the information about the queue. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sqs.py | 43 | [
"self",
"queue_name",
"attributes"
] | dict | true | 2 | 7.6 | apache/airflow | 43,597 | sphinx | false |
greatCircleMinLatitude | public double greatCircleMinLatitude(LatLng latLng) {
if (isNumericallyIdentical(latLng)) {
return latLng.lat;
}
return latLng.lat < this.lat ? greatCircleMinLatitude(latLng, this) : greatCircleMinLatitude(this, latLng);
} | Determines the minimum latitude of the great circle defined by this LatLng to the provided LatLng.
@param latLng The LatLng.
@return The minimum latitude of the great circle in radians. | java | libs/h3/src/main/java/org/elasticsearch/h3/LatLng.java | 158 | [
"latLng"
] | true | 3 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false | |
newProperties | protected Properties newProperties() {
return new Properties();
} | Template method for creating a plain new {@link Properties} instance.
The default implementation simply calls {@link Properties#Properties()}.
<p>Allows for returning a custom {@link Properties} extension in subclasses.
Overriding methods should just instantiate a custom {@link Properties} subclass,
with no further ini... | java | spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java | 603 | [] | Properties | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false |
nodeById | public Node nodeById(int id) {
return this.nodesById.get(id);
} | Get the node by the node id (or null if the node is not online or does not exist)
@param id The id of the node
@return The node, or null if the node is not online or does not exist | java | clients/src/main/java/org/apache/kafka/common/Cluster.java | 243 | [
"id"
] | Node | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
resolveType | private String resolveType(MetadataGenerationEnvironment environment) {
return environment.getTypeUtils().getType(getDeclaringElement(), getType());
} | Return if this property has been explicitly marked as nested (for example using an
annotation}.
@param environment the metadata generation environment
@return if the property has been marked as nested | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptor.java | 205 | [
"environment"
] | String | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
concat | function concat<I0, I1>(list0: L.List<I0>, list1: L.List<I1>) {
let length = list0.length + list1.length
// tipping point where implementation becomes slower
if (length > 200) return list0.concat(list1 as any[])
const _list: (I0 | I1)[] = new Array(length)
for (let i = list1.length - 1; i >= 0; --i) {
... | Combines two lists into a new one.
(more efficient than native concat)
@param list0
@param list1
@returns | typescript | helpers/blaze/concat.ts | 13 | [
"list0",
"list1"
] | false | 4 | 7.6 | prisma/prisma | 44,834 | jsdoc | false | |
build_subgraph_buffer | def build_subgraph_buffer(
args: list[TensorBox],
subgraph: Subgraph,
):
"""
This function is adapted from ../kernel/flex_attention.py.
The goal is to take in the required args and produce the subgraph buffer
The subgraph buffer is a ComputedBuffer that will be inlined into the triton template
... | This function is adapted from ../kernel/flex_attention.py.
The goal is to take in the required args and produce the subgraph buffer
The subgraph buffer is a ComputedBuffer that will be inlined into the triton template
Args:
args: The args that are passed into the subgraph
subgraph: The Subgraph ir for which to... | python | torch/_inductor/fx_passes/b2b_gemm.py | 455 | [
"args",
"subgraph"
] | true | 6 | 6.8 | pytorch/pytorch | 96,034 | google | false | |
complementOf | @J2ktIncompatible
@GwtIncompatible // EnumSet.complementOf
public static <E extends Enum<E>> EnumSet<E> complementOf(Collection<E> collection) {
if (collection instanceof EnumSet) {
return EnumSet.complementOf((EnumSet<E>) collection);
}
checkArgument(
!collection.isEmpty(), "collection is... | Creates an {@code EnumSet} consisting of all enum values that are not in the specified
collection. If the collection is an {@link EnumSet}, this method has the same behavior as
{@link EnumSet#complementOf}. Otherwise, the specified collection must contain at least one
element, in order to determine the element type. If... | java | android/guava/src/com/google/common/collect/Sets.java | 505 | [
"collection"
] | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false | |
is_sparse | def is_sparse(arr) -> bool:
"""
Check whether an array-like is a 1-D pandas sparse array.
.. deprecated:: 2.1.0
Use isinstance(dtype, pd.SparseDtype) instead.
Check that the one-dimensional array-like is a pandas sparse array.
Returns True if it is a pandas sparse array, not another type o... | Check whether an array-like is a 1-D pandas sparse array.
.. deprecated:: 2.1.0
Use isinstance(dtype, pd.SparseDtype) instead.
Check that the one-dimensional array-like is a pandas sparse array.
Returns True if it is a pandas sparse array, not another type of
sparse array.
Parameters
----------
arr : array-like
... | python | pandas/core/dtypes/common.py | 189 | [
"arr"
] | bool | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
state_from_response | def state_from_response(response: dict[str, Any]) -> str:
"""
Get state from boto3 response.
:param response: response from AWS API
:return: state
"""
raise NotImplementedError("Please implement state_from_response() in subclass") | Get state from boto3 response.
:param response: response from AWS API
:return: state | python | providers/amazon/src/airflow/providers/amazon/aws/sensors/emr.py | 97 | [
"response"
] | str | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
mixin | function mixin(object, source, options) {
var props = keys(source),
methodNames = baseFunctions(source, props);
if (options == null &&
!(isObject(source) && (methodNames.length || !props.length))) {
options = source;
source = object;
object = this;
method... | Adds all own enumerable string keyed function properties of a source
object to the destination object. If `object` is a function, then methods
are added to its prototype as well.
**Note:** Use `_.runInContext` to create a pristine `lodash` function to
avoid conflicts caused by modifying the original.
@static
@since 0.1... | javascript | lodash.js | 15,817 | [
"object",
"source",
"options"
] | false | 10 | 7.2 | lodash/lodash | 61,490 | jsdoc | false | |
isSingleton | @Override
public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
String beanName = transformedBeanName(name);
Object beanInstance = getSingleton(beanName, false);
if (beanInstance != null) {
if (beanInstance instanceof FactoryBean<?> factoryBean) {
return (BeanFactoryUtils.isFacto... | Return an instance, which may be shared or independent, of the specified bean.
@param name the name of the bean to retrieve
@param requiredType the required type of the bean to retrieve
@param args arguments to use when creating a bean instance using explicit arguments
(only applied when creating a new instance as oppo... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 435 | [
"name"
] | true | 9 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
roundtrip | @SuppressWarnings("unchecked") // OK, because we serialized a type `T`
public static <T extends Serializable> T roundtrip(final T obj) {
return (T) deserialize(serialize(obj));
} | Performs a serialization roundtrip. Serializes and deserializes the given object, great for testing objects that
implement {@link Serializable}.
@param <T>
the type of the object involved.
@param obj
the object to roundtrip.
@return the serialized and deserialized object.
@since 3.3 | java | src/main/java/org/apache/commons/lang3/SerializationUtils.java | 222 | [
"obj"
] | T | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
asVariableDeclaration | function asVariableDeclaration(variableDeclaration: string | BindingName | VariableDeclaration | undefined) {
if (typeof variableDeclaration === "string" || variableDeclaration && !isVariableDeclaration(variableDeclaration)) {
return createVariableDeclaration(
variableDeclaration,... | Lifts a NodeArray containing only Statement nodes to a block.
@param nodes The NodeArray. | typescript | src/compiler/factory/nodeFactory.ts | 7,167 | [
"variableDeclaration"
] | false | 4 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
clusterId | public String clusterId() {
return this.data.clusterId();
} | The cluster identifier returned in the metadata response.
@return cluster identifier if it is present in the response, null otherwise. | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java | 257 | [] | String | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
removeAll | public static char[] removeAll(final char[] array, final int... indices) {
return (char[]) 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,022 | [
"array"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
toShort | public static short toShort(final String str, final short defaultValue) {
try {
return Short.parseShort(str);
} catch (final RuntimeException e) {
return defaultValue;
}
} | Converts a {@link String} to an {@code short}, returning a default value if the conversion fails.
<p>
If the string is {@code null}, the default value is returned.
</p>
<pre>
NumberUtils.toShort(null, 1) = 1
NumberUtils.toShort("", 1) = 1
NumberUtils.toShort("1", 0) = 1
</pre>
@param str the string to... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,788 | [
"str",
"defaultValue"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
_get_team_executor_configs | def _get_team_executor_configs(cls, validate_teams: bool = True) -> list[tuple[str | None, list[str]]]:
"""
Return a list of executor configs to be loaded.
Each tuple contains the team id as the first element and the second element is the executor config
for that team (a list of executo... | Return a list of executor configs to be loaded.
Each tuple contains the team id as the first element and the second element is the executor config
for that team (a list of executor names/modules/aliases).
:param validate_teams: Whether to validate that team names exist in database | python | airflow-core/src/airflow/executors/executor_loader.py | 188 | [
"cls",
"validate_teams"
] | list[tuple[str | None, list[str]]] | true | 12 | 6.96 | apache/airflow | 43,597 | sphinx | false |
connect | int connect(int sockfd, SockAddr addr); | Connect a socket to an address.
@param sockfd An open socket file descriptor
@param addr The address to connect to
@return 0 on success, -1 on failure with errno set | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/lib/PosixCLibrary.java | 128 | [
"sockfd",
"addr"
] | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false | |
clone | public static boolean[] clone(final boolean[] array) {
return array != null ? array.clone() : null;
} | Clones an array or returns {@code null}.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array the array to clone, may be {@code null}.
@return the cloned array, {@code null} if {@code null} input. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1,453 | [
"array"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
asConfigurationPropertySource | private static @Nullable ConfigurationPropertySource asConfigurationPropertySource(
PropertySource<?> propertySource) {
ConfigurationPropertySource configurationPropertySource = ConfigurationPropertySource.from(propertySource);
if (configurationPropertySource != null && propertySource instanceof PropertySourceIn... | Factory method to create an {@link Kind#UNBOUND_IMPORT unbound import} contributor.
This contributor has been actively imported from another contributor and may itself
import further contributors later.
@param location the location of this contributor
@param resource the config data resource
@param profileSpecific if t... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java | 454 | [
"propertySource"
] | ConfigurationPropertySource | true | 3 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false |
create | R create(@Nullable T value); | Create a new instance for the given nullable value.
@param value the value used to create the instance (may be
{@code null})
@return the resulting instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 533 | [
"value"
] | R | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
reverse | public StrBuilder reverse() {
if (size == 0) {
return this;
}
final int half = size / 2;
final char[] buf = buffer;
for (int leftIdx = 0, rightIdx = size - 1; leftIdx < half; leftIdx++, rightIdx--) {
final char swap = buf[leftIdx];
buf[leftIdx... | Reverses the string builder placing each character in the opposite index.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,739 | [] | StrBuilder | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
matchesAtMostOne | public boolean matchesAtMostOne() {
return patternFilter.matchesAtMostOne() && entryFilter.matchesAtMostOne();
} | Return true if the resource and entry filters can only match one ACE. In other words, if
there are no ANY or UNKNOWN fields. | java | clients/src/main/java/org/apache/kafka/common/acl/AclBindingFilter.java | 86 | [] | true | 2 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
resolveInnerBean | public <T> T resolveInnerBean(@Nullable String innerBeanName, BeanDefinition innerBd,
BiFunction<String, RootBeanDefinition, T> resolver) {
String nameToUse = (innerBeanName != null ? innerBeanName : "(inner bean)" +
BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR + ObjectUtils.getIdentityHexString(innerBd));
... | Resolve an inner bean definition and invoke the specified {@code resolver}
on its merged bean definition.
@param innerBeanName the inner bean name (or {@code null} to assign one)
@param innerBd the inner raw bean definition
@param resolver the function to invoke to resolve
@param <T> the type of the resolution
@return ... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java | 257 | [
"innerBeanName",
"innerBd",
"resolver"
] | T | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
toStringYesNo | public static String toStringYesNo(final Boolean bool) {
return toString(bool, YES, NO, null);
} | Converts a Boolean to a String returning {@code 'yes'},
{@code 'no'}, or {@code null}.
<pre>
BooleanUtils.toStringYesNo(Boolean.TRUE) = "yes"
BooleanUtils.toStringYesNo(Boolean.FALSE) = "no"
BooleanUtils.toStringYesNo(null) = null;
</pre>
@param bool the Boolean to check
@return {@code 'yes'}, {@code '... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 1,139 | [
"bool"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
contains | public static boolean contains(char[] array, char target) {
for (char value : array) {
if (value == target) {
return true;
}
}
return false;
} | Returns {@code true} if {@code target} is present as an element anywhere in {@code array}.
@param array an array of {@code char} values, possibly empty
@param target a primitive {@code char} value
@return {@code true} if {@code array[i] == target} for some value of {@code i} | java | android/guava/src/com/google/common/primitives/Chars.java | 133 | [
"array",
"target"
] | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false | |
toBoolean | public static boolean toBoolean(final int value, final int trueValue, final int falseValue) {
if (value == trueValue) {
return true;
}
if (value == falseValue) {
return false;
}
throw new IllegalArgumentException("The Integer did not match either specified... | Converts an int to a boolean specifying the conversion values.
<p>If the {@code trueValue} and {@code falseValue} are the same number then
the return value will be {@code true} in case {@code value} matches it.</p>
<pre>
BooleanUtils.toBoolean(0, 1, 0) = false
BooleanUtils.toBoolean(1, 1, 0) = true
BooleanUtils.t... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 438 | [
"value",
"trueValue",
"falseValue"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
toStringBuilder | private static StringBuilder toStringBuilder(Readable r) throws IOException {
StringBuilder sb = new StringBuilder();
if (r instanceof Reader) {
copyReaderToBuilder((Reader) r, sb);
} else {
copy(r, sb);
}
return sb;
} | Reads all characters from a {@link Readable} object into a new {@link StringBuilder} instance.
Does not close the {@code Readable}.
@param r the object to read from
@return a {@link StringBuilder} containing all the characters
@throws IOException if an I/O error occurs | java | android/guava/src/com/google/common/io/CharStreams.java | 174 | [
"r"
] | StringBuilder | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false |
get_system_encoding | def get_system_encoding():
"""
The encoding for the character type functions. Fallback to 'ascii' if the
#encoding is unsupported by Python or could not be determined. See tickets
#10335 and #5846.
"""
try:
encoding = locale.getlocale()[1] or "ascii"
codecs.lookup(encoding)
e... | The encoding for the character type functions. Fallback to 'ascii' if the
#encoding is unsupported by Python or could not be determined. See tickets
#10335 and #5846. | python | django/utils/encoding.py | 248 | [] | false | 2 | 6.4 | django/django | 86,204 | unknown | false | |
txnOffsetCommitHandler | private TxnOffsetCommitHandler txnOffsetCommitHandler(TransactionalRequestResult result,
Map<TopicPartition, OffsetAndMetadata> offsets,
ConsumerGroupMetadata groupMetadata) {
for (Map.Entry<Topic... | Check if the transaction is in the prepared state.
@return true if the current state is PREPARED_TRANSACTION | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 1,223 | [
"result",
"offsets",
"groupMetadata"
] | TxnOffsetCommitHandler | true | 2 | 7.2 | apache/kafka | 31,560 | javadoc | false |
run | @Override
@SuppressWarnings("CatchingUnchecked") // sneaky checked exception
public void run() {
boolean stillRunning = true;
try {
while (true) {
ListenerCallQueue.Event<L> nextToRun;
Object nextLabel;
synchronized (PerListenerQueue.this) {
Precondi... | Dispatches all listeners {@linkplain #enqueue enqueued} prior to this call, serially and in
order. | java | android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java | 189 | [] | void | true | 5 | 6.72 | google/guava | 51,352 | javadoc | false |
invoke | @Override
public Object invoke(final Object unusedProxy, final Method method, final Object[] args)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
for (final L listener : listeners) {
try {
method.invoke(listene... | Propagates the method call to all registered listeners in place of the proxy listener object.
<p>
Calls listeners in the order added to the underlying {@link List}.
</p>
@param unusedProxy the proxy object representing a listener on which the invocation was called; not used
@param method the listener method that will b... | java | src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java | 120 | [
"unusedProxy",
"method",
"args"
] | Object | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
std | def std(
self,
axis=None,
dtype=None,
out=None,
ddof: int = 1,
keepdims: bool = False,
skipna: bool = True,
) -> Timedelta:
"""
Return sample standard deviation over requested axis.
Normalized by `N-1` by default. This can be changed u... | Return sample standard deviation over requested axis.
Normalized by `N-1` by default. This can be changed using ``ddof``.
Parameters
----------
axis : int, optional
Axis for the function to be applied on. For :class:`pandas.Series`
this parameter is unused and defaults to ``None``.
dtype : dtype, optional, de... | python | pandas/core/arrays/datetimes.py | 2,326 | [
"self",
"axis",
"dtype",
"out",
"ddof",
"keepdims",
"skipna"
] | Timedelta | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
run | public void run() throws Exception {
printBanner();
try {
runInputLoop();
}
catch (Exception ex) {
if (!(ex instanceof ShellExitException)) {
throw ex;
}
}
} | Run the shell until the user exists.
@throws Exception on error | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java | 130 | [] | void | true | 3 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
maybeCloseRecordStream | private void maybeCloseRecordStream() {
if (records != null) {
records.close();
records = null;
}
} | Draining a {@link CompletedFetch} will signal that the data has been consumed and the underlying resources
are closed. This is somewhat analogous to {@link Closeable#close() closing}, though no error will result if a
caller invokes {@link #fetchRecords(FetchConfig, Deserializers, int)}; an empty {@link List list} will ... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CompletedFetch.java | 175 | [] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
highlight_quantile | def highlight_quantile(
self,
subset: Subset | None = None,
color: str = "yellow",
axis: Axis | None = 0,
q_left: float = 0.0,
q_right: float = 1.0,
interpolation: QuantileInterpolation = "linear",
inclusive: IntervalClosedType = "both",
props: str... | Highlight values defined by a quantile with a style.
Parameters
----------
%(subset)s
%(color)s
axis : {0 or 'index', 1 or 'columns', None}, default 0
Axis along which to determine and highlight quantiles. If ``None`` quantiles
are measured over the entire DataFrame. See examples.
q_left : float, default 0
... | python | pandas/io/formats/style.py | 3,576 | [
"self",
"subset",
"color",
"axis",
"q_left",
"q_right",
"interpolation",
"inclusive",
"props"
] | Styler | true | 5 | 8.08 | pandas-dev/pandas | 47,362 | numpy | false |
get_freeable_input_buf | def get_freeable_input_buf(
nodes: list[BaseSchedulerNode],
graph_inputs: OrderedSet[str],
) -> dict[str, FreeableInputBuffer]:
"""
Create and keep track of all input buffers that can be freed during the program
Returns:
A dictionary containing all freeable input buffers, keyed by their nam... | Create and keep track of all input buffers that can be freed during the program
Returns:
A dictionary containing all freeable input buffers, keyed by their names. | python | torch/_inductor/memory.py | 89 | [
"nodes",
"graph_inputs"
] | dict[str, FreeableInputBuffer] | true | 8 | 7.92 | pytorch/pytorch | 96,034 | unknown | false |
coordinatorUnknown | public boolean coordinatorUnknown() {
return checkAndGetCoordinator() == null;
} | Check if we know who the coordinator is and we have an active connection
@return true if the coordinator is unknown | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 973 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
getBeanPostProcessorCache | BeanPostProcessorCache getBeanPostProcessorCache() {
synchronized (this.beanPostProcessors) {
BeanPostProcessorCache bppCache = this.beanPostProcessorCache;
if (bppCache == null) {
bppCache = new BeanPostProcessorCache();
for (BeanPostProcessor bpp : this.beanPostProcessors) {
if (bpp instanceof In... | Return the internal cache of pre-filtered post-processors,
freshly (re-)building it if necessary.
@since 5.3 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,011 | [] | BeanPostProcessorCache | true | 6 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
hexDigitToInt | public static int hexDigitToInt(final char hexChar) {
final int digit = Character.digit(hexChar, 16);
if (digit < 0) {
throw new IllegalArgumentException("Cannot convert '" + hexChar + "' to a hexadecimal digit");
}
return digit;
} | Converts a hexadecimal digit into an int using the default (LSB0) bit ordering.
<p>
'1' is converted to 1
</p>
@param hexChar the hexadecimal digit to convert.
@return an int equals to {@code hexDigit}.
@throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit. | java | src/main/java/org/apache/commons/lang3/Conversion.java | 725 | [
"hexChar"
] | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
permutations | public static <E> Collection<List<E>> permutations(Collection<E> elements) {
return new PermutationCollection<E>(ImmutableList.copyOf(elements));
} | Returns a {@link Collection} of all the permutations of the specified {@link Collection}.
<p><i>Notes:</i> This is an implementation of the Plain Changes algorithm for permutations
generation, described in Knuth's "The Art of Computer Programming", Volume 4, Chapter 7,
Section 7.2.1.2.
<p>If the input list contains equ... | java | android/guava/src/com/google/common/collect/Collections2.java | 567 | [
"elements"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
supportsEventType | @Override
@SuppressWarnings("unchecked")
public boolean supportsEventType(ResolvableType eventType) {
if (this.delegate instanceof GenericApplicationListener gal) {
return gal.supportsEventType(eventType);
}
else if (this.delegate instanceof SmartApplicationListener sal) {
Class<? extends ApplicationEvent... | Create a new GenericApplicationListener for the given delegate.
@param delegate the delegate listener to be invoked | java | spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java | 67 | [
"eventType"
] | true | 5 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
first | def first(self, numeric_only: bool = False):
"""
Calculate the expanding First (left-most) element of the window.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
-------
Series or Dat... | Calculate the expanding First (left-most) element of the window.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
-------
Series or DataFrame
Return type is the same as the original object with ``np.float64`` dtype.
See Also
--------
GroupBy.first : S... | python | pandas/core/window/expanding.py | 997 | [
"self",
"numeric_only"
] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false | |
readFromSocketChannel | protected int readFromSocketChannel() throws IOException {
return socketChannel.read(netReadBuffer);
} | Reads available bytes from socket channel to `netReadBuffer`.
Visible for testing.
@return number of bytes read | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 236 | [] | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false | |
convertClassesToClassNames | public static List<String> convertClassesToClassNames(final List<Class<?>> classes) {
return classes == null ? null : classes.stream().map(e -> getName(e, null)).collect(Collectors.toList());
} | Given a {@link List} of {@link Class} objects, this method converts them into class names.
<p>
A new {@link List} is returned. {@code null} objects will be copied into the returned list as {@code null}.
</p>
@param classes the classes to change.
@return a {@link List} of class names corresponding to the Class objects, ... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 205 | [
"classes"
] | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false | |
emptyToNull | public static @Nullable String emptyToNull(@Nullable String string) {
return Platform.emptyToNull(string);
} | Returns the given string if it is nonempty; {@code null} otherwise.
@param string the string to test and possibly return
@return {@code string} itself if it is nonempty; {@code null} if it is empty or null | java | android/guava/src/com/google/common/base/Strings.java | 53 | [
"string"
] | String | true | 1 | 6.96 | google/guava | 51,352 | javadoc | false |
filterProducerIds | public ListTransactionsOptions filterProducerIds(Collection<Long> producerIdFilters) {
this.filteredProducerIds = new HashSet<>(producerIdFilters);
return this;
} | Filter only the transactions from producers in a specific set of producerIds.
If no filter is specified or if the passed collection of producerIds is empty,
then the transactions of all producerIds will be returned.
@param producerIdFilters the set of producerIds to filter by
@return this object | java | clients/src/main/java/org/apache/kafka/clients/admin/ListTransactionsOptions.java | 56 | [
"producerIdFilters"
] | ListTransactionsOptions | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
rehashIfNecessary | private void rehashIfNecessary() {
@Nullable Node<K, V>[] oldKToV = hashTableKToV;
if (Hashing.needsResizing(size, oldKToV.length, LOAD_FACTOR)) {
int newTableSize = oldKToV.length * 2;
this.hashTableKToV = createTable(newTableSize);
this.hashTableVToK = createTable(newTableSize);
this.... | 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 | guava/src/com/google/common/collect/HashBiMap.java | 390 | [] | void | true | 3 | 7.92 | google/guava | 51,352 | javadoc | false |
setAttribute | @Override
public void setAttribute(Traceable traceable, String key, boolean value) {
final var span = Span.fromContextOrNull(spans.get(traceable.getSpanId()));
if (span != null) {
span.setAttribute(key, value);
}
} | Most of the examples of how to use the OTel API look something like this, where the span context
is automatically propagated:
<pre>{@code
Span span = tracer.spanBuilder("parent").startSpan();
try (Scope scope = parentSpan.makeCurrent()) {
// ...do some stuff, possibly creating further spans
} finally {
span.end... | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracer.java | 356 | [
"traceable",
"key",
"value"
] | void | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
LoggerConfiguration other = (LoggerConfiguration) obj;
return ObjectUtils.nullSafeEquals(this.name, other.name)
&& ObjectUtils.nullSafeEquals(this.lev... | Return the level configuration for the given scope.
@param scope the configuration scope
@return the level configuration or {@code null} for
{@link ConfigurationScope#DIRECT direct scope} results without applied
configuration
@since 2.7.13 | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java | 121 | [
"obj"
] | true | 6 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false | |
join | public static String join(final Iterator<?> iterator, final char separator) {
// handle null, zero and one elements before building a buffer
if (iterator == null) {
return null;
}
if (!iterator.hasNext()) {
return EMPTY;
}
return Streams.of(iterato... | Joins the elements of the provided {@link Iterator} into a single String containing the provided elements.
<p>
No delimiter is added before or after the list. Null objects or empty strings within the iteration are represented by empty strings.
</p>
<p>
See the examples here: {@link #join(Object[],char)}.
</p>
@param it... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 4,303 | [
"iterator",
"separator"
] | String | true | 3 | 8.4 | apache/commons-lang | 2,896 | javadoc | false |
typesSatisfyVariables | public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVariableMap) {
Objects.requireNonNull(typeVariableMap, "typeVariableMap");
// all types must be assignable to all the bounds of their mapped
// type variable.
for (final Map.Entry<TypeVariable<?>, Type> entr... | Determines whether or not specified types satisfy the bounds of their mapped type variables. When a type parameter extends another (such as
{@code <T, S extends T>}), uses another as a type parameter (such as {@code <T, S extends Comparable>>}), or otherwise depends on another type variable
to be specified, the depende... | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,566 | [
"typeVariableMap"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getAspectInstance | @Override
public final Object getAspectInstance() {
try {
return ReflectionUtils.accessibleConstructor(this.aspectClass).newInstance();
}
catch (NoSuchMethodException ex) {
throw new AopConfigException(
"No default constructor on aspect class: " + this.aspectClass.getName(), ex);
}
catch (Instanti... | Return the specified aspect class (never {@code null}). | java | spring-aop/src/main/java/org/springframework/aop/aspectj/SimpleAspectInstanceFactory.java | 58 | [] | Object | true | 5 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
trim | public static String trim(final String str) {
return str == null ? null : str.trim();
} | Removes control characters (char <= 32) from both ends of this String, handling {@code null} by returning {@code null}.
<p>
The String is trimmed using {@link String#trim()}. Trim removes start and end characters <= 32. To strip whitespace use {@link #strip(String)}.
</p>
<p>
To trim your choice of characters, us... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,724 | [
"str"
] | String | true | 2 | 7.84 | apache/commons-lang | 2,896 | javadoc | false |
might_contain_dag_via_default_heuristic | def might_contain_dag_via_default_heuristic(file_path: str, zip_file: zipfile.ZipFile | None = None) -> bool:
"""
Heuristic that guesses whether a Python file contains an Airflow DAG definition.
:param file_path: Path to the file to be checked.
:param zip_file: if passed, checks the archive. Otherwise,... | Heuristic that guesses whether a Python file contains an Airflow DAG definition.
:param file_path: Path to the file to be checked.
:param zip_file: if passed, checks the archive. Otherwise, check local filesystem.
:return: True, if file might contain DAGs. | python | airflow-core/src/airflow/utils/file.py | 307 | [
"file_path",
"zip_file"
] | bool | true | 5 | 8.24 | apache/airflow | 43,597 | sphinx | false |
getFuture | public synchronized Future<T> getFuture() {
if (future == null) {
throw new IllegalStateException("start() must be called first!");
}
return future;
} | Gets the {@link Future} object that was created when {@link #start()}
was called. Therefore this method can only be called after {@code
start()}.
@return the {@link Future} object wrapped by this initializer.
@throws IllegalStateException if {@link #start()} has not been called. | java | src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java | 300 | [] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
getCache | private static ConcurrentMap<Locale, Strategy> getCache(final int field) {
synchronized (CACHES) {
if (CACHES[field] == null) {
CACHES[field] = new ConcurrentHashMap<>(3);
}
return CACHES[field];
}
} | Gets a cache of Strategies for a particular field
@param field The Calendar field
@return a cache of Locale to Strategy | java | src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 753 | [
"field"
] | true | 2 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
deduceEnvironmentClass | private Class<? extends ConfigurableEnvironment> deduceEnvironmentClass() {
WebApplicationType webApplicationType = this.properties.getWebApplicationType();
Class<? extends ConfigurableEnvironment> environmentType = this.applicationContextFactory
.getEnvironmentType(webApplicationType);
if (environmentType == ... | Run the Spring application, creating and refreshing a new
{@link ApplicationContext}.
@param args the application arguments (usually passed from a Java main method)
@return a running {@link ApplicationContext} | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 370 | [] | true | 4 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
load_connections_dict | def load_connections_dict(file_path: str) -> dict[str, Any]:
"""
Load connection from text file.
``JSON``, `YAML` and ``.env`` files are supported.
:return: A dictionary where the key contains a connection ID and the value contains the connection.
"""
log.debug("Loading connection")
secre... | Load connection from text file.
``JSON``, `YAML` and ``.env`` files are supported.
:return: A dictionary where the key contains a connection ID and the value contains the connection. | python | airflow-core/src/airflow/secrets/local_filesystem.py | 253 | [
"file_path"
] | dict[str, Any] | true | 6 | 7.04 | apache/airflow | 43,597 | unknown | false |
identity | function identity(value) {
return value;
} | This method returns the first argument it receives.
@static
@since 0.1.0
@memberOf _
@category Util
@param {*} value Any value.
@returns {*} Returns `value`.
@example
var object = { 'a': 1 };
console.log(_.identity(object) === object);
// => true | javascript | lodash.js | 15,596 | [
"value"
] | false | 1 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
snap | def snap(self, freq: Frequency = "S") -> DatetimeIndex:
"""
Snap time stamps to nearest occurring frequency.
Parameters
----------
freq : str, Timedelta, datetime.timedelta, or DateOffset, default 'S'
Frequency strings can have multiples, e.g. '5h'. See
:... | Snap time stamps to nearest occurring frequency.
Parameters
----------
freq : str, Timedelta, datetime.timedelta, or DateOffset, default 'S'
Frequency strings can have multiples, e.g. '5h'. See
:ref:`here <timeseries.offset_aliases>` for a list of
frequency aliases.
Returns
-------
DatetimeIndex
Time ... | python | pandas/core/indexes/datetimes.py | 823 | [
"self",
"freq"
] | DatetimeIndex | true | 5 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
addGenericArgumentValue | public void addGenericArgumentValue(ValueHolder newValue) {
Assert.notNull(newValue, "ValueHolder must not be null");
if (!this.genericArgumentValues.contains(newValue)) {
addOrMergeGenericArgumentValue(newValue);
}
} | Add a generic argument value to be matched by type or name (if available).
<p>Note: A single generic argument value will just be used once,
rather than matched multiple times.
@param newValue the argument value in the form of a ValueHolder
<p>Note: Identical ValueHolder instances will only be registered once,
to allow ... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java | 214 | [
"newValue"
] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
setBeanFactory | @Override
public void setBeanFactory(BeanFactory beanFactory) {
if (!StringUtils.hasText(this.targetBeanName)) {
throw new IllegalArgumentException("Property 'targetBeanName' is required");
}
if (!StringUtils.hasText(this.methodName)) {
throw new IllegalArgumentException("Property 'methodName' is required"... | Set the name of the {@link Method} to locate.
<p>This property is required.
@param methodName the name of the {@link Method} to locate | java | spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java | 62 | [
"beanFactory"
] | void | true | 5 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
memoize | def memoize(
self,
custom_params_encoder: Callable[_P, object] | None = None,
custom_result_encoder: Callable[_P, Callable[[_R], _EncodedR]] | None = None,
custom_result_decoder: Callable[_P, Callable[[_EncodedR], _R]] | None = None,
) -> Callable[[Callable[_P, _R]], Callable[_P, _R]... | Memoize a function with record and replay functionality.
This is a decorator that attempts to replay cached results first.
If a cache miss occurs, it records the result by executing the wrapped function.
Args:
custom_params_encoder: Optional encoder for function parameters.
If None, para... | python | torch/_inductor/runtime/caching/interfaces.py | 154 | [
"self",
"custom_params_encoder",
"custom_result_encoder",
"custom_result_decoder"
] | Callable[[Callable[_P, _R]], Callable[_P, _R]] | true | 2 | 9.12 | pytorch/pytorch | 96,034 | google | false |
fromBigInteger | private static InetAddress fromBigInteger(BigInteger address, boolean isIpv6) {
checkArgument(address.signum() >= 0, "BigInteger must be greater than or equal to 0");
int numBytes = isIpv6 ? 16 : 4;
byte[] addressBytes = address.toByteArray();
byte[] targetCopyArray = new byte[numBytes];
int srcP... | Converts a BigInteger to either an IPv4 or IPv6 address. If the IP is IPv4, it must be
constrained to 32 bits, otherwise it is constrained to 128 bits.
@param address the address represented as a big integer
@param isIpv6 whether the created address should be IPv4 or IPv6
@return the BigInteger converted to an address
... | java | android/guava/src/com/google/common/net/InetAddresses.java | 1,120 | [
"address",
"isIpv6"
] | InetAddress | true | 5 | 7.92 | google/guava | 51,352 | javadoc | false |
randomInt | public int randomInt() {
return randomInt(0, Integer.MAX_VALUE);
} | Generates a random int between 0 (inclusive) and Integer.MAX_VALUE (exclusive).
@return the random integer.
@see #randomInt(int, int)
@since 3.16.0 | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 386 | [] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
add_job_flow_steps | def add_job_flow_steps(
self,
job_flow_id: str,
steps: list[dict] | str | None = None,
wait_for_completion: bool = False,
waiter_delay: int | None = None,
waiter_max_attempts: int | None = None,
execution_role_arn: str | None = None,
) -> list[str]:
""... | Add new steps to a running cluster.
.. seealso::
- :external+boto3:py:meth:`EMR.Client.add_job_flow_steps`
:param job_flow_id: The id of the job flow to which the steps are being added
:param steps: A list of the steps to be executed by the job flow
:param wait_for_completion: If True, wait for the steps to be co... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/emr.py | 139 | [
"self",
"job_flow_id",
"steps",
"wait_for_completion",
"waiter_delay",
"waiter_max_attempts",
"execution_role_arn"
] | list[str] | true | 9 | 6.88 | apache/airflow | 43,597 | sphinx | false |
print | String print(T object, Locale locale); | Print the object of type T for display.
@param object the instance to print
@param locale the current user locale
@return the printed text string | java | spring-context/src/main/java/org/springframework/format/Printer.java | 37 | [
"object",
"locale"
] | String | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false |
fstat | function fstat(fd, options = { bigint: false }, callback) {
if (typeof options === 'function') {
callback = options;
options = kEmptyObject;
}
callback = makeStatsCallback(callback);
const req = new FSReqCallback(options.bigint);
req.oncomplete = callback;
binding.fstat(fd, options.bigint, req);
} | Invokes the callback with the `fs.Stats`
for the file descriptor.
@param {number} fd
@param {{ bigint?: boolean; }} [options]
@param {(
err?: Error,
stats?: Stats
) => any} [callback]
@returns {void} | javascript | lib/fs.js | 1,566 | [
"fd",
"callback"
] | false | 2 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
unsubscribe | @Override
public void unsubscribe() {
acquireAndEnsureOpen();
try {
fetchBuffer.retainAll(Collections.emptySet());
Timer timer = time.timer(defaultApiTimeoutMs);
UnsubscribeEvent unsubscribeEvent = new UnsubscribeEvent(calculateDeadlineMs(timer));
appl... | Get the current subscription. or an empty set if no such call has
been made.
@return The set of topics currently subscribed to | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 1,829 | [] | void | true | 4 | 8.24 | apache/kafka | 31,560 | javadoc | false |
poll | public void poll(Timer timer, PollCondition pollCondition, boolean disableWakeup) {
// there may be handlers which need to be invoked if we woke up the previous call to poll
firePendingCompletedRequests();
lock.lock();
try {
// Handle async disconnects prior to attempting an... | Poll for any network IO.
@param timer Timer bounding how long this method can block
@param pollCondition Nullable blocking condition
@param disableWakeup If TRUE disable triggering wake-ups | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java | 262 | [
"timer",
"pollCondition",
"disableWakeup"
] | void | true | 6 | 6.24 | apache/kafka | 31,560 | javadoc | false |
chebpow | def chebpow(c, pow, maxpower=16):
"""Raise a Chebyshev series to a power.
Returns the Chebyshev series `c` raised to the power `pow`. The
argument `c` is a sequence of coefficients ordered from low to high.
i.e., [1,2,3] is the series ``T_0 + 2*T_1 + 3*T_2.``
Parameters
----------
c : arr... | Raise a Chebyshev series to a power.
Returns the Chebyshev series `c` raised to the power `pow`. The
argument `c` is a sequence of coefficients ordered from low to high.
i.e., [1,2,3] is the series ``T_0 + 2*T_1 + 3*T_2.``
Parameters
----------
c : array_like
1-D array of Chebyshev series coefficients ordered fr... | python | numpy/polynomial/chebyshev.py | 814 | [
"c",
"pow",
"maxpower"
] | false | 9 | 7.84 | numpy/numpy | 31,054 | numpy | false | |
_set_axis_name | def _set_axis_name(
self, name, axis: Axis = 0, *, inplace: bool = False
) -> Self | None:
"""
Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
... | Set the name(s) of the axis.
Parameters
----------
name : str or list of str
Name(s) to set.
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to set the label. The value 0 or 'index' specifies index,
and the value 1 or 'columns' specifies columns.
inplace : bool, default False
If `True`, do op... | python | pandas/core/generic.py | 1,296 | [
"self",
"name",
"axis",
"inplace"
] | Self | None | true | 5 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
close | synchronized void close() {
KafkaException shutdownException = new KafkaException("The producer closed forcefully");
pendingRequests.forEach(handler ->
handler.fatalError(shutdownException));
if (pendingTransition != null) {
pendingTransition.result.fail(shutdownExcep... | Returns the first inflight sequence for a given partition. This is the base sequence of an inflight batch with
the lowest sequence number.
@return the lowest inflight sequence if the transaction manager is tracking inflight requests for this partition.
If there are no inflight requests being tracked for this pa... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 951 | [] | void | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false |
createRequest | abstract AbstractRequest.Builder<?> createRequest(int timeoutMs); | Create an AbstractRequest.Builder for this Call.
@param timeoutMs The timeout in milliseconds.
@return The AbstractRequest builder. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 972 | [
"timeoutMs"
] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
estimateSum | public static double estimateSum(BucketIterator negativeBuckets, BucketIterator positiveBuckets) {
assert negativeBuckets.scale() == positiveBuckets.scale();
// for each bucket index, sum up the counts, but account for the positive/negative sign
BucketIterator it = new MergingBucketIterator(
... | Estimates the sum of all values of a histogram just based on the populated buckets.
Will never return NaN, but might return +/-Infinity if the histogram is too big.
@param negativeBuckets the negative buckets of the histogram
@param positiveBuckets the positive buckets of the histogram
@return the estimated sum of all ... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramUtils.java | 37 | [
"negativeBuckets",
"positiveBuckets"
] | true | 4 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false | |
nullToEmpty | public static long[] nullToEmpty(final long[] array) {
return isEmpty(array) ? EMPTY_LONG_ARRAY : array;
} | Defensive programming technique to change a {@code null}
reference to an empty one.
<p>
This method returns an empty array for a {@code null} input array.
</p>
<p>
As a memory optimizing technique an empty array passed in will be overridden with
the empty {@code public static} references in this class.
</p>
@param arra... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,527 | [
"array"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.