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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
validate_bool_kwarg | def validate_bool_kwarg(
value: BoolishNoneT,
arg_name: str,
none_allowed: bool = True,
int_allowed: bool = False,
) -> BoolishNoneT:
"""
Ensure that argument passed in arg_name can be interpreted as boolean.
Parameters
----------
value : bool
Value to be validated.
arg_... | Ensure that argument passed in arg_name can be interpreted as boolean.
Parameters
----------
value : bool
Value to be validated.
arg_name : str
Name of the argument. To be reflected in the error message.
none_allowed : bool, default True
Whether to consider None to be a valid boolean.
int_allowed : bool, d... | python | pandas/util/_validators.py | 228 | [
"value",
"arg_name",
"none_allowed",
"int_allowed"
] | BoolishNoneT | true | 6 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
preinitialize | private void preinitialize() {
Runner runner = new Runner(this.factoriesLoader.load(BackgroundPreinitializer.class));
try {
Thread thread = new Thread(runner, "background-preinit");
thread.start();
}
catch (Exception ex) {
// This will fail on Google App Engine where creating threads is
// prohibite... | System property that instructs Spring Boot how to run pre initialization. When the
property is set to {@code true}, no pre-initialization happens and each item is
initialized in the foreground as it needs to. When the property is {@code false}
(default), pre initialization runs in a separate thread in the background. | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/preinitialize/BackgroundPreinitializingApplicationListener.java | 98 | [] | void | true | 2 | 7.2 | spring-projects/spring-boot | 79,428 | javadoc | false |
itertuples | def itertuples(
self, index: bool = True, name: str | None = "Pandas"
) -> Iterable[tuple[Any, ...]]:
"""
Iterate over DataFrame rows as namedtuples.
Parameters
----------
index : bool, default True
If True, return the index as the first element of the tu... | Iterate over DataFrame rows as namedtuples.
Parameters
----------
index : bool, default True
If True, return the index as the first element of the tuple.
name : str or None, default "Pandas"
The name of the returned namedtuples or None to return regular
tuples.
Returns
-------
iterator
An object to it... | python | pandas/core/frame.py | 1,598 | [
"self",
"index",
"name"
] | Iterable[tuple[Any, ...]] | true | 3 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
max_cookie_size | def max_cookie_size(self) -> int: # type: ignore
"""Read-only view of the :data:`MAX_COOKIE_SIZE` config key.
See :attr:`~werkzeug.wrappers.Response.max_cookie_size` in
Werkzeug's docs.
"""
if current_app:
return current_app.config["MAX_COOKIE_SIZE"] # type: ignore... | Read-only view of the :data:`MAX_COOKIE_SIZE` config key.
See :attr:`~werkzeug.wrappers.Response.max_cookie_size` in
Werkzeug's docs. | python | src/flask/wrappers.py | 247 | [
"self"
] | int | true | 2 | 6.56 | pallets/flask | 70,946 | unknown | false |
getCollectionElementType | private TypeMirror getCollectionElementType(TypeMirror type) {
if (((TypeElement) this.types.asElement(type)).getQualifiedName().contentEquals(Collection.class.getName())) {
DeclaredType declaredType = (DeclaredType) type;
// raw type, just "Collection"
if (declaredType.getTypeArguments().isEmpty()) {
re... | Extract the target element type from the specified container type or {@code null}
if no element type was found.
@param type a type, potentially wrapping an element type
@return the element type or {@code null} if no specific type was found | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | 154 | [
"type"
] | TypeMirror | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
asarray | def asarray(a, dtype=None, order=None):
"""
Convert the input to a masked array of the given data-type.
No copy is performed if the input is already an `ndarray`. If `a` is
a subclass of `MaskedArray`, a base class `MaskedArray` is returned.
Parameters
----------
a : array_like
Inp... | Convert the input to a masked array of the given data-type.
No copy is performed if the input is already an `ndarray`. If `a` is
a subclass of `MaskedArray`, a base class `MaskedArray` is returned.
Parameters
----------
a : array_like
Input data, in any form that can be converted to a masked array. This
inclu... | python | numpy/ma/core.py | 8,555 | [
"a",
"dtype",
"order"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
_maybe_adjust_name | def _maybe_adjust_name(name: str, version: Sequence[int]) -> str:
"""
Prior to 0.10.1, we named values blocks like: values_block_0 and the
name values_0, adjust the given name if necessary.
Parameters
----------
name : str
version : Tuple[int, int, int]
Returns
-------
str
... | Prior to 0.10.1, we named values blocks like: values_block_0 and the
name values_0, adjust the given name if necessary.
Parameters
----------
name : str
version : Tuple[int, int, int]
Returns
-------
str | python | pandas/io/pytables.py | 5,391 | [
"name",
"version"
] | str | true | 7 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
dot | def dot(lhs: Any, rhs: Any, sum_dims: Any) -> Union[_Tensor, torch.Tensor]:
"""
Perform dot product between two tensors along specified dimensions.
Args:
lhs: Left-hand side tensor
rhs: Right-hand side tensor
sum_dims: Dimensions to sum over (contract)
Returns:
Result o... | Perform dot product between two tensors along specified dimensions.
Args:
lhs: Left-hand side tensor
rhs: Right-hand side tensor
sum_dims: Dimensions to sum over (contract)
Returns:
Result of dot product | python | functorch/dim/__init__.py | 1,399 | [
"lhs",
"rhs",
"sum_dims"
] | Union[_Tensor, torch.Tensor] | true | 22 | 6.32 | pytorch/pytorch | 96,034 | google | false |
heartbeatIntervalForResponse | public abstract long heartbeatIntervalForResponse(R response); | Returns the heartbeat interval for the response.
@param response The heartbeat response
@return The heartbeat interval | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractHeartbeatRequestManager.java | 523 | [
"response"
] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
_discover_hooks_from_connection_types | def _discover_hooks_from_connection_types(
self,
hook_class_names_registered: set[str],
already_registered_warning_connection_types: set[str],
package_name: str,
provider: ProviderInfo,
):
"""
Discover hooks from the "connection-types" property.
This ... | Discover hooks from the "connection-types" property.
This is new, better method that replaces discovery from hook-class-names as it
allows to lazy import individual Hook classes when they are accessed.
The "connection-types" keeps information about both - connection type and class
name so we can discover all connectio... | python | airflow-core/src/airflow/providers_manager.py | 613 | [
"self",
"hook_class_names_registered",
"already_registered_warning_connection_types",
"package_name",
"provider"
] | true | 7 | 7.52 | apache/airflow | 43,597 | sphinx | false | |
newTreeMap | @SuppressWarnings("NonApiType") // acts as a direct substitute for a constructor call
public static <K extends @Nullable Object, V extends @Nullable Object> TreeMap<K, V> newTreeMap(
SortedMap<K, ? extends V> map) {
return new TreeMap<>(map);
} | Creates a <i>mutable</i> {@code TreeMap} instance with the same mappings as the specified map
and using the same ordering as the specified map.
<p><b>Note:</b> if mutability is not required, use {@link
ImmutableSortedMap#copyOfSorted(SortedMap)} instead.
<p><b>Note:</b> this method is now unnecessary and should be trea... | java | android/guava/src/com/google/common/collect/Maps.java | 384 | [
"map"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
is_number | def is_number(obj: object) -> TypeGuard[Number | np.number]:
"""
Check if the object is a number.
Returns True when the object is a number, and False if is not.
Parameters
----------
obj : any type
The object to check if is a number.
Returns
-------
bool
Whether `o... | Check if the object is a number.
Returns True when the object is a number, and False if is not.
Parameters
----------
obj : any type
The object to check if is a number.
Returns
-------
bool
Whether `obj` is a number or not.
See Also
--------
api.types.is_integer: Checks a subgroup of numbers.
Examples
----... | python | pandas/core/dtypes/inference.py | 40 | [
"obj"
] | TypeGuard[Number | np.number] | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false |
get | private static ResourceLoader get(ResourceLoader resourceLoader, SpringFactoriesLoader springFactoriesLoader,
boolean preferFileResolution) {
Assert.notNull(resourceLoader, "'resourceLoader' must not be null");
Assert.notNull(springFactoriesLoader, "'springFactoriesLoader' must not be null");
List<ProtocolReso... | Return a {@link ResourceLoader} delegating to the given resource loader and
supporting additional {@link ProtocolResolver ProtocolResolvers} registered in
{@code spring.factories}.
@param resourceLoader the delegate resource loader
@param springFactoriesLoader the {@link SpringFactoriesLoader} used to load
{@link Proto... | java | core/spring-boot/src/main/java/org/springframework/boot/io/ApplicationResourceLoader.java | 159 | [
"resourceLoader",
"springFactoriesLoader",
"preferFileResolution"
] | ResourceLoader | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
withTimeout | public CloseOptions withTimeout(final Duration timeout) {
this.timeout = Optional.ofNullable(timeout);
return this;
} | Fluent method to set the timeout for the close process.
@param timeout the maximum time to wait for the consumer to close. If {@code null}, the default timeout will be used.
@return this {@code CloseOptions} instance. | java | clients/src/main/java/org/apache/kafka/clients/consumer/CloseOptions.java | 89 | [
"timeout"
] | CloseOptions | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
toString | @Override
public String toString() {
StringBuilder bld = new StringBuilder("TAGGED_FIELDS_TYPE_NAME(");
String prefix = "";
for (Map.Entry<Integer, Field> field : fields.entrySet()) {
bld.append(prefix);
prefix = ", ";
bld.append(field.getKey()).append(" -... | Create a new TaggedFields object with the given tags and fields.
@param fields This is an array containing Integer tags followed
by associated Field objects.
@return The new {@link TaggedFields} | java | clients/src/main/java/org/apache/kafka/common/protocol/types/TaggedFields.java | 134 | [] | String | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false |
isASCIINumber | function isASCIINumber (value) {
if (value.length === 0) return false
for (let i = 0; i < value.length; i++) {
if (value.charCodeAt(i) < 0x30 || value.charCodeAt(i) > 0x39) return false
}
return true
} | Checks if the given value is a base 10 digit.
@param {string} value
@returns {boolean} | javascript | deps/undici/src/lib/web/eventsource/util.js | 18 | [
"value"
] | false | 5 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
bucket_fsdp_all_gather | def bucket_fsdp_all_gather(
gm: torch.fx.GraphModule,
bucket_cap_mb_by_bucket_idx: Callable[[int], float] | None = None,
mode: BucketMode = "default",
) -> None:
"""
Bucketing pass for SimpleFSDP all_gather ops.
Attributes:
gm (torch.fx.GraphModule): Graph module of the graph.
b... | Bucketing pass for SimpleFSDP all_gather ops.
Attributes:
gm (torch.fx.GraphModule): Graph module of the graph.
bucket_cap_mb_by_bucket_idx (Callable[[int], float] | None): callback function that
takes in bucket id and returns size of a bucket in megabytes. | python | torch/_inductor/fx_passes/fsdp.py | 57 | [
"gm",
"bucket_cap_mb_by_bucket_idx",
"mode"
] | None | true | 3 | 6.4 | pytorch/pytorch | 96,034 | unknown | false |
allow_in_pre_dispatch_graph | def allow_in_pre_dispatch_graph(func):
"""
Experimental decorator that adds user function to export pre-dispatch graph. Note that
we only support custom autograd function/subclass constructors today. To use this function:
1. For subclasses:
1. refer to instructions in mark_subclass_const... | Experimental decorator that adds user function to export pre-dispatch graph. Note that
we only support custom autograd function/subclass constructors today. To use this function:
1. For subclasses:
1. refer to instructions in mark_subclass_constructor_exportable_experimental
2. Define apply method on yo... | python | torch/_export/wrappers.py | 254 | [
"func"
] | false | 8 | 6.96 | pytorch/pytorch | 96,034 | unknown | false | |
asConfigurationPropertyName | private ConfigurationPropertyName asConfigurationPropertyName(ConfigurationMetadataProperty metadataProperty) {
return ConfigurationPropertyName.isValid(metadataProperty.getId())
? ConfigurationPropertyName.of(metadataProperty.getId())
: ConfigurationPropertyName.adapt(metadataProperty.getId(), '.');
} | Analyse the {@link ConfigurableEnvironment environment} and attempt to rename
legacy properties if a replacement exists.
@return a report of the migration | java | core/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java | 134 | [
"metadataProperty"
] | ConfigurationPropertyName | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
_validate_apply_axis_arg | def _validate_apply_axis_arg(
arg: NDFrame | Sequence | np.ndarray,
arg_name: str,
dtype: Any | None,
data: NDFrame,
) -> np.ndarray:
"""
For the apply-type methods, ``axis=None`` creates ``data`` as DataFrame, and for
``axis=[1,0]`` it creates a Series. Where ``arg`` is expected as an eleme... | For the apply-type methods, ``axis=None`` creates ``data`` as DataFrame, and for
``axis=[1,0]`` it creates a Series. Where ``arg`` is expected as an element
of some operator with ``data`` we must make sure that the two are compatible shapes,
or raise.
Parameters
----------
arg : sequence, Series or DataFrame
the u... | python | pandas/io/formats/style.py | 3,882 | [
"arg",
"arg_name",
"dtype",
"data"
] | np.ndarray | true | 9 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
add | def add(self, *, caller, callee):
"""Add a method mapping.
Parameters
----------
caller : str
Parent estimator's method name in which the ``callee`` is called.
callee : str
Child object's method name. This method is called in ``caller``.
Return... | Add a method mapping.
Parameters
----------
caller : str
Parent estimator's method name in which the ``callee`` is called.
callee : str
Child object's method name. This method is called in ``caller``.
Returns
-------
self : MethodMapping
Returns self. | python | sklearn/utils/_metadata_requests.py | 775 | [
"self",
"caller",
"callee"
] | false | 3 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
hangup | public ExitStatus hangup() {
return new ExitStatus(this.code, this.name, true);
} | Convert the existing code to a hangup.
@return a new ExitStatus with hangup=true | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/status/ExitStatus.java | 95 | [] | ExitStatus | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
fnv32_BROKEN | constexpr uint32_t fnv32_BROKEN(
const char* buf, uint32_t hash = fnv32_hash_start) noexcept {
for (; *buf; ++buf) {
hash = fnv32_append_byte_BROKEN(hash, static_cast<uint8_t>(*buf));
}
return hash;
} | FNV hash of a c-str.
Continues hashing until a null byte is reached.
@param hash The initial hash seed.
@methodset fnv | cpp | folly/hash/FnvHash.h | 101 | [] | true | 2 | 7.04 | facebook/folly | 30,157 | doxygen | false | |
verifyFullFetchResponsePartitions | String verifyFullFetchResponsePartitions(Set<TopicPartition> topicPartitions, Set<Uuid> ids, short version) {
StringBuilder bld = new StringBuilder();
Set<TopicPartition> extra =
findMissing(topicPartitions, sessionPartitions.keySet());
Set<TopicPartition> omitted =
findM... | Verify that a full fetch response contains all the partitions in the fetch session.
@param topicPartitions The topicPartitions from the FetchResponse.
@param ids The topic IDs from the FetchResponse.
@param version The version of the FetchResponse.
@return null if the full fetch r... | java | clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java | 431 | [
"topicPartitions",
"ids",
"version"
] | String | true | 8 | 7.6 | apache/kafka | 31,560 | javadoc | false |
throwableMembers | private static void throwableMembers(Members<ILoggingEvent> members, Extractor extractor) {
members.add("full_message", extractor::messageAndStackTrace);
members.add("_error_type", ILoggingEvent::getThrowableProxy).as(IThrowableProxy::getClassName);
members.add("_error_stack_trace", extractor::stackTrace);
memb... | GELF requires "seconds since UNIX epoch with optional <b>decimal places for
milliseconds</b>". To comply with this requirement, we format a POSIX timestamp
with millisecond precision as e.g. "1725459730385" -> "1725459730.385"
@param timeStamp the timestamp of the log message
@return the timestamp formatted as string w... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java | 127 | [
"members",
"extractor"
] | void | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
describeClassicGroups | DescribeClassicGroupsResult describeClassicGroups(Collection<String> groupIds,
DescribeClassicGroupsOptions options); | Describe some classic groups in the cluster.
@param groupIds The IDs of the groups to describe.
@param options The options to use when describing the groups.
@return The DescribeClassicGroupsResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 2,067 | [
"groupIds",
"options"
] | DescribeClassicGroupsResult | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
preferredReadReplica | public static Optional<Integer> preferredReadReplica(FetchResponseData.PartitionData partitionResponse) {
return partitionResponse.preferredReadReplica() == INVALID_PREFERRED_REPLICA_ID ? Optional.empty()
: Optional.of(partitionResponse.preferredReadReplica());
} | Convenience method to find the size of a response.
@param version The version of the response to use.
@param partIterator The partition iterator.
@return The response size in bytes. | java | clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java | 188 | [
"partitionResponse"
] | true | 2 | 8 | apache/kafka | 31,560 | javadoc | false | |
createDefaultBeanWiringInfoResolver | protected @Nullable BeanWiringInfoResolver createDefaultBeanWiringInfoResolver() {
return new ClassNameBeanWiringInfoResolver();
} | Create the default BeanWiringInfoResolver to be used if none was
specified explicitly.
<p>The default implementation builds a {@link ClassNameBeanWiringInfoResolver}.
@return the default BeanWiringInfoResolver (never {@code null}) | java | spring-beans/src/main/java/org/springframework/beans/factory/wiring/BeanConfigurerSupport.java | 93 | [] | BeanWiringInfoResolver | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
_check_for_bom | def _check_for_bom(self, first_row: list[Scalar]) -> list[Scalar]:
"""
Checks whether the file begins with the BOM character.
If it does, remove it. In addition, if there is quoting
in the field subsequent to the BOM, remove it as well
because it technically takes place at the be... | Checks whether the file begins with the BOM character.
If it does, remove it. In addition, if there is quoting
in the field subsequent to the BOM, remove it as well
because it technically takes place at the beginning of
the name, not the middle of it. | python | pandas/io/parsers/python_parser.py | 824 | [
"self",
"first_row"
] | list[Scalar] | true | 9 | 6 | pandas-dev/pandas | 47,362 | unknown | 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, else None.
""" | Retrieve a value from the cache.
Args:
key (Key): The key to look up.
Returns:
Value | None: The cached value if present, else None. | python | torch/_inductor/cache.py | 43 | [
"self",
"key"
] | Value | None | true | 1 | 6.56 | pytorch/pytorch | 96,034 | google | false |
table_exists | def table_exists(self, table: str) -> bool:
"""
Check if a table exists in Cassandra.
:param table: Target Cassandra table.
Use dot notation to target a specific keyspace.
"""
keyspace = self.keyspace
if "." in table:
keyspace, table = t... | Check if a table exists in Cassandra.
:param table: Target Cassandra table.
Use dot notation to target a specific keyspace. | python | providers/apache/cassandra/src/airflow/providers/apache/cassandra/hooks/cassandra.py | 176 | [
"self",
"table"
] | bool | true | 3 | 6.72 | apache/airflow | 43,597 | sphinx | false |
insertCaptureThisForNodeIfNeeded | function insertCaptureThisForNodeIfNeeded(statements: Statement[], node: Node): boolean {
if (hierarchyFacts & HierarchyFacts.CapturedLexicalThis && node.kind !== SyntaxKind.ArrowFunction) {
insertCaptureThisForNode(statements, node, factory.createThis());
return true;
}
... | Adds a statement to capture the `this` of a function declaration if it is needed.
NOTE: This must be executed *after* the subtree has been visited.
@param statements The statements for the new function body.
@param node A node. | typescript | src/compiler/transformers/es2015.ts | 2,151 | [
"statements",
"node"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
immutableEnumMap | public static <K extends Enum<K>, V> ImmutableMap<K, V> immutableEnumMap(
Map<K, ? extends V> map) {
if (map instanceof ImmutableEnumMap) {
@SuppressWarnings("unchecked") // safe covariant cast
ImmutableEnumMap<K, V> result = (ImmutableEnumMap<K, V>) map;
return result;
}
Iterator<? ... | Returns an immutable map instance containing the given entries. Internally, the returned map
will be backed by an {@link EnumMap}.
<p>The iteration order of the returned map follows the enum's iteration order, not the order in
which the elements appear in the given map.
@param map the map to make an immutable copy of
@... | java | android/guava/src/com/google/common/collect/Maps.java | 127 | [
"map"
] | true | 4 | 8.08 | google/guava | 51,352 | javadoc | false | |
sensor | public Sensor sensor(String name) {
return this.sensor(name, Sensor.RecordingLevel.INFO);
} | Get or create a sensor with the given unique name and no parent sensors. This uses
a default recording level of INFO.
@param name The sensor name
@return The sensor | java | clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java | 325 | [
"name"
] | Sensor | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
reverse | public static void reverse(TDigestIntArray order, int offset, int length) {
for (int i = 0; i < length / 2; i++) {
int t = order.get(offset + i);
order.set(offset + i, order.get(offset + length - i - 1));
order.set(offset + length - i - 1, t);
}
} | Reverses part of an array.
@param order The array containing the data to reverse.
@param offset Where to start reversing.
@param length How many elements to reverse | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/Sort.java | 190 | [
"order",
"offset",
"length"
] | void | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
withPrefix | default ConfigurationPropertySource withPrefix(@Nullable String prefix) {
return (StringUtils.hasText(prefix)) ? new PrefixedConfigurationPropertySource(this, prefix) : this;
} | Return a variant of this source that supports a prefix.
@param prefix the prefix for properties in the source
@return a {@link ConfigurationPropertySource} instance supporting a prefix
@since 2.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySource.java | 86 | [
"prefix"
] | ConfigurationPropertySource | true | 2 | 7.84 | spring-projects/spring-boot | 79,428 | javadoc | false |
_lstsq | def _lstsq(X, y, indices, fit_intercept):
"""Least Squares Estimator for TheilSenRegressor class.
This function calculates the least squares method on a subset of rows of X
and y defined by the indices array. Optionally, an intercept column is
added if intercept is set to true.
Parameters
----... | Least Squares Estimator for TheilSenRegressor class.
This function calculates the least squares method on a subset of rows of X
and y defined by the indices array. Optionally, an intercept column is
added if intercept is set to true.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Design mat... | python | sklearn/linear_model/_theil_sen.py | 163 | [
"X",
"y",
"indices",
"fit_intercept"
] | false | 2 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
supportsType | default boolean supportsType(Class<?> type) {
Class<?> objectType = getObjectType();
return (objectType != null && type.isAssignableFrom(objectType));
} | Determine whether this factory supports the requested type.
<p>By default, this supports the primary type exposed by the factory, as
indicated by {@link #getObjectType()}. Specific factories may support
additional types for dependency injection.
@param type the requested type
@return {@code true} if {@link #getObject(C... | java | spring-beans/src/main/java/org/springframework/beans/factory/SmartFactoryBean.java | 85 | [
"type"
] | true | 2 | 7.36 | spring-projects/spring-framework | 59,386 | javadoc | false | |
flatten | private void flatten(@Nullable String prefix, Map<String, Object> result, Map<String, Object> map) {
String namePrefix = (prefix != null) ? prefix + "." : "";
map.forEach((key, value) -> extract(namePrefix + key, result, value));
} | Flatten the map keys using period separator.
@param map the map that should be flattened
@return the flattened map | java | core/spring-boot/src/main/java/org/springframework/boot/support/SpringApplicationJsonEnvironmentPostProcessor.java | 125 | [
"prefix",
"result",
"map"
] | void | true | 2 | 8.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
_has_same_id_matched_objs | def _has_same_id_matched_objs(frame: DynamoFrameType, cache_entry: Any) -> bool:
"""
Checks if the ID_MATCH'd objects saved on cache_entry are same as the ones
in frame.f_locals.
"""
if not cache_entry:
return False
for (
local_name,
weakref_from_cache_entry,
) in ca... | Checks if the ID_MATCH'd objects saved on cache_entry are same as the ones
in frame.f_locals. | python | torch/_dynamo/cache_size.py | 114 | [
"frame",
"cache_entry"
] | bool | true | 5 | 6 | pytorch/pytorch | 96,034 | unknown | false |
containsTypeVariables | public static boolean containsTypeVariables(final Type type) {
if (type instanceof TypeVariable<?>) {
return true;
}
if (type instanceof Class<?>) {
return ((Class<?>) type).getTypeParameters().length > 0;
}
if (type instanceof ParameterizedType) {
... | Tests, recursively, whether any of the type parameters associated with {@code type} are bound to variables.
@param type The type to check for type variables.
@return Whether any of the type parameters associated with {@code type} are bound to variables.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 373 | [
"type"
] | true | 8 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
isin | def isin(self, values) -> Series:
"""
Whether elements in Series are contained in `values`.
Return a boolean Series showing whether each element in the Series
matches an element in the passed sequence of `values` exactly.
Parameters
----------
values : set or li... | Whether elements in Series are contained in `values`.
Return a boolean Series showing whether each element in the Series
matches an element in the passed sequence of `values` exactly.
Parameters
----------
values : set or list-like
The sequence of values to test. Passing in a single string will
raise a ``Type... | python | pandas/core/series.py | 5,883 | [
"self",
"values"
] | Series | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
find_common_type | def find_common_type(types):
"""
Find a common data type among the given dtypes.
Parameters
----------
types : list of dtypes
Returns
-------
pandas extension or numpy dtype
See Also
--------
numpy.find_common_type
"""
if not types:
raise ValueError("no ty... | Find a common data type among the given dtypes.
Parameters
----------
types : list of dtypes
Returns
-------
pandas extension or numpy dtype
See Also
--------
numpy.find_common_type | python | pandas/core/dtypes/cast.py | 1,307 | [
"types"
] | false | 12 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false | |
notNull | @Deprecated
public static <T> T notNull(final T object) {
return notNull(object, DEFAULT_IS_NULL_EX_MESSAGE);
} | Validate that the specified argument is not {@code null};
otherwise throwing an exception.
<pre>Validate.notNull(myObject, "The object must not be null");</pre>
<p>The message of the exception is "The validated object is
null".
@param <T> the object type.
@param object the object to check.
@return the valida... | java | src/main/java/org/apache/commons/lang3/Validate.java | 1,041 | [
"object"
] | T | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
setupInspectorHooks | function setupInspectorHooks() {
// If Debugger.setAsyncCallStackDepth is sent during bootstrap,
// we cannot immediately call into JS to enable the hooks, which could
// interrupt the JS execution of bootstrap. So instead we save the
// notification in the inspector agent if it's sent in the middle of
// boo... | Patch the process object with legacy properties and normalizations.
Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.
Replace `process.argv[1]` with the resolved absolute file path of the entry point, if found.
@param {boolean} expandArgv1 - Whether to replac... | javascript | lib/internal/process/pre_execution.js | 490 | [] | false | 2 | 6.96 | nodejs/node | 114,839 | jsdoc | false | |
mirror_inductor_external_kernels | def mirror_inductor_external_kernels() -> None:
"""
Copy external kernels into Inductor so they are importable.
"""
cuda_is_disabled = not str2bool(os.getenv("USE_CUDA"))
paths = [
(
CWD / "torch/_inductor/kernel/vendored_templates/cutedsl_grouped_gemm.py",
CWD
... | Copy external kernels into Inductor so they are importable. | python | setup.py | 633 | [] | None | true | 9 | 6.88 | pytorch/pytorch | 96,034 | unknown | false |
_get_expected_output_shape | def _get_expected_output_shape(self) -> list:
"""Get the expected output shape from iteration variables.
Iteration variables are shaped for broadcasting. For 2D outputs:
- First var (e.g., y0) gets shape (1, N) - innermost dimension
- Second var (e.g., x1) gets shape (M, 1) - outermost ... | Get the expected output shape from iteration variables.
Iteration variables are shaped for broadcasting. For 2D outputs:
- First var (e.g., y0) gets shape (1, N) - innermost dimension
- Second var (e.g., x1) gets shape (M, 1) - outermost dimension
The broadcast result is (M, N). | python | torch/_inductor/codegen/pallas.py | 1,033 | [
"self"
] | list | true | 5 | 6 | pytorch/pytorch | 96,034 | unknown | false |
getElementsAnnotatedOrMetaAnnotatedWith | List<Element> getElementsAnnotatedOrMetaAnnotatedWith(Element element, TypeElement annotationType) {
LinkedList<Element> stack = new LinkedList<>();
stack.push(element);
collectElementsAnnotatedOrMetaAnnotatedWith(annotationType, stack);
stack.removeFirst();
return Collections.unmodifiableList(stack);
} | Collect the annotations that are annotated or meta-annotated with the specified
{@link TypeElement annotation}.
@param element the element to inspect
@param annotationType the annotation to discover
@return the annotations that are annotated or meta-annotated with this annotation | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 287 | [
"element",
"annotationType"
] | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
repeat | def repeat(self, repeats, axis: None = None) -> Self:
"""
Repeat elements of an Index.
Returns a new Index where each element of the current Index
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or array of ints
... | Repeat elements of an Index.
Returns a new Index where each element of the current Index
is repeated consecutively a given number of times.
Parameters
----------
repeats : int or array of ints
The number of repetitions for each element. This should be a
non-negative integer. Repeating 0 times will return an e... | python | pandas/core/indexes/base.py | 1,329 | [
"self",
"repeats",
"axis"
] | Self | true | 1 | 7.28 | pandas-dev/pandas | 47,362 | numpy | false |
containsElements | private boolean containsElements(final Collection<?> coll) {
if (coll == null || coll.isEmpty()) {
return false;
}
return coll.stream().anyMatch(Objects::nonNull);
} | Learn whether the specified Collection contains non-null elements.
@param coll to check
@return {@code true} if some Object was found, {@code false} otherwise. | java | src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java | 250 | [
"coll"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
_find_executor_class_name | def _find_executor_class_name() -> str | None:
"""Inspect the call stack looking for any executor classes and returning the first found."""
stack = inspect.stack()
# Fetch class objects on all frames, looking for one containing an executor (since it
# will inherit from BaseExecutor)
... | Inspect the call stack looking for any executor classes and returning the first found. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/base_aws.py | 553 | [] | str | None | true | 5 | 7.04 | apache/airflow | 43,597 | unknown | false |
toStringOnOff | public static String toStringOnOff(final boolean bool) {
return toString(bool, ON, OFF);
} | Converts a boolean to a String returning {@code 'on'}
or {@code 'off'}.
<pre>
BooleanUtils.toStringOnOff(true) = "on"
BooleanUtils.toStringOnOff(false) = "off"
</pre>
@param bool the Boolean to check
@return {@code 'on'}, {@code 'off'}, or {@code null} | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 1,056 | [
"bool"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
print_value_stack | def print_value_stack(
self, *, file: Optional[TextIO] = None, stacklevel: int = 0
) -> None:
"""
Print the current Python value stack. Note that this is NOT the same
as the traceback; use print_bt() to print that. Note that at
stacklevel=0, this will typically be empty, as... | Print the current Python value stack. Note that this is NOT the same
as the traceback; use print_bt() to print that. Note that at
stacklevel=0, this will typically be empty, as comptime cannot
currently be used in an expression context where there would be
intermediates on the stack. If you would find this useful, p... | python | torch/_dynamo/comptime.py | 258 | [
"self",
"file",
"stacklevel"
] | None | true | 2 | 6.88 | pytorch/pytorch | 96,034 | unknown | false |
flush | @SuppressWarnings("IdentifierName") // See Closeables.close
public static void flush(Flushable flushable, boolean swallowIOException) throws IOException {
try {
flushable.flush();
} catch (IOException e) {
if (swallowIOException) {
logger.log(Level.WARNING, "IOException thrown while flushi... | Flush a {@link Flushable}, with control over whether an {@code IOException} may be thrown.
<p>If {@code swallowIOException} is true, then we don't rethrow {@code IOException}, but merely
log it.
@param flushable the {@code Flushable} object to be flushed.
@param swallowIOException if true, don't propagate IO exceptions... | java | android/guava/src/com/google/common/io/Flushables.java | 51 | [
"flushable",
"swallowIOException"
] | void | true | 3 | 6.56 | google/guava | 51,352 | javadoc | false |
revoke_by_stamped_headers | def revoke_by_stamped_headers(state, headers, terminate=False, signal=None, **kwargs):
"""Revoke task by header (or list of headers).
Keyword Arguments:
headers(dictionary): Dictionary that contains stamping scheme name as keys and stamps as values.
If headers is a list, it... | Revoke task by header (or list of headers).
Keyword Arguments:
headers(dictionary): Dictionary that contains stamping scheme name as keys and stamps as values.
If headers is a list, it will be converted to a dictionary.
terminate (bool): Also terminate the process if the task is active... | python | celery/worker/control.py | 160 | [
"state",
"headers",
"terminate",
"signal"
] | false | 13 | 6.24 | celery/celery | 27,741 | unknown | false | |
transformEnumMemberDeclarationValue | function transformEnumMemberDeclarationValue(member: EnumMember, constantValue: string | number | undefined): Expression {
if (constantValue !== undefined) {
return typeof constantValue === "string" ? factory.createStringLiteral(constantValue) :
constantValue < 0 ? factory.createP... | Transforms the value of an enum member.
@param member The enum member node. | typescript | src/compiler/transformers/ts.ts | 1,948 | [
"member",
"constantValue"
] | true | 7 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
newMetadataRequestBuilder | @Override
public synchronized MetadataRequest.Builder newMetadataRequestBuilder() {
if (subscription.hasPatternSubscription()) {
// Consumer subscribed to client-side regex => request all topics to compute regex
return MetadataRequest.Builder.allTopics();
}
if (subscr... | Constructs a metadata request builder for fetching cluster metadata for the topics the consumer needs.
This will include:
<ul>
<li>topics the consumer is subscribed to using topic names (calls to subscribe with topic name list or client-side regex)</li>
<li>topics the consumer is subscribed to using topic IDs (... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMetadata.java | 80 | [] | true | 4 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
compare | public static int compare(final boolean x, final boolean y) {
if (x == y) {
return 0;
}
return x ? 1 : -1;
} | Compares two {@code boolean} values. This is the same functionality as provided in Java 7.
@param x the first {@code boolean} to compare
@param y the second {@code boolean} to compare
@return the value {@code 0} if {@code x == y};
a value less than {@code 0} if {@code !x && y}; and
a value greater than ... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 157 | [
"x",
"y"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return Objects.equals(this.text, ((PemContent) obj).text);
} | Parse and return the {@link PrivateKey private keys} from the PEM content or
{@code null} if there is no private key.
@param password the password to decrypt the private keys or {@code null}
@return the private keys | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemContent.java | 90 | [
"obj"
] | true | 4 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
parseMap | Map<String, Object> parseMap(@Nullable String json) throws JsonParseException; | Parse the specified JSON string into a Map.
@param json the JSON to parse
@return the parsed JSON as a map
@throws JsonParseException if the JSON cannot be parsed | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonParser.java | 42 | [
"json"
] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
wait_for_state | def wait_for_state(self, instance_id: str, target_state: str, check_interval: float) -> None:
"""
Wait EC2 instance until its state is equal to the target_state.
:param instance_id: id of the AWS EC2 instance
:param target_state: target state of instance
:param check_interval: t... | Wait EC2 instance until its state is equal to the target_state.
:param instance_id: id of the AWS EC2 instance
:param target_state: target state of instance
:param check_interval: time in seconds that the job should wait in
between each instance state checks until operation is completed
:return: None | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/ec2.py | 192 | [
"self",
"instance_id",
"target_state",
"check_interval"
] | None | true | 2 | 7.76 | apache/airflow | 43,597 | sphinx | false |
getProperty | @Override
public @Nullable Value getProperty(String name) {
PropertyFile propertyFile = this.propertyFiles.get(name);
return (propertyFile != null) ? propertyFile.getContent() : null;
} | Create a new {@link ConfigTreePropertySource} instance.
@param name the name of the property source
@param sourceDirectory the underlying source directory
@param options the property source options | java | core/spring-boot/src/main/java/org/springframework/boot/env/ConfigTreePropertySource.java | 125 | [
"name"
] | Value | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
startupTimes | ImmutableMap<Service, Long> startupTimes() {
List<Entry<Service, Long>> loadTimes;
monitor.enter();
try {
loadTimes = Lists.newArrayListWithCapacity(startupTimers.size());
// N.B. There will only be an entry in the map if the service has started
for (Entry<Service, Stopwatch> e... | Marks the {@link State} as ready to receive transitions. Returns true if no transitions have
been observed yet. | java | android/guava/src/com/google/common/util/concurrent/ServiceManager.java | 645 | [] | true | 3 | 7.2 | google/guava | 51,352 | javadoc | false | |
validateGenerators | async function validateGenerators(generators: GeneratorConfig[]): Promise<void> {
const binaryTarget = await getBinaryTargetForCurrentPlatform()
for (const generator of generators) {
if (generator.binaryTargets) {
const binaryTargets =
generator.binaryTargets && generator.binaryTargets.length > 0... | Shortcut for getGenerators, if there is only one generator defined. Useful for testing.
@param schemaPath path to schema.prisma
@param aliases Aliases like `photonjs` -> `node_modules/photonjs/gen.js`
@param version Version of the binary, commit hash of https://github.com/prisma/prisma-engine/commits/master
@param prin... | typescript | packages/internals/src/get-generators/getGenerators.ts | 355 | [
"generators"
] | true | 8 | 6.32 | prisma/prisma | 44,834 | jsdoc | true | |
pendingToString | @Override
protected final @Nullable String pendingToString() {
@RetainedLocalRef ImmutableCollection<? extends Future<?>> localFutures = futures;
if (localFutures != null) {
return "futures=" + localFutures;
}
return super.pendingToString();
} | The input futures. After {@link #init}, this field is read only by {@link #afterDone()} (to
propagate cancellation) and {@link #toString()}. To access the futures' <i>values</i>, {@code
AggregateFuture} attaches listeners that hold references to one or more inputs. And in the case
of {@link CombinedFuture}, the user-su... | java | android/guava/src/com/google/common/util/concurrent/AggregateFuture.java | 97 | [] | String | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false |
getAnnotations | public Annotation[] getAnnotations() {
if (this.field != null) {
Annotation[] fieldAnnotations = this.fieldAnnotations;
if (fieldAnnotations == null) {
fieldAnnotations = this.field.getAnnotations();
this.fieldAnnotations = fieldAnnotations;
}
return fieldAnnotations;
}
else {
return obtain... | Obtain the annotations associated with the wrapped field or method/constructor parameter. | java | spring-beans/src/main/java/org/springframework/beans/factory/InjectionPoint.java | 121 | [] | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false | |
areNeighbours | public static boolean areNeighbours(long origin, long destination) {
// Make sure they're hexagon indexes
if (H3Index.H3_get_mode(origin) != Constants.H3_CELL_MODE) {
throw new IllegalArgumentException("Invalid cell: " + origin);
}
if (H3Index.H3_get_mode(destination) != Con... | Returns whether or not the provided H3Indexes are neighbors.
@param origin The origin H3 index.
@param destination The destination H3 index.
@return true if the indexes are neighbors, false otherwise | java | libs/h3/src/main/java/org/elasticsearch/h3/HexRing.java | 591 | [
"origin",
"destination"
] | true | 18 | 7.12 | elastic/elasticsearch | 75,680 | javadoc | false | |
findDefaultHomeDir | private File findDefaultHomeDir() {
String userDir = System.getProperty("user.dir");
return new File(StringUtils.hasLength(userDir) ? userDir : ".");
} | Create a new {@link ApplicationHome} instance for the specified source class.
@param sourceClass the source class or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java | 151 | [] | File | true | 2 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
readAsn1Object | public Asn1Object readAsn1Object() throws IOException {
int tag = derInputStream.read();
if (tag == -1) {
throw new IOException("Invalid DER: stream too short, missing tag");
}
int length = getLength();
// getLength() can return any 32 bit integer, so ensure that a co... | Read an object and verify its type
@param requiredType The expected type code
@throws IOException if data can not be parsed
@throws IllegalStateException if the parsed object is of the wrong type | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java | 81 | [] | Asn1Object | true | 4 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
parseExpectedTokenJSDoc | function parseExpectedTokenJSDoc(t: JSDocSyntaxKind): Node {
const optional = parseOptionalTokenJSDoc(t);
if (optional) return optional;
Debug.assert(isKeywordOrPunctuation(t));
return createMissingNode(t, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(t));... | 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 | 2,546 | [
"t"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
dag_state | def dag_state(args, session: Session = NEW_SESSION) -> None:
"""
Return the state (and conf if exists) of a DagRun at the command line.
>>> airflow dags state tutorial 2015-01-01T00:00:00.000000
running
>>> airflow dags state a_dag_with_conf_passed 2015-01-01T00:00:00.000000
failed, {"name": "b... | Return the state (and conf if exists) of a DagRun at the command line.
>>> airflow dags state tutorial 2015-01-01T00:00:00.000000
running
>>> airflow dags state a_dag_with_conf_passed 2015-01-01T00:00:00.000000
failed, {"name": "bob", "age": "42"} | python | airflow-core/src/airflow/cli/commands/dag_command.py | 280 | [
"args",
"session"
] | None | true | 5 | 6.96 | apache/airflow | 43,597 | unknown | false |
doFindMatchingMethod | @SuppressWarnings("NullAway") // Dataflow analysis limitation
protected @Nullable Method doFindMatchingMethod(@Nullable Object[] arguments) {
TypeConverter converter = getTypeConverter();
if (converter != null) {
String targetMethod = getTargetMethod();
Method matchingMethod = null;
int argCount = argumen... | Actually find a method with matching parameter type, i.e. where each
argument value is assignable to the corresponding parameter type.
@param arguments the argument values to match against method parameters
@return a matching method, or {@code null} if none | java | spring-beans/src/main/java/org/springframework/beans/support/ArgumentConvertingMethodInvoker.java | 133 | [
"arguments"
] | Method | true | 10 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
stream | public static Stream<Throwable> stream(final Throwable throwable) {
// No point building a custom Iterable as it would keep track of visited elements to avoid infinite loops
return getThrowableList(throwable).stream();
} | Streams causes of a Throwable.
<p>
A throwable without cause will return a stream containing one element - the input throwable. A throwable with one cause
will return a stream containing two elements. - the input throwable and the cause throwable. A {@code null} throwable
will return a stream of count zero.
</p>
<p>
Th... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 894 | [
"throwable"
] | true | 1 | 7.12 | apache/commons-lang | 2,896 | javadoc | false | |
ones | def ones(shape, dtype=None, order='C', *, device=None, like=None):
"""
Return a new array of given shape and type, filled with ones.
Parameters
----------
shape : int or sequence of ints
Shape of the new array, e.g., ``(2, 3)`` or ``2``.
dtype : data-type, optional
The desired d... | Return a new array of given shape and type, filled with ones.
Parameters
----------
shape : int or sequence of ints
Shape of the new array, e.g., ``(2, 3)`` or ``2``.
dtype : data-type, optional
The desired data-type for the array, e.g., `numpy.int8`. Default is
`numpy.float64`.
order : {'C', 'F'}, option... | python | numpy/_core/numeric.py | 172 | [
"shape",
"dtype",
"order",
"device",
"like"
] | false | 2 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
lastIndexOf | public int lastIndexOf(final char ch) {
return lastIndexOf(ch, size - 1);
} | Searches the string builder to find the last reference to the specified char.
@param ch the character to find
@return the last index of the character, or -1 if not found | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,312 | [
"ch"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
registerPostProcessor | private static BeanDefinitionHolder registerPostProcessor(
BeanDefinitionRegistry registry, RootBeanDefinition definition, String beanName) {
definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
registry.registerBeanDefinition(beanName, definition);
return new BeanDefinitionHolder(definition, beanName);
} | Register all relevant annotation post processors in the given registry.
@param registry the registry to operate on
@param source the configuration source element (already extracted)
that this registration was triggered from. May be {@code null}.
@return a Set of BeanDefinitionHolders, containing all bean definitions
th... | java | spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java | 207 | [
"registry",
"definition",
"beanName"
] | BeanDefinitionHolder | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
isClassLoaderAccepted | private static boolean isClassLoaderAccepted(ClassLoader classLoader) {
for (ClassLoader acceptedLoader : acceptedClassLoaders) {
if (isUnderneathClassLoader(classLoader, acceptedLoader)) {
return true;
}
}
return false;
} | Check whether this CachedIntrospectionResults class is configured
to accept the given ClassLoader.
@param classLoader the ClassLoader to check
@return whether the given ClassLoader is accepted
@see #acceptClassLoader | java | spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java | 180 | [
"classLoader"
] | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
isLazyLookup | boolean isLazyLookup(RegisteredBean registeredBean) {
AnnotatedElement ae = getAnnotatedElement(registeredBean);
Lazy lazy = ae.getAnnotation(Lazy.class);
return (lazy != null && lazy.value());
} | Create a suitable {@link DependencyDescriptor} for the specified bean.
@param registeredBean the registered bean
@return a descriptor for that bean | java | spring-context/src/main/java/org/springframework/context/annotation/ResourceElementResolver.java | 144 | [
"registeredBean"
] | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
initials | public static String initials(final String str) {
return initials(str, null);
} | Extracts the initial characters from each word in the String.
<p>All first characters after whitespace are returned as a new string.
Their case is not changed.</p>
<p>Whitespace is defined by {@link Character#isWhitespace(char)}.
A {@code null} input String returns {@code null}.</p>
<pre>
WordUtils.initials(null) ... | java | src/main/java/org/apache/commons/lang3/text/WordUtils.java | 230 | [
"str"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
addTriggerToScheduler | private boolean addTriggerToScheduler(Trigger trigger) throws SchedulerException {
boolean triggerExists = (getScheduler().getTrigger(trigger.getKey()) != null);
if (triggerExists && !this.overwriteExistingJobs) {
return false;
}
// Check if the Trigger is aware of an associated JobDetail.
JobDetail jobDe... | Add the given trigger to the Scheduler, if it doesn't already exist.
Overwrites the trigger in any case if "overwriteExistingJobs" is set.
@param trigger the trigger to add
@return {@code true} if the trigger was actually added,
{@code false} if it already existed before
@see #setOverwriteExistingJobs | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java | 291 | [
"trigger"
] | true | 18 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
afterPropertiesSet | @Override
public void afterPropertiesSet() {
if (!isActive()) {
refresh();
}
} | Triggers {@link #refresh()} if not refreshed in the concrete context's
constructor already. | java | spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java | 149 | [] | void | true | 2 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
nextTo | public String nextTo(String excluded) {
if (excluded == null) {
throw new NullPointerException("excluded == null");
}
return nextToInternal(excluded).trim();
} | Returns the current position and the entire input string.
@return the current position and the entire input string. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 507 | [
"excluded"
] | String | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
getPropertyName | private String getPropertyName(@Nullable String path, String key) {
if (!StringUtils.hasText(path)) {
return key;
}
if (key.startsWith("[")) {
return path + key;
}
return path + "." + key;
} | Create a new {@link CloudFoundryVcapEnvironmentPostProcessor} instance.
@param logFactory the log factory to use
@since 3.0.0 | java | core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java | 222 | [
"path",
"key"
] | String | true | 3 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
getSemverFromPatchBranch | function getSemverFromPatchBranch(version: string) {
// the branch name must match
// number.number.x like 3.0.x or 2.29.x
// as an exact match, no character before or after
const regex = /^(\d+)\.(\d+)\.x$/
const match = regex.exec(version)
if (match) {
return {
major: Number(match[1]),
mi... | Only used when publishing to the `dev` and `integration` npm channels
(see `getNewDevVersion()` and `getNewIntegrationVersion()`)
@returns The next minor version for the `latest` channel
Example: If latest is `4.9.0` it will return `4.10.0` | typescript | scripts/ci/publish.ts | 441 | [
"version"
] | false | 2 | 6.64 | prisma/prisma | 44,834 | jsdoc | false | |
getImportedMessage | private CharSequence getImportedMessage(Set<ConfigDataResolutionResult> results) {
if (results.isEmpty()) {
return "Nothing imported";
}
StringBuilder message = new StringBuilder();
message.append("Imported " + results.size() + " resource" + ((results.size() != 1) ? "s " : " "));
message.append(results.str... | Processes imports from all active contributors and return a new
{@link ConfigDataEnvironmentContributors} instance.
@param importer the importer used to import {@link ConfigData}
@param activationContext the current activation context or {@code null} if the
context has not yet been created
@return a {@link ConfigDataEn... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java | 142 | [
"results"
] | CharSequence | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
create_iter_data_given_by | def create_iter_data_given_by(
data: DataFrame, kind: str = "hist"
) -> dict[Hashable, DataFrame | Series]:
"""
Create data for iteration given `by` is assigned or not, and it is only
used in both hist and boxplot.
If `by` is assigned, return a dictionary of DataFrames in which the key of
dicti... | Create data for iteration given `by` is assigned or not, and it is only
used in both hist and boxplot.
If `by` is assigned, return a dictionary of DataFrames in which the key of
dictionary is the values in groups.
If `by` is not assigned, return input as is, and this preserves current
status of iter_data.
Parameters
... | python | pandas/plotting/_matplotlib/groupby.py | 27 | [
"data",
"kind"
] | dict[Hashable, DataFrame | Series] | true | 3 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
min | @GwtIncompatible(
"Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.")
public static double min(double... array) {
checkArgument(array.length > 0);
double min = array[0];
for (int i = 1; i < array.length; i++) {
min = Math.min(min, array[i]);
}
re... | Returns the least value present in {@code array}, using the same rules of comparison as {@link
Math#min(double, double)}.
@param array a <i>nonempty</i> array of {@code double} values
@return the value present in {@code array} that is less than or equal to every other value in
the array
@throws IllegalArgumentExcep... | java | android/guava/src/com/google/common/primitives/Doubles.java | 209 | [] | true | 2 | 7.6 | google/guava | 51,352 | javadoc | false | |
compare | public abstract int compare(String str1, String str2); | Compare two Strings lexicographically, like {@link String#compareTo(String)}.
<p>
The return values are:
</p>
<ul>
<li>{@code int = 0}, if {@code str1} is equal to {@code str2} (or both {@code null})</li>
<li>{@code int < 0}, if {@code str1} is less than {@code str2}</li>
<li>{@code int > 0}, if {@code str1} is greater... | java | src/main/java/org/apache/commons/lang3/Strings.java | 477 | [
"str1",
"str2"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
workOnQueue | @SuppressWarnings("CatchingUnchecked") // sneaky checked exception
private void workOnQueue() {
boolean interruptedDuringTask = false;
boolean hasSetRunning = false;
try {
while (true) {
synchronized (queue) {
// Choose whether this thread will run or not after acquir... | Continues executing tasks from {@link #queue} until it is empty.
<p>The thread's interrupt bit is cleared before execution of each task.
<p>If the Thread in use is interrupted before or during execution of the tasks in {@link
#queue}, the Executor will complete its tasks, and then restore the interruption. This means
t... | java | android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java | 206 | [] | void | true | 7 | 6.88 | google/guava | 51,352 | javadoc | false |
updatePatternSubscription | private void updatePatternSubscription(MembershipManagerShim membershipManager, Cluster cluster) {
final Set<String> topicsToSubscribe = cluster.topics().stream()
.filter(subscriptions::matchesSubscribedPattern)
.collect(Collectors.toSet());
if (subscriptions.subscribeFromPattern... | This function evaluates the regex that the consumer subscribed to
against the list of topic names from metadata, and updates
the list of topics in subscription state accordingly
@param cluster Cluster from which we get the topics | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 825 | [
"membershipManager",
"cluster"
] | void | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
get_current_task_execution_arn | def get_current_task_execution_arn(self, task_arn: str) -> str | None:
"""
Get current TaskExecutionArn (if one exists) for the specified ``task_arn``.
:param task_arn: TaskArn
:return: CurrentTaskExecutionArn for this ``task_arn`` or None.
:raises AirflowBadRequest: if ``task_a... | Get current TaskExecutionArn (if one exists) for the specified ``task_arn``.
:param task_arn: TaskArn
:return: CurrentTaskExecutionArn for this ``task_arn`` or None.
:raises AirflowBadRequest: if ``task_arn`` is empty. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/datasync.py | 280 | [
"self",
"task_arn"
] | str | None | true | 3 | 7.6 | apache/airflow | 43,597 | sphinx | false |
handleFetchFailure | protected void handleFetchFailure(final Node fetchTarget,
final FetchSessionHandler.FetchRequestData data,
final Throwable t) {
try {
final FetchSessionHandler handler = sessionHandler(fetchTarget.id());
if (han... | Implements the core logic for a failed fetch response.
@param fetchTarget {@link Node} from which the fetch data was requested
@param data {@link FetchSessionHandler.FetchRequestData} from request
@param t {@link Throwable} representing the error that resulted in the failure | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractFetch.java | 266 | [
"fetchTarget",
"data",
"t"
] | void | true | 2 | 6.24 | apache/kafka | 31,560 | javadoc | false |
copyTo | @CanIgnoreReturnValue
public long copyTo(CharSink sink) throws IOException {
checkNotNull(sink);
Closer closer = Closer.create();
try {
Reader reader = closer.register(openStream());
Writer writer = closer.register(sink.openStream());
return CharStreams.copy(reader, writer);
} catch... | Copies the contents of this source to the given sink.
@return the number of characters copied
@throws IOException if an I/O error occurs while reading from this source or writing to {@code
sink} | java | android/guava/src/com/google/common/io/CharSource.java | 271 | [
"sink"
] | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false | |
_maybe_coerce_freq | def _maybe_coerce_freq(code) -> str:
"""we might need to coerce a code to a rule_code
and uppercase it
Parameters
----------
source : str or DateOffset
Frequency converting from
Returns
-------
str
"""
assert code is not None
if isinstance(code, DateOffset):
... | we might need to coerce a code to a rule_code
and uppercase it
Parameters
----------
source : str or DateOffset
Frequency converting from
Returns
-------
str | python | pandas/tseries/frequencies.py | 568 | [
"code"
] | str | true | 4 | 6.08 | pandas-dev/pandas | 47,362 | numpy | false |
count | int count(@CompatibleWith("E") @Nullable Object element); | Returns the number of occurrences of an element in this multiset (the <i>count</i> of the
element). Note that for an {@link Object#equals}-based multiset, this gives the same result as
{@link Collections#frequency} (which would presumably perform more poorly).
<p><b>Note:</b> the utility method {@link Iterables#frequen... | java | android/guava/src/com/google/common/collect/Multiset.java | 115 | [
"element"
] | true | 1 | 6.32 | google/guava | 51,352 | javadoc | false | |
startAsync | @CanIgnoreReturnValue
Service startAsync(); | If the service state is {@link State#NEW}, this initiates service startup and returns
immediately. A stopped service may not be restarted.
@return this
@throws IllegalStateException if the service is not {@link State#NEW}
@since 15.0 | java | android/guava/src/com/google/common/util/concurrent/Service.java | 67 | [] | Service | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
createPropertyDescriptor | PropertyDescriptor createPropertyDescriptor(String name, PropertyDescriptor propertyDescriptor) {
String key = ConventionUtils.toDashedCase(name);
if (this.items.containsKey(key)) {
ItemMetadata itemMetadata = this.items.get(key);
ItemHint itemHint = this.hints.get(key);
return new SourcePropertyDescr... | Create a {@link PropertyDescriptor} for the given property name.
@param name the name of a property
@param propertyDescriptor the descriptor of the property
@return a property descriptor that applies additional source metadata if
necessary | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationPropertiesSourceResolver.java | 106 | [
"name",
"propertyDescriptor"
] | PropertyDescriptor | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
after | function after(n, func) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
} | The opposite of `_.before`; this method creates a function that invokes
`func` once it's called `n` or more times.
@static
@memberOf _
@since 0.1.0
@category Function
@param {number} n The number of calls before `func` is invoked.
@param {Function} func The function to restrict.
@returns {Function} Returns the new rest... | javascript | lodash.js | 10,097 | [
"n",
"func"
] | false | 3 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
estimate_bandwidth | def estimate_bandwidth(X, *, quantile=0.3, n_samples=None, random_state=0, n_jobs=None):
"""Estimate the bandwidth to use with the mean-shift algorithm.
This function takes time at least quadratic in `n_samples`. For large
datasets, it is wise to subsample by setting `n_samples`. Alternatively,
the par... | Estimate the bandwidth to use with the mean-shift algorithm.
This function takes time at least quadratic in `n_samples`. For large
datasets, it is wise to subsample by setting `n_samples`. Alternatively,
the parameter `bandwidth` can be set to a small value without estimating
it.
Parameters
----------
X : array-like ... | python | sklearn/cluster/_mean_shift.py | 41 | [
"X",
"quantile",
"n_samples",
"random_state",
"n_jobs"
] | false | 4 | 7.44 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
noneLookup | public static StrLookup<?> noneLookup() {
return NONE_LOOKUP;
} | Returns a lookup which always returns null.
@return a lookup that always returns null, not null. | java | src/main/java/org/apache/commons/lang3/text/StrLookup.java | 130 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.