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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_translate_train_sizes | def _translate_train_sizes(train_sizes, n_max_training_samples):
"""Determine absolute sizes of training subsets and validate 'train_sizes'.
Examples:
_translate_train_sizes([0.5, 1.0], 10) -> [5, 10]
_translate_train_sizes([5, 10], 10) -> [5, 10]
Parameters
----------
train_sizes ... | Determine absolute sizes of training subsets and validate 'train_sizes'.
Examples:
_translate_train_sizes([0.5, 1.0], 10) -> [5, 10]
_translate_train_sizes([5, 10], 10) -> [5, 10]
Parameters
----------
train_sizes : array-like of shape (n_ticks,)
Numbers of training examples that will be used to generate ... | python | sklearn/model_selection/_validation.py | 2,072 | [
"train_sizes",
"n_max_training_samples"
] | false | 8 | 7.44 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
onStartup | @Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext.setAttribute(LoggingApplicationListener.REGISTER_SHUTDOWN_HOOK_PROPERTY, false);
// Logger initialization is deferred in case an ordered
// LogServletContextInitializer is being used
this.logger = LogFactory... | Set if the {@link ErrorPageFilter} should be registered. Set to {@code false} if
error page mappings should be handled through the server and not Spring Boot.
@param registerErrorPageFilter if the {@link ErrorPageFilter} should be registered. | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializer.java | 103 | [
"servletContext"
] | void | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
process | private void process(final StreamsOnTasksAssignedCallbackCompletedEvent event) {
if (requestManagers.streamsMembershipManager.isEmpty()) {
log.warn("An internal error occurred; the Streams membership manager was not present, so the notification " +
"of the onTasksAssigned callback ex... | Process event indicating whether the AcknowledgeCommitCallbackHandler is configured by the user.
@param event Event containing a boolean to indicate if the callback handler is configured or not. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 696 | [
"event"
] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
getChunk | static byte[] getChunk(InputStream is) throws IOException {
byte[] buf = new byte[MAX_CHUNK_SIZE];
int chunkSize = 0;
while (chunkSize < MAX_CHUNK_SIZE) {
int read = is.read(buf, chunkSize, MAX_CHUNK_SIZE - chunkSize);
if (read == -1) {
break;
... | This method fetches the database file for the given database from the passed-in source, then indexes that database
file into the .geoip_databases Elasticsearch index, deleting any old versions of the database from the index if they exist.
@param name The name of the database to be downloaded and indexed into an Elastic... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloader.java | 369 | [
"is"
] | true | 4 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false | |
initApplicationEventMulticaster | protected void initApplicationEventMulticaster() {
ConfigurableListableBeanFactory beanFactory = getBeanFactory();
if (beanFactory.containsLocalBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME)) {
this.applicationEventMulticaster =
beanFactory.getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, ApplicationEventMul... | Initialize the {@link ApplicationEventMulticaster}.
<p>Uses {@link SimpleApplicationEventMulticaster} if none defined in the context.
@see #APPLICATION_EVENT_MULTICASTER_BEAN_NAME
@see org.springframework.context.event.SimpleApplicationEventMulticaster | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 852 | [] | void | true | 4 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
parsePort | async function parsePort(host: string | undefined, strPort: string | undefined): Promise<number> {
if (strPort) {
let range: { start: number; end: number } | undefined;
if (strPort.match(/^\d+$/)) {
return parseInt(strPort, 10);
} else if (range = parseRange(strPort)) {
const port = await findFreePort(host... | If `--port` is specified and describes a single port, connect to that port.
If `--port`describes a port range
then find a free port in that range. Throw error if no
free port available in range.
In absence of specified ports, connect to port 8000. | typescript | src/server-main.ts | 170 | [
"host",
"strPort"
] | true | 7 | 6 | microsoft/vscode | 179,840 | jsdoc | true | |
removeAll | public static boolean[] removeAll(final boolean[] array, final int... indices) {
return (boolean[]) removeAll((Object) array, indices);
} | Removes the elements at the specified positions from the specified array. All remaining elements are shifted to the left.
<p>
This method returns a new array with the same elements of the input array except those at the specified positions. The component type of the returned
array is always the same as that of the inpu... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,964 | [
"array"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
always | static PropertySourceOptions always(Options options) {
if (options == Options.NONE) {
return ALWAYS_NONE;
}
return new AlwaysPropertySourceOptions(options);
} | Create a new {@link PropertySourceOptions} instance that always returns the
same options regardless of the property source.
@param options the options to return
@return a new {@link PropertySourceOptions} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java | 143 | [
"options"
] | PropertySourceOptions | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
setCc | @Override
public void setCc(String... cc) throws MailParseException {
try {
this.helper.setCc(cc);
}
catch (MessagingException ex) {
throw new MailParseException(ex);
}
} | Return the JavaMail MimeMessage that this MimeMailMessage is based on. | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMailMessage.java | 126 | [] | void | true | 2 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
transform | def transform(self, X):
"""Apply dimensionality reduction to X.
X is projected on the first principal components previously extracted
from a training set, using minibatches of size batch_size if X is
sparse.
Parameters
----------
X : {array-like, sparse matrix} ... | Apply dimensionality reduction to X.
X is projected on the first principal components previously extracted
from a training set, using minibatches of size batch_size if X is
sparse.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
New data, where `n_samples` is the number of s... | python | sklearn/decomposition/_incremental_pca.py | 378 | [
"self",
"X"
] | false | 5 | 7.04 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_weighted_cluster_center | def _weighted_cluster_center(self, X):
"""Calculate and store the centroids/medoids of each cluster.
This requires `X` to be a raw feature array, not precomputed
distances. Rather than return outputs directly, this helper method
instead stores them in the `self.{centroids, medoids}_` at... | Calculate and store the centroids/medoids of each cluster.
This requires `X` to be a raw feature array, not precomputed
distances. Rather than return outputs directly, this helper method
instead stores them in the `self.{centroids, medoids}_` attributes.
The choice for which attributes are calculated and stored is med... | python | sklearn/cluster/_hdbscan/hdbscan.py | 923 | [
"self",
"X"
] | false | 6 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
createSystemModuleBody | function createSystemModuleBody(node: SourceFile, dependencyGroups: DependencyGroup[]) {
// Shape of the body in system modules:
//
// function (exports) {
// <list of local aliases for imports>
// <hoisted variable declarations>
// <hoisted function... | Adds the statements for the module body function for the source file.
@param node The source file for the module.
@param dependencyGroups The grouped dependencies of the module. | typescript | src/compiler/transformers/module/system.ts | 310 | [
"node",
"dependencyGroups"
] | false | 3 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toPrimitive | public static double[] toPrimitive(final Double[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_DOUBLE_ARRAY;
}
final double[] result = new double[array.length];
for (int i = 0; i < array.length; i++) {
... | Converts an array of object Doubles to primitives.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array a {@link Double} array, may be {@code null}.
@return a {@code double} array, {@code null} if null array input.
@throws NullPointerException if an array element is {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,957 | [
"array"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
hextetsToIPv6String | private static String hextetsToIPv6String(int[] hextets) {
// While scanning the array, handle these state transitions:
// start->num => "num" start->gap => "::"
// num->num => ":num" num->gap => "::"
// gap->num => "num" gap->gap => ""
StringBuilder buf = new StringBuilder(... | Convert a list of hextets into a human-readable IPv6 address.
<p>In order for "::" compression to work, the input should contain negative sentinel values in
place of the elided zeroes.
@param hextets {@code int[]} array of eight 16-bit hextets, or -1s | java | android/guava/src/com/google/common/net/InetAddresses.java | 537 | [
"hextets"
] | String | true | 6 | 7.2 | google/guava | 51,352 | javadoc | false |
get_slice_bound | def get_slice_bound(self, label, side: Literal["left", "right"]) -> int:
"""
Calculate slice bound that corresponds to given label.
Returns leftmost (one-past-the-rightmost if ``side=='right'``) position
of given label.
Parameters
----------
label : object
... | Calculate slice bound that corresponds to given label.
Returns leftmost (one-past-the-rightmost if ``side=='right'``) position
of given label.
Parameters
----------
label : object
The label for which to calculate the slice bound.
side : {'left', 'right'}
if 'left' return leftmost position of given label.
... | python | pandas/core/indexes/base.py | 6,821 | [
"self",
"label",
"side"
] | int | true | 10 | 8.08 | pandas-dev/pandas | 47,362 | numpy | false |
getLineNumber | public int getLineNumber() {
Throwable cause = getCause();
if (cause instanceof SAXParseException parseEx) {
return parseEx.getLineNumber();
}
return -1;
} | Return the line number in the XML resource that failed.
@return the line number if available (in case of a SAXParseException); -1 else
@see org.xml.sax.SAXParseException#getLineNumber() | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionStoreException.java | 53 | [] | true | 2 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
completeQuietly | void completeQuietly(final Utils.ThrowingRunnable function,
final String msg,
final AtomicReference<Throwable> firstException) {
try {
function.run();
} catch (TimeoutException e) {
log.debug("Timeout expired before the {} operati... | This method can be used by cases where the caller has an event that needs to both block for completion but
also process background events. For some events, in order to fully process the associated logic, the
{@link ConsumerNetworkThread background thread} needs assistance from the application thread to complete.
If the... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java | 1,329 | [
"function",
"msg",
"firstException"
] | void | true | 3 | 7.76 | apache/kafka | 31,560 | javadoc | false |
generateReturnCode | @Override
public CodeBlock generateReturnCode(
GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode) {
CodeBlock.Builder code = CodeBlock.builder();
code.addStatement("return $L", BEAN_DEFINITION_VARIABLE);
return code.build();
} | Extract the target class of a public {@link FactoryBean} based on its
constructor. If the implementation does not resolve the target class
because it itself uses a generic, attempt to extract it from the bean type.
@param factoryBeanType the factory bean type
@param beanType the bean type
@return the target class to us... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragments.java | 238 | [
"generationContext",
"beanRegistrationCode"
] | CodeBlock | true | 1 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
toStringArray | public static String[] toStringArray(final Object[] array) {
return toStringArray(array, "null");
} | Returns an array containing the string representation of each element in the argument array.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array the {@code Object[]} to be processed, may be {@code null}.
@return {@code String[]} of the same size as the source with its element's string... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 9,283 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
checkStrictModeWithStatement | function checkStrictModeWithStatement(node: WithStatement) {
// Grammar checking for withStatement
if (inStrictMode) {
errorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode);
}
} | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 2,729 | [
"node"
] | false | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
startTask | private void startTask(ProjectId projectId, Runnable onFailure) {
persistentTasksService.sendProjectStartRequest(
projectId,
getTaskId(projectId, projectResolver.supportsMultipleProjects()),
GEOIP_DOWNLOADER,
new GeoIpTaskParams(),
MasterNodeRequest.IN... | Check if a processor is a pipeline processor containing at least a geoip processor. This method also updates
pipelineHasGeoProcessorById with a result for any pipelines it looks at.
@param processor Processor config.
@param downloadDatabaseOnPipelineCreation Should the download_database_on_pipeline_creation of the geoi... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java | 534 | [
"projectId",
"onFailure"
] | void | true | 3 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false |
resolveConstructorBoundProperties | private Stream<PropertyDescriptor> resolveConstructorBoundProperties(TypeElement declaringElement,
TypeElementMembers members, ExecutableElement bindConstructor) {
Map<String, PropertyDescriptor> candidates = new LinkedHashMap<>();
bindConstructor.getParameters().forEach((parameter) -> {
PropertyDescriptor de... | Return the {@link PropertyDescriptor} instances that are valid candidates for the
specified {@link TypeElement type} based on the specified {@link ExecutableElement
factory method}, if any.
@param type the target type
@param factoryMethod the method that triggered the metadata for that {@code type}
or {@code null}
@ret... | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolver.java | 78 | [
"declaringElement",
"members",
"bindConstructor"
] | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
setIntrospectionClass | protected void setIntrospectionClass(Class<?> clazz) {
if (this.cachedIntrospectionResults != null && this.cachedIntrospectionResults.getBeanClass() != clazz) {
this.cachedIntrospectionResults = null;
}
} | Set the class to introspect.
Needs to be called when the target object changes.
@param clazz the class to introspect | java | spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java | 152 | [
"clazz"
] | void | true | 3 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
iterator | @Override
public Iterator<ConfigDataEnvironmentContributor> iterator() {
return this.root.iterator();
} | Return a {@link Binder} backed by the contributors.
@param activationContext the activation context
@param filter a filter used to limit the contributors
@param options binder options to apply
@return a binder instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributors.java | 251 | [] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
addCandidateComponentsFromIndex | private Set<BeanDefinition> addCandidateComponentsFromIndex(CandidateComponentsIndex index, String basePackage) {
Set<BeanDefinition> candidates = new LinkedHashSet<>();
try {
Set<String> types = new HashSet<>();
for (TypeFilter filter : this.includeFilters) {
String stereotype = extractStereotype(filter)... | Extract the stereotype to use for the specified compatible filter.
@param filter the filter to handle
@return the stereotype in the index matching this filter
@since 5.0
@see #indexSupportsIncludeFilter(TypeFilter) | java | spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java | 403 | [
"index",
"basePackage"
] | true | 8 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
poll | @Override
public NetworkClientDelegate.PollResult poll(long currentTimeMs) {
if (coordinatorRequestManager.coordinator().isEmpty() || membershipManager.shouldSkipHeartbeat()) {
membershipManager.onHeartbeatRequestSkipped();
maybePropagateCoordinatorFatalErrorEvent();
retu... | This will build a heartbeat request if one must be sent, determined based on the member
state. A heartbeat is sent when all of the following applies:
<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
tha... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsGroupHeartbeatRequestManager.java | 363 | [
"currentTimeMs"
] | true | 7 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
withBindRestrictions | public Bindable<T> withBindRestrictions(BindRestriction... additionalRestrictions) {
EnumSet<BindRestriction> bindRestrictions = EnumSet.copyOf(this.bindRestrictions);
bindRestrictions.addAll(Arrays.asList(additionalRestrictions));
return new Bindable<>(this.type, this.boxedType, this.value, this.annotations, bin... | Create an updated {@link Bindable} instance with additional bind restrictions.
@param additionalRestrictions any additional restrictions to apply
@return an updated {@link Bindable}
@since 2.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | 225 | [] | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
access | function access(path, mode, callback) {
if (typeof mode === 'function') {
callback = mode;
mode = F_OK;
}
path = getValidatedPath(path);
callback = makeCallback(callback);
const req = new FSReqCallback();
req.oncomplete = callback;
binding.access(path, mode, req);
} | Tests a user's permissions for the file or directory
specified by `path`.
@param {string | Buffer | URL} path
@param {number} [mode]
@param {(err?: Error) => any} callback
@returns {void} | javascript | lib/fs.js | 215 | [
"path",
"mode",
"callback"
] | false | 2 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
destroySingletons | public void destroySingletons() {
if (logger.isTraceEnabled()) {
logger.trace("Destroying singletons in " + this);
}
this.singletonsCurrentlyInDestruction = true;
String[] disposableBeanNames;
synchronized (this.disposableBeans) {
disposableBeanNames = StringUtils.toStringArray(this.disposableBeans.key... | Return the names of all beans that the specified bean depends on, if any.
@param beanName the name of the bean
@return the array of names of beans which the bean depends on,
or an empty array if none | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java | 693 | [] | void | true | 3 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
assert_prek_installed | def assert_prek_installed():
"""
Check if prek is installed in the right version.
:return: True is the prek is installed in the right version.
"""
# Local import to make autocomplete work
import yaml
from packaging.version import Version
prek_config = yaml.safe_load((AIRFLOW_ROOT_PATH ... | Check if prek is installed in the right version.
:return: True is the prek is installed in the right version. | python | dev/breeze/src/airflow_breeze/utils/run_utils.py | 207 | [] | false | 8 | 7.2 | apache/airflow | 43,597 | unknown | false | |
brokers | public Collection<Node> brokers() {
return holder().brokers.values();
} | Get all brokers returned in metadata response
@return the brokers | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java | 229 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
hideStackFrames | function hideStackFrames(fn) {
function wrappedFn(...args) {
try {
return ReflectApply(fn, this, args);
} catch (error) {
Error.stackTraceLimit && ErrorCaptureStackTrace(error, wrappedFn);
throw error;
}
}
wrappedFn.withoutStackTrace = fn;
return wrappedFn;
} | This function removes unnecessary frames from Node.js core errors.
@template {(...args: unknown[]) => unknown} T
@param {T} fn
@returns {T} | javascript | lib/internal/errors.js | 540 | [
"fn"
] | false | 3 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
readLiteral | private Object readLiteral() throws JSONException {
String literal = nextToInternal("{}[]/\\:,=;# \t\f");
if (literal.isEmpty()) {
throw syntaxError("Expected literal value");
}
else if ("null".equalsIgnoreCase(literal)) {
return JSONObject.NULL;
}
else if ("true".equalsIgnoreCase(literal)) {
retu... | Reads a null, boolean, numeric or unquoted string literal value. Numeric values
will be returned as an Integer, Long, or Double, in that order of preference.
@return a literal value
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 273 | [] | Object | true | 14 | 8.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
requireMethod | private static Method requireMethod(final Method method) {
return Objects.requireNonNull(method, "method");
} | Throws NullPointerException if {@code method} is {@code null}.
@param method The method to test.
@return The given method.
@throws NullPointerException if {@code method} is {@code null}. | java | src/main/java/org/apache/commons/lang3/function/MethodInvokers.java | 236 | [
"method"
] | Method | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
getCanonicalName | private static String getCanonicalName(final String name) {
String className = StringUtils.deleteWhitespace(name);
if (className == null) {
return null;
}
int dim = 0;
final int len = className.length();
while (dim < len && className.charAt(dim) == '[') {
... | Converts a given name of class into canonical format. If name of class is not a name of array class it returns
unchanged name.
<p>
The method does not change the {@code $} separators in case the class is inner class.
</p>
<p>
Example:
<ul>
<li>{@code getCanonicalName("[I") = "int[]"}</li>
<li>{@code getCanonicalName("[... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 496 | [
"name"
] | String | true | 13 | 9.36 | apache/commons-lang | 2,896 | javadoc | false |
load64 | static long load64(byte[] input, int offset) {
// We don't want this in production code as this is the most critical part of the loop.
assert input.length >= offset + 8;
// Delegates to the fast (unsafe) version or the fallback.
return byteArray.getLongLittleEndian(input, offset);
} | Load 8 bytes into long in a little endian manner, from the substring between position and
position + 8. The array must have at least 8 bytes from offset (inclusive).
@param input the input bytes
@param offset the offset into the array at which to start
@return a long of a concatenated 8 bytes | java | android/guava/src/com/google/common/hash/LittleEndianByteArray.java | 51 | [
"input",
"offset"
] | true | 1 | 7.2 | google/guava | 51,352 | javadoc | false | |
genericArrayTypeToString | private static String genericArrayTypeToString(final GenericArrayType genericArrayType) {
return String.format("%s[]", toString(genericArrayType.getGenericComponentType()));
} | Formats a {@link GenericArrayType} as a {@link String}.
@param genericArrayType {@link GenericArrayType} to format.
@return String. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 583 | [
"genericArrayType"
] | String | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
millis | public long millis() {
return timeUnit.toMillis(duration);
} | @return the number of {@link #timeUnit()} units this value contains | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 130 | [] | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false | |
convertProperties | protected void convertProperties(Properties props) {
Enumeration<?> propertyNames = props.propertyNames();
while (propertyNames.hasMoreElements()) {
String propertyName = (String) propertyNames.nextElement();
String propertyValue = props.getProperty(propertyName);
String convertedValue = convertProperty(pr... | Convert the given merged properties, converting property values
if necessary. The result will then be processed.
<p>The default implementation will invoke {@link #convertPropertyValue}
for each property value, replacing the original with the converted value.
@param props the Properties to convert
@see #processPropertie... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyResourceConfigurer.java | 101 | [
"props"
] | void | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
ohlc | def ohlc(self) -> DataFrame:
"""
Compute open, high, low and close values of a group, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Returns
-------
DataFrame
Open, high, low and close values within each group.
... | Compute open, high, low and close values of a group, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Returns
-------
DataFrame
Open, high, low and close values within each group.
See Also
--------
DataFrame.agg : Aggregate using one or more operations over the specified ax... | python | pandas/core/groupby/groupby.py | 3,408 | [
"self"
] | DataFrame | true | 3 | 8.08 | pandas-dev/pandas | 47,362 | unknown | false |
_matches_client_defaults | def _matches_client_defaults(cls, var: Any, attrname: str) -> bool:
"""
Check if a field value matches client_defaults and should be excluded.
This implements the hierarchical defaults optimization where values that match
client_defaults are omitted from individual task serialization.
... | Check if a field value matches client_defaults and should be excluded.
This implements the hierarchical defaults optimization where values that match
client_defaults are omitted from individual task serialization.
:param var: The value to check
:param attrname: The attribute name
:return: True if value matches client... | python | airflow-core/src/airflow/serialization/serialized_objects.py | 1,692 | [
"cls",
"var",
"attrname"
] | bool | true | 3 | 7.76 | apache/airflow | 43,597 | sphinx | false |
collect_node_descendants | def collect_node_descendants(
graph: torch.fx.Graph,
) -> dict[torch.fx.Node, OrderedSet[torch.fx.Node]]:
"""
Collects the descendants of each node in the graph.
Args:
graph (torch.fx.Graph): The graph to collect descendants from.
Returns:
dict[torch.fx.Node, OrderedSet[torch.fx.Node... | Collects the descendants of each node in the graph.
Args:
graph (torch.fx.Graph): The graph to collect descendants from.
Returns:
dict[torch.fx.Node, OrderedSet[torch.fx.Node]]: A dictionary mapping each node to its descendants. | python | torch/_inductor/fx_passes/bucketing.py | 234 | [
"graph"
] | dict[torch.fx.Node, OrderedSet[torch.fx.Node]] | true | 7 | 7.6 | pytorch/pytorch | 96,034 | google | false |
parseCacheAnnotations | @Nullable Collection<CacheOperation> parseCacheAnnotations(Method method); | Parse the cache definition for the given method,
based on an annotation type understood by this parser.
<p>This essentially parses a known cache annotation into Spring's metadata
attribute class. Returns {@code null} if the method is not cacheable.
@param method the annotated method
@return the configured caching opera... | java | spring-context/src/main/java/org/springframework/cache/annotation/CacheAnnotationParser.java | 79 | [
"method"
] | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
set_operator_weight | def set_operator_weight(op_name: str, weight: float) -> None:
"""Set the selection weight for a specific operator.
Args:
op_name: The registered operator name (e.g., "add", "arg") OR fully-qualified torch op
(e.g., "torch.nn.functional.relu", "torch.matmul")
weight: New relativ... | Set the selection weight for a specific operator.
Args:
op_name: The registered operator name (e.g., "add", "arg") OR fully-qualified torch op
(e.g., "torch.nn.functional.relu", "torch.matmul")
weight: New relative selection weight (must be > 0) | python | tools/experimental/torchfuzz/operators/registry.py | 177 | [
"op_name",
"weight"
] | None | true | 5 | 6.56 | pytorch/pytorch | 96,034 | google | false |
apply | def apply(
self,
f,
align_keys: list[str] | None = None,
**kwargs,
) -> Self:
"""
Iterate over the blocks, collect and create a new BlockManager.
Parameters
----------
f : str or callable
Name of the Block method to apply.
... | Iterate over the blocks, collect and create a new BlockManager.
Parameters
----------
f : str or callable
Name of the Block method to apply.
align_keys: List[str] or None, default None
**kwargs
Keywords to pass to `f`
Returns
-------
BlockManager | python | pandas/core/internals/managers.py | 395 | [
"self",
"f",
"align_keys"
] | Self | true | 11 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
reauthenticationLatencyMs | public Long reauthenticationLatencyMs() {
return authenticator.reauthenticationLatencyMs();
} | Return the number of milliseconds that elapsed while re-authenticating this
session from the perspective of this instance, if applicable, otherwise null.
The server-side perspective will yield a lower value than the client-side
perspective of the same re-authentication because the client-side observes an
additional net... | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 628 | [] | Long | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
_coerce_indexer_frozen | def _coerce_indexer_frozen(array_like, categories, copy: bool = False) -> np.ndarray:
"""
Coerce the array-like indexer to the smallest integer dtype that can encode all
of the given categories.
Parameters
----------
array_like : array-like
categories : array-like
copy : bool
Retur... | Coerce the array-like indexer to the smallest integer dtype that can encode all
of the given categories.
Parameters
----------
array_like : array-like
categories : array-like
copy : bool
Returns
-------
np.ndarray
Non-writeable. | python | pandas/core/indexes/multi.py | 4,411 | [
"array_like",
"categories",
"copy"
] | np.ndarray | true | 2 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
slice_locs | def slice_locs(
self,
start: SliceType = None,
end: SliceType = None,
step: int | None = None,
) -> tuple[int, int]:
"""
Compute slice locations for input labels.
Parameters
----------
start : label, default None
If None, defaults ... | Compute slice locations for input labels.
Parameters
----------
start : label, default None
If None, defaults to the beginning.
end : label, default None
If None, defaults to the end.
step : int, defaults None
If None, defaults to 1.
Returns
-------
tuple[int, int]
Returns a tuple of two integers repr... | python | pandas/core/indexes/base.py | 6,910 | [
"self",
"start",
"end",
"step"
] | tuple[int, int] | true | 14 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
min | public static double min(final double a, final double b) {
if (Double.isNaN(a)) {
return b;
}
if (Double.isNaN(b)) {
return a;
}
return Math.min(a, b);
} | Gets the minimum of two {@code double} values.
<p>NaN is only returned if all numbers are NaN as per IEEE-754r.</p>
@param a value 1.
@param b value 2.
@return the smallest of the values. | java | src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java | 173 | [
"a",
"b"
] | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
nextHook | function nextHook(): null | Hook {
const hook = currentHook;
if (hook !== null) {
currentHook = hook.next;
}
return hook;
} | 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-debug-tools/src/ReactDebugHooks.js | 153 | [] | false | 2 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
findResource | @Override
public URL findResource(String name) {
if (!this.hasJarUrls) {
return super.findResource(name);
}
Optimizations.enable(false);
try {
return super.findResource(name);
}
finally {
Optimizations.disable();
}
} | Create a new {@link LaunchedClassLoader} instance.
@param urls the URLs from which to load classes and resources
@param parent the parent class loader for delegation | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlClassLoader.java | 66 | [
"name"
] | URL | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
offset | public long offset() {
return this.offset;
} | The offset of the record in the topic/partition.
@return the offset of the record, or -1 if {{@link #hasOffset()}} returns false. | java | clients/src/main/java/org/apache/kafka/clients/producer/RecordMetadata.java | 69 | [] | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false | |
unescapeJava | public static final String unescapeJava(final String input) {
return UNESCAPE_JAVA.translate(input);
} | Unescapes any Java literals found in the {@link String}.
For example, it will turn a sequence of {@code '\'} and
{@code 'n'} into a newline character, unless the {@code '\'}
is preceded by another {@code '\'}.
@param input the {@link String} to unescape, may be null
@return a new unescaped {@link String}, {@code null}... | java | src/main/java/org/apache/commons/lang3/StringEscapeUtils.java | 742 | [
"input"
] | String | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
adjacentNodes | @Override
public Set<N> adjacentNodes() {
if (orderedNodeConnections == null) {
return Collections.unmodifiableSet(adjacentNodeValues.keySet());
} else {
return new AbstractSet<N>() {
@Override
public UnmodifiableIterator<N> iterator() {
Iterator<NodeConnection<N>> nodeCo... | All node connections in this graph, in edge insertion order.
<p>Note: This field and {@link #adjacentNodeValues} cannot be combined into a single
LinkedHashMap because one target node may be mapped to both a predecessor and a successor. A
LinkedHashMap combines two such edges into a single node-value pair, even though ... | java | android/guava/src/com/google/common/graph/DirectedGraphConnections.java | 233 | [] | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false | |
wakeupTrigger | WakeupTrigger wakeupTrigger() {
return wakeupTrigger;
} | Get the current subscription. or an empty set if no such call has
been made.
@return The set of topics currently subscribed to | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 1,868 | [] | WakeupTrigger | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
read_array | def read_array(fp, allow_pickle=False, pickle_kwargs=None, *,
max_header_size=_MAX_HEADER_SIZE):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pick... | Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
pickle_kwargs : dict
Additional keyword arguments to pass to pickl... | python | numpy/lib/_format_impl.py | 781 | [
"fp",
"allow_pickle",
"pickle_kwargs",
"max_header_size"
] | false | 15 | 6 | numpy/numpy | 31,054 | numpy | false | |
maybeTruncateReason | public static String maybeTruncateReason(final String reason) {
if (reason.length() > 255) {
return reason.substring(0, 255);
} else {
return reason;
}
} | Ensures that the provided {@code reason} remains within a range of 255 chars.
@param reason This is the reason that is sent to the broker over the wire
as a part of {@code JoinGroupRequest} or {@code LeaveGroupRequest} messages.
@return a provided reason as is or truncated reason if it exceeds the 255 cha... | java | clients/src/main/java/org/apache/kafka/common/requests/JoinGroupRequest.java | 78 | [
"reason"
] | String | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false |
_cum_func | def _cum_func(
func: Callable,
values: np.ndarray,
*,
skipna: bool = True,
) -> np.ndarray:
"""
Accumulations for 1D datetimelike arrays.
Parameters
----------
func : np.cumsum, np.maximum.accumulate, np.minimum.accumulate
values : np.ndarray
Numpy array with the values ... | Accumulations for 1D datetimelike arrays.
Parameters
----------
func : np.cumsum, np.maximum.accumulate, np.minimum.accumulate
values : np.ndarray
Numpy array with the values (can be of any dtype that support the
operation). Values is changed is modified inplace.
skipna : bool, default True
Whether to skip... | python | pandas/core/array_algos/datetimelike_accumulations.py | 19 | [
"func",
"values",
"skipna"
] | np.ndarray | true | 3 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
is_datetime64_any_dtype | def is_datetime64_any_dtype(arr_or_dtype) -> bool:
"""
Check whether the provided array or dtype is of the datetime64 dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
bool
Whether or not the array or dtype is o... | Check whether the provided array or dtype is of the datetime64 dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array or dtype to check.
Returns
-------
bool
Whether or not the array or dtype is of the datetime64 dtype.
See Also
--------
api.types.is_datetime64_dtype : Check whether an arr... | python | pandas/core/dtypes/common.py | 999 | [
"arr_or_dtype"
] | bool | true | 6 | 7.92 | pandas-dev/pandas | 47,362 | numpy | false |
bootstrap_plot | def bootstrap_plot(
series: Series,
fig: Figure | None = None,
size: int = 50,
samples: int = 500,
**kwds,
) -> Figure:
"""
Bootstrap plot on mean, median and mid-range statistics.
The bootstrap plot is used to estimate the uncertainty of a statistic
by relying on random sampling wi... | Bootstrap plot on mean, median and mid-range statistics.
The bootstrap plot is used to estimate the uncertainty of a statistic
by relying on random sampling with replacement [1]_. This function will
generate bootstrapping plots for mean, median and mid-range statistics
for the given number of samples of the given size... | python | pandas/plotting/_misc.py | 439 | [
"series",
"fig",
"size",
"samples"
] | Figure | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
negativeBuckets | @Override
public ExponentialHistogram.Buckets negativeBuckets() {
return negativeBuckets;
} | Attempts to add a bucket to the positive or negative range of this histogram.
<br>
Callers must adhere to the following rules:
<ul>
<li>All buckets for the negative values range must be provided before the first one from the positive values range.</li>
<li>For both the negative and positive ranges, buckets must... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/FixedCapacityExponentialHistogram.java | 196 | [] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
hitRate | public double hitRate() {
long requestCount = requestCount();
return (requestCount == 0) ? 1.0 : (double) hitCount / requestCount;
} | Returns the ratio of cache requests which were hits. This is defined as {@code hitCount /
requestCount}, or {@code 1.0} when {@code requestCount == 0}. Note that {@code hitRate +
missRate =~ 1.0}. | java | android/guava/src/com/google/common/cache/CacheStats.java | 123 | [] | true | 2 | 6.8 | google/guava | 51,352 | javadoc | false | |
makeFindCoordinatorRequest | NetworkClientDelegate.UnsentRequest makeFindCoordinatorRequest(final long currentTimeMs) {
coordinatorRequestState.onSendAttempt(currentTimeMs);
FindCoordinatorRequestData data = new FindCoordinatorRequestData()
.setKeyType(FindCoordinatorRequest.CoordinatorType.GROUP.id())
... | Poll for the FindCoordinator request.
If we don't need to discover a coordinator, this method will return a PollResult with Long.MAX_VALUE backoff time and an empty list.
If we are still backing off from a previous attempt, this method will return a PollResult with the remaining backoff time and an empty list.
Otherwis... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CoordinatorRequestManager.java | 113 | [
"currentTimeMs"
] | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
parseStringItems | private Map<String, String> parseStringItems(JSONObject json) throws JSONException {
Map<String, String> result = new HashMap<>();
for (Iterator<?> iterator = json.keys(); iterator.hasNext();) {
String key = (String) iterator.next();
Object value = json.get(key);
if (value instanceof String string) {
r... | Returns the defaults applicable to the service.
@return the defaults of the service | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java | 216 | [
"json"
] | true | 3 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
toString | @Override
public String toString() {
return "RandomUtils [random=" + random() + "]";
} | Generates a random long within the specified range.
@param startInclusive the smallest value that can be returned, must be non-negative.
@param endExclusive the upper bound (not included).
@throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is negative.
@return the r... | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 454 | [] | String | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
get_last_ti | def get_last_ti(self, dag: SerializedDAG, session: Session = NEW_SESSION) -> TI | None:
"""Get Last TI from the dagrun to build and pass Execution context object from server to then run callbacks."""
tis = self.get_task_instances(session=session)
# tis from a dagrun may not be a part of dag.part... | Get Last TI from the dagrun to build and pass Execution context object from server to then run callbacks. | python | airflow-core/src/airflow/models/dagrun.py | 1,409 | [
"self",
"dag",
"session"
] | TI | None | true | 3 | 6 | apache/airflow | 43,597 | unknown | false |
coordinatorNotAvailable | public static <T> RequestFuture<T> coordinatorNotAvailable() {
return failure(Errors.COORDINATOR_NOT_AVAILABLE.exception());
} | Convert from a request future of one type to another type
@param adapter The adapter which does the conversion
@param <S> The type of the future adapted to
@return The new future | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestFuture.java | 243 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
adopt_or_reset_orphaned_tasks | def adopt_or_reset_orphaned_tasks(self, session: Session = NEW_SESSION) -> int:
"""
Adopt or reset any TaskInstance in resettable state if its SchedulerJob is no longer running.
:return: the number of TIs reset
"""
self.log.info("Adopting or resetting orphaned tasks for active d... | Adopt or reset any TaskInstance in resettable state if its SchedulerJob is no longer running.
:return: the number of TIs reset | python | airflow-core/src/airflow/jobs/scheduler_job_runner.py | 2,527 | [
"self",
"session"
] | int | true | 9 | 6.64 | apache/airflow | 43,597 | unknown | false |
checkInvalidTopics | private void checkInvalidTopics(Cluster cluster) {
if (!cluster.invalidTopics().isEmpty()) {
log.error("Metadata response reported invalid topics {}", cluster.invalidTopics());
invalidTopics = new HashSet<>(cluster.invalidTopics());
}
} | Updates the partition-leadership info in the metadata. Update is done by merging existing metadata with the input leader information and nodes.
This is called whenever partition-leadership updates are returned in a response from broker(ex - ProduceResponse & FetchResponse).
Note that the updates via Metadata RPC are ha... | java | clients/src/main/java/org/apache/kafka/clients/Metadata.java | 469 | [
"cluster"
] | void | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false |
containsSingleton | boolean containsSingleton(String beanName); | Check if this registry contains a singleton instance with the given name.
<p>Only checks already instantiated singletons; does not return {@code true}
for singleton bean definitions which have not been instantiated yet.
<p>The main purpose of this method is to check manually registered singletons
(see {@link #registerS... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/SingletonBeanRegistry.java | 110 | [
"beanName"
] | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
currentLeader | public synchronized LeaderAndEpoch currentLeader(TopicPartition topicPartition) {
Optional<MetadataResponse.PartitionMetadata> maybeMetadata = partitionMetadataIfCurrent(topicPartition);
if (maybeMetadata.isEmpty())
return new LeaderAndEpoch(Optional.empty(), Optional.ofNullable(lastSeenLead... | @return a mapping from topic names to topic IDs for all topics with valid IDs in the cache | java | clients/src/main/java/org/apache/kafka/clients/Metadata.java | 295 | [
"topicPartition"
] | LeaderAndEpoch | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
appendExportsOfVariableStatement | function appendExportsOfVariableStatement(statements: Statement[] | undefined, node: VariableStatement, exportSelf: boolean): Statement[] | undefined {
if (moduleInfo.exportEquals) {
return statements;
}
for (const decl of node.declarationList.declarations) {
if (d... | Appends the exports of a VariableStatement to a statement list, returning the statement
list.
@param statements A statement list to which the down-level export statements are to be
appended. If `statements` is `undefined`, a new array is allocated if statements are
appended.
@param node The VariableStatement whos... | typescript | src/compiler/transformers/module/system.ts | 1,074 | [
"statements",
"node",
"exportSelf"
] | true | 4 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
withUpperBounds | public WildcardTypeBuilder withUpperBounds(final Type... bounds) {
this.upperBounds = bounds;
return this;
} | Specify upper bounds of the wildcard type to build.
@param bounds to set.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 218 | [] | WildcardTypeBuilder | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
__call__ | def __call__(self, X, Y=None, eval_gradient=False):
"""Return the kernel k(X, Y) and optionally its gradient.
Parameters
----------
X : ndarray of shape (n_samples_X, n_features)
Left argument of the returned kernel k(X, Y)
Y : ndarray of shape (n_samples_Y, n_featu... | Return the kernel k(X, Y) and optionally its gradient.
Parameters
----------
X : ndarray of shape (n_samples_X, n_features)
Left argument of the returned kernel k(X, Y)
Y : ndarray of shape (n_samples_Y, n_features), default=None
Right argument of the returned kernel k(X, Y). If None, k(X, X)
if evaluated... | python | sklearn/gaussian_process/kernels.py | 1,525 | [
"self",
"X",
"Y",
"eval_gradient"
] | false | 10 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
eye | def eye(N, M=None, k=0, dtype=float, order='C', *, device=None, like=None):
"""
Return a 2-D array with ones on the diagonal and zeros elsewhere.
Parameters
----------
N : int
Number of rows in the output.
M : int, optional
Number of columns in the output. If None, defaults to `N`.
... | Return a 2-D array with ones on the diagonal and zeros elsewhere.
Parameters
----------
N : int
Number of rows in the output.
M : int, optional
Number of columns in the output. If None, defaults to `N`.
k : int, optional
Index of the diagonal: 0 (the default) refers to the main diagonal,
a positive value refer... | python | numpy/lib/_twodim_base_impl.py | 178 | [
"N",
"M",
"k",
"dtype",
"order",
"device",
"like"
] | false | 6 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
instantiate | public @Nullable T instantiate(@Nullable ClassLoader classLoader, String name) {
return instantiate(TypeSupplier.forName(classLoader, name));
} | Instantiate the given set of class name, injecting constructor arguments as
necessary.
@param classLoader the source classloader
@param name the class name to instantiate
@return an instantiated instance
@since 3.4.0 | java | core/spring-boot/src/main/java/org/springframework/boot/util/Instantiator.java | 149 | [
"classLoader",
"name"
] | T | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
nextIndex | int nextIndex(int index) {
return (index + 1 < size) ? index + 1 : -1;
} | Constructs a new instance of {@code ObjectCountHashMap} with the specified capacity.
@param capacity the initial capacity of this {@code ObjectCountHashMap}. | java | android/guava/src/com/google/common/collect/ObjectCountHashMap.java | 177 | [
"index"
] | true | 2 | 6 | google/guava | 51,352 | javadoc | false | |
nextInTable | boolean nextInTable() {
while (nextTableIndex >= 0) {
if ((nextEntry = currentTable.get(nextTableIndex--)) != null) {
if (advanceTo(nextEntry) || nextInChain()) {
return true;
}
}
}
return false;
} | Finds the next entry in the current table. Returns true if an entry was found. | java | android/guava/src/com/google/common/cache/LocalCache.java | 4,261 | [] | true | 5 | 6.88 | google/guava | 51,352 | javadoc | false | |
rangeEndTimestamp | private long rangeEndTimestamp() {
return BASE_TIMESTAMP + (long) (batchSize * deltaTime * queryRange);
} | Calculates the upper bound for the timestamp range query based on {@code batchSize},
{@code deltaTime}, and {@code queryRange}.
@return the computed upper bound for the timestamp range query | java | benchmarks/src/main/java/org/elasticsearch/benchmark/search/query/range/DateFieldMapperDocValuesSkipperBenchmark.java | 269 | [] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
lastIndexOfIgnoreCase | @Deprecated
public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr, final int startPos) {
return Strings.CI.lastIndexOf(str, searchStr, startPos);
} | Case in-sensitive find of the last index within a CharSequence from the specified position.
<p>
A {@code null} CharSequence will return {@code -1}. A negative start position returns {@code -1}. An empty ("") search CharSequence always matches unless
the start position is negative. A start position greater than the stri... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 4,992 | [
"str",
"searchStr",
"startPos"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
describeCluster | default DescribeClusterResult describeCluster() {
return describeCluster(new DescribeClusterOptions());
} | Get information about the nodes in the cluster, using the default options.
<p>
This is a convenience method for {@link #describeCluster(DescribeClusterOptions)} with default options.
See the overload for more details.
@return The DescribeClusterResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 342 | [] | DescribeClusterResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
getDefaultNativeImageArguments | protected List<String> getDefaultNativeImageArguments(String applicationClassName) {
List<String> args = new ArrayList<>();
args.add("-H:Class=" + applicationClassName);
args.add("--no-fallback");
return args;
} | Return the native image arguments to use.
<p>By default, the main class to use, as well as standard application flags
are added.
<p>If the returned list is empty, no {@code native-image.properties} is
contributed.
@param applicationClassName the fully qualified class name of the application
entry point
@return the nati... | java | spring-context/src/main/java/org/springframework/context/aot/ContextAotProcessor.java | 136 | [
"applicationClassName"
] | true | 1 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toMillisInt | public static int toMillisInt(final Duration duration) {
Objects.requireNonNull(duration, "duration");
// intValue() does not do a narrowing conversion here
return LONG_TO_INT_RANGE.fit(Long.valueOf(duration.toMillis())).intValue();
} | Converts a Duration to milliseconds bound to an int (instead of a long).
<p>
Handy for low-level APIs that take millisecond timeouts in ints rather than longs.
</p>
<ul>
<li>If the duration milliseconds are greater than {@link Integer#MAX_VALUE}, then return
{@link Integer#MAX_VALUE}.</li>
<li>If the duration milliseco... | java | src/main/java/org/apache/commons/lang3/time/DurationUtils.java | 252 | [
"duration"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
stripAll | public static String[] stripAll(final String[] strs, final String stripChars) {
final int strsLen = ArrayUtils.getLength(strs);
if (strsLen == 0) {
return strs;
}
return ArrayUtils.setAll(new String[strsLen], i -> strip(strs[i], stripChars));
} | Strips any of a set of characters from the start and end of every String in an array.
<p>
Whitespace is defined by {@link Character#isWhitespace(char)}.
</p>
<p>
A new array is returned each time, except for length zero. A {@code null} array will return {@code null}. An empty array will return itself. A
{@code null} ar... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 7,918 | [
"strs",
"stripChars"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
isExcluded | private boolean isExcluded(RegisteredBean registeredBean) {
if (isImplicitlyExcluded(registeredBean)) {
return true;
}
for (BeanRegistrationExcludeFilter excludeFilter : this.excludeFilters) {
if (excludeFilter.isExcludedFromAotProcessing(registeredBean)) {
logger.trace(LogMessage.format(
"Excludi... | Return a {@link BeanDefinitionMethodGenerator} for the given
{@link RegisteredBean} or {@code null} if the registered bean is excluded
by a {@link BeanRegistrationExcludeFilter}. The resulting
{@link BeanDefinitionMethodGenerator} will include all
{@link BeanRegistrationAotProcessor} provided contributions.
@param regi... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorFactory.java | 116 | [
"registeredBean"
] | true | 3 | 7.12 | spring-projects/spring-framework | 59,386 | javadoc | false | |
setCacheOperationSources | public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) {
Assert.notEmpty(cacheOperationSources, "At least 1 CacheOperationSource needs to be specified");
this.cacheOperationSource = (cacheOperationSources.length > 1 ?
new CompositeCacheOperationSource(cacheOperationSources) : cacheO... | Set one or more cache operation sources which are used to find the cache
attributes. If more than one source is provided, they will be aggregated
using a {@link CompositeCacheOperationSource}.
@see #setCacheOperationSource | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 175 | [] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
get_rows | def get_rows(self, infer_nrows: int, skiprows: set[int] | None = None) -> list[str]:
"""
Read rows from self.f, skipping as specified.
We distinguish buffer_rows (the first <= infer_nrows
lines) from the rows returned to detect_colspecs
because it's simpler to leave the other lo... | Read rows from self.f, skipping as specified.
We distinguish buffer_rows (the first <= infer_nrows
lines) from the rows returned to detect_colspecs
because it's simpler to leave the other locations
with skiprows logic alone than to modify them to
deal with the fact we skipped some rows here as
well.
Parameters
------... | python | pandas/io/parsers/python_parser.py | 1,420 | [
"self",
"infer_nrows",
"skiprows"
] | list[str] | true | 5 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
throwIfInPreparedState | private void throwIfInPreparedState() {
if (transactionManager != null &&
transactionManager.isTransactional() &&
transactionManager.isPrepared()
) {
throw new IllegalStateException("Cannot perform operation while the transaction is in a prepared state. " +
... | Throws an exception if the transaction is in a prepared state.
In a two-phase commit (2PC) flow, once a transaction enters the prepared state,
only commit, abort, or complete operations are allowed.
@throws IllegalStateException if any other operation is attempted in the prepared state. | java | clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java | 1,080 | [] | void | true | 4 | 6.72 | apache/kafka | 31,560 | javadoc | false |
getPackageName | public static String getPackageName(String className) {
if (StringUtils.isEmpty(className)) {
return StringUtils.EMPTY;
}
int i = 0;
// Strip array encoding
while (className.charAt(i) == '[') {
i++;
}
className = className.substring(i);
... | Gets the package name from a {@link String}.
<p>
The string passed in is assumed to be a class name.
</p>
<p>
If the class is unpackaged, return an empty string.
</p>
@param className the className to get the package name for, may be {@code null}.
@return the package name or an empty string. | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 809 | [
"className"
] | String | true | 6 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
commitAsync | @Override
public synchronized void commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback) {
ensureNotClosed();
committed.putAll(offsets);
if (callback != null) {
callback.onComplete(offsets, null);
}
} | Sets the maximum number of records returned in a single call to {@link #poll(Duration)}.
@param maxPollRecords the max.poll.records. | java | clients/src/main/java/org/apache/kafka/clients/consumer/MockConsumer.java | 352 | [
"offsets",
"callback"
] | void | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
constrainLng | private static double constrainLng(double lng) {
while (lng > Math.PI) {
lng = lng - Constants.M_2PI;
}
while (lng < -Math.PI) {
lng = lng + Constants.M_2PI;
}
return lng;
} | constrainLng makes sure longitudes are in the proper bounds
@param lng The origin lng value
@return The corrected lng value | java | libs/h3/src/main/java/org/elasticsearch/h3/LatLng.java | 118 | [
"lng"
] | true | 3 | 7.28 | elastic/elasticsearch | 75,680 | javadoc | false | |
visitImportDeclaration | function visitImportDeclaration(node: ImportDeclaration): VisitResult<Statement | undefined> {
let statements: Statement[] | undefined;
if (node.importClause) {
hoistVariableDeclaration(getLocalNameForExternalImport(factory, node, currentSourceFile)!); // TODO: GH#18217
}
... | Visits an ImportDeclaration node.
@param node The node to visit. | typescript | src/compiler/transformers/module/system.ts | 753 | [
"node"
] | true | 2 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
readMoreChars | private void readMoreChars() throws IOException {
// Possibilities:
// 1) array has space available on right-hand side (between limit and capacity)
// 2) array has space available on left-hand side (before position)
// 3) array has no space available
//
// In case 2 we shift the existing chars t... | Handle the case of underflow caused by needing more input characters. | java | android/guava/src/com/google/common/io/ReaderInputStream.java | 203 | [] | void | true | 4 | 7.04 | google/guava | 51,352 | javadoc | false |
check_and_track | def check_and_track(self, proxy_node: Proxy) -> bool:
"""
Check if a tensor can be added as a subgraph output without causing aliasing issues.
Given a proxy node, extracts its example tensor value and checks if its storage
aliases with any previously tracked storages (from inputs or oth... | Check if a tensor can be added as a subgraph output without causing aliasing issues.
Given a proxy node, extracts its example tensor value and checks if its storage
aliases with any previously tracked storages (from inputs or other outputs).
If there's no aliasing conflict, the tensor's storage is added to the tracked... | python | torch/_dynamo/variables/higher_order_ops.py | 503 | [
"self",
"proxy_node"
] | bool | true | 6 | 8.08 | pytorch/pytorch | 96,034 | google | false |
get | @Override
public <T> @Nullable T get(Object key, Callable<T> valueLoader) {
try {
return valueLoader.call();
}
catch (Exception ex) {
throw new ValueRetrievalException(key, valueLoader, ex);
}
} | Create a {@link NoOpCache} instance with the specified name.
@param name the name of the cache | java | spring-context/src/main/java/org/springframework/cache/support/NoOpCache.java | 73 | [
"key",
"valueLoader"
] | T | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
_generate_kernel_inputs_key | def _generate_kernel_inputs_key(kernel_inputs: KernelInputs) -> str:
"""
Generate a key based on input node properties and scalars.
The key includes dtype, size, and stride information for each input node,
plus scalar values as key=value pairs separated by & signs.
"""
# ... | Generate a key based on input node properties and scalars.
The key includes dtype, size, and stride information for each input node,
plus scalar values as key=value pairs separated by & signs. | python | torch/_inductor/lookup_table/choices.py | 59 | [
"kernel_inputs"
] | str | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
handshakeFinished | private void handshakeFinished() throws IOException {
// SSLEngine.getHandshakeStatus is transient and it doesn't record FINISHED status properly.
// It can move from FINISHED status to NOT_HANDSHAKING after the handshake is completed.
// Hence we also need to check handshakeResult.getHandshakeS... | Checks if the handshake status is finished
Sets the interestOps for the selectionKey. | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 453 | [] | void | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false |
close | function close(fd, callback = defaultCloseCallback) {
if (callback !== defaultCloseCallback)
callback = makeCallback(callback);
const req = new FSReqCallback();
req.oncomplete = callback;
binding.close(fd, req);
} | Closes the file descriptor.
@param {number} fd
@param {(err?: Error) => any} [callback]
@returns {void} | javascript | lib/fs.js | 498 | [
"fd"
] | false | 2 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
optDouble | public double optDouble(String name, double fallback) {
Object object = opt(name);
Double result = JSON.toDouble(object);
return result != null ? result : fallback;
} | Returns the value mapped by {@code name} if it exists and is a double or can be
coerced to a double. Returns {@code fallback} otherwise.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 461 | [
"name",
"fallback"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
size | @Override
public long size() {
return count;
} | Returns the number of samples represented in this histogram. If you want to know how many
centroids are being used, try centroids().size().
@return the number of samples that have been added. | java | libs/tdigest/src/main/java/org/elasticsearch/tdigest/AVLTreeDigest.java | 206 | [] | true | 1 | 6.96 | 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.