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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
entries | @Override
public ImmutableSet<Entry<K, V>> entries() {
ImmutableSet<Entry<K, V>> result = entries;
return result == null ? (entries = new EntrySet<>(this)) : result;
} | Returns an immutable collection of all key-value pairs in the multimap. Its iterator traverses
the values for the first key, the values for the second key, and so on. | java | android/guava/src/com/google/common/collect/ImmutableSetMultimap.java | 604 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReplicaState that = (ReplicaState) o;
return replicaId == that.replicaId
&& Objects.equals(replicaDirectoryId, that.r... | Return the last millisecond timestamp at which this replica was known to be
caught up with the leader.
@return The value of the lastCaughtUpTime if known, empty otherwise | java | clients/src/main/java/org/apache/kafka/clients/admin/QuorumInfo.java | 176 | [
"o"
] | true | 8 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
afterPropertiesSet | @Override
public void afterPropertiesSet() throws Exception {
if (isSingleton()) {
this.initialized = true;
this.singletonInstance = createInstance();
this.earlySingletonInstance = null;
}
} | Eagerly create the singleton instance, if necessary. | java | spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java | 134 | [] | void | true | 2 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
addPartitionsToTransactionHandler | private TxnRequestHandler addPartitionsToTransactionHandler() {
pendingPartitionsInTransaction.addAll(newPartitionsInTransaction);
newPartitionsInTransaction.clear();
AddPartitionsToTxnRequest.Builder builder =
AddPartitionsToTxnRequest.Builder.forClient(transactionalId,
... | Check if the transaction is in the prepared state.
@return true if the current state is PREPARED_TRANSACTION | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 1,212 | [] | TxnRequestHandler | true | 1 | 7.04 | apache/kafka | 31,560 | javadoc | false |
always | public Always<T> always() {
Supplier<@Nullable T> getValue = this::getValue;
return new Always<>(getValue, this::test);
} | Return a version of this source that can be used to always complete mappings,
even if values are {@code null}.
@return a new {@link Always} instance
@since 4.0.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 352 | [] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
evictEntries | @GuardedBy("this")
void evictEntries(ReferenceEntry<K, V> newest) {
if (!map.evictsBySize()) {
return;
}
drainRecencyQueue();
// If the newest entry by itself is too heavy for the segment, don't bother evicting
// anything else, just that
if (newest.getValueReference().... | Performs eviction if the segment is over capacity. Avoids flushing the entire cache if the
newest entry exceeds the maximum weight all on its own.
@param newest the most recently added entry | java | android/guava/src/com/google/common/cache/LocalCache.java | 2,558 | [
"newest"
] | void | true | 6 | 7.04 | google/guava | 51,352 | javadoc | false |
zipContent | ZipContent zipContent() {
return this.zipContent;
} | Return the underling {@link ZipContent}.
@return the zip content | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFileResources.java | 69 | [] | ZipContent | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
bindIndexed | private void bindIndexed(ConfigurationPropertySource source, ConfigurationPropertyName root, Bindable<?> target,
AggregateElementBinder elementBinder, IndexedCollectionSupplier collection, ResolvableType aggregateType,
ResolvableType elementType) {
ConfigurationProperty property = source.getConfigurationPropert... | Bind indexed elements to the supplied collection.
@param name the name of the property to bind
@param target the target bindable
@param elementBinder the binder to use for elements
@param aggregateType the aggregate type, may be a collection or an array
@param elementType the element type
@param result the destination ... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java | 83 | [
"source",
"root",
"target",
"elementBinder",
"collection",
"aggregateType",
"elementType"
] | void | true | 2 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
reschedule | @CanIgnoreReturnValue
Cancellable reschedule() {
// invoke the callback outside the lock, prevents some shenanigans.
Schedule schedule;
try {
schedule = CustomScheduler.this.getNextSchedule();
} catch (Throwable t) {
restoreInterruptIfIsInterruptedException(t);
... | Atomically reschedules this task and assigns the new future to {@link
#cancellationDelegate}. | java | android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java | 593 | [] | Cancellable | true | 4 | 6.24 | google/guava | 51,352 | javadoc | false |
format | StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos); | Formats a {@link Date}, {@link Calendar} or
{@link Long} (milliseconds) object.
@param obj the object to format.
@param toAppendTo the buffer to append to.
@param pos the position - ignored.
@return the buffer passed in.
@see java.text.DateFormat#format(Object, StringBuffer, FieldPosition) | java | src/main/java/org/apache/commons/lang3/time/DatePrinter.java | 152 | [
"obj",
"toAppendTo",
"pos"
] | StringBuffer | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
determinePropertySourceName | private String determinePropertySourceName(ConfigurationPropertySource source) {
if (source.getUnderlyingSource() instanceof PropertySource<?> underlyingSource) {
return underlyingSource.getName();
}
Object underlyingSource = source.getUnderlyingSource();
Assert.state(underlyingSource != null, "'underlyingSo... | 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 | 111 | [
"source"
] | String | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
_record_count | def _record_count(self) -> int:
"""
Get number of records in file.
This is maybe suboptimal because we have to seek to the end of
the file.
Side effect: returns file position to record_start.
"""
self.filepath_or_buffer.seek(0, 2)
total_records_length = ... | Get number of records in file.
This is maybe suboptimal because we have to seek to the end of
the file.
Side effect: returns file position to record_start. | python | pandas/io/sas/sas_xport.py | 386 | [
"self"
] | int | true | 5 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
negate | default FailableIntPredicate<E> negate() {
return t -> !test(t);
} | Returns a predicate that negates this predicate.
@return a predicate that negates this predicate. | java | src/main/java/org/apache/commons/lang3/function/FailableIntPredicate.java | 79 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
splitPreserveAllTokens | public static String[] splitPreserveAllTokens(final String str, final String separatorChars) {
return splitWorker(str, separatorChars, -1, true);
} | Splits the provided text into an array, separators specified, preserving all tokens, including empty tokens created by adjacent separators. This is an
alternative to using StringTokenizer.
<p>
The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,509 | [
"str",
"separatorChars"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
systemDefault | static SslBundle systemDefault() {
try {
KeyManagerFactory keyManagerFactory = KeyManagerFactory
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(null, null);
TrustManagerFactory trustManagerFactory = TrustManagerFactory
.getInstance(TrustManagerFactory.getDefaultAlgorith... | Factory method to create a new {@link SslBundle} which uses the system defaults.
@return a new {@link SslBundle} instance
@since 3.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslBundle.java | 193 | [] | SslBundle | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
analyzeForMissingParameters | static @Nullable FailureAnalysis analyzeForMissingParameters(Throwable failure) {
return analyzeForMissingParameters(failure, failure, new HashSet<>());
} | Analyze the given failure for missing parameter name exceptions.
@param failure the failure to analyze
@return a failure analysis or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParameterNamesFailureAnalyzer.java | 60 | [
"failure"
] | FailureAnalysis | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
matches | boolean matches(Class<?> clazz); | Should the pointcut apply to the given interface or target class?
@param clazz the candidate target class
@return whether the advice should apply to the given target class | java | spring-aop/src/main/java/org/springframework/aop/ClassFilter.java | 48 | [
"clazz"
] | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false | |
checkJarHell | public static void checkJarHell(Consumer<String> output) throws IOException {
ClassLoader loader = JarHell.class.getClassLoader();
output.accept("java.class.path: " + System.getProperty("java.class.path"));
output.accept("sun.boot.class.path: " + System.getProperty("sun.boot.class.path"));
... | Checks the current classpath for duplicate classes
@param output A {@link String} {@link Consumer} to which debug output will be sent
@throws IllegalStateException if jar hell was found | java | libs/core/src/main/java/org/elasticsearch/jdk/JarHell.java | 78 | [
"output"
] | void | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false |
findAllAnnotationsOnBean | @Override
public <A extends Annotation> Set<A> findAllAnnotationsOnBean(
String beanName, Class<A> annotationType, boolean allowFactoryBeanInit)
throws NoSuchBeanDefinitionException {
Set<A> annotations = new LinkedHashSet<>();
Class<?> beanType = getType(beanName, allowFactoryBeanInit);
if (beanType != n... | Check whether the specified bean would need to be eagerly initialized
in order to determine its type.
@param factoryBeanName a factory-bean reference that the bean definition
defines a factory method for
@return whether eager initialization is necessary | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 845 | [
"beanName",
"annotationType",
"allowFactoryBeanInit"
] | true | 7 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_encode | def _encode(values, *, uniques, check_unknown=True):
"""Helper function to encode values into [0, n_uniques - 1].
Uses pure python method for object dtype, and numpy method for
all other dtypes.
The numpy method has the limitation that the `uniques` need to
be sorted. Importantly, this is not check... | Helper function to encode values into [0, n_uniques - 1].
Uses pure python method for object dtype, and numpy method for
all other dtypes.
The numpy method has the limitation that the `uniques` need to
be sorted. Importantly, this is not checked but assumed to already be
the case. The calling method needs to ensure th... | python | sklearn/utils/_encode.py | 197 | [
"values",
"uniques",
"check_unknown"
] | false | 5 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
supportedResourceTypes | public Set<Byte> supportedResourceTypes() {
return version() == 0 ?
Set.of(ConfigResource.Type.CLIENT_METRICS.id()) :
Set.of(
ConfigResource.Type.TOPIC.id(),
ConfigResource.Type.BROKER.id(),
ConfigResource.Type.BROKER_LOGGER.id(),
... | Return the supported config resource types in different request version.
If there is a new config resource type, the ListConfigResourcesRequest should bump a new request version to include it.
For v0, the supported config resource types contain CLIENT_METRICS (16).
For v1, the supported config resource types contain TO... | java | clients/src/main/java/org/apache/kafka/common/requests/ListConfigResourcesRequest.java | 95 | [] | true | 2 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
toString | @Override
public String toString() {
if (count() > 0) {
return MoreObjects.toStringHelper(this)
.add("xStats", xStats)
.add("yStats", yStats)
.add("populationCovariance", populationCovariance())
.toString();
} else {
return MoreObjects.toStringHelper(this)
... | {@inheritDoc}
<p><b>Note:</b> This hash code is consistent with exact equality of the calculated statistics,
including the floating point values. See the note on {@link #equals} for details. | java | android/guava/src/com/google/common/math/PairedStats.java | 240 | [] | String | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false |
NativeStyleEditor | function NativeStyleEditor() {
const {inspectedElementID} = useContext(TreeStateContext);
const inspectedElementStyleAndLayout = useContext(NativeStyleContext);
if (inspectedElementID === null) {
return null;
}
if (inspectedElementStyleAndLayout === null) {
return null;
}
const {layout, style} = ... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/index.js | 45 | [] | false | 7 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
ActualOpenInEditorButton | function ActualOpenInEditorButton({
editorURL,
source,
className,
}: Props): React.Node {
let disable;
if (source == null) {
disable = true;
} else {
const staleLocation: ReactFunctionLocation = [
'',
source.url,
// This is not live but we just use any line/column to validate wheth... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/Editor/OpenInEditorButton.js | 27 | [] | false | 5 | 6.4 | facebook/react | 241,750 | jsdoc | false | |
close | @Override
public void close() throws IOException {
synchronized (this.lock) {
if (this.thread != null) {
this.thread.close();
this.thread.interrupt();
try {
this.thread.join();
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
this.thread = null;
}
... | Retrieves all {@link Path Paths} that should be registered for the specified
{@link Path}. If the path is a symlink, changes to the symlink should be monitored,
not just the file it points to. For example, for the given {@code keystore.jks}
path in the following directory structure:<pre>
+- stores
| +─ keystore.jks
+-... | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/FileWatcher.java | 144 | [] | void | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
getExcludeAutoConfigurationsProperty | protected List<String> getExcludeAutoConfigurationsProperty() {
Environment environment = getEnvironment();
if (environment == null) {
return Collections.emptyList();
}
if (environment instanceof ConfigurableEnvironment) {
Binder binder = Binder.get(environment);
return binder.bind(PROPERTY_NAME_AUTOCO... | Returns the auto-configurations excluded by the
{@code spring.autoconfigure.exclude} property.
@return excluded auto-configurations
@since 2.3.2 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java | 263 | [] | true | 4 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getEcCurveNameFromOid | private static String getEcCurveNameFromOid(String oidString) throws GeneralSecurityException {
return switch (oidString) {
// see https://tools.ietf.org/html/rfc5480#section-2.1.1.1
case "1.2.840.10045.3.1" -> "secp192r1";
case "1.3.132.0.1" -> "sect163k1";
case ... | Parses a DER encoded private key and reads its algorithm identifier Object OID.
@param keyBytes the private key raw bytes
@return A string identifier for the key algorithm (RSA, DSA, or EC)
@throws GeneralSecurityException if the algorithm oid that is parsed from ASN.1 is unknown
@throws IOException if the DER encoded ... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | 728 | [
"oidString"
] | String | true | 1 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
refreshAndGetPartitionsToValidate | Map<TopicPartition, SubscriptionState.FetchPosition> refreshAndGetPartitionsToValidate() {
return positionsValidator.refreshAndGetPartitionsToValidate(apiVersions);
} | Callback for the response of the list offset call.
@param listOffsetsResponse The response from the server.
@return {@link OffsetFetcherUtils.ListOffsetResult} extracted from the response, containing the fetched offsets
and partitions to retry. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetFetcherUtils.java | 175 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
of | static <T> ValueProcessor<T> of(Class<? extends T> type, UnaryOperator<@Nullable T> action) {
return of(action).whenInstanceOf(type);
} | Factory method to crate a new {@link ValueProcessor} that applies the given
action.
@param <T> the value type
@param type the value type
@param action the action to apply
@return a new {@link ValueProcessor} instance | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 1,046 | [
"type",
"action"
] | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false | |
dag_next_execution | def dag_next_execution(args) -> None:
"""
Return the next logical datetime of a DAG at the command line.
>>> airflow dags next-execution tutorial
2018-08-31 10:38:00
"""
from airflow.models.serialized_dag import SerializedDagModel
with create_session() as session:
dag = SerializedD... | Return the next logical datetime of a DAG at the command line.
>>> airflow dags next-execution tutorial
2018-08-31 10:38:00 | python | airflow-core/src/airflow/cli/commands/dag_command.py | 308 | [
"args"
] | None | true | 7 | 7.28 | apache/airflow | 43,597 | unknown | false |
write | public static long write(DataOutputStream out,
byte magic,
long timestamp,
byte[] key,
byte[] value,
CompressionType compressionType,
TimestampTyp... | Write the record data with the given compression type and return the computed crc.
@param out The output stream to write to
@param magic The magic value to be used
@param timestamp The timestamp of the record
@param key The record key
@param value The record value
@param compressionType The compression type
@param time... | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 400 | [
"out",
"magic",
"timestamp",
"key",
"value",
"compressionType",
"timestampType"
] | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
hermder | def hermder(c, m=1, scl=1, axis=0):
"""
Differentiate a Hermite series.
Returns the Hermite series coefficients `c` differentiated `m` times
along `axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The argument
`c` is an ... | Differentiate a Hermite series.
Returns the Hermite series coefficients `c` differentiated `m` times
along `axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The argument
`c` is an array of coefficients from low to high degree along each
axis, e... | python | numpy/polynomial/hermite.py | 596 | [
"c",
"m",
"scl",
"axis"
] | false | 8 | 7.44 | numpy/numpy | 31,054 | numpy | false | |
memory_efficient_fusion | def memory_efficient_fusion(
fn: Union[Callable, nn.Module],
**kwargs,
):
"""
Wrapper function over :func:`aot_function` and :func:`aot_module` to perform
memory efficient fusion. It uses the
:func:`min_cut_rematerialization_partition` partitioner to perform efficient
recomputation. It uses ... | Wrapper function over :func:`aot_function` and :func:`aot_module` to perform
memory efficient fusion. It uses the
:func:`min_cut_rematerialization_partition` partitioner to perform efficient
recomputation. It uses NVFuser to compile the generated forward and backward
graphs.
.. warning::
This API is experimental a... | python | torch/_functorch/compilers.py | 237 | [
"fn"
] | true | 3 | 7.44 | pytorch/pytorch | 96,034 | google | false | |
__iter__ | def __iter__(self) -> Iterator:
"""
Return an iterator over the boxed values
Yields
------
tstamp : Timestamp
"""
if self.ndim > 1:
for i in range(len(self)):
yield self[i]
else:
# convert in chunks of 10k for effic... | Return an iterator over the boxed values
Yields
------
tstamp : Timestamp | python | pandas/core/arrays/datetimes.py | 670 | [
"self"
] | Iterator | true | 5 | 6.56 | pandas-dev/pandas | 47,362 | unknown | false |
toCalendar | public static Calendar toCalendar(final Date date, final TimeZone tz) {
final Calendar c = Calendar.getInstance(tz);
c.setTime(Objects.requireNonNull(date, "date"));
return c;
} | Converts a {@link Date} of a given {@link TimeZone} into a {@link Calendar}.
@param date the date to convert to a Calendar.
@param tz the time zone of the {@code date}.
@return the created Calendar.
@throws NullPointerException if {@code date} or {@code tz} is null. | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,626 | [
"date",
"tz"
] | Calendar | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false |
check_job_success | def check_job_success(self, job_id: str) -> bool:
"""
Check the final status of the Batch job.
Return True if the job 'SUCCEEDED', else raise an AirflowException.
:param job_id: a Batch job ID
:raises: AirflowException
"""
job = self.get_job_description(job_id)... | Check the final status of the Batch job.
Return True if the job 'SUCCEEDED', else raise an AirflowException.
:param job_id: a Batch job ID
:raises: AirflowException | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/batch_client.py | 256 | [
"self",
"job_id"
] | bool | true | 4 | 6.72 | apache/airflow | 43,597 | sphinx | false |
_validate_binary_probabilistic_prediction | def _validate_binary_probabilistic_prediction(y_true, y_prob, sample_weight, pos_label):
r"""Convert y_true and y_prob in binary classification to shape (n_samples, 2)
Parameters
----------
y_true : array-like of shape (n_samples,)
True labels.
y_prob : array-like of shape (n_samples,)
... | r"""Convert y_true and y_prob in binary classification to shape (n_samples, 2)
Parameters
----------
y_true : array-like of shape (n_samples,)
True labels.
y_prob : array-like of shape (n_samples,)
Probabilities of the positive class.
sample_weight : array-like of shape (n_samples,), default=None
Sample ... | python | sklearn/metrics/_classification.py | 3,559 | [
"y_true",
"y_prob",
"sample_weight",
"pos_label"
] | false | 7 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getInputStream | @Override
public InputStream getInputStream(ZipEntry entry) throws IOException {
Objects.requireNonNull(entry, "entry");
if (entry instanceof NestedJarEntry nestedJarEntry && nestedJarEntry.isOwnedBy(this)) {
return getInputStream(nestedJarEntry.contentEntry());
}
return getInputStream(getNestedJarEntry(ent... | Return if an entry with the given name exists.
@param name the name to check
@return if the entry exists | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java | 343 | [
"entry"
] | InputStream | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
rackId | public Optional<String> rackId() {
return rackId;
} | @return Instance ID used by the member when joining the group. If non-empty, it will indicate that
this is a static member. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMembershipManager.java | 207 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
sample | def sample(
obj_len: int,
size: int,
replace: bool,
weights: np.ndarray | None,
random_state: np.random.RandomState | np.random.Generator,
) -> np.ndarray:
"""
Randomly sample `size` indices in `np.arange(obj_len)`.
Parameters
----------
obj_len : int
The length of the i... | Randomly sample `size` indices in `np.arange(obj_len)`.
Parameters
----------
obj_len : int
The length of the indices being considered
size : int
The number of values to choose
replace : bool
Allow or disallow sampling of the same row more than once.
weights : np.ndarray[np.float64] or None
If None, eq... | python | pandas/core/sample.py | 118 | [
"obj_len",
"size",
"replace",
"weights",
"random_state"
] | np.ndarray | true | 6 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
getMatchData | function getMatchData(object) {
var result = keys(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;
} | Gets the property names, values, and compare flags of `object`.
@private
@param {Object} object The object to query.
@returns {Array} Returns the match data of `object`. | javascript | lodash.js | 6,054 | [
"object"
] | false | 2 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
memberEquals | private static boolean memberEquals(final Class<?> type, final Object o1, final Object o2) {
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
if (type.isArray()) {
return arrayMemberEquals(type.getComponentType(), ... | Helper method for checking whether two objects of the given type are
equal. This method is used to compare the parameters of two annotation
instances.
@param type the type of the objects to be compared
@param o1 the first object
@param o2 the second object
@return a flag whether these objects are equal | java | src/main/java/org/apache/commons/lang3/AnnotationUtils.java | 307 | [
"type",
"o1",
"o2"
] | true | 6 | 8 | apache/commons-lang | 2,896 | javadoc | false | |
protocolType | protected abstract String protocolType(); | Unique identifier for the class of supported protocols (e.g. "consumer" or "connect").
@return Non-null protocol type name | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 204 | [] | String | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
write | def write(
self,
log: str,
remote_log_location: str,
append: bool = True,
max_retry: int = 1,
) -> bool:
"""
Write the log to the remote_log_location; return `True` or fails silently and return `False`.
:param log: the contents to write to the remote_... | Write the log to the remote_log_location; return `True` or fails silently and return `False`.
:param log: the contents to write to the remote_log_location
:param remote_log_location: the log's location in remote storage
:param append: if False, any existing log file is overwritten. If True,
the new log is appended... | python | providers/amazon/src/airflow/providers/amazon/aws/log/s3_task_handler.py | 102 | [
"self",
"log",
"remote_log_location",
"append",
"max_retry"
] | bool | true | 7 | 8.08 | apache/airflow | 43,597 | sphinx | false |
getInfo | @SuppressWarnings("unchecked")
public <I> I getInfo(Class<I> type, Function<ZipContent, I> function) {
Map<Class<?>, Object> info = (this.info != null) ? this.info.get() : null;
if (info == null) {
info = new ConcurrentHashMap<>();
this.info = new SoftReference<>(info);
}
return (I) info.computeIfAbsent(... | Get or compute information based on the {@link ZipContent}.
@param <I> the info type to get or compute
@param type the info type to get or compute
@param function the function used to compute the information
@return the computed or existing information | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 317 | [
"type",
"function"
] | I | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
initializeGpuInfo | private static long initializeGpuInfo() {
try {
var gpuInfoProvider = CuVSProvider.provider().gpuInfoProvider();
var availableGPUs = gpuInfoProvider.availableGPUs();
if (availableGPUs.isEmpty()) {
LOG.warn("No GPU found");
return -1L;
... | Initializes GPU support information by finding the first compatible GPU.
Returns the total GPU memory in bytes, or -1 if GPU is not found or supported. | java | libs/gpu-codec/src/main/java/org/elasticsearch/gpu/GPUSupport.java | 41 | [] | true | 10 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false | |
removePattern | @Deprecated
public static String removePattern(final String source, final String regex) {
return RegExUtils.removePattern(source, regex);
} | Removes each substring of the source String that matches the given regular expression using the DOTALL option.
This call is a {@code null} safe equivalent to:
<ul>
<li>{@code source.replaceAll("(?s)" + regex, StringUtils.EMPTY)}</li>
<li>{@code Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,928 | [
"source",
"regex"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
_boost | def _boost(self, iboost, X, y, sample_weight, random_state):
"""Implement a single boost.
Perform a single boost according to the discrete SAMME algorithm and return the
updated sample weights.
Parameters
----------
iboost : int
The index of the current boos... | Implement a single boost.
Perform a single boost according to the discrete SAMME algorithm and return the
updated sample weights.
Parameters
----------
iboost : int
The index of the current boost iteration.
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The training input samples.
y : arra... | python | sklearn/ensemble/_weight_boosting.py | 486 | [
"self",
"iboost",
"X",
"y",
"sample_weight",
"random_state"
] | false | 6 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
get_k8s_pod_yaml | def get_k8s_pod_yaml(cls, ti: TaskInstance, session: Session = NEW_SESSION) -> dict | None:
"""
Get rendered Kubernetes Pod Yaml for a TaskInstance from the RenderedTaskInstanceFields table.
:param ti: Task Instance
:param session: SqlAlchemy Session
:return: Kubernetes Pod Yaml... | Get rendered Kubernetes Pod Yaml for a TaskInstance from the RenderedTaskInstanceFields table.
:param ti: Task Instance
:param session: SqlAlchemy Session
:return: Kubernetes Pod Yaml | python | airflow-core/src/airflow/models/renderedtifields.py | 227 | [
"cls",
"ti",
"session"
] | dict | None | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false |
generate_kernel_call | def generate_kernel_call(
self,
kernel_name: str,
call_args,
*,
device=None,
triton=True,
arg_types=None,
raw_keys=None,
raw_args=None,
triton_meta=None,
original_fxnode_name=None,
):
"""
Generates kernel call co... | Generates kernel call code.
triton: Defines whether the backend uses Triton for codegen. Otherwise it uses the CUDA language when gpu=True,
and C++ when gpu=False. | python | torch/_inductor/codegen/wrapper.py | 2,848 | [
"self",
"kernel_name",
"call_args",
"device",
"triton",
"arg_types",
"raw_keys",
"raw_args",
"triton_meta",
"original_fxnode_name"
] | true | 2 | 6.88 | pytorch/pytorch | 96,034 | unknown | false | |
afterPropertiesSet | @Override
public void afterPropertiesSet() {
if (isSingleton()) {
this.map = createMap();
}
} | Set if a singleton should be created, or a new object on each request
otherwise. Default is {@code true} (a singleton). | java | spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java | 94 | [] | void | true | 2 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
validIndex | public static <T> T[] validIndex(final T[] array, final int index) {
return validIndex(array, index, DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE, Integer.valueOf(index));
} | Validates that the index is within the bounds of the argument
array; otherwise throwing an exception.
<pre>Validate.validIndex(myArray, 2);</pre>
<p>If the array is {@code null}, then the message of the exception
is "The validated object is null".</p>
<p>If the index is invalid, then the message of the except... | java | src/main/java/org/apache/commons/lang3/Validate.java | 1,197 | [
"array",
"index"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
noNullElements | public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) {
Objects.requireNonNull(array, "array");
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
final Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i));
... | Validate that the specified argument array is neither
{@code null} nor contains any elements that are {@code null};
otherwise throwing an exception with the specified message.
<pre>Validate.noNullElements(myArray, "The array contain null at position %d");</pre>
<p>If the array is {@code null}, then the message in the e... | java | src/main/java/org/apache/commons/lang3/Validate.java | 751 | [
"array",
"message"
] | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
getOverrideHierarchy | public static Set<Method> getOverrideHierarchy(final Method method, final Interfaces interfacesBehavior) {
Objects.requireNonNull(method, "method");
final Set<Method> result = new LinkedHashSet<>();
result.add(method);
final Class<?>[] parameterTypes = method.getParameterTypes();
... | Gets the hierarchy of overridden methods down to {@code result} respecting generics.
@param method lowest to consider.
@param interfacesBehavior whether to search interfaces, {@code null} {@code implies} false.
@return a {@code Set<Method>} in ascending order from subclass to superclass.
@throws NullPointerException if... | java | src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | 501 | [
"method",
"interfacesBehavior"
] | true | 6 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
compression | @Override
public double compression() {
if (mergingDigest != null) {
return mergingDigest.compression();
}
return sortingDigest.compression();
} | Similar to the constructor above. The limit for switching from a {@link SortingDigest} to a {@link MergingDigest} implementation
is calculated based on the passed compression factor.
@param compression The compression factor for the MergingDigest | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/HybridDigest.java | 182 | [] | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
generate_copies_of_performance_dag | def generate_copies_of_performance_dag(
performance_dag_path: str, performance_dag_conf: dict[str, str]
) -> tuple[str, list[str]]:
"""
Create context manager that creates copies of DAG.
Contextmanager that creates copies of performance DAG inside temporary directory using the
dag prefix env variab... | Create context manager that creates copies of DAG.
Contextmanager that creates copies of performance DAG inside temporary directory using the
dag prefix env variable as a base for filenames.
:param performance_dag_path: path to the performance DAG that should be copied.
:param performance_dag_conf: dict with environm... | python | performance/src/performance_dags/performance_dag/performance_dag_utils.py | 414 | [
"performance_dag_path",
"performance_dag_conf"
] | tuple[str, list[str]] | true | 2 | 6.72 | apache/airflow | 43,597 | sphinx | false |
nanAwareAggregate | private static double nanAwareAggregate(double a, double b, DoubleBinaryOperator aggregator) {
if (Double.isNaN(a)) {
return b;
}
if (Double.isNaN(b)) {
return a;
}
return aggregator.applyAsDouble(a, b);
} | Merges the given histogram into the current result. The histogram might be upscaled if needed.
@param toAdd the histogram to merge | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramMerger.java | 298 | [
"a",
"b",
"aggregator"
] | true | 3 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false | |
poll | @Override
public NetworkClientDelegate.PollResult poll(long currentTimeMs) {
if (coordinatorRequestManager.coordinator().isEmpty() || membershipManager().shouldSkipHeartbeat()) {
membershipManager().onHeartbeatRequestSkipped();
maybePropagateCoordinatorFatalErrorEvent();
... | This will build a heartbeat request if one must be sent, determined based on the member
state. A heartbeat is sent in the following situations:
<ol>
<li>Member is part of the consumer group or wants to join it.</li>
<li>The heartbeat interval has expired, or the member is in a state that indicates
that it s... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractHeartbeatRequestManager.java | 163 | [
"currentTimeMs"
] | true | 9 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
all_functions | def all_functions():
"""Get a list of all functions from `sklearn`.
Returns
-------
functions : list of tuples
List of (name, function), where ``name`` is the function name as
string and ``function`` is the actual function.
Examples
--------
>>> from sklearn.utils.discovery... | Get a list of all functions from `sklearn`.
Returns
-------
functions : list of tuples
List of (name, function), where ``name`` is the function name as
string and ``function`` is the actual function.
Examples
--------
>>> from sklearn.utils.discovery import all_functions
>>> functions = all_functions()
>>> na... | python | sklearn/utils/discovery.py | 210 | [] | false | 4 | 7.36 | scikit-learn/scikit-learn | 64,340 | unknown | false | |
hasNonStaticBeanMethods | boolean hasNonStaticBeanMethods() {
for (BeanMethod beanMethod : this.beanMethods) {
if (!beanMethod.getMetadata().isStatic()) {
return true;
}
}
return false;
} | Return the configuration classes that imported this class,
or an empty Set if this configuration was not imported.
@since 4.0.5
@see #isImported() | java | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java | 211 | [] | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
reallocateResultWithCapacity | private void reallocateResultWithCapacity(int newCapacity, boolean copyBucketsFromPreviousResult) {
FixedCapacityExponentialHistogram newResult = FixedCapacityExponentialHistogram.create(newCapacity, breaker);
if (copyBucketsFromPreviousResult && result != null) {
BucketIterator it = result.... | Sets the given bucket of the negative buckets. If the bucket already exists, it will be replaced.
Buckets may be set in arbitrary order. However, for best performance and minimal allocations,
buckets should be set in order of increasing index and all negative buckets should be set before positive buckets.
@param index ... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramBuilder.java | 221 | [
"newCapacity",
"copyBucketsFromPreviousResult"
] | void | true | 7 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false |
warnDisablingExponentialBackoff | public static void warnDisablingExponentialBackoff(AbstractConfig config) {
long retryBackoffMs = config.getLong(RETRY_BACKOFF_MS_CONFIG);
long retryBackoffMaxMs = config.getLong(RETRY_BACKOFF_MAX_MS_CONFIG);
if (retryBackoffMs > retryBackoffMaxMs) {
log.warn("Configuration '{}' with... | Log warning if the exponential backoff is disabled due to initial backoff value is greater than max backoff value.
@param config The config object. | java | clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java | 277 | [
"config"
] | void | true | 3 | 6.56 | apache/kafka | 31,560 | javadoc | false |
controller | public Node controller() {
return holder().controller;
} | The controller node returned in metadata response
@return the controller node or null if it doesn't exist | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java | 249 | [] | Node | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
as | @SuppressWarnings("unchecked")
public <R> Member<R> as(Extractor<T, R> extractor) {
Assert.notNull(extractor, "'adapter' must not be null");
Member<R> result = (Member<R>) this;
result.valueExtractor = this.valueExtractor.as(extractor::extract);
return result;
} | Adapt the value by applying the given {@link Function}.
@param <R> the result type
@param extractor a {@link Extractor} to adapt the value
@return a {@link Member} which may be configured further | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 452 | [
"extractor"
] | true | 1 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
hasReadyNodes | public boolean hasReadyNodes(long now) {
for (Map.Entry<String, NodeConnectionState> entry : nodeState.entrySet()) {
if (isReady(entry.getValue(), now)) {
return true;
}
}
return false;
} | Return true if there is at least one node with connection in the READY state and not throttled. Returns false
otherwise.
@param now the current time in ms | java | clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java | 300 | [
"now"
] | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
doShutdown | protected void doShutdown() throws IOException {
IOUtils.close(databaseReader.get());
int numEntriesEvicted = cache.purgeCacheEntriesForDatabase(projectId, databasePath);
logger.info("evicted [{}] entries from cache after reloading database [{}]", numEntriesEvicted, databasePath);
if (de... | Prepares the database for lookup by incrementing the usage count.
If the usage count is already negative, it indicates that the database is being closed,
and this method will return false to indicate that no lookup should be performed.
@return true if the database is ready for lookup, false if it is being closed | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/DatabaseReaderLazyLoader.java | 156 | [] | void | true | 2 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false |
serverAuthenticationSessionExpired | public boolean serverAuthenticationSessionExpired(long nowNanos) {
Long serverSessionExpirationTimeNanos = authenticator.serverSessionExpirationTimeNanos();
return serverSessionExpirationTimeNanos != null && nowNanos - serverSessionExpirationTimeNanos > 0;
} | Return true if this is a server-side channel and the given time is past the
session expiration time, if any, otherwise false
@param nowNanos
the current time in nanoseconds as per {@code System.nanoTime()}
@return true if this is a server-side channel and the given time is past the
session expiratio... | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 641 | [
"nowNanos"
] | true | 2 | 7.36 | apache/kafka | 31,560 | javadoc | false | |
topicPartitions | public ListConsumerGroupOffsetsSpec topicPartitions(Collection<TopicPartition> topicPartitions) {
this.topicPartitions = topicPartitions;
return this;
} | Set the topic partitions whose offsets are to be listed for a consumer group.
{@code null} includes all topic partitions.
@param topicPartitions List of topic partitions to include
@return This ListConsumerGroupOffsetSpec | java | clients/src/main/java/org/apache/kafka/clients/admin/ListConsumerGroupOffsetsSpec.java | 39 | [
"topicPartitions"
] | ListConsumerGroupOffsetsSpec | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
growIfNeeded | private void growIfNeeded() {
if (size > queue.length) {
int newCapacity = calculateNewCapacity();
Object[] newQueue = new Object[newCapacity];
arraycopy(queue, 0, newQueue, 0, queue.length);
queue = newQueue;
}
} | Returns the comparator used to order the elements in this queue. Obeys the general contract of
{@link PriorityQueue#comparator}, but returns {@link Ordering#natural} instead of {@code null}
to indicate natural ordering. | java | android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java | 957 | [] | void | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false |
synchronizedSetMultimap | @J2ktIncompatible // Synchronized
public static <K extends @Nullable Object, V extends @Nullable Object>
SetMultimap<K, V> synchronizedSetMultimap(SetMultimap<K, V> multimap) {
return Synchronized.setMultimap(multimap, null);
} | Returns a synchronized (thread-safe) {@code SetMultimap} backed by the specified multimap.
<p>You must follow the warnings described in {@link #synchronizedMultimap}.
<p>The returned multimap will be serializable if the specified multimap is serializable.
@param multimap the multimap to be wrapped
@return a synchronize... | java | android/guava/src/com/google/common/collect/Multimaps.java | 899 | [
"multimap"
] | true | 1 | 6.4 | google/guava | 51,352 | javadoc | false | |
get_cmake_cache_variables | def get_cmake_cache_variables(self) -> dict[str, CMakeValue]:
r"""Gets values in CMakeCache.txt into a dictionary.
Returns:
dict: A ``dict`` containing the value of cached CMake variables.
"""
with open(self._cmake_cache_file) as f:
return get_cmake_cache_variables_... | r"""Gets values in CMakeCache.txt into a dictionary.
Returns:
dict: A ``dict`` containing the value of cached CMake variables. | python | tools/setup_helpers/cmake.py | 159 | [
"self"
] | dict[str, CMakeValue] | true | 1 | 6.4 | pytorch/pytorch | 96,034 | unknown | false |
addIfAbsent | public boolean addIfAbsent(long offset, AcknowledgeType type) {
return acknowledgements.putIfAbsent(offset, type) == null;
} | Adds an acknowledgement for a specific offset. Will <b>not</b> overwrite an existing
acknowledgement for the same offset.
@param offset The record offset.
@param type The AcknowledgeType.
@return Whether the acknowledgement was added. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/Acknowledgements.java | 75 | [
"offset",
"type"
] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
invokeBeanDefiningMethod | private GroovyBeanDefinitionWrapper invokeBeanDefiningMethod(String beanName, Object[] args) {
boolean hasClosureArgument = (args[args.length - 1] instanceof Closure);
if (args[0] instanceof Class<?> beanClass) {
if (hasClosureArgument) {
if (args.length - 1 != 1) {
this.currentBeanDefinition = new Groo... | This method is called when a bean definition node is called.
@param beanName the name of the bean to define
@param args the arguments to the bean. The first argument is the class name, the last
argument is sometimes a closure. All the arguments in between are constructor arguments.
@return the bean definition wrapper | java | spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java | 466 | [
"beanName",
"args"
] | GroovyBeanDefinitionWrapper | true | 15 | 8.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
square | private static double square(double x) {
return x * x;
} | Square of a number
@param x The input number.
@return The square of the input number. | java | libs/h3/src/main/java/org/elasticsearch/h3/Vec3d.java | 126 | [
"x"
] | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false | |
unassignUnsentCalls | private void unassignUnsentCalls(Predicate<Node> shouldUnassign) {
for (Iterator<Map.Entry<Node, List<Call>>> iter = callsToSend.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry<Node, List<Call>> entry = iter.next();
Node node = entry.getKey();
List<Call> ... | Unassign calls that have not yet been sent based on some predicate. For example, this
is used to reassign the calls that have been assigned to a disconnected node.
@param shouldUnassign Condition for reassignment. If the predicate is true, then the calls will
be put back in the pendingCalls collec... | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 1,402 | [
"shouldUnassign"
] | void | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false |
encodeRealpathResult | function encodeRealpathResult(result, options) {
if (!options || !options.encoding || options.encoding === 'utf8')
return result;
const asBuffer = Buffer.from(result);
if (options.encoding === 'buffer') {
return asBuffer;
}
return asBuffer.toString(options.encoding);
} | Stops watching for changes on `filename`.
@param {string | Buffer | URL} filename
@param {() => any} [listener]
@returns {void} | javascript | lib/fs.js | 2,642 | [
"result",
"options"
] | false | 5 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
add | @CanIgnoreReturnValue
@Override
public Builder<E> add(E element) {
super.add(element);
return this;
} | Adds {@code element} to the {@code ImmutableList}.
@param element the element to add
@return this {@code Builder} object
@throws NullPointerException if {@code element} is null | java | android/guava/src/com/google/common/collect/ImmutableList.java | 786 | [
"element"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
createTypeFiltersFor | public static List<TypeFilter> createTypeFiltersFor(AnnotationAttributes filterAttributes, Environment environment,
ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {
List<TypeFilter> typeFilters = new ArrayList<>();
FilterType filterType = filterAttributes.getEnum("type");
for (Class<?> filte... | Create {@linkplain TypeFilter type filters} from the supplied
{@link AnnotationAttributes}, such as those sourced from
{@link ComponentScan#includeFilters()} or {@link ComponentScan#excludeFilters()}.
<p>Each {@link TypeFilter} will be instantiated using an appropriate
constructor, with {@code BeanClassLoaderAware}, {@... | java | spring-context/src/main/java/org/springframework/context/annotation/TypeFilterUtils.java | 73 | [
"filterAttributes",
"environment",
"resourceLoader",
"registry"
] | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
__init__ | def __init__(
self,
len_or_dims: Optional[Union[int, Sequence]] = None,
name: Optional[str] = None,
):
"""
Initialize a new DimList object.
Args:
len_or_dims: Optional length (int) or sequence of dimensions/sizes
name: Optional name for the di... | Initialize a new DimList object.
Args:
len_or_dims: Optional length (int) or sequence of dimensions/sizes
name: Optional name for the dimension list | python | functorch/dim/__init__.py | 155 | [
"self",
"len_or_dims",
"name"
] | true | 7 | 6.4 | pytorch/pytorch | 96,034 | google | false | |
forbid_nonstring_types | def forbid_nonstring_types(
forbidden: list[str] | None, name: str | None = None
) -> Callable[[F], F]:
"""
Decorator to forbid specific types for a method of StringMethods.
For calling `.str.{method}` on a Series or Index, it is necessary to first
initialize the :class:`StringMethods` object, and ... | Decorator to forbid specific types for a method of StringMethods.
For calling `.str.{method}` on a Series or Index, it is necessary to first
initialize the :class:`StringMethods` object, and then call the method.
However, different methods allow different input types, and so this can not
be checked during :meth:`Strin... | python | pandas/core/strings/accessor.py | 83 | [
"forbidden",
"name"
] | Callable[[F], F] | true | 4 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
setExcludedPatterns | public void setExcludedPatterns(String... excludedPatterns) {
Assert.notEmpty(excludedPatterns, "'excludedPatterns' must not be empty");
this.excludedPatterns = new String[excludedPatterns.length];
for (int i = 0; i < excludedPatterns.length; i++) {
this.excludedPatterns[i] = excludedPatterns[i].strip();
}
... | Set the regular expressions defining methods to match for exclusion.
Matching will be the union of all these; if any match, the pointcut matches.
@see #setExcludedPattern | java | spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java | 110 | [] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
readSchemaFromDirectory | async function readSchemaFromDirectory(schemaPath: string): Promise<LookupResult> {
debug('Reading schema from multiple files', schemaPath)
const typeError = await ensureType(schemaPath, 'directory')
if (typeError) {
return { ok: false, error: typeError }
}
const files = await loadSchemaFiles(schemaPath)
... | Loads the schema, returns null if it is not found
Throws an error if schema is specified explicitly in
any of the available ways (argument, package.json config), but
can not be loaded
@param schemaPathFromArgs
@param schemaPathFromConfig
@param opts
@returns | typescript | packages/internals/src/cli/getSchema.ts | 130 | [
"schemaPath"
] | true | 2 | 7.44 | prisma/prisma | 44,834 | jsdoc | true | |
fit_transform | def fit_transform(self, X, y=None):
"""Fit the model with X and apply the dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_featur... | Fit the model with X and apply the dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of features.
y : Ignored
Ignored.
Returns
-------
X_new : ndarr... | python | sklearn/decomposition/_pca.py | 444 | [
"self",
"X",
"y"
] | false | 5 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
isPossiblyBitMask | static bool isPossiblyBitMask(const EnumDecl *EnumDec) {
const ValueRange VR(EnumDec);
const int EnumLen = enumLength(EnumDec);
const int NonPowOfTwoCounter = countNonPowOfTwoLiteralNum(EnumDec);
return NonPowOfTwoCounter >= 1 && NonPowOfTwoCounter <= 2 &&
NonPowOfTwoCounter < EnumLen / 2 &&
(... | literal) or when it could contain consecutive values. | cpp | clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp | 100 | [] | true | 6 | 6.88 | llvm/llvm-project | 36,021 | doxygen | false | |
count | private int count() {
return buffer.getInt(RECORDS_COUNT_OFFSET);
} | Gets the base timestamp of the batch which is used to calculate the record timestamps from the deltas.
@return The base timestamp | java | clients/src/main/java/org/apache/kafka/common/record/DefaultRecordBatch.java | 226 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
compare | public static int compare(final String str1, final String str2, final boolean nullIsLess) {
if (str1 == str2) { // NOSONARLINT this intentionally uses == to allow for both null
return 0;
}
if (str1 == null) {
return nullIsLess ? -1 : 1;
}
if (str2 == null)... | Compares two Strings lexicographically, as per {@link String#compareTo(String)}, returning :
<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 than {@code str2... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 853 | [
"str1",
"str2",
"nullIsLess"
] | true | 6 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
lookup | function lookup(hostname, options) {
let hints = 0;
let family = 0;
let all = false;
let dnsOrder = getDefaultResultOrder();
// Parse arguments
if (hostname) {
validateString(hostname, 'hostname');
}
if (typeof options === 'number') {
validateOneOf(options, 'family', validFamilies);
family... | Get the IP address for a given hostname.
@param {string} hostname - The hostname to resolve (ex. 'nodejs.org').
@param {object} [options] - Optional settings.
@param {boolean} [options.all] - Whether to return all or just the first resolved address.
@param {0 | 4 | 6} [options.family] - The record family. Must be 4, 6,... | javascript | lib/internal/dns/promises.js | 195 | [
"hostname",
"options"
] | false | 13 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
tryGetConstEnumValue | function tryGetConstEnumValue(node: Node): string | number | undefined {
if (getIsolatedModules(compilerOptions)) {
return undefined;
}
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
} | Hooks node substitutions.
@param hint A hint as to the intended usage of the node.
@param node The node to substitute. | typescript | src/compiler/transformers/ts.ts | 2,735 | [
"node"
] | true | 4 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
hashCode | @InlineMe(replacement = "Byte.hashCode(value)")
@InlineMeValidationDisabled(
"The hash code of a byte is the int version of the byte itself, so it's simplest to return"
+ " that.")
public static int hashCode(byte value) {
return value;
} | Returns a hash code for {@code value}; obsolete alternative to {@link Byte#hashCode(byte)}.
@param value a primitive {@code byte} value
@return a hash code for the value | java | android/guava/src/com/google/common/primitives/Bytes.java | 60 | [
"value"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
addAdvisorOnChainCreation | private void addAdvisorOnChainCreation(Object next) {
// We need to convert to an Advisor if necessary so that our source reference
// matches what we find from superclass interceptors.
addAdvisor(namedBeanToAdvisor(next));
} | Invoked when advice chain is created.
<p>Add the given advice, advisor or object to the interceptor list.
Because of these three possibilities, we can't type the signature
more strongly.
@param next advice, advisor or target object | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java | 517 | [
"next"
] | void | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
scanJsxIdentifier | function scanJsxIdentifier(): SyntaxKind {
if (tokenIsIdentifierOrKeyword(token)) {
// An identifier or keyword has already been parsed - check for a `-` or a single instance of `:` and then append it and
// everything after it to the token
// Do note that this means that... | Unconditionally back up and scan a template expression portion. | typescript | src/compiler/scanner.ts | 3,770 | [] | true | 5 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
indexOf | public abstract int indexOf(CharSequence seq, CharSequence searchSeq, int startPos); | Finds the first index within a CharSequence, handling {@code null}. This method uses {@link String#indexOf(String, int)} if possible.
<p>
A {@code null} CharSequence will return {@code -1}. A negative start position is treated as zero. An empty ("") search CharSequence always matches. A
start position greater than the ... | java | src/main/java/org/apache/commons/lang3/Strings.java | 860 | [
"seq",
"searchSeq",
"startPos"
] | true | 1 | 6 | apache/commons-lang | 2,896 | javadoc | false | |
gh_summary_path | def gh_summary_path() -> Path | None:
"""Return the Path to the GitHub step summary file, or None if not set."""
p = os.environ.get("GITHUB_STEP_SUMMARY")
return Path(p) if p else None | Return the Path to the GitHub step summary file, or None if not set. | python | .ci/lumen_cli/cli/lib/common/gh_summary.py | 55 | [] | Path | None | true | 2 | 6.48 | pytorch/pytorch | 96,034 | unknown | false |
format | public static String format(final Date date, final String pattern, final TimeZone timeZone) {
return format(date, pattern, timeZone, null);
} | Formats a date/time into a specific pattern in a time zone.
@param date the date to format, not null.
@param pattern the pattern to use to format the date, not null.
@param timeZone the time zone to use, may be {@code null}.
@return the formatted date. | java | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | 290 | [
"date",
"pattern",
"timeZone"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
bindIndexed | private void bindIndexed(ConfigurationPropertySource source, ConfigurationPropertyName root,
AggregateElementBinder elementBinder, IndexedCollectionSupplier collection, ResolvableType elementType) {
Set<String> knownIndexedChildren = new HashSet<>();
if (source instanceof IterableConfigurationPropertySource iter... | Bind indexed elements to the supplied collection.
@param name the name of the property to bind
@param target the target bindable
@param elementBinder the binder to use for elements
@param aggregateType the aggregate type, may be a collection or an array
@param elementType the element type
@param result the destination ... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java | 109 | [
"source",
"root",
"elementBinder",
"collection",
"elementType"
] | void | true | 5 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
newInstance | public static @Nullable EnclosedInSquareBracketsConverter newInstance(@Nullable Configuration config,
String[] options) {
if (options.length < 1) {
LOGGER.error("Incorrect number of options on style. Expected at least 1, received {}", options.length);
return null;
}
PatternParser parser = PatternLayout.c... | Creates a new instance of the class. Required by Log4J2.
@param config the configuration
@param options the options
@return a new instance, or {@code null} if the options are invalid | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/EnclosedInSquareBracketsConverter.java | 70 | [
"config",
"options"
] | EnclosedInSquareBracketsConverter | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
_merge_dictionaries | def _merge_dictionaries(d1, d2, aggregate_duplicates=True):
"""Merge two dictionaries recursively into the first one.
Example:
>>> d1 = {'dict': {'a': 1}, 'list': [1, 2], 'tuple': (1, 2)}
>>> d2 = {'dict': {'b': 2}, 'list': [3, 4], 'set': {'a', 'b'}}
>>> _merge_dictionaries(d1, d2)
d1 will be ... | Merge two dictionaries recursively into the first one.
Example:
>>> d1 = {'dict': {'a': 1}, 'list': [1, 2], 'tuple': (1, 2)}
>>> d2 = {'dict': {'b': 2}, 'list': [3, 4], 'set': {'a', 'b'}}
>>> _merge_dictionaries(d1, d2)
d1 will be modified to: {
'dict': {'a': 1, 'b': 2},
'list': [1, 2, 3, 4],
'tuple': (1,... | python | celery/canvas.py | 73 | [
"d1",
"d2",
"aggregate_duplicates"
] | false | 15 | 7.44 | celery/celery | 27,741 | google | false | |
_build_chime_payload | def _build_chime_payload(self, message: str) -> str:
"""
Build payload for Chime and ensures messages do not exceed max length allowed.
:param message: The message you want to send to your Chime room. (max 4096 characters)
"""
payload: dict[str, Any] = {}
# We need to ma... | Build payload for Chime and ensures messages do not exceed max length allowed.
:param message: The message you want to send to your Chime room. (max 4096 characters) | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/chime.py | 86 | [
"self",
"message"
] | str | true | 2 | 7.04 | apache/airflow | 43,597 | sphinx | false |
determinePrimaryCandidate | protected @Nullable String determinePrimaryCandidate(Map<String, Object> candidates, Class<?> requiredType) {
String primaryBeanName = null;
// First pass: identify unique primary candidate
for (Map.Entry<String, Object> entry : candidates.entrySet()) {
String candidateBeanName = entry.getKey();
Object bean... | Determine the primary candidate in the given set of beans.
@param candidates a Map of candidate names and candidate instances
(or candidate classes if not created yet) that match the required type
@param requiredType the target dependency type to match against
@return the name of the primary candidate, or {@code null} ... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 2,085 | [
"candidates",
"requiredType"
] | String | true | 8 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
get | public static Path get(URI uri) {
if (uri.getScheme().equalsIgnoreCase("file")) {
return DEFAULT.provider().getPath(uri);
} else {
return Paths.get(uri);
}
} | Returns a {@code Path} from a URI
<p>
This works just like {@code Paths.get()}.
<p>
Remember: this should almost never be used. Usually resolve
a path against an existing one! | java | libs/core/src/main/java/org/elasticsearch/core/PathUtils.java | 59 | [
"uri"
] | Path | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.