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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
paddedValue | private static String paddedValue(final long value, final boolean padWithZeros, final int count) {
final String longString = Long.toString(value);
return padWithZeros ? StringUtils.leftPad(longString, count, '0') : longString;
} | Converts a {@code long} to a {@link String} with optional
zero padding.
@param value the value to convert
@param padWithZeros whether to pad with zeroes
@param count the size to pad to (ignored if {@code padWithZeros} is false)
@return the string result | java | src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java | 780 | [
"value",
"padWithZeros",
"count"
] | String | true | 2 | 7.84 | apache/commons-lang | 2,896 | javadoc | false |
parseBoolean | public static boolean parseBoolean(String value) {
if (isFalse(value)) {
return false;
}
if (isTrue(value)) {
return true;
}
throw new IllegalArgumentException("Failed to parse value [" + value + "] as only [true] or [false] are allowed.");
} | Parses a string representation of a boolean value to <code>boolean</code>.
@return <code>true</code> iff the provided value is "true". <code>false</code> iff the provided value is "false".
@throws IllegalArgumentException if the string cannot be parsed to boolean. | java | libs/core/src/main/java/org/elasticsearch/core/Booleans.java | 56 | [
"value"
] | true | 3 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false | |
restore_from_cluster_snapshot | def restore_from_cluster_snapshot(self, cluster_identifier: str, snapshot_identifier: str) -> dict | None:
"""
Restore a cluster from its snapshot.
.. seealso::
- :external+boto3:py:meth:`Redshift.Client.restore_from_cluster_snapshot`
:param cluster_identifier: unique ident... | Restore a cluster from its snapshot.
.. seealso::
- :external+boto3:py:meth:`Redshift.Client.restore_from_cluster_snapshot`
:param cluster_identifier: unique identifier of a cluster
:param snapshot_identifier: unique identifier for a snapshot of a cluster | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_cluster.py | 141 | [
"self",
"cluster_identifier",
"snapshot_identifier"
] | dict | None | true | 2 | 6.08 | apache/airflow | 43,597 | sphinx | false |
getFormatter | public static DateTimeFormatter getFormatter(DateTimeFormatter formatter, @Nullable Locale locale) {
DateTimeFormatter formatterToUse = (locale != null ? formatter.withLocale(locale) : formatter);
DateTimeContext context = getDateTimeContext();
return (context != null ? context.getFormatter(formatterToUse) : form... | Obtain a DateTimeFormatter with user-specific settings applied to the given base formatter.
@param formatter the base formatter that establishes default formatting rules
(generally user independent)
@param locale the current user locale (may be {@code null} if not known)
@return the user-specific DateTimeFormatter | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeContextHolder.java | 79 | [
"formatter",
"locale"
] | DateTimeFormatter | true | 3 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
union | public static ClassFilter union(ClassFilter cf1, ClassFilter cf2) {
Assert.notNull(cf1, "First ClassFilter must not be null");
Assert.notNull(cf2, "Second ClassFilter must not be null");
return new UnionClassFilter(new ClassFilter[] {cf1, cf2});
} | Match all classes that <i>either</i> (or both) of the given ClassFilters matches.
@param cf1 the first ClassFilter
@param cf2 the second ClassFilter
@return a distinct ClassFilter that matches all classes that either
of the given ClassFilter matches | java | spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java | 49 | [
"cf1",
"cf2"
] | ClassFilter | true | 1 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
cloneDeepWith | function cloneDeepWith(value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
} | This method is like `_.cloneWith` except that it recursively clones `value`.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to recursively clone.
@param {Function} [customizer] The function to customize cloning.
@returns {*} Returns the deep cloned value.
@see _.cloneWith
@example
function c... | javascript | lodash.js | 11,226 | [
"value",
"customizer"
] | false | 2 | 6.96 | lodash/lodash | 61,490 | jsdoc | false | |
lastConnectAttemptMs | public long lastConnectAttemptMs(String id) {
NodeConnectionState nodeState = this.nodeState.get(id);
return nodeState == null ? 0 : nodeState.lastConnectAttemptMs;
} | Get the timestamp of the latest connection attempt of a given node
@param id the connection to fetch the state for | java | clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java | 426 | [
"id"
] | true | 2 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
define | public ConfigDef define(String name, Type type, Object defaultValue, Importance importance, String documentation, String alternativeString) {
return define(name, type, defaultValue, null, importance, documentation, null, -1, Width.NONE,
name, Collections.emptyList(), null, alternativeString);
... | Define a new configuration with no special validation logic
@param name The name of the config parameter
@param type The type of the config
@param defaultValue The default value to use if this config isn't present
@param importance The importance of this config: is this something y... | java | clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java | 428 | [
"name",
"type",
"defaultValue",
"importance",
"documentation",
"alternativeString"
] | ConfigDef | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
lower_to_while_loop | def lower_to_while_loop(*args, **kwargs):
"""
The traced graph of this function will be used to replace the original scan fx_node.
"""
assert len(kwargs) == 0
# Step 1: construct necessary inputs to while_loop based on scan's input.
(
... | The traced graph of this function will be used to replace the original scan fx_node. | python | torch/_inductor/fx_passes/post_grad.py | 615 | [] | false | 2 | 6.32 | pytorch/pytorch | 96,034 | unknown | false | |
extract | def extract(condition, arr):
"""
Return the elements of an array that satisfy some condition.
This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If
`condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``.
Note that `place` does the exact opposite of `extract`.
... | Return the elements of an array that satisfy some condition.
This is equivalent to ``np.compress(ravel(condition), ravel(arr))``. If
`condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``.
Note that `place` does the exact opposite of `extract`.
Parameters
----------
condition : array_like
An ... | python | numpy/lib/_function_base_impl.py | 2,044 | [
"condition",
"arr"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
transposeHalfByteImpl | public static void transposeHalfByteImpl(int[] q, byte[] quantQueryByte) {
int limit = q.length - 7;
int i = 0;
int index = 0;
for (; i < limit; i += 8, index++) {
assert q[i] >= 0 && q[i] <= 15;
assert q[i + 1] >= 0 && q[i + 1] <= 15;
assert q[i + 2] ... | Packs two bit vector (values 0-3) into a byte array with lower bits first.
The striding is similar to transposeHalfByte
@param vector the input vector with values 0-3
@param packed the output packed byte array | java | libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/DefaultESVectorUtilSupport.java | 409 | [
"q",
"quantQueryByte"
] | void | true | 12 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
start_task_execution | def start_task_execution(self, task_arn: str, **kwargs) -> str:
"""
Start a TaskExecution for the specified task_arn.
Each task can have at most one TaskExecution.
Additional keyword arguments send to ``start_task_execution`` boto3 method.
.. seealso::
- :external+b... | Start a TaskExecution for the specified task_arn.
Each task can have at most one TaskExecution.
Additional keyword arguments send to ``start_task_execution`` boto3 method.
.. seealso::
- :external+boto3:py:meth:`DataSync.Client.start_task_execution`
:param task_arn: TaskArn
:return: TaskExecutionArn
:raises Clie... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/datasync.py | 218 | [
"self",
"task_arn"
] | str | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false |
get_commented_out_prs_from_provider_changelogs | def get_commented_out_prs_from_provider_changelogs() -> list[int]:
"""
Returns list of PRs that are commented out in the changelog.
:return: list of PR numbers that appear only in comments in changelog.rst files in "providers" dir
"""
pr_matcher = re.compile(r".*\(#([0-9]+)\).*")
commented_prs =... | Returns list of PRs that are commented out in the changelog.
:return: list of PR numbers that appear only in comments in changelog.rst files in "providers" dir | python | dev/breeze/src/airflow_breeze/commands/release_management_commands.py | 2,444 | [] | list[int] | true | 14 | 8.4 | apache/airflow | 43,597 | unknown | false |
_maybe_align_series_as_frame | def _maybe_align_series_as_frame(self, series: Series, axis: AxisInt):
"""
If the Series operand is not EA-dtype, we can broadcast to 2D and operate
blockwise.
"""
rvalues = series._values
if not isinstance(rvalues, np.ndarray):
# TODO(EA2D): no need to specia... | If the Series operand is not EA-dtype, we can broadcast to 2D and operate
blockwise. | python | pandas/core/frame.py | 9,000 | [
"self",
"series",
"axis"
] | true | 6 | 6 | pandas-dev/pandas | 47,362 | unknown | false | |
dateTimePattern | static Coercer dateTimePattern(String pattern) {
return new Coercer(
(value) -> DateTimeFormatter.ofPattern(pattern).parse(value, Instant::from).toEpochMilli(),
DateTimeParseException.class::isInstance);
} | Attempt to convert the specified value to epoch time.
@param value the value to coerce to
@return the epoch time in milliseconds or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java | 157 | [
"pattern"
] | Coercer | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
temp_environ | def temp_environ(updates: dict[str, str]):
"""
Temporarily set environment variables and restore them after the block.
Args:
updates: Dict of environment variables to set.
"""
missing = object()
old: dict[str, str | object] = {k: os.environ.get(k, missing) for k in updates}
try:
... | Temporarily set environment variables and restore them after the block.
Args:
updates: Dict of environment variables to set. | python | .ci/lumen_cli/cli/lib/common/utils.py | 85 | [
"updates"
] | true | 4 | 6.4 | pytorch/pytorch | 96,034 | google | false | |
applyAsBoolean | boolean applyAsBoolean(T t, U u); | Applies this function to the given arguments.
@param t the first function argument.
@param u the second function argument.
@return the function result. | java | src/main/java/org/apache/commons/lang3/function/ToBooleanBiFunction.java | 41 | [
"t",
"u"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
initialize | @Override
public void initialize(ConfigurableApplicationContext applicationContext) {
applicationContext.addApplicationListener(new ConditionEvaluationReportListener(applicationContext));
} | Static factory method that creates a
{@link ConditionEvaluationReportLoggingListener} which logs the report at the
specified log level.
@param logLevelForReport the log level to log the report at
@return a {@link ConditionEvaluationReportLoggingListener} instance.
@since 3.0.0 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java | 82 | [
"applicationContext"
] | void | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
getObject | @Override
public MessageInterpolator getObject() throws BeansException {
MessageInterpolator messageInterpolator = getMessageInterpolator();
if (this.messageSource != null) {
return new MessageSourceMessageInterpolator(this.messageSource, messageInterpolator);
}
return messageInterpolator;
} | Creates a new {@link MessageInterpolatorFactory} that will produce a
{@link MessageInterpolator} that uses the given {@code messageSource} to resolve
any message parameters before final interpolation.
@param messageSource message source to be used by the interpolator
@since 2.6.0 | java | core/spring-boot/src/main/java/org/springframework/boot/validation/MessageInterpolatorFactory.java | 69 | [] | MessageInterpolator | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
_compute_missing_values_in_feature_mask | def _compute_missing_values_in_feature_mask(self, X, estimator_name=None):
"""Return boolean mask denoting if there are missing values for each feature.
This method also ensures that X is finite.
Parameter
---------
X : array-like of shape (n_samples, n_features), dtype=DOUBLE
... | Return boolean mask denoting if there are missing values for each feature.
This method also ensures that X is finite.
Parameter
---------
X : array-like of shape (n_samples, n_features), dtype=DOUBLE
Input data.
estimator_name : str or None, default=None
Name to use when raising an error. Defaults to the cla... | python | sklearn/tree/_classes.py | 194 | [
"self",
"X",
"estimator_name"
] | false | 5 | 6.08 | scikit-learn/scikit-learn | 64,340 | unknown | false | |
addCopies | @CanIgnoreReturnValue
@Override
public Builder<E> addCopies(E element, int occurrences) {
checkNotNull(element);
CollectPreconditions.checkNonnegative(occurrences, "occurrences");
if (occurrences == 0) {
return this;
}
maintenance();
elements[length] = element;
... | Adds a number of occurrences of an element to this {@code ImmutableSortedMultiset}.
@param element the element to add
@param occurrences the number of occurrences of the element to add. May be zero, in which
case no change will be made.
@return this {@code Builder} object
@throws NullPointerException if {@code elem... | java | android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 593 | [
"element",
"occurrences"
] | true | 2 | 7.76 | google/guava | 51,352 | javadoc | false | |
rec_array_to_mgr | def rec_array_to_mgr(
data: np.rec.recarray | np.ndarray,
index,
columns,
dtype: DtypeObj | None,
copy: bool,
) -> Manager:
"""
Extract from a masked rec array and create the manager.
"""
# essentially process a record array then fill it
fdata = ma.getdata(data)
if index is N... | Extract from a masked rec array and create the manager. | python | pandas/core/internals/construction.py | 154 | [
"data",
"index",
"columns",
"dtype",
"copy"
] | Manager | true | 6 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
resolve | @SuppressWarnings("unchecked")
public <T> @Nullable T resolve(RegisteredBean registeredBean, Class<T> requiredType) {
Object value = resolveObject(registeredBean);
Assert.isInstanceOf(requiredType, value);
return (T) value;
} | Resolve the field value for the specified registered bean.
@param registeredBean the registered bean
@param requiredType the required type
@return the resolved field value | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredFieldValueResolver.java | 125 | [
"registeredBean",
"requiredType"
] | T | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
next | @CanIgnoreReturnValue
@Override
@ParametricNullness
public V next() {
if (next == null) {
throw new NoSuchElementException();
}
previous = current = next;
next = next.nextSibling;
nextIndex++;
return current.getValue();
} | Constructs a new iterator over all values for the specified key starting at the specified
index. This constructor is optimized so that it starts at either the head or the tail,
depending on which is closer to the specified index. This allows adds to the tail to be done
in constant time.
@throws IndexOutOfBoundsExceptio... | java | android/guava/src/com/google/common/collect/LinkedListMultimap.java | 502 | [] | V | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
getLoggingSystem | @Override
public @Nullable LoggingSystem getLoggingSystem(ClassLoader classLoader) {
List<LoggingSystemFactory> delegates = (this.delegates != null) ? this.delegates.apply(classLoader) : null;
if (delegates != null) {
for (LoggingSystemFactory delegate : delegates) {
LoggingSystem loggingSystem = delegate.g... | Create a new {@link DelegatingLoggingSystemFactory} instance.
@param delegates a function that provides the delegates | java | core/spring-boot/src/main/java/org/springframework/boot/logging/DelegatingLoggingSystemFactory.java | 41 | [
"classLoader"
] | LoggingSystem | true | 4 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
mapKeysToLayers | function mapKeysToLayers(layers: CompositeProxyLayer[]) {
const keysToLayerMap = new Map<string | symbol, CompositeProxyLayer>()
for (const layer of layers) {
const keys = layer.getKeys()
for (const key of keys) {
keysToLayerMap.set(key, layer)
}
}
return keysToLayerMap
} | Creates a proxy from a set of layers.
Each layer is a building for a proxy (potentially, reusable) that
can add or override property on top of the target.
When multiple layers define the same property, last one wins
@param target
@param layers
@returns | typescript | packages/client/src/runtime/core/compositeProxy/createCompositeProxy.ts | 130 | [
"layers"
] | false | 1 | 6.08 | prisma/prisma | 44,834 | jsdoc | false | |
isDeprecated | boolean isDeprecated(Element element) {
if (element == null) {
return false;
}
String elementName = element.getEnclosingElement() + "#" + element.getSimpleName();
if (DEPRECATION_EXCLUDES.contains(elementName)) {
return false;
}
if (isElementDeprecated(element)) {
return true;
}
if (element ins... | Resolve the {@link SourceMetadata} for the specified property.
@param field the field of the property (can be {@code null})
@param getter the getter of the property (can be {@code null})
@return the {@link SourceMetadata} for the specified property | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 183 | [
"element"
] | true | 6 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false | |
remaining_estimate | def remaining_estimate(self, last_run_at: datetime) -> timedelta:
"""Return estimate of next time to run.
Returns:
~datetime.timedelta: when the periodic task should
run next, or if it shouldn't run today (e.g., the sun does
not rise today), returns the time ... | Return estimate of next time to run.
Returns:
~datetime.timedelta: when the periodic task should
run next, or if it shouldn't run today (e.g., the sun does
not rise today), returns the time when the next check
should take place. | python | celery/schedules.py | 828 | [
"self",
"last_run_at"
] | timedelta | true | 3 | 6.88 | celery/celery | 27,741 | unknown | false |
builder | public static final Builder builder() {
return new Builder();
} | Constructs a new {@link Builder} instance.
@return a new {@link Builder} instance. | java | src/main/java/org/apache/commons/lang3/Strings.java | 280 | [] | Builder | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
run | public static <V> FutureTask<V> run(final Callable<V> callable) {
final FutureTask<V> futureTask = new FutureTask<>(callable);
futureTask.run();
return futureTask;
} | Creates a {@link FutureTask} and runs the given {@link Callable}.
@param <V> The result type returned by this FutureTask's {@code get} methods.
@param callable the Callable task.
@return a new FutureTask. | java | src/main/java/org/apache/commons/lang3/concurrent/FutureTasks.java | 36 | [
"callable"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
get_optional_arg | def get_optional_arg(annotation: typing.Any) -> typing.Any:
"""Get the argument from an Optional[...] annotation, or None if it is no such annotation."""
origin = typing.get_origin(annotation)
if origin != typing.Union and (sys.version_info >= (3, 10) and origin != types.UnionType):
return None
... | Get the argument from an Optional[...] annotation, or None if it is no such annotation. | python | celery/utils/annotations.py | 17 | [
"annotation"
] | typing.Any | true | 6 | 6 | celery/celery | 27,741 | unknown | false |
configure | private void configure(Supplier<@Nullable DateTimeFormatter> supplier, Consumer<DateTimeFormatter> consumer) {
DateTimeFormatter formatter = supplier.get();
if (formatter != null) {
consumer.accept(formatter);
}
} | Create a new WebConversionService that configures formatters with the provided
date, time, and date-time formats, or registers the default if no custom format is
provided.
@param dateTimeFormatters the formatters to use for date, time, and date-time
formatting
@since 2.3.0 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java | 84 | [
"supplier",
"consumer"
] | void | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
invertFrom | @CanIgnoreReturnValue
public static <K extends @Nullable Object, V extends @Nullable Object, M extends Multimap<K, V>>
M invertFrom(Multimap<? extends V, ? extends K> source, M dest) {
checkNotNull(dest);
for (Map.Entry<? extends V, ? extends K> entry : source.entries()) {
dest.put(entry.getValue(... | Copies each key-value mapping in {@code source} into {@code dest}, with its key and value
reversed.
<p>If {@code source} is an {@link ImmutableMultimap}, consider using {@link
ImmutableMultimap#inverse} instead.
@param source any multimap
@param dest the multimap to copy into; usually empty
@return {@code dest} | java | android/guava/src/com/google/common/collect/Multimaps.java | 596 | [
"source",
"dest"
] | M | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false |
getLong | public long getLong(String name) throws JSONException {
Object object = get(name);
Long result = JSON.toLong(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "long");
}
return result;
} | Returns the value mapped by {@code name} if it exists and is a long or can be
coerced to a long. Note that JSON represents numbers as doubles, so this is
<a href="#lossy">lossy</a>; use strings to transfer numbers over JSON.
@param name the name of the property
@return the value
@throws JSONException if the mapping doe... | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 514 | [
"name"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
addConstructor | function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, name: Identifier, extendsClauseElement: ExpressionWithTypeArguments | undefined): void {
const savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
const ancestorFacts = enterSu... | Adds the constructor of the class to a class body function.
@param statements The statements of the class body function.
@param node The ClassExpression or ClassDeclaration node.
@param extendsClauseElement The expression for the class `extends` clause. | typescript | src/compiler/transformers/es2015.ts | 1,147 | [
"statements",
"node",
"name",
"extendsClauseElement"
] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
one_hot | def one_hot(
x: Array,
/,
num_classes: int,
*,
dtype: DType | None = None,
axis: int = -1,
xp: ModuleType | None = None,
) -> Array:
"""
One-hot encode the given indices.
Each index in the input `x` is encoded as a vector of zeros of length `num_classes`
with the element at ... | One-hot encode the given indices.
Each index in the input `x` is encoded as a vector of zeros of length `num_classes`
with the element at the given index set to one.
Parameters
----------
x : array
An array with integral dtype whose values are between `0` and `num_classes - 1`.
num_classes : int
Number of cla... | python | sklearn/externals/array_api_extra/_delegation.py | 195 | [
"x",
"num_classes",
"dtype",
"axis",
"xp"
] | Array | true | 8 | 8.4 | scikit-learn/scikit-learn | 64,340 | numpy | false |
explicitlyInheritsFrom | function explicitlyInheritsFrom(symbol: Symbol, parent: Symbol, cachedResults: Map<string, boolean>, checker: TypeChecker): boolean {
if (symbol === parent) {
return true;
}
const key = getSymbolId(symbol) + "," + getSymbolId(parent);
const cached = cachedResults.get(k... | Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol
is an interface, determines if some ancestor of the child symbol extends or inherits from it.
Also takes in a cache of previous results which makes this slightly more efficient and is
necessary to avoid potential loops lik... | typescript | src/services/findAllReferences.ts | 2,338 | [
"symbol",
"parent",
"cachedResults",
"checker"
] | true | 6 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
omitEmptyStrings | public Splitter omitEmptyStrings() {
return new Splitter(strategy, true, trimmer, limit);
} | Returns a splitter that behaves equivalently to {@code this} splitter, but automatically omits
empty strings from the results. For example, {@code
Splitter.on(',').omitEmptyStrings().split(",a,,,b,c,,")} returns an iterable containing only
{@code ["a", "b", "c"]}.
<p>If either {@code trimResults} option is also specifi... | java | android/guava/src/com/google/common/base/Splitter.java | 306 | [] | Splitter | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false |
wrapInstance | public static <T> Plugin<T> wrapInstance(T instance, Metrics metrics, String key, String name, String value) {
Supplier<Map<String, String>> tagsSupplier = () -> {
Map<String, String> tags = tags(key, instance);
tags.put(name, value);
return tags;
};
return wr... | Wrap an instance into a Plugin.
@param instance the instance to wrap
@param metrics the metrics
@param name extra tag name to add
@param value extra tag value to add
@param key the value for the <code>config</code> tag
@return the plugin | java | clients/src/main/java/org/apache/kafka/common/internals/Plugin.java | 86 | [
"instance",
"metrics",
"key",
"name",
"value"
] | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
_get_group_names | def _get_group_names(regex: re.Pattern) -> list[Hashable] | range:
"""
Get named groups from compiled regex.
Unnamed groups are numbered.
Parameters
----------
regex : compiled regex
Returns
-------
list of column labels
"""
rng = range(regex.groups)
names = {v: k for ... | Get named groups from compiled regex.
Unnamed groups are numbered.
Parameters
----------
regex : compiled regex
Returns
-------
list of column labels | python | pandas/core/strings/accessor.py | 3,942 | [
"regex"
] | list[Hashable] | range | true | 4 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
requireNonNullMode | private static void requireNonNullMode(ConnectionMode connectionMode, SecurityProtocol securityProtocol) {
if (connectionMode == null)
throw new IllegalArgumentException("`mode` must be non-null if `securityProtocol` is `" + securityProtocol + "`");
} | @return a mutable RecordingMap. The elements got from RecordingMap are marked as "used". | java | clients/src/main/java/org/apache/kafka/common/network/ChannelBuilders.java | 214 | [
"connectionMode",
"securityProtocol"
] | void | true | 2 | 6.64 | apache/kafka | 31,560 | javadoc | false |
toString | @Deprecated
public static String toString(final byte[] bytes, final String charsetName) {
return new String(bytes, Charsets.toCharset(charsetName));
} | Converts a {@code byte[]} to a String using the specified character encoding.
@param bytes the byte array to read from.
@param charsetName the encoding to use, if null then use the platform default.
@return a new String.
@throws NullPointerException if the input is null.
@deprecated Use {@link StringUtils#toEncod... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,697 | [
"bytes",
"charsetName"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
isAnyBlank | public static boolean isAnyBlank(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return false;
}
for (final CharSequence cs : css) {
if (isBlank(cs)) {
return true;
}
}
return false;
} | Tests if any of the CharSequences are {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or {@code null}).
<p>
Whitespace is defined by {@link Character#isWhitespace(char)}.
</p>
<pre>
StringUtils.isAnyBlank((String) null) = true
StringUtils.isAnyBlank((String[]) null) = false
StringUtils.isAnyBl... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 3,408 | [] | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
emit_dispatch_case | def emit_dispatch_case(
overload: PythonSignatureGroup,
structseq_typenames: dict[str, str],
*,
symint: bool = True,
) -> str:
"""
Emit dispatch code for a single parsed signature. This corresponds to either
a single native function, or a pair that differ only in output params. In the
la... | Emit dispatch code for a single parsed signature. This corresponds to either
a single native function, or a pair that differ only in output params. In the
latter case, a single python signature is used for both and dispatching
switches on the presence/absence of passed output args. | python | tools/autograd/gen_python_functions.py | 1,014 | [
"overload",
"structseq_typenames",
"symint"
] | str | true | 3 | 6 | pytorch/pytorch | 96,034 | unknown | false |
toOffsetDateTime | public static OffsetDateTime toOffsetDateTime(final Date date) {
return toOffsetDateTime(date, TimeZone.getDefault());
} | Converts a {@link Date} to a {@link OffsetDateTime}.
@param date the Date to convert, not null.
@return a new OffsetDateTime.
@since 3.19.0 | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,662 | [
"date"
] | OffsetDateTime | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
toString | public static String toString(URL url, Charset charset) throws IOException {
return asCharSource(url, charset).read();
} | Reads all characters from a URL into a {@link String}, using the given character set.
@param url the URL to read from
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@return a string containing all the characters from the URL
@throws IOExcept... | java | android/guava/src/com/google/common/io/Resources.java | 107 | [
"url",
"charset"
] | String | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
guessPropertyTypeFromEditors | protected @Nullable Class<?> guessPropertyTypeFromEditors(String propertyName) {
if (this.customEditorsForPath != null) {
CustomEditorHolder editorHolder = this.customEditorsForPath.get(propertyName);
if (editorHolder == null) {
List<String> strippedPaths = new ArrayList<>();
addStrippedPropertyPaths(st... | Guess the property type of the specified property from the registered
custom editors (provided that they were registered for a specific type).
@param propertyName the name of the property
@return the property type, or {@code null} if not determinable | java | spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java | 447 | [
"propertyName"
] | true | 6 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toCharset | static Charset toCharset(final Charset charset) {
return charset == null ? Charset.defaultCharset() : charset;
} | Returns the given {@code charset} or the default Charset if {@code charset} is null.
@param charset a Charset or null.
@return the given {@code charset} or the default Charset if {@code charset} is null. | java | src/main/java/org/apache/commons/lang3/Charsets.java | 43 | [
"charset"
] | Charset | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false |
field | public XContentBuilder field(String name, Byte value) throws IOException {
return (value == null) ? nullField(name) : field(name, value.byteValue());
} | @return the value of the "human readable" flag. When the value is equal to true,
some types of values are written in a format easier to read for a human. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 431 | [
"name",
"value"
] | XContentBuilder | true | 2 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
shouldSkipHeartbeat | public boolean shouldSkipHeartbeat() {
return isNotInGroup();
} | @return True if the member should not send heartbeats, which is the case when it is in a
state where it is not an active member of the group. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 599 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
appendln | public StrBuilder appendln(final char ch) {
return append(ch).appendNewLine();
} | Appends a char value followed by a new line to the string builder.
@param ch the value to append
@return {@code this} instance.
@since 2.3 | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 945 | [
"ch"
] | StrBuilder | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
token | protected abstract boolean token(
String aggregationName,
String currentFieldName,
XContentParser.Token token,
XContentParser parser,
Map<ParseField, Object> otherOptions
) throws IOException; | Allows subclasses of {@link ArrayValuesSourceParser} to parse extra
parameters and store them in a {@link Map} which will later be passed to
{@link #createFactory(String, ValuesSourceType, Map)}.
@param aggregationName
the name of the aggregation
@param currentFieldName
the name of the current fie... | java | modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/ArrayValuesSourceParser.java | 247 | [
"aggregationName",
"currentFieldName",
"token",
"parser",
"otherOptions"
] | true | 1 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
deactivate_stale_dags | def deactivate_stale_dags(
self,
last_parsed: dict[DagFileInfo, datetime | None],
session: Session = NEW_SESSION,
):
"""Detect and deactivate DAGs which are no longer present in files."""
to_deactivate = set()
bundle_names = {b.name for b in self._dag_bundles}
... | Detect and deactivate DAGs which are no longer present in files. | python | airflow-core/src/airflow/dag_processing/manager.py | 299 | [
"self",
"last_parsed",
"session"
] | true | 6 | 6 | apache/airflow | 43,597 | unknown | false | |
resolve | @Nullable Entry resolve(String name); | Resolve the entry with the specified name, return {@code null} if the entry should
not be handled.
@param name the name of the entry to handle
@return the resolved {@link Entry} | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/JarStructure.java | 49 | [
"name"
] | Entry | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false |
createBuildInfo | protected Properties createBuildInfo(ProjectDetails project) {
Properties properties = CollectionFactory.createSortedProperties(true);
addIfHasValue(properties, "build.group", project.getGroup());
addIfHasValue(properties, "build.artifact", project.getArtifact());
addIfHasValue(properties, "build.name", project... | Creates a new {@code BuildPropertiesWriter} that will write to the given
{@code outputFile}.
@param outputFile the output file | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/BuildPropertiesWriter.java | 76 | [
"project"
] | Properties | true | 3 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
autodiscover_modules | def autodiscover_modules(*args, **kwargs):
"""
Auto-discover INSTALLED_APPS modules and fail silently when
not present. This forces an import on them to register any admin bits they
may want.
You may provide a register_to keyword parameter as a way to access a
registry. This register_to object ... | Auto-discover INSTALLED_APPS modules and fail silently when
not present. This forces an import on them to register any admin bits they
may want.
You may provide a register_to keyword parameter as a way to access a
registry. This register_to object must have a _registry instance variable
to access it. | python | django/utils/module_loading.py | 38 | [] | false | 6 | 6.4 | django/django | 86,204 | unknown | false | |
toBin | public int toBin(double x) {
int binNumber = (int) ((x - min) / bucketWidth);
if (binNumber < MIN_BIN_NUMBER) {
return MIN_BIN_NUMBER;
}
return Math.min(binNumber, maxBinNumber);
} | Create a bin scheme with the specified number of bins that all have the same width.
@param bins the number of bins; must be at least 2
@param min the minimum value to be counted in the bins
@param max the maximum value to be counted in the bins | java | clients/src/main/java/org/apache/kafka/common/metrics/stats/Histogram.java | 153 | [
"x"
] | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
resetCaches | default void resetCaches() {
for (String cacheName : getCacheNames()) {
Cache cache = getCache(cacheName);
if (cache != null) {
cache.clear();
}
}
} | Remove all registered caches from this cache manager if possible,
re-creating them on demand. After this call, {@link #getCacheNames()}
will possibly be empty and the cache provider will have dropped all
cache management state.
<p>Alternatively, an implementation may perform an equivalent reset
on fixed existing cache ... | java | spring-context/src/main/java/org/springframework/cache/CacheManager.java | 69 | [] | void | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
getContent | public String getContent() {
if (chars == null) {
return null;
}
return new String(chars);
} | Gets the String content that the tokenizer is parsing.
@return the string content being parsed. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 481 | [] | String | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
deleteAcls | default DeleteAclsResult deleteAcls(Collection<AclBindingFilter> filters) {
return deleteAcls(filters, new DeleteAclsOptions());
} | This is a convenience method for {@link #deleteAcls(Collection, DeleteAclsOptions)} with default options.
See the overload for more details.
<p>
This operation is supported by brokers with version 0.11.0.0 or higher.
@param filters The filters to use.
@return The DeleteAclsResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 422 | [
"filters"
] | DeleteAclsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
order_queued_tasks_by_priority | def order_queued_tasks_by_priority(self) -> list[tuple[TaskInstanceKey, workloads.ExecuteTask]]:
"""
Orders the queued tasks by priority.
:return: List of workloads from the queued_tasks according to the priority.
"""
if not self.queued_tasks:
return []
# V3... | Orders the queued tasks by priority.
:return: List of workloads from the queued_tasks according to the priority. | python | airflow-core/src/airflow/executors/base_executor.py | 335 | [
"self"
] | list[tuple[TaskInstanceKey, workloads.ExecuteTask]] | true | 2 | 7.04 | apache/airflow | 43,597 | unknown | false |
getInvalidChars | private static List<Character> getInvalidChars(Elements elements, int index) {
List<Character> invalidChars = new ArrayList<>();
for (int charIndex = 0; charIndex < elements.getLength(index); charIndex++) {
char ch = elements.charAt(index, charIndex);
if (!ElementsParser.isValidChar(ch, charIndex)) {
inva... | Return a {@link ConfigurationPropertyName} for the specified string.
@param name the source name
@param returnNullIfInvalid if null should be returned if the name is not valid
@return a {@link ConfigurationPropertyName} instance
@throws InvalidConfigurationPropertyNameException if the name is not valid and
{@code retur... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 701 | [
"elements",
"index"
] | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
predict | def predict(self, X, **params):
"""Transform the data, and apply `predict` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls `predict`
method. Only valid if the final estimator implem... | Transform the data, and apply `predict` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls `predict`
method. Only valid if the final estimator implements `predict`.
Parameters
----------
X : iterable
Data to pre... | python | sklearn/pipeline.py | 699 | [
"self",
"X"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
tryParse | @GwtIncompatible // regular expressions
public static @Nullable Double tryParse(String string) {
if (FLOATING_POINT_PATTERN.matcher(string).matches()) {
// TODO(lowasser): could be potentially optimized, but only with
// extensive testing
try {
return Double.parseDouble(string);
} ... | Parses the specified string as a double-precision floating point value. The ASCII character
{@code '-'} (<code>'\u002D'</code>) is recognized as the minus sign.
<p>Unlike {@link Double#parseDouble(String)}, this method returns {@code null} instead of
throwing an exception if parsing fails. Valid inputs are exactly ... | java | android/guava/src/com/google/common/primitives/Doubles.java | 772 | [
"string"
] | Double | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false |
clear | public FluentBitSet clear(final int bitIndex) {
bitSet.clear(bitIndex);
return this;
} | Sets the bit specified by the index to {@code false}.
@param bitIndex the index of the bit to be cleared.
@throws IndexOutOfBoundsException if the specified index is negative.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/util/FluentBitSet.java | 164 | [
"bitIndex"
] | FluentBitSet | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
set_context | def set_context(self, filename):
"""
Provide filename context to airflow task handler.
:param filename: filename in which the dag is located
"""
local_loc = self._init_file(filename)
self.handler = NonCachingFileHandler(local_loc)
self.handler.setFormatter(self.f... | Provide filename context to airflow task handler.
:param filename: filename in which the dag is located | python | airflow-core/src/airflow/utils/log/file_processor_handler.py | 57 | [
"self",
"filename"
] | false | 2 | 6.24 | apache/airflow | 43,597 | sphinx | false | |
getTSVInstance | public static StrTokenizer getTSVInstance(final char[] input) {
final StrTokenizer tok = getTSVClone();
tok.reset(input);
return tok;
} | Gets a new tokenizer instance which parses Tab Separated Value strings.
The default for CSV processing will be trim whitespace from both ends
(which can be overridden with the setTrimmer method).
@param input the string to parse.
@return a new tokenizer instance which parses Tab Separated Value strings. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 199 | [
"input"
] | StrTokenizer | true | 1 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
_matchesPrefix | function _matchesPrefix(ignoreCase: boolean, word: string, wordToMatchAgainst: string): IMatch[] | null {
if (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) {
return null;
}
let matches: boolean;
if (ignoreCase) {
matches = strings.startsWithIgnoreCase(wordToMatchAgainst, word);
} else {
ma... | @returns A filter which combines the provided set
of filters with an or. The *first* filters that
matches defined the return value of the returned
filter. | typescript | src/vs/base/common/filters.ts | 47 | [
"ignoreCase",
"word",
"wordToMatchAgainst"
] | true | 7 | 7.04 | microsoft/vscode | 179,840 | jsdoc | false | |
size | @Override
public int size() {
Segment<K, V, E, S>[] segments = this.segments;
long sum = 0;
for (int i = 0; i < segments.length; ++i) {
sum += segments[i].count;
}
return Ints.saturatedCast(sum);
} | Concrete implementation of {@link Segment} for weak keys and {@link Dummy} values. | java | android/guava/src/com/google/common/collect/MapMakerInternalMap.java | 2,345 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
fromProperties | @J2ktIncompatible
@GwtIncompatible // java.util.Properties
public static ImmutableMap<String, String> fromProperties(Properties properties) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) {
/*
*... | Creates an {@code ImmutableMap<String, String>} from a {@code Properties} instance. Properties
normally derive from {@code Map<Object, Object>}, but they typically contain strings, which is
awkward. This method lets you get a plain-old-{@code Map} out of a {@code Properties}.
@param properties a {@code Properties} obje... | java | android/guava/src/com/google/common/collect/Maps.java | 1,363 | [
"properties"
] | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false | |
launderException | private RuntimeException launderException(final Throwable throwable) {
throw new IllegalStateException("Unchecked exception", ExceptionUtils.throwUnchecked(throwable));
} | This method launders a Throwable to either a RuntimeException, Error or any other Exception wrapped in an
IllegalStateException.
@param throwable the throwable to laundered
@return a RuntimeException, Error or an IllegalStateException | java | src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java | 146 | [
"throwable"
] | RuntimeException | true | 1 | 6 | apache/commons-lang | 2,896 | javadoc | false |
duration | public Optional<Duration> duration() {
return duration;
} | Return the timestamp to be used for the ListOffsetsRequest.
@return the timestamp for the OffsetResetStrategy,
if the strategy is EARLIEST or LATEST or duration is provided
else return Optional.empty() | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AutoOffsetResetStrategy.java | 133 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
nonNull | @SafeVarargs
public static <E> Stream<E> nonNull(final E... array) {
return nonNull(of(array));
} | Streams the non-null elements of an array.
@param <E> the type of elements in the collection.
@param array the array to stream or null.
@return A non-null stream that filters out null elements.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 650 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
shouldParseReturnType | function shouldParseReturnType(returnToken: SyntaxKind.ColonToken | SyntaxKind.EqualsGreaterThanToken, isType: boolean): boolean {
if (returnToken === SyntaxKind.EqualsGreaterThanToken) {
parseExpected(returnToken);
return true;
}
else if (parseOptional(SyntaxKind.Co... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 4,101 | [
"returnToken",
"isType"
] | true | 7 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getAsText | @Override
public String getAsText() {
File value = (File) getValue();
return (value != null ? value.getPath() : "");
} | Create a new FileEditor, using the given ResourceEditor underneath.
@param resourceEditor the ResourceEditor to use | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/FileEditor.java | 116 | [] | String | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
doLoadBeanDefinitions | protected int doLoadBeanDefinitions(InputSource inputSource, Resource resource)
throws BeanDefinitionStoreException {
try {
Document doc = doLoadDocument(inputSource, resource);
int count = registerBeanDefinitions(doc, resource);
if (logger.isDebugEnabled()) {
logger.debug("Loaded " + count + " bean ... | Actually load bean definitions from the specified XML file.
@param inputSource the SAX InputSource to read from
@param resource the resource descriptor for the XML file
@return the number of bean definitions found
@throws BeanDefinitionStoreException in case of loading or parsing errors
@see #doLoadDocument
@see #regis... | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java | 393 | [
"inputSource",
"resource"
] | true | 8 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
tryPreallocate | void tryPreallocate(Path file, long size); | Retrieves the actual number of bytes of disk storage used to store a specified file.
@param path the path to the file
@return an {@link OptionalLong} that contains the number of allocated bytes on disk for the file, or empty if the size is invalid | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/NativeAccess.java | 76 | [
"file",
"size"
] | void | true | 1 | 6.48 | elastic/elasticsearch | 75,680 | javadoc | false |
getMainMethod | private Method getMainMethod(Class<?> mainClass) throws Exception {
try {
return mainClass.getDeclaredMethod("main", String[].class);
}
catch (NoSuchMethodException ex) {
return mainClass.getDeclaredMethod("main");
}
} | Launch the application given the archive file and a fully configured classloader.
@param classLoader the classloader
@param mainClassName the main class to run
@param args the incoming arguments
@throws Exception if the launch fails | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/Launcher.java | 110 | [
"mainClass"
] | Method | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
partition | def partition(a, sep):
"""
Partition each element in ``a`` around ``sep``.
For each element in ``a``, split the element at the first
occurrence of ``sep``, and return a 3-tuple containing the part
before the separator, the separator itself, and the part after
the separator. If the separator is ... | Partition each element in ``a`` around ``sep``.
For each element in ``a``, split the element at the first
occurrence of ``sep``, and return a 3-tuple containing the part
before the separator, the separator itself, and the part after
the separator. If the separator is not found, the first item of
the tuple will contain... | python | numpy/_core/strings.py | 1,538 | [
"a",
"sep"
] | false | 3 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
findDefaultEditor | private @Nullable PropertyEditor findDefaultEditor(@Nullable Class<?> requiredType) {
PropertyEditor editor = null;
if (requiredType != null) {
// No custom editor -> check BeanWrapperImpl's default editors.
editor = this.propertyEditorRegistry.getDefaultEditor(requiredType);
if (editor == null && String.c... | Find a default editor for the given type.
@param requiredType the type to find an editor for
@return the corresponding editor, or {@code null} if none | java | spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java | 337 | [
"requiredType"
] | PropertyEditor | true | 4 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
from_dataframe | def from_dataframe(df, allow_copy: bool = True) -> pd.DataFrame:
"""
Build a ``pd.DataFrame`` from any DataFrame supporting the interchange protocol.
.. note::
For new development, we highly recommend using the Arrow C Data Interface
alongside the Arrow PyCapsule Interface instead of the int... | Build a ``pd.DataFrame`` from any DataFrame supporting the interchange protocol.
.. note::
For new development, we highly recommend using the Arrow C Data Interface
alongside the Arrow PyCapsule Interface instead of the interchange protocol.
From pandas 3.0 onwards, `from_dataframe` uses the PyCapsule Interf... | python | pandas/core/interchange/from_dataframe.py | 42 | [
"df",
"allow_copy"
] | pd.DataFrame | true | 5 | 7.92 | pandas-dev/pandas | 47,362 | numpy | false |
maybeUpdateLeaderEpoch | void maybeUpdateLeaderEpoch(OptionalInt latestLeaderEpoch) {
if (latestLeaderEpoch.isPresent()
&& (currentLeaderEpoch.isEmpty() || currentLeaderEpoch.getAsInt() < latestLeaderEpoch.getAsInt())) {
log.trace("For {}, leader will be updated, currentLeaderEpoch: {}, attemptsWhenLeaderLastCha... | It will update the leader to which this batch will be produced for the ongoing attempt, if a newer leader is known.
@param latestLeaderEpoch latest leader's epoch. | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java | 113 | [
"latestLeaderEpoch"
] | void | true | 4 | 6.72 | apache/kafka | 31,560 | javadoc | false |
toSplitString | public String toSplitString() {
final String msgStr = Objects.toString(message, StringUtils.EMPTY);
final String formattedTime = formatSplitTime();
return msgStr.isEmpty() ? formattedTime : msgStr + StringUtils.SPACE + formattedTime;
} | Gets a summary of the last split time that this StopWatch recorded as a string.
<p>
The format used is ISO 8601-like, [<em>message</em> ]<em>hours</em>:<em>minutes</em>:<em>seconds</em>.<em>milliseconds</em>.
</p>
@return the split time as a String.
@since 2.1
@since 3.10 Returns the prefix {@code "message "} if the me... | java | src/main/java/org/apache/commons/lang3/time/StopWatch.java | 799 | [] | String | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
move_to | def move_to(*arrays, xp, device):
"""Move all arrays to `xp` and `device`.
Each array will be moved to the reference namespace and device if
it is not already using it. Otherwise the array is left unchanged.
`array` may contain `None` entries, these are left unchanged.
Sparse arrays are accepted ... | Move all arrays to `xp` and `device`.
Each array will be moved to the reference namespace and device if
it is not already using it. Otherwise the array is left unchanged.
`array` may contain `None` entries, these are left unchanged.
Sparse arrays are accepted (as pass through) if the reference namespace is
NumPy, in... | python | sklearn/utils/_array_api.py | 466 | [
"xp",
"device"
] | false | 14 | 6.16 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
nextCheckIntervalData | private CheckIntervalData nextCheckIntervalData(final int increment,
final CheckIntervalData currentData, final State currentState, final long time) {
final CheckIntervalData nextData;
if (stateStrategy(currentState).isCheckIntervalFinished(this, currentData, time)) {
nextData = ... | Calculates the next {@link CheckIntervalData} object based on the current data and
the current state. The next data object takes the counter increment and the current
time into account.
@param increment the increment for the internal counter
@param currentData the current check data object
@param currentState the curre... | java | src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java | 504 | [
"increment",
"currentData",
"currentState",
"time"
] | CheckIntervalData | true | 2 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
contains | public boolean contains(final String str) {
return indexOf(str, 0) >= 0;
} | Checks if the string builder contains the specified string.
@param str the string to find
@return true if the builder contains the string | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,635 | [
"str"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
isAutowirable | public static boolean isAutowirable(Parameter parameter, int parameterIndex) {
Assert.notNull(parameter, "Parameter must not be null");
AnnotatedElement annotatedParameter = getEffectiveAnnotatedParameter(parameter, parameterIndex);
return (AnnotatedElementUtils.hasAnnotation(annotatedParameter, Autowired.class) ... | Determine if the supplied {@link Parameter} can <em>potentially</em> be
autowired from an {@link AutowireCapableBeanFactory}.
<p>Returns {@code true} if the supplied parameter is annotated or
meta-annotated with {@link Autowired @Autowired},
{@link Qualifier @Qualifier}, or {@link Value @Value}.
<p>Note that {@link #re... | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/ParameterResolutionDelegate.java | 84 | [
"parameter",
"parameterIndex"
] | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
isPrototype | @Override
public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
String beanName = BeanFactoryUtils.transformedBeanName(name);
Object bean = obtainBean(beanName);
return (!BeanFactoryUtils.isFactoryDereference(name) &&
((bean instanceof SmartFactoryBean<?> smartFactoryBean && smartFac... | Add a new singleton bean.
<p>Will overwrite any existing instance for the given name.
@param name the name of the bean
@param bean the bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java | 223 | [
"name"
] | true | 5 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
shouldSkip | public boolean shouldSkip(AnnotatedTypeMetadata metadata) {
return shouldSkip(metadata, null);
} | Determine if an item should be skipped based on {@code @Conditional} annotations.
The {@link ConfigurationPhase} will be deduced from the type of item (i.e. a
{@code @Configuration} class will be {@link ConfigurationPhase#PARSE_CONFIGURATION})
@param metadata the meta data
@return if the item should be skipped | java | spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java | 71 | [
"metadata"
] | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false | |
decimal_encoder | def decimal_encoder(dec_value: Decimal) -> Union[int, float]:
"""
Encodes a Decimal as int if there's no exponent, otherwise float
This is useful when we use ConstrainedDecimal to represent Numeric(x,0)
where an integer (but not int typed) is used. Encoding this as a float
results in failed round-t... | Encodes a Decimal as int if there's no exponent, otherwise float
This is useful when we use ConstrainedDecimal to represent Numeric(x,0)
where an integer (but not int typed) is used. Encoding this as a float
results in failed round-tripping between encode and parse.
Our Id type is a prime example of this.
>>> decimal... | python | fastapi/encoders.py | 38 | [
"dec_value"
] | Union[int, float] | true | 4 | 7.12 | tiangolo/fastapi | 93,264 | unknown | false |
toString | @Override
public String toString() {
return "(timestamp=" + timestamp +
", leaderEpoch=" + leaderEpoch.orElse(null) +
", offset=" + offset + ")";
} | Get the leader epoch corresponding to the offset that was found (if one exists).
This can be provided to seek() to ensure that the log hasn't been truncated prior to fetching.
@return The leader epoch or empty if it is not known | java | clients/src/main/java/org/apache/kafka/clients/consumer/OffsetAndTimestamp.java | 64 | [] | String | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
equals | @Override
public boolean equals(@Nullable Object object) {
if (object instanceof SipHashFunction) {
SipHashFunction other = (SipHashFunction) object;
return (c == other.c) && (d == other.d) && (k0 == other.k0) && (k1 == other.k1);
}
return false;
} | @param c the number of compression rounds (must be positive)
@param d the number of finalization rounds (must be positive)
@param k0 the first half of the key
@param k1 the second half of the key | java | android/guava/src/com/google/common/hash/SipHashFunction.java | 83 | [
"object"
] | true | 5 | 6.4 | google/guava | 51,352 | javadoc | false | |
reentrantReadWriteLockVisitor | public static <O> ReadWriteLockVisitor<O> reentrantReadWriteLockVisitor(final O object) {
return create(object, new ReentrantReadWriteLock());
} | Creates a new instance of {@link ReadWriteLockVisitor} with the given object.
@param <O> The type of the object to protect.
@param object The object to protect.
@return A new {@link ReadWriteLockVisitor}.
@see LockingVisitors | java | src/main/java/org/apache/commons/lang3/concurrent/locks/LockingVisitors.java | 734 | [
"object"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
isStartOfFunctionTypeOrConstructorType | function isStartOfFunctionTypeOrConstructorType(): boolean {
if (token() === SyntaxKind.LessThanToken) {
return true;
}
if (token() === SyntaxKind.OpenParenToken && lookAhead(isUnambiguouslyStartOfFunctionType)) {
return true;
}
return token() === S... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 4,852 | [] | true | 6 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
findThreadGroups | @Deprecated
public static Collection<ThreadGroup> findThreadGroups(final ThreadGroupPredicate predicate) {
return findThreadGroups(getSystemThreadGroup(), true, predicate);
} | Finds all active thread groups which match the given predicate.
@param predicate the predicate.
@return An unmodifiable {@link Collection} of active thread groups matching the given predicate.
@throws NullPointerException if the predicate is null.
@throws SecurityException if the current thread cannot access the sys... | java | src/main/java/org/apache/commons/lang3/ThreadUtils.java | 297 | [
"predicate"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
get | def get(self: Self, key: Key) -> Value | None:
"""
Retrieve a value from the cache.
Args:
key (Key): The key to look up.
Returns:
Value | None: The cached value if present and version matches, else None.
Raises:
CacheError: If the value is corr... | Retrieve a value from the cache.
Args:
key (Key): The key to look up.
Returns:
Value | None: The cached value if present and version matches, else None.
Raises:
CacheError: If the value is corrupted or cannot be unpickled.
Side Effects:
Removes stale cache files if the version prefix does not match. | python | torch/_inductor/cache.py | 323 | [
"self",
"key"
] | Value | None | true | 4 | 8.24 | pytorch/pytorch | 96,034 | google | false |
isCompatIPv4Address | public static boolean isCompatIPv4Address(Inet6Address ip) {
if (!ip.isIPv4CompatibleAddress()) {
return false;
}
byte[] bytes = ip.getAddress();
if ((bytes[12] == 0)
&& (bytes[13] == 0)
&& (bytes[14] == 0)
&& ((bytes[15] == 0) || (bytes[15] == 1))) {
return false;
... | Evaluates whether the argument is an IPv6 "compat" address.
<p>An "IPv4 compatible", or "compat", address is one with 96 leading bits of zero, with the
remaining 32 bits interpreted as an IPv4 address. These are conventionally represented in
string literals as {@code "::192.168.0.1"}, though {@code "::c0a8:1"} is also ... | java | android/guava/src/com/google/common/net/InetAddresses.java | 679 | [
"ip"
] | true | 7 | 7.6 | google/guava | 51,352 | javadoc | false | |
visitParameter | function visitParameter(node: ParameterDeclaration) {
if (parameterIsThisKeyword(node)) {
return undefined;
}
const updated = factory.updateParameterDeclaration(
node,
visitNodes(node.modifiers, node => isDecorator(node) ? visitor(node) : undefined, is... | Determines whether to emit an accessor declaration. We should not emit the
declaration if it does not have a body and is abstract.
@param node The declaration node. | typescript | src/compiler/transformers/ts.ts | 1,603 | [
"node"
] | false | 4 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getProperty | static String getProperty(final String property, final Supplier<String> defaultIfAbsent) {
try {
if (StringUtils.isEmpty(property)) {
return Suppliers.get(defaultIfAbsent);
}
return StringUtils.getIfEmpty(System.getProperty(property), defaultIfAbsent);
... | Gets a System property, defaulting to {@code null} if the property cannot be read.
<p>
If a {@link SecurityException} is caught, the return value is {@code null}.
</p>
@param property the system property name.
@param defaultIfAbsent get this Supplier when the property is empty or throws SecurityException.
@retur... | java | src/main/java/org/apache/commons/lang3/SystemProperties.java | 3,908 | [
"property",
"defaultIfAbsent"
] | String | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
read | function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
// This function will be called by both CJS and ESM, so we need to make sure
// non-null attributes are converted to strings.
const parsed = modulesBinding.readPackageJSON(
jsonPath,
isESM,
base == null ? undefined : `${base}`,
s... | Reads a package.json file and returns the parsed contents.
@param {string} jsonPath
@param {{
base?: URL | string,
specifier?: URL | string,
isESM?: boolean,
}} options
@returns {PackageConfig} | javascript | lib/internal/modules/package_json_reader.js | 113 | [
"jsonPath"
] | false | 3 | 6.08 | nodejs/node | 114,839 | jsdoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.