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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
describe_categorical_1d | def describe_categorical_1d(
data: Series,
percentiles_ignored: Sequence[float],
) -> Series:
"""Describe series containing categorical data.
Parameters
----------
data : Series
Series to be described.
percentiles_ignored : list-like of numbers
Ignored, but in place to unify... | Describe series containing categorical data.
Parameters
----------
data : Series
Series to be described.
percentiles_ignored : list-like of numbers
Ignored, but in place to unify interface. | python | pandas/core/methods/describe.py | 267 | [
"data",
"percentiles_ignored"
] | Series | true | 3 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
appendAll | public <T> StrBuilder appendAll(@SuppressWarnings("unchecked") final T... array) {
/*
* @SuppressWarnings used to hide warning about vararg usage. We cannot
* use @SafeVarargs, since this method is not final. Using @SuppressWarnings
* is fine, because it isn't inherited by subclasses,... | Appends each item in an array to the builder without any separators.
Appending a null array will have no effect.
Each object is appended using {@link #append(Object)}.
@param <T> the element type
@param array the array to append
@return {@code this} instance.
@since 2.3 | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 821 | [] | StrBuilder | true | 2 | 8.4 | apache/commons-lang | 2,896 | javadoc | false |
__init__ | def __init__(self, name: str = "", rules=None) -> None:
"""
Initializes holiday object with a given set a rules. Normally
classes just have the rules defined within them.
Parameters
----------
name : str
Name of the holiday calendar, defaults to class name
... | Initializes holiday object with a given set a rules. Normally
classes just have the rules defined within them.
Parameters
----------
name : str
Name of the holiday calendar, defaults to class name
rules : array of Holiday objects
A set of rules used to create the holidays. | python | pandas/tseries/holiday.py | 469 | [
"self",
"name",
"rules"
] | None | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
_initial_imputation | def _initial_imputation(self, X, in_fit=False):
"""Perform initial imputation for input `X`.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
Input data, where `n_samples` is the number of samples and
`n_features` is the number of features.
... | Perform initial imputation for input `X`.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
Input data, where `n_samples` is the number of samples and
`n_features` is the number of features.
in_fit : bool, default=False
Whether function is called in :meth:`fit`.
Returns
-------
Xt : ndar... | python | sklearn/impute/_iterative.py | 591 | [
"self",
"X",
"in_fit"
] | false | 8 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
update_source_code | def update_source_code(cls, dag_id: str, fileloc: str, session: Session = NEW_SESSION) -> None:
"""
Check if the source code of the DAG has changed and update it if needed.
:param dag_id: Dag ID
:param fileloc: The path of code file to read the code from
:param session: The data... | Check if the source code of the DAG has changed and update it if needed.
:param dag_id: Dag ID
:param fileloc: The path of code file to read the code from
:param session: The database session.
:return: None | python | airflow-core/src/airflow/models/dagcode.py | 175 | [
"cls",
"dag_id",
"fileloc",
"session"
] | None | true | 3 | 8.08 | apache/airflow | 43,597 | sphinx | false |
insert | public StrBuilder insert(final int index, final char[] chars, final int offset, final int length) {
validateIndex(index);
if (chars == null) {
return insert(index, nullText);
}
if (offset < 0 || offset > chars.length) {
throw new StringIndexOutOfBoundsException("I... | Inserts part of the character array into this builder.
Inserting null will use the stored null text value.
@param index the index to add at, must be valid
@param chars the char array to insert
@param offset the offset into the character array to start at, must be valid
@param length the length of the character arra... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,168 | [
"index",
"chars",
"offset",
"length"
] | StrBuilder | true | 7 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
binaryToHexDigit | public static char binaryToHexDigit(final boolean[] src, final int srcPos) {
if (src.length == 0) {
throw new IllegalArgumentException("Cannot convert an empty array.");
}
if (src.length > srcPos + 3 && src[srcPos + 3]) {
if (src[srcPos + 2]) {
if (src[src... | Converts binary (represented as boolean array) to a hexadecimal digit using the default (LSB0) bit ordering.
<p>
(1, 0, 0, 0) is converted as follow: '1'.
</p>
@param src the binary to convert.
@param srcPos the position of the LSB to start the conversion.
@return a hexadecimal digit representing the selected bits.
... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 201 | [
"src",
"srcPos"
] | true | 20 | 6.72 | apache/commons-lang | 2,896 | javadoc | false | |
manhattan_distances | def manhattan_distances(X, Y=None):
"""Compute the L1 distances between the vectors in X and Y.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
An array where each row is a sample and each column is a fe... | Compute the L1 distances between the vectors in X and Y.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
An array where each row is a sample and each column is a feature.
Y : {array-like, sparse matrix} of shape (n_samples_Y, ... | python | sklearn/metrics/pairwise.py | 1,052 | [
"X",
"Y"
] | false | 6 | 7.28 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
whenNot | public Member<T> whenNot(Predicate<@Nullable T> predicate) {
Assert.notNull(predicate, "'predicate' must not be null");
return when(predicate.negate());
} | Only include this member when the given predicate does not match.
@param predicate the predicate to test
@return a {@link Member} which may be configured further | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 430 | [
"predicate"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
lookupGeneratedClass | private static GeneratedClass lookupGeneratedClass(GenerationContext generationContext, ClassName target) {
ClassName topLevelClassName = target.topLevelClassName();
GeneratedClass generatedClass = generationContext.getGeneratedClasses()
.getOrAddForFeatureComponent("BeanDefinitions", topLevelClassName, type ->... | Return the {@link GeneratedClass} to use for the specified {@code target}.
<p>If the target class is an inner class, a corresponding inner class in
the original structure is created.
@param generationContext the generation context to use
@param target the chosen target class name for the bean definition
@return the gen... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGenerator.java | 117 | [
"generationContext",
"target"
] | GeneratedClass | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
_rsplit | def _rsplit(a, sep=None, maxsplit=None):
"""
For each element in `a`, return a list of the words in the
string, using `sep` as the delimiter string.
Calls :meth:`str.rsplit` element-wise.
Except for splitting from the right, `rsplit`
behaves like `split`.
Parameters
----------
a :... | For each element in `a`, return a list of the words in the
string, using `sep` as the delimiter string.
Calls :meth:`str.rsplit` element-wise.
Except for splitting from the right, `rsplit`
behaves like `split`.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
sep : str or un... | python | numpy/_core/strings.py | 1,445 | [
"a",
"sep",
"maxsplit"
] | false | 1 | 6.64 | numpy/numpy | 31,054 | numpy | false | |
isBeforeRange | public boolean isBeforeRange(final Range<T> otherRange) {
if (otherRange == null) {
return false;
}
return isBefore(otherRange.minimum);
} | Checks whether this range is completely before the specified range.
<p>This method may fail if the ranges have two different comparators or element types.</p>
@param otherRange the range to check, null returns false.
@return true if this range is completely before the specified range.
@throws RuntimeException if range... | java | src/main/java/org/apache/commons/lang3/Range.java | 464 | [
"otherRange"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
findInterruptibleMethods | private static Set<Method> findInterruptibleMethods(Class<?> interfaceType) {
Set<Method> set = new HashSet<>();
for (Method m : interfaceType.getMethods()) {
if (declaresInterruptedEx(m)) {
set.add(m);
}
}
return set;
} | Creates a TimeLimiter instance using the given executor service to execute method calls.
<p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
up, any time callers spend waiting for a thread may count toward their time limit, and in this
case the call may even time out before th... | java | android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java | 241 | [
"interfaceType"
] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
countMatches | public static int countMatches(final CharSequence str, final char ch) {
if (isEmpty(str)) {
return 0;
}
int count = 0;
// We could also call str.toCharArray() for faster lookups but that would generate more garbage.
for (int i = 0; i < str.length(); i++) {
... | Counts how many times the char appears in the given string.
<p>
A {@code null} or empty ("") String input returns {@code 0}.
</p>
<pre>
StringUtils.countMatches(null, *) = 0
StringUtils.countMatches("", *) = 0
StringUtils.countMatches("abba", 0) = 0
StringUtils.countMatches("abba", 'a') = 2
StringUtils.coun... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 1,457 | [
"str",
"ch"
] | true | 4 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
splitByWholeSeparator | public static String[] splitByWholeSeparator(final String str, final String separator, final int max) {
return splitByWholeSeparatorWorker(str, separator, max, false);
} | Splits the provided text into an array, separator string specified. Returns a maximum of {@code max} substrings.
<p>
The separator(s) will not be included in the returned String array. Adjacent separators are treated as one separator.
</p>
<p>
A {@code null} input String returns {@code null}. A {@code null} separator s... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,277 | [
"str",
"separator",
"max"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
build | @Override
public SpringProfileArbiter build() {
Environment environment = Log4J2LoggingSystem.getEnvironment(this.loggerContext);
if (environment == null) {
statusLogger.debug("Creating Arbiter without a Spring Environment");
}
String name = this.configuration.getStrSubstitutor().replace(this.name);
... | Sets the profile name or expression.
@param name the profile name or expression
@return this
@see Profiles#of(String...) | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/SpringProfileArbiter.java | 98 | [] | SpringProfileArbiter | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
flush | protected boolean flush(ByteBuffer buf) throws IOException {
int remaining = buf.remaining();
if (remaining > 0) {
int written = socketChannel.write(buf);
return written >= remaining;
}
return true;
} | Flushes the buffer to the network, non blocking.
Visible for testing.
@param buf ByteBuffer
@return boolean true if the buffer has been emptied out, false otherwise
@throws IOException | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 247 | [
"buf"
] | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
isCurrentThreadAllowedToHoldSingletonLock | @Override
protected @Nullable Boolean isCurrentThreadAllowedToHoldSingletonLock() {
String mainThreadPrefix = this.mainThreadPrefix;
if (mainThreadPrefix != null) {
// We only differentiate in the preInstantiateSingletons phase, using
// the volatile mainThreadPrefix field as an indicator for that phase.
... | Considers all beans as eligible for metadata caching
if the factory's configuration has been marked as frozen.
@see #freezeConfiguration() | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 1,058 | [] | Boolean | true | 7 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
instance | public Struct instance(BoundField field) {
validateField(field);
if (field.def.type instanceof Schema) {
return new Struct((Schema) field.def.type);
} else if (field.def.type.isArray()) {
return new Struct((Schema) field.def.type.arrayElementType().get());
} else ... | Create a struct for the schema of a container type (struct or array). Note that for array type, this method
assumes that the type is an array of schema and creates a struct of that schema. Arrays of other types can't be
instantiated with this method.
@param field The field to create an instance of
@return The struct
@t... | java | clients/src/main/java/org/apache/kafka/common/protocol/types/Struct.java | 164 | [
"field"
] | Struct | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false |
calculateFirst | function calculateFirst(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {
return { first: field.values[0] };
} | @returns an object with a key for each selected stat
NOTE: This will also modify the 'field.state' object,
leaving values in a cache until cleared. | typescript | packages/grafana-data/src/transformations/fieldReducer.ts | 607 | [
"field",
"ignoreNulls",
"nullAsZero"
] | true | 1 | 6.96 | grafana/grafana | 71,362 | jsdoc | false | |
format | String format(long millis); | Formats a millisecond {@code long} value.
@param millis the millisecond value to format.
@return the formatted string.
@since 2.1 | java | src/main/java/org/apache/commons/lang3/time/DatePrinter.java | 116 | [
"millis"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
loadJars | private static ClassLoader loadJars(List<Path> dirs) {
final List<URL> urls = new ArrayList<>();
for (var dir : dirs) {
try (Stream<Path> jarFiles = Files.list(dir)) {
jarFiles.filter(p -> p.getFileName().toString().endsWith(".jar")).map(p -> {
try {
... | Loads a tool provider from the Elasticsearch distribution.
@param sysprops the system properties of the CLI process
@param toolname the name of the tool to load
@param libs the library directories to load, relative to the Elasticsearch homedir
@return the instance of the loaded tool
@throws AssertionError if the given ... | java | libs/cli/src/main/java/org/elasticsearch/cli/CliToolProvider.java | 76 | [
"dirs"
] | ClassLoader | true | 3 | 7.76 | elastic/elasticsearch | 75,680 | javadoc | false |
is_bool_indexer | def is_bool_indexer(key: Any) -> bool:
"""
Check whether `key` is a valid boolean indexer.
Parameters
----------
key : Any
Only list-likes may be considered boolean indexers.
All other types are not considered a boolean indexer.
For array-like input, boolean ndarrays or Exte... | Check whether `key` is a valid boolean indexer.
Parameters
----------
key : Any
Only list-likes may be considered boolean indexers.
All other types are not considered a boolean indexer.
For array-like input, boolean ndarrays or ExtensionArrays
with ``_is_boolean`` set are considered boolean indexers.
... | python | pandas/core/common.py | 103 | [
"key"
] | bool | true | 10 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
transformThen | function transformThen(node: PromiseReturningCallExpression<"then">, onFulfilled: Expression | undefined, onRejected: Expression | undefined, transformer: Transformer, hasContinuation: boolean, continuationArgName?: SynthBindingName): readonly Statement[] {
if (!onFulfilled || isNullOrUndefined(transformer, onFulf... | @param hasContinuation Whether another `then`, `catch`, or `finally` continuation follows this continuation.
@param continuationArgName The argument name for the continuation that follows this call. | typescript | src/services/codefixes/convertToAsyncFunction.ts | 549 | [
"node",
"onFulfilled",
"onRejected",
"transformer",
"hasContinuation",
"continuationArgName?"
] | true | 7 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toFloatVersion | private static float toFloatVersion(final String value) {
final int defaultReturnValue = -1;
if (!value.contains(".")) {
return NumberUtils.toFloat(value, defaultReturnValue);
}
final String[] toParse = split(value);
if (toParse.length >= 2) {
return Numbe... | Parses a float value from a String.
@param value the String to parse.
@return the float value represented by the string or -1 if the given String cannot be parsed. | java | src/main/java/org/apache/commons/lang3/JavaVersion.java | 332 | [
"value"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
add_srs_entry | def add_srs_entry(
srs, auth_name="EPSG", auth_srid=None, ref_sys_name=None, database=None
):
"""
Take a GDAL SpatialReference system and add its information to the
`spatial_ref_sys` table of the spatial backend. Doing this enables
database-level spatial transformations for the backend. Thus, this u... | Take a GDAL SpatialReference system and add its information to the
`spatial_ref_sys` table of the spatial backend. Doing this enables
database-level spatial transformations for the backend. Thus, this utility
is useful for adding spatial reference systems not included by default with
the backend:
>>> from django.contr... | python | django/contrib/gis/utils/srs.py | 5 | [
"srs",
"auth_name",
"auth_srid",
"ref_sys_name",
"database"
] | false | 10 | 7.6 | django/django | 86,204 | unknown | false | |
listConsumerGroupOffsets | ListConsumerGroupOffsetsResult listConsumerGroupOffsets(Map<String, ListConsumerGroupOffsetsSpec> groupSpecs, ListConsumerGroupOffsetsOptions options); | List the consumer group offsets available in the cluster for the specified consumer groups.
@param groupSpecs Map of consumer group ids to a spec that specifies the topic partitions of the group to list offsets for.
@param options The options to use when listing the consumer group offsets.
@return The ListConsumerGroup... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 938 | [
"groupSpecs",
"options"
] | ListConsumerGroupOffsetsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
hashCode | @Override
public int hashCode() {
int hashCode = this.hashCode;
Elements elements = this.elements;
if (hashCode == 0 && elements.getSize() != 0) {
for (int elementIndex = 0; elementIndex < elements.getSize(); elementIndex++) {
hashCode = 31 * hashCode + elements.hashCode(elementIndex);
}
this.hashCo... | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 527 | [] | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
flip | public FluentBitSet flip(final int fromIndex, final int toIndex) {
bitSet.flip(fromIndex, toIndex);
return this;
} | Sets each bit from the specified {@code fromIndex} (inclusive) to the specified {@code toIndex} (exclusive) to the
complement of its current value.
@param fromIndex index of the first bit to flip.
@param toIndex index after the last bit to flip.
@throws IndexOutOfBoundsException if {@code fromIndex} is negative, or {@c... | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 230 | [
"fromIndex",
"toIndex"
] | FluentBitSet | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
occupied_slots | def occupied_slots(self, session: Session = NEW_SESSION) -> int:
"""
Get the number of slots used by running/queued tasks at the moment.
:param session: SQLAlchemy ORM Session
:return: the used number of slots
"""
from airflow.models.taskinstance import TaskInstance # A... | Get the number of slots used by running/queued tasks at the moment.
:param session: SQLAlchemy ORM Session
:return: the used number of slots | python | airflow-core/src/airflow/models/pool.py | 244 | [
"self",
"session"
] | int | true | 2 | 8.08 | apache/airflow | 43,597 | sphinx | false |
fetchablePartitions | private List<TopicPartition> fetchablePartitions(Set<TopicPartition> buffered) {
// This is the test that returns true if the partition is *not* buffered
Predicate<TopicPartition> isNotBuffered = tp -> !buffered.contains(tp);
// Return all partitions that are in an otherwise fetchable state *an... | Return the list of <em>fetchable</em> partitions, which are the list of partitions to which we are subscribed,
but <em>excluding</em> any partitions for which we still have buffered data. The idea is that since the user
has yet to process the data for the partition that has already been fetched, we should not go send f... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractFetch.java | 346 | [
"buffered"
] | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
getValue | @Deprecated
@Override
public Double getValue() {
return Double.valueOf(this.value);
} | Gets the value as a Double instance.
@return the value as a Double, never null.
@deprecated Use {@link #get()}. | java | src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java | 276 | [] | Double | true | 1 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
atan2 | public static double atan2(double y, double x) {
if (x > 0.0) {
if (y == 0.0) {
return (1 / y == Double.NEGATIVE_INFINITY) ? -0.0 : 0.0;
}
if (x == Double.POSITIVE_INFINITY) {
if (y == Double.POSITIVE_INFINITY) {
return M_QU... | For special values for which multiple conventions could be adopted, behaves like Math.atan2(double,double).
@param y Coordinate on y axis.
@param x Coordinate on x axis.
@return Angle from x axis positive side to (x,y) position, in radians, in [-PI,PI].
Angle measure is positive when going from x axis to y axis... | java | libs/h3/src/main/java/org/elasticsearch/h3/FastMath.java | 537 | [
"y",
"x"
] | true | 26 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
withTimeout | @J2ktIncompatible
@GwtIncompatible // java.util.concurrent.ScheduledExecutorService
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
public static <V extends @Nullable Object> ListenableFuture<V> withTimeout(
ListenableFuture<V> delegate,
long time,
TimeUnit unit,
Schedu... | Returns a future that delegates to another but will finish early (via a {@link
TimeoutException} wrapped in an {@link ExecutionException}) if the specified duration expires.
<p>The delegate future is interrupted and cancelled if it times out.
@param delegate The future to delegate to.
@param time when to time out the f... | java | android/guava/src/com/google/common/util/concurrent/Futures.java | 405 | [
"delegate",
"time",
"unit",
"scheduledExecutor"
] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
list_fargate_profiles | def list_fargate_profiles(
self,
clusterName: str,
verbose: bool = False,
) -> list:
"""
List all AWS Fargate profiles associated with the specified cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.list_fargate_profiles`
:param cluster... | List all AWS Fargate profiles associated with the specified cluster.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.list_fargate_profiles`
:param clusterName: The name of the Amazon EKS Cluster containing Fargate profiles to list.
:param verbose: Provides additional logging if set to True. Defaults to False.... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 500 | [
"self",
"clusterName",
"verbose"
] | list | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
get_event_subscription_state | def get_event_subscription_state(self, subscription_name: str) -> str:
"""
Get the current state of an RDS snapshot export to Amazon S3.
.. seealso::
- :external+boto3:py:meth:`RDS.Client.describe_event_subscriptions`
:param subscription_name: The name of the target RDS eve... | Get the current state of an RDS snapshot export to Amazon S3.
.. seealso::
- :external+boto3:py:meth:`RDS.Client.describe_event_subscriptions`
:param subscription_name: The name of the target RDS event notification subscription.
:return: Returns the status of the event subscription as a string (eg. "active")
:rai... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/rds.py | 186 | [
"self",
"subscription_name"
] | str | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false |
set_uuid | def set_uuid(self, uuid: str) -> Styler:
"""
Set the uuid applied to ``id`` attributes of HTML elements.
Parameters
----------
uuid : str
The uuid to be applied to ``id`` attributes of HTML elements.
Returns
-------
Styler
Instanc... | Set the uuid applied to ``id`` attributes of HTML elements.
Parameters
----------
uuid : str
The uuid to be applied to ``id`` attributes of HTML elements.
Returns
-------
Styler
Instance of class with specified uuid for `id` attributes set.
See Also
--------
Styler.set_caption : Set the text added to a ``<ca... | python | pandas/io/formats/style.py | 2,356 | [
"self",
"uuid"
] | Styler | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
containsEqualValue | bool containsEqualValue(value_type const& value) const {
auto it = table_.findMatching(value.first, [&](auto& key) {
return value.first == key;
});
return !it.atEnd() && value.second == table_.valueAtItem(it.citem()).second;
} | Checks for a value using operator==
@methodset Lookup
containsEqualValue returns true iff there is an element in the map
that compares equal to value using operator==. It is undefined
behavior to call this function if operator== on key_type can ever
return true when the same keys passed to key_eq() would return false
... | cpp | folly/container/F14Map.h | 999 | [] | true | 2 | 6.4 | facebook/folly | 30,157 | doxygen | false | |
getBigThreadConstructor | private static @Nullable Constructor<Thread> getBigThreadConstructor() {
try {
return Thread.class.getConstructor(
ThreadGroup.class, Runnable.class, String.class, long.class, boolean.class);
} catch (Throwable t) {
// Probably pre Java 9. We'll fall back to Thread.inheritableThreadLocals.... | Looks up FinalizableReference.finalizeReferent() method. | java | android/guava/src/com/google/common/base/internal/Finalizer.java | 246 | [] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
containsOption | boolean containsOption(String name); | Return whether the set of option arguments parsed from the arguments contains an
option with the given name.
@param name the name to check
@return {@code true} if the arguments contain an option with the given name | java | core/spring-boot/src/main/java/org/springframework/boot/ApplicationArguments.java | 51 | [
"name"
] | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getApplicationEventMulticaster | ApplicationEventMulticaster getApplicationEventMulticaster() throws IllegalStateException {
if (this.applicationEventMulticaster == null) {
throw new IllegalStateException("ApplicationEventMulticaster not initialized - " +
"call 'refresh' before multicasting events via the context: " + this);
}
return thi... | Return the internal ApplicationEventMulticaster used by the context.
@return the internal ApplicationEventMulticaster (never {@code null})
@throws IllegalStateException if the context has not been initialized yet | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 466 | [] | ApplicationEventMulticaster | true | 2 | 7.12 | spring-projects/spring-framework | 59,386 | javadoc | false |
_get_value | def _get_value(self, index, col, takeable: bool = False) -> Scalar:
"""
Quickly retrieve single value at passed column and index.
Parameters
----------
index : row label
col : column label
takeable : interpret the index/col as indexers, default False
Ret... | Quickly retrieve single value at passed column and index.
Parameters
----------
index : row label
col : column label
takeable : interpret the index/col as indexers, default False
Returns
-------
scalar
Notes
-----
Assumes that both `self.index._index_as_unique` and
`self.columns._index_as_unique`; Caller is responsi... | python | pandas/core/frame.py | 4,274 | [
"self",
"index",
"col",
"takeable"
] | Scalar | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
endsWithAny | public boolean endsWithAny(final CharSequence sequence, final CharSequence... searchStrings) {
if (StringUtils.isEmpty(sequence) || ArrayUtils.isEmpty(searchStrings)) {
return false;
}
for (final CharSequence searchString : searchStrings) {
if (endsWith(sequence, searchSt... | Tests if a CharSequence ends with any of the provided suffixes.
<p>
Case-sensitive examples
</p>
<pre>
Strings.CS.endsWithAny(null, null) = false
Strings.CS.endsWithAny(null, new String[] {"abc"}) = false
Strings.CS.endsWithAny("abcxyz", null) = false
Strings.CS.endsWithAny("abcxyz", new ... | java | src/main/java/org/apache/commons/lang3/Strings.java | 633 | [
"sequence"
] | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
make_union | def make_union(
*transformers, n_jobs=None, verbose=False, verbose_feature_names_out=True
):
"""Construct a :class:`FeatureUnion` from the given transformers.
This is a shorthand for the :class:`FeatureUnion` constructor; it does not
require, and does not permit, naming the transformers. Instead, they ... | Construct a :class:`FeatureUnion` from the given transformers.
This is a shorthand for the :class:`FeatureUnion` constructor; it does not
require, and does not permit, naming the transformers. Instead, they will
be given names automatically based on their types. It also does not allow
weighting.
Parameters
----------... | python | sklearn/pipeline.py | 2,086 | [
"n_jobs",
"verbose",
"verbose_feature_names_out"
] | false | 1 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
topicsAwaitingReconciliation | Set<Uuid> topicsAwaitingReconciliation() {
return topicPartitionsAwaitingReconciliation().keySet();
} | @return Set of topic IDs received in a target assignment that have not been reconciled yet
because topic names are not in metadata or reconciliation hasn't finished. Reconciliation
hasn't finished for a topic if the currently active assignment has a different set of partitions
for the topic than the target assignment.
... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 1,338 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
reinstall_if_setup_changed | def reinstall_if_setup_changed() -> bool:
"""
Prints warning if detected airflow sources are not the ones that Breeze was installed with.
:return: True if warning was printed.
"""
res = subprocess.run(
["uv", "tool", "upgrade", "apache-airflow-breeze"],
cwd=MY_BREEZE_ROOT_PATH,
... | Prints warning if detected airflow sources are not the ones that Breeze was installed with.
:return: True if warning was printed. | python | dev/breeze/src/airflow_breeze/utils/path_utils.py | 129 | [] | bool | true | 2 | 8.24 | apache/airflow | 43,597 | unknown | false |
invoke | @Override
public @Nullable Object invoke(final MethodInvocation invocation) throws Throwable {
Method method = invocation.getMethod();
CacheOperationInvoker aopAllianceInvoker = () -> {
try {
return invocation.proceed();
}
catch (Throwable ex) {
throw new CacheOperationInvoker.ThrowableWrapper(ex... | Construct a new {@code JCacheInterceptor} with the given error handler.
@param errorHandler a supplier for the error handler to use,
applying the default error handler if the supplier is not resolvable
@since 5.1 | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheInterceptor.java | 68 | [
"invocation"
] | Object | true | 3 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
heartbeat | def heartbeat(
self, heartbeat_callback: Callable[[Session], None], session: Session = NEW_SESSION
) -> None:
"""
Update the job's entry in the database with the latest_heartbeat timestamp.
This allows for the job to be killed externally and allows the system
to monitor what... | Update the job's entry in the database with the latest_heartbeat timestamp.
This allows for the job to be killed externally and allows the system
to monitor what is actually active. For instance, an old heartbeat
for SchedulerJob would mean something is wrong. This also allows for
any job to be killed externally, re... | python | airflow-core/src/airflow/jobs/job.py | 204 | [
"self",
"heartbeat_callback",
"session"
] | None | true | 12 | 6.96 | apache/airflow | 43,597 | sphinx | false |
get | public static ConditionEvaluationReport get(ConfigurableListableBeanFactory beanFactory) {
synchronized (beanFactory) {
ConditionEvaluationReport report;
if (beanFactory.containsSingleton(BEAN_NAME)) {
report = beanFactory.getBean(BEAN_NAME, ConditionEvaluationReport.class);
}
else {
report = new ... | Obtain a {@link ConditionEvaluationReport} for the specified bean factory.
@param beanFactory the bean factory
@return an existing or new {@link ConditionEvaluationReport} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | 181 | [
"beanFactory"
] | ConditionEvaluationReport | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
toFloat | public Float toFloat() {
return Float.valueOf(floatValue());
} | Gets this mutable as an instance of Float.
@return a Float instance containing the value from this mutable, never null. | java | src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java | 402 | [] | Float | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
getEnvironmentPostProcessors | List<EnvironmentPostProcessor> getEnvironmentPostProcessors(@Nullable ResourceLoader resourceLoader,
ConfigurableBootstrapContext bootstrapContext) {
ClassLoader classLoader = (resourceLoader != null) ? resourceLoader.getClassLoader() : null;
EnvironmentPostProcessorsFactory postProcessorsFactory = this.postProc... | Factory method that creates an {@link EnvironmentPostProcessorApplicationListener}
with a specific {@link EnvironmentPostProcessorsFactory}.
@param postProcessorsFactory the environment post processor factory
@return an {@link EnvironmentPostProcessorApplicationListener} instance | java | core/spring-boot/src/main/java/org/springframework/boot/support/EnvironmentPostProcessorApplicationListener.java | 153 | [
"resourceLoader",
"bootstrapContext"
] | true | 2 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false | |
exactly_one | def exactly_one(*args) -> bool:
"""
Return True if exactly one of args is "truthy", and False otherwise.
If user supplies an iterable, we raise ValueError and force them to unpack.
"""
if is_container(args[0]):
raise ValueError(
"Not supported for iterable args. Use `*` to unpac... | Return True if exactly one of args is "truthy", and False otherwise.
If user supplies an iterable, we raise ValueError and force them to unpack. | python | airflow-core/src/airflow/utils/helpers.py | 265 | [] | bool | true | 2 | 6.72 | apache/airflow | 43,597 | unknown | false |
name | default String name() {
NamedComponent[] annotationsByType = this.getClass().getAnnotationsByType(NamedComponent.class);
if (annotationsByType.length == 1) {
return annotationsByType[0].value();
}
return null;
} | Returns a name from NamedComponent annotation.
@return a name used on NamedComponent annotation or null when a class implementing this interface is not annotated | java | libs/plugin-api/src/main/java/org/elasticsearch/plugin/Nameable.java | 23 | [] | String | true | 2 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false |
loadPatternCompiler | private static PatternCompiler loadPatternCompiler() {
// We want the JDK Pattern compiler:
// - under Android (where it hurts startup performance)
// - even for the JVM in our open-source release (https://github.com/google/guava/issues/3147)
// If anyone in our monorepo uses the Android copy of Guava o... | Returns the string if it is not empty, or a null string otherwise.
@param string the string to test and possibly return
@return {@code string} if it is not empty; {@code null} otherwise | java | android/guava/src/com/google/common/base/Platform.java | 98 | [] | PatternCompiler | true | 1 | 7.2 | google/guava | 51,352 | javadoc | false |
negate | default FailableLongPredicate<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/FailableLongPredicate.java | 79 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
writeTo | @Override
public int writeTo(TransferableChannel destChannel, int offset, int length) throws IOException {
long newSize = Math.min(channel.size(), end) - start;
int oldSize = sizeInBytes();
if (newSize < oldSize)
throw new KafkaException(String.format(
"Size o... | Truncate this file message set to the given size in bytes. Note that this API does no checking that the
given size falls on a valid message boundary.
In some versions of the JDK truncating to the same size as the file message set will cause an
update of the files mtime, so truncate is only performed if the targetSize i... | java | clients/src/main/java/org/apache/kafka/common/record/FileRecords.java | 290 | [
"destChannel",
"offset",
"length"
] | true | 2 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
close | @Override
public void close() {
close(Duration.ZERO);
} | Add a {@link CompletableApplicationEvent} to the handler. The method blocks waiting for the result, and will
return the result value upon successful completion; otherwise throws an error.
<p/>
See {@link ConsumerUtils#getResult(Future)} for more details.
@param event A {@link CompletableApplicationEvent} created by the... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventHandler.java | 147 | [] | void | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
serialize | def serialize(cls, operation: "GemmOperation") -> str: # type: ignore[name-defined] # noqa: F821
"""Serialize a GEMM operation to JSON string.
Args:
operation: GemmOperation object
Returns:
str: JSON string representation of the operation
"""
assert op... | Serialize a GEMM operation to JSON string.
Args:
operation: GemmOperation object
Returns:
str: JSON string representation of the operation | python | torch/_inductor/codegen/cuda/serialization.py | 32 | [
"cls",
"operation"
] | str | true | 1 | 6.08 | pytorch/pytorch | 96,034 | google | false |
maybe_cast_to_integer_array | def maybe_cast_to_integer_array(arr: list | np.ndarray, dtype: np.dtype) -> np.ndarray:
"""
Takes any dtype and returns the casted version, raising for when data is
incompatible with integer/unsigned integer dtypes.
Parameters
----------
arr : np.ndarray or list
The array to cast.
d... | Takes any dtype and returns the casted version, raising for when data is
incompatible with integer/unsigned integer dtypes.
Parameters
----------
arr : np.ndarray or list
The array to cast.
dtype : np.dtype
The integer dtype to cast the array to.
Returns
-------
ndarray
Array of integer or unsigned intege... | python | pandas/core/dtypes/cast.py | 1,492 | [
"arr",
"dtype"
] | np.ndarray | true | 15 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
getUnsafe | private static @Nullable Unsafe getUnsafe() {
try {
return Unsafe.getUnsafe();
} catch (SecurityException e) {
// that's okay; try reflection instead
}
try {
return doPrivileged(
(PrivilegedExceptionAction<Unsafe>)
() -> {
... | The offset to the first element in a byte array, or {@link
#OFFSET_UNSAFE_APPROACH_IS_UNAVAILABLE}. | java | android/guava/src/com/google/common/primitives/UnsignedBytes.java | 372 | [] | Unsafe | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false |
replay | def replay(
self,
custom_params_encoder: Callable[_P, object] | None = None,
custom_result_decoder: Callable[_P, Callable[[_EncodedR], _R]] | None = None,
) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]:
"""Replay a cached function result without executing the function.
... | Replay a cached function result without executing the function.
This is a decorator that retrieves cached results using a two-level
cache strategy. It checks the in-memory cache first (fast), then
falls back to the on-disk cache. If found on disk, the result is
cached in memory for future access.
Args:
custom_par... | python | torch/_inductor/runtime/caching/interfaces.py | 712 | [
"self",
"custom_params_encoder",
"custom_result_decoder"
] | Callable[[Callable[_P, _R]], Callable[_P, _R]] | true | 4 | 9.12 | pytorch/pytorch | 96,034 | google | false |
_build_metrics | def _build_metrics(func_name, namespace):
"""
Build metrics dict from function args.
It assumes that function arguments is from airflow.bin.cli module's function
and has Namespace instance where it optionally contains "dag_id", "task_id",
and "logical_date".
:param func_name: name of function
... | Build metrics dict from function args.
It assumes that function arguments is from airflow.bin.cli module's function
and has Namespace instance where it optionally contains "dag_id", "task_id",
and "logical_date".
:param func_name: name of function
:param namespace: Namespace instance from argparse
:return: dict with ... | python | airflow-core/src/airflow/utils/cli.py | 129 | [
"func_name",
"namespace"
] | false | 20 | 6 | apache/airflow | 43,597 | sphinx | false | |
intersect | public static Optional<ApiVersion> intersect(ApiVersion thisVersion,
ApiVersion other) {
if (thisVersion == null || other == null) return Optional.empty();
if (thisVersion.apiKey() != other.apiKey())
throw new IllegalArgumentException("thisVer... | Find the common range of supported API versions between the locally
known range and that of another set.
@param listenerType the listener type which constrains the set of exposed APIs
@param activeControllerApiVersions controller ApiVersions
@param enableUnstableLastVersion whether unstable versions should be advertise... | java | clients/src/main/java/org/apache/kafka/common/requests/ApiVersionsResponse.java | 311 | [
"thisVersion",
"other"
] | true | 5 | 7.28 | apache/kafka | 31,560 | javadoc | false | |
_decode_attribute | def _decode_attribute(self, s):
'''(INTERNAL) Decodes an attribute line.
The attribute is the most complex declaration in an arff file. All
attributes must follow the template::
@attribute <attribute-name> <datatype>
where ``attribute-name`` is a string, quoted if the nam... | (INTERNAL) Decodes an attribute line.
The attribute is the most complex declaration in an arff file. All
attributes must follow the template::
@attribute <attribute-name> <datatype>
where ``attribute-name`` is a string, quoted if the name contains any
whitespace, and ``datatype`` can be:
- Numerical attributes... | python | sklearn/externals/_arff.py | 713 | [
"self",
"s"
] | false | 7 | 6.96 | scikit-learn/scikit-learn | 64,340 | sphinx | false | |
chebroots | def chebroots(c):
"""
Compute the roots of a Chebyshev series.
Return the roots (a.k.a. "zeros") of the polynomial
.. math:: p(x) = \\sum_i c[i] * T_i(x).
Parameters
----------
c : 1-D array_like
1-D array of coefficients.
Returns
-------
out : ndarray
Array o... | Compute the roots of a Chebyshev series.
Return the roots (a.k.a. "zeros") of the polynomial
.. math:: p(x) = \\sum_i c[i] * T_i(x).
Parameters
----------
c : 1-D array_like
1-D array of coefficients.
Returns
-------
out : ndarray
Array of the roots of the series. If all the roots are real,
then `out` i... | python | numpy/polynomial/chebyshev.py | 1,666 | [
"c"
] | false | 3 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
withPrefix | @Override
default IterableConfigurationPropertySource withPrefix(@Nullable String prefix) {
return (StringUtils.hasText(prefix)) ? new PrefixedIterableConfigurationPropertySource(this, prefix) : this;
} | Returns a sequential {@code Stream} for the {@link ConfigurationPropertyName names}
managed by this source.
@return a stream of names (never {@code null}) | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/IterableConfigurationPropertySource.java | 79 | [
"prefix"
] | IterableConfigurationPropertySource | true | 2 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
substituteThisExpression | function substituteThisExpression(node: ThisExpression) {
if (
enabledSubstitutions & ClassPropertySubstitutionFlags.ClassStaticThisOrSuperReference &&
lexicalEnvironment?.data &&
!noSubstitution.has(node)
) {
const { facts, classConstructor, classTh... | Hooks node substitutions.
@param hint The context for the emitter.
@param node The node to substitute. | typescript | src/compiler/transformers/classFields.ts | 3,265 | [
"node"
] | false | 8 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
_get_data_info_by_name | def _get_data_info_by_name(
name: str,
version: Union[int, str],
data_home: Optional[str],
n_retries: int = 3,
delay: float = 1.0,
):
"""
Utilizes the openml dataset listing api to find a dataset by
name/version
OpenML api function:
https://www.openml.org/api_docs#!/data/get_data... | Utilizes the openml dataset listing api to find a dataset by
name/version
OpenML api function:
https://www.openml.org/api_docs#!/data/get_data_list_data_name_data_name
Parameters
----------
name : str
name of the dataset
version : int or str
If version is an integer, the exact name/version will be obtained fr... | python | sklearn/datasets/_openml.py | 262 | [
"name",
"version",
"data_home",
"n_retries",
"delay"
] | true | 4 | 6.8 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
scanWordCharacters | function scanWordCharacters(): string {
let value = "";
while (true) {
const ch = charCodeChecked(pos);
if (ch === CharacterCodes.EOF || !isWordCharacter(ch)) {
break;
}
value += String.fromCharCode(ch);
... | A stack of scopes for named capturing groups. @see {scanGroupName} | typescript | src/compiler/scanner.ts | 3,555 | [] | true | 4 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
reorder_communication_preserving_peak_memory | def reorder_communication_preserving_peak_memory(
snodes: list[BaseSchedulerNode],
) -> list[BaseSchedulerNode]:
"""
Reorders communication ops relative to computation ops to improve communication-compute overlapping and hide comm
latency. Stops moving a particular op if it reaches a point that would h... | Reorders communication ops relative to computation ops to improve communication-compute overlapping and hide comm
latency. Stops moving a particular op if it reaches a point that would have increased the peak memory footprint.
Currently, follows these heuristics (subject to change or tune):
- never reorders collectiv... | python | torch/_inductor/comms.py | 113 | [
"snodes"
] | list[BaseSchedulerNode] | true | 1 | 6.96 | pytorch/pytorch | 96,034 | unknown | false |
hashCode | @Override
public int hashCode() {
int result = topic != null ? topic.hashCode() : 0;
result = 31 * result + (partition != null ? partition.hashCode() : 0);
result = 31 * result + (headers != null ? headers.hashCode() : 0);
result = 31 * result + (key != null ? key.hashCode() : 0);
... | @return The partition to which the record will be sent (or null if no partition was specified) | java | clients/src/main/java/org/apache/kafka/clients/producer/ProducerRecord.java | 215 | [] | true | 7 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
tryToComputeNext | private boolean tryToComputeNext() {
state = State.FAILED; // temporary pessimism
next = computeNext();
if (state != State.DONE) {
state = State.READY;
return true;
}
return false;
} | Implementations of {@link #computeNext} <b>must</b> invoke this method when there are no
elements left in the iteration.
@return {@code null}; a convenience so your {@code computeNext} implementation can use the
simple statement {@code return endOfData();} | java | android/guava/src/com/google/common/collect/AbstractIterator.java | 139 | [] | true | 2 | 7.44 | google/guava | 51,352 | javadoc | false | |
handleBindResult | @Contract("_, _, _, _, _, true -> null")
private <T> @Nullable T handleBindResult(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler,
Context context, @Nullable Object result, boolean create) throws Exception {
if (result != null) {
result = handler.onSuccess(name, target, context, result)... | 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 | 382 | [
"name",
"target",
"handler",
"context",
"result",
"create"
] | T | true | 5 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
setAsText | @Override
public void setAsText(String text) throws IllegalArgumentException {
this.resourceEditor.setAsText(text);
Resource resource = (Resource) this.resourceEditor.getValue();
try {
setValue(resource != null ? resource.getInputStream() : null);
}
catch (IOException ex) {
throw new IllegalArgumentExc... | Create a new InputStreamEditor, using the given ResourceEditor underneath.
@param resourceEditor the ResourceEditor to use | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/InputStreamEditor.java | 68 | [
"text"
] | void | true | 3 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
_create_tasks | def _create_tasks(
self,
tasks: Iterable[Operator],
task_creator: Callable[[Operator, Iterable[int]], CreatedTasks],
*,
session: Session,
) -> CreatedTasks:
"""
Create missing tasks -- and expand any MappedOperator that _only_ have literals as input.
... | Create missing tasks -- and expand any MappedOperator that _only_ have literals as input.
:param tasks: Tasks to create jobs for in the DAG run
:param task_creator: Function to create task instances | python | airflow-core/src/airflow/models/dagrun.py | 1,879 | [
"self",
"tasks",
"task_creator",
"session"
] | CreatedTasks | true | 5 | 6.72 | apache/airflow | 43,597 | sphinx | false |
predecessors | @Override
public Set<N> predecessors() {
return new AbstractSet<N>() {
@Override
public UnmodifiableIterator<N> iterator() {
if (orderedNodeConnections == null) {
Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator();
return new AbstractIterator<N>()... | All node connections in this graph, in edge insertion order.
<p>Note: This field and {@link #adjacentNodeValues} cannot be combined into a single
LinkedHashMap because one target node may be mapped to both a predecessor and a successor. A
LinkedHashMap combines two such edges into a single node-value pair, even though ... | java | android/guava/src/com/google/common/graph/DirectedGraphConnections.java | 271 | [] | true | 6 | 6.72 | google/guava | 51,352 | javadoc | false | |
resolveShortcut | public @Nullable Object resolveShortcut(BeanFactory beanFactory) throws BeansException {
return null;
} | Resolve a shortcut for this dependency against the given factory, for example
taking some pre-resolved information into account.
<p>The resolution algorithm will first attempt to resolve a shortcut through this
method before going into the regular type matching algorithm across all beans.
Subclasses may override this m... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java | 207 | [
"beanFactory"
] | Object | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
put | public JSONArray put(int index, long value) throws JSONException {
return put(index, (Long) value);
} | Sets the value at {@code index} to {@code value}, null padding this array to the
required length if necessary. If a value already exists at {@code
index}, it will be replaced.
@param index the index to set the value to
@param value the value
@return this array.
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java | 232 | [
"index",
"value"
] | JSONArray | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false |
joining | public static Collector<Object, ?, String> joining() {
return new SimpleCollector<>(StringBuilder::new, StringBuilder::append, StringBuilder::append, StringBuilder::toString, CH_NOID);
} | Returns a {@code Collector} that concatenates the input elements, separated by the specified delimiter, in encounter order.
<p>
This is a variation of {@link Collectors#joining()} that works with any element class, not just {@code CharSequence}.
</p>
<p>
For example:
</p>
<pre>
Stream.of(Long.valueOf(1), Long.valueOf(2... | java | src/main/java/org/apache/commons/lang3/stream/LangCollectors.java | 132 | [] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
asBiConsumer | public static <O1, O2> BiConsumer<O1, O2> asBiConsumer(final FailableBiConsumer<O1, O2, ?> consumer) {
return (input1, input2) -> accept(consumer, input1, input2);
} | Converts the given {@link FailableBiConsumer} into a standard {@link BiConsumer}.
@param <O1> the type of the first argument of the consumers
@param <O2> the type of the second argument of the consumers
@param consumer a failable {@link BiConsumer}
@return a standard {@link BiConsumer}
@since 3.10 | java | src/main/java/org/apache/commons/lang3/Functions.java | 352 | [
"consumer"
] | true | 1 | 6.24 | apache/commons-lang | 2,896 | javadoc | false | |
getFraction | public static Fraction getFraction(double value) {
final int sign = value < 0 ? -1 : 1;
value = Math.abs(value);
if (value > Integer.MAX_VALUE || Double.isNaN(value)) {
throw new ArithmeticException("The value must not be greater than Integer.MAX_VALUE or NaN");
}
fin... | Creates a {@link Fraction} instance from a {@code double} value.
<p>
This method uses the <a href="https://web.archive.org/web/20210516065058/http%3A//archives.math.utk.edu/articles/atuyl/confrac/"> continued fraction
algorithm</a>, computing a maximum of 25 convergents and bounding the denominator by 10,000.
</p>
@par... | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 134 | [
"value"
] | Fraction | true | 8 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
nullToEmpty | public static Boolean[] nullToEmpty(final Boolean[] array) {
return nullTo(array, EMPTY_BOOLEAN_OBJECT_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,299 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
read | public static int read(InputStream input, ByteBuffer buffer, int count) throws IOException {
if (buffer.hasArray()) {
return readToHeapBuffer(input, buffer, count);
}
return readToDirectBuffer(input, buffer, count);
} | Read up to {code count} bytes from {@code input} and store them into {@code buffer}.
The buffers position will be incremented by the number of bytes read from the stream.
@param input stream to read from
@param buffer buffer to read into
@param count maximum number of bytes to read
@return number of bytes read from the... | java | libs/core/src/main/java/org/elasticsearch/core/Streams.java | 92 | [
"input",
"buffer",
"count"
] | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false | |
getFilteredHeaders | function getFilteredHeaders(
headers: HttpHeaders,
includeHeaders: string[] | undefined,
): Record<string, string[]> {
if (!includeHeaders) {
return {};
}
const headersMap: Record<string, string[]> = {};
for (const key of includeHeaders) {
const values = headers.getAll(key);
if (values !== null... | @returns true when the requests contains autorization related headers. | typescript | packages/common/http/src/transfer_cache.ts | 249 | [
"headers",
"includeHeaders"
] | true | 3 | 6.4 | angular/angular | 99,544 | jsdoc | false | |
badElementIndex | private static String badElementIndex(int index, int size, String desc) {
if (index < 0) {
return lenientFormat("%s (%s) must not be negative", desc, index);
} else if (size < 0) {
throw new IllegalArgumentException("negative size: " + size);
} else { // index >= size
return lenientFormat(... | Ensures that {@code index} specifies a valid <i>element</i> in an array, list or string of size
{@code size}. An element index may range from zero, inclusive, to {@code size}, exclusive.
@param index a user-supplied index identifying an element of an array, list or string
@param size the size of that array, list or str... | java | android/guava/src/com/google/common/base/Preconditions.java | 1,374 | [
"index",
"size",
"desc"
] | String | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false |
toString | @Deprecated
public static String toString(final Object obj, final String nullStr) {
return Objects.toString(obj, nullStr);
} | Gets the {@code toString} of an {@link Object} returning
a specified text if {@code null} input.
<pre>
ObjectUtils.toString(null, null) = null
ObjectUtils.toString(null, "null") = "null"
ObjectUtils.toString("", "null") = ""
ObjectUtils.toString("bat", "null") = "bat"
ObjectUtils.toSt... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 1,263 | [
"obj",
"nullStr"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
isEmpty | boolean isEmpty() {
return acknowledgementsToSend.isEmpty() &&
incompleteAcknowledgements.isEmpty() &&
inFlightAcknowledgements.isEmpty();
} | Timeout in milliseconds indicating how long the request would be retried if it fails with a retriable exception. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 1,300 | [] | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
merge | function merge(/* obj1, obj2, obj3, ... */) {
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
const result = {};
const assignValue = (val, key) => {
const targetKey = caseless && findKey(result, key) || key;
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
result... | Accepts varargs expecting each argument to be an object, then
immutably merges the properties of each object and returns result.
When multiple objects contain the same key the later object in
the arguments list will take precedence.
Example:
```js
var result = merge({foo: 123}, {foo: 456});
console.log(result.foo); // ... | javascript | lib/utils.js | 344 | [] | false | 16 | 7.84 | axios/axios | 108,381 | jsdoc | false | |
add | @CanIgnoreReturnValue
@Override
boolean add(@ParametricNullness E element); | Adds a single occurrence of the specified element to this multiset.
<p>This method refines {@link Collection#add}, which only <i>ensures</i> the presence of the
element, to further specify that a successful call must always increment the count of the
element, and the overall size of the collection, by one.
<p>To both a... | java | android/guava/src/com/google/common/collect/Multiset.java | 159 | [
"element"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
close | @Override
public void close() {
if (closed == false) {
closed = true;
arrays.adjustBreaker(-SHALLOW_SIZE);
Releasables.close(weight, mean, tempWeight, tempMean, order);
}
} | Merges any pending inputs and compresses the data down to the public setting.
Note that this typically loses a bit of precision and thus isn't a thing to
be doing all the time. It is best done only when we want to show results to
the outside world. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/MergingDigest.java | 624 | [] | void | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
resolveConfigurationMetadata | private ConfigurationMetadata resolveConfigurationMetadata(TypeElement type) {
try {
String sourceLocation = MetadataStore.SOURCE_METADATA_PATH.apply(type, this.typeUtils);
FileObject resource = this.processingEnvironment.getFiler()
.getResource(StandardLocation.CLASS_PATH, "", sourceLocation);
return (r... | Resolve the {@link SourceMetadata} for the specified type. If the type has no
source metadata, return an {@link SourceMetadata#EMPTY} source.
@param typeElement the type to discover source metadata from
@return the source metadata for the specified type | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationPropertiesSourceResolver.java | 66 | [
"type"
] | ConfigurationMetadata | true | 3 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
valueOrThrow | public static short valueOrThrow(String key, Map<String, Short> versionRangeMap) {
final Short value = versionRangeMap.get(key);
if (value == null) {
throw new IllegalArgumentException(String.format("%s absent in [%s]", key, mapToString(versionRangeMap)));
}
return value;
... | Raises an exception unless the following condition is met:
minValue >= 0 and maxValue >= 0 and maxValue >= minValue.
@param minKeyLabel Label for the min version key, that's used only to convert to/from a map.
@param minValue The minimum version value.
@param maxKeyLabel Label for the max version key, that's u... | java | clients/src/main/java/org/apache/kafka/common/feature/BaseVersionRange.java | 131 | [
"key",
"versionRangeMap"
] | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
removeAllOccurrences | public static char[] removeAllOccurrences(final char[] array, final char element) {
return (char[]) removeAt(array, indexesOf(array, element));
} | Removes the occurrences of the specified element from the specified char array.
<p>
All subsequent elements are shifted to the left (subtracts one from their indices).
If the array doesn't contain such an element, no elements are removed from the array.
{@code null} will be returned if the input array is {@code null}.
... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5,470 | [
"array",
"element"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
_recursive_set_fill_value | def _recursive_set_fill_value(fillvalue, dt):
"""
Create a fill value for a structured dtype.
Parameters
----------
fillvalue : scalar or array_like
Scalar or array representing the fill value. If it is of shorter
length than the number of fields in dt, it will be resized.
dt : ... | Create a fill value for a structured dtype.
Parameters
----------
fillvalue : scalar or array_like
Scalar or array representing the fill value. If it is of shorter
length than the number of fields in dt, it will be resized.
dt : dtype
The structured dtype for which to create the fill value.
Returns
------... | python | numpy/ma/core.py | 423 | [
"fillvalue",
"dt"
] | false | 5 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
isUnderneathClassLoader | private static boolean isUnderneathClassLoader(@Nullable ClassLoader candidate, @Nullable ClassLoader parent) {
if (candidate == parent) {
return true;
}
if (candidate == null) {
return false;
}
ClassLoader classLoaderToCheck = candidate;
while (classLoaderToCheck != null) {
classLoaderToCheck = cl... | Check whether the given ClassLoader is underneath the given parent,
that is, whether the parent is within the candidate's hierarchy.
@param candidate the candidate ClassLoader to check
@param parent the parent ClassLoader to check for | java | spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java | 195 | [
"candidate",
"parent"
] | true | 5 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false | |
job_completion | def job_completion(
self, job_name: str, run_id: str, verbose: bool = False, sleep_before_return: int = 0
) -> dict[str, str]:
"""
Wait until Glue job with job_name finishes; return final state if finished or raises AirflowException.
:param job_name: unique job name per AWS account
... | Wait until Glue job with job_name finishes; return final state if finished or raises AirflowException.
:param job_name: unique job name per AWS account
:param run_id: The job-run ID of the predecessor job run
:param verbose: If True, more Glue Job Run logs show in the Airflow Task Logs. (default: False)
:param sleep_... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue.py | 374 | [
"self",
"job_name",
"run_id",
"verbose",
"sleep_before_return"
] | dict[str, str] | true | 3 | 8.08 | apache/airflow | 43,597 | sphinx | false |
insert | def insert(self, loc: int, item) -> Index:
"""
Make new Index inserting new item at location.
Follows Python numpy.insert semantics for negative values.
Parameters
----------
loc : int
The integer location where the new item will be inserted.
item : ... | Make new Index inserting new item at location.
Follows Python numpy.insert semantics for negative values.
Parameters
----------
loc : int
The integer location where the new item will be inserted.
item : object
The new item to be inserted into the Index.
Returns
-------
Index
Returns a new Index object re... | python | pandas/core/indexes/base.py | 7,051 | [
"self",
"loc",
"item"
] | Index | true | 14 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
getDatabaseType | @Override
public final String getDatabaseType() throws IOException {
if (databaseType.get() == null) {
synchronized (databaseType) {
if (databaseType.get() == null) {
databaseType.set(MMDBUtil.getDatabaseType(databasePath));
}
}
... | Read the database type from the database and cache it for future calls.
@return the database type
@throws IOException if an I/O exception occurs reading the database type | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/DatabaseReaderLazyLoader.java | 82 | [] | String | true | 3 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false |
resolveBeanClass | protected @Nullable Class<?> resolveBeanClass(RootBeanDefinition mbd, String beanName, Class<?>... typesToMatch)
throws CannotLoadBeanClassException {
try {
if (mbd.hasBeanClass()) {
return mbd.getBeanClass();
}
Class<?> beanClass = doResolveBeanClass(mbd, typesToMatch);
if (mbd.hasBeanClass()) {
... | Resolve the bean class for the specified bean definition,
resolving a bean class name into a Class reference (if necessary)
and storing the resolved Class in the bean definition for further use.
@param mbd the merged bean definition to determine the class for
@param beanName the name of the bean (for error handling pur... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,557 | [
"mbd",
"beanName"
] | true | 6 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
withAlias | public PemSslStoreDetails withAlias(@Nullable String alias) {
return new PemSslStoreDetails(this.type, alias, this.password, this.certificates, this.privateKey,
this.privateKeyPassword);
} | Return a new {@link PemSslStoreDetails} instance with a new alias.
@param alias the new alias
@return a new {@link PemSslStoreDetails} instance
@since 3.2.0 | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStoreDetails.java | 101 | [
"alias"
] | PemSslStoreDetails | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.