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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isFactoryBean | protected boolean isFactoryBean(String beanName, RootBeanDefinition mbd) {
Boolean result = mbd.isFactoryBean;
if (result == null) {
Class<?> beanType = predictBeanType(beanName, mbd, FactoryBean.class);
result = (beanType != null && FactoryBean.class.isAssignableFrom(beanType));
mbd.isFactoryBean = result... | Check whether the given bean is defined as a {@link FactoryBean}.
@param beanName the name of the bean
@param mbd the corresponding bean definition | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,696 | [
"beanName",
"mbd"
] | true | 3 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
upperCase | public static String upperCase(final String str, final Locale locale) {
if (str == null) {
return null;
}
return str.toUpperCase(LocaleUtils.toLocale(locale));
} | Converts a String to upper case as per {@link String#toUpperCase(Locale)}.
<p>
A {@code null} input String returns {@code null}.
</p>
<pre>
StringUtils.upperCase(null, Locale.ENGLISH) = null
StringUtils.upperCase("", Locale.ENGLISH) = ""
StringUtils.upperCase("aBc", Locale.ENGLISH) = "ABC"
</pre>
@param str the ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 9,034 | [
"str",
"locale"
] | String | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
getCSVInstance | public static StrTokenizer getCSVInstance(final char[] input) {
final StrTokenizer tok = getCSVClone();
tok.reset(input);
return tok;
} | Gets a new tokenizer instance which parses Comma Separated Value strings
initializing it with the given input. The default for CSV processing
will be trim whitespace from both ends (which can be overridden with
the setTrimmer method).
@param input the text to parse.
@return a new tokenizer instance which parses Comma... | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 149 | [
"input"
] | StrTokenizer | true | 1 | 6.72 | apache/commons-lang | 2,896 | javadoc | false |
setBcc | @Override
public void setBcc(String... bcc) throws MailParseException {
try {
this.helper.setBcc(bcc);
}
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 | 146 | [] | void | true | 2 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
between | @Deprecated
public static <T> Range<T> between(final T fromInclusive, final T toInclusive, final Comparator<T> comparator) {
return new Range<>(fromInclusive, toInclusive, comparator);
} | Creates a range with the specified minimum and maximum values (both inclusive).
<p>The range uses the specified {@link Comparator} to determine where
values lie in the range.</p>
<p>The arguments may be passed in the order (min,max) or (max,min).
The getMinimum and getMaximum methods will return the correct values.</p>... | java | src/main/java/org/apache/commons/lang3/Range.java | 104 | [
"fromInclusive",
"toInclusive",
"comparator"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
add_content_weights_lightweight | def add_content_weights_lightweight(
output_dir: Path, glob_pattern: str, exclude_patterns: list[str] | None = None
) -> int:
"""Add data-pagefind-weight attributes using simple regex replacement.
:param output_dir: Output directory
:param glob_pattern: Glob pattern
:param exclude_patterns: Exclude... | Add data-pagefind-weight attributes using simple regex replacement.
:param output_dir: Output directory
:param glob_pattern: Glob pattern
:param exclude_patterns: Exclude patterns
:return: Number of files processed | python | devel-common/src/sphinx_exts/pagefind_search/builder.py | 37 | [
"output_dir",
"glob_pattern",
"exclude_patterns"
] | int | true | 7 | 7.76 | apache/airflow | 43,597 | sphinx | false |
compareAndSet | public final boolean compareAndSet(int i, double expect, double update) {
return longs.compareAndSet(i, doubleToRawLongBits(expect), doubleToRawLongBits(update));
} | Atomically sets the element at position {@code i} to the given updated value if the current
value is <a href="#bitEquals">bitwise equal</a> to the expected value.
@param i the index
@param expect the expected value
@param update the new value
@return true if successful. False return indicates that the actual value was ... | java | android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java | 148 | [
"i",
"expect",
"update"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
equals | @Override
public boolean equals(final Object obj) {
return obj instanceof MutableDouble
&& Double.doubleToLongBits(((MutableDouble) obj).value) == Double.doubleToLongBits(value);
} | Compares this object against the specified object. The result is {@code true} if and only if the argument is not {@code null} and is a {@link Double}
object that represents a double that has the identical bit pattern to the bit pattern of the double represented by this object. For this purpose, two
{@code double} value... | java | src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java | 199 | [
"obj"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
throwFileNotFound | private void throwFileNotFound() throws FileNotFoundException {
if (Optimizations.isEnabled()) {
throw FILE_NOT_FOUND_EXCEPTION;
}
if (this.notFound != null) {
throw this.notFound.get();
}
throw new FileNotFoundException("JAR entry " + this.entryName + " not found in " + this.jarFile.getName());
} | The {@link URLClassLoader} connects often to check if a resource exists, we can
save some object allocations by using the cached copy if we have one.
@param jarFileURL the jar file to check
@param entryName the entry name to check
@throws FileNotFoundException on a missing entry | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlConnection.java | 324 | [] | void | true | 3 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
count | def count(self, pat, flags: int = 0):
r"""
Count occurrences of pattern in each string of the Series/Index.
This function is used to count the number of times a particular regex
pattern is repeated in each of the string elements of the
:class:`~pandas.Series`.
Parameter... | r"""
Count occurrences of pattern in each string of the Series/Index.
This function is used to count the number of times a particular regex
pattern is repeated in each of the string elements of the
:class:`~pandas.Series`.
Parameters
----------
pat : str
Valid regular expression.
flags : int, default 0, meaning n... | python | pandas/core/strings/accessor.py | 2,621 | [
"self",
"pat",
"flags"
] | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false | |
formatDecimal | private static String formatDecimal(double value, int fractionPieces) {
String p = String.valueOf(value);
int totalLength = p.length();
int ix = p.indexOf('.') + 1;
int ex = p.indexOf('E');
// Location where the fractional values end
int fractionEnd = ex == -1 ? Math.min(... | Returns a {@link String} representation of the current {@link TimeValue}.
Note that this method might produce fractional time values (ex 1.6m) which cannot be
parsed by method like {@link TimeValue#parse(String, String, String, String)}. The number of
fractional decimals (up to 10 maximum) are truncated to the number o... | java | libs/core/src/main/java/org/elasticsearch/core/TimeValue.java | 280 | [
"value",
"fractionPieces"
] | String | true | 10 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false |
CONST_BYTE | public static byte CONST_BYTE(final int v) {
if (v < Byte.MIN_VALUE || v > Byte.MAX_VALUE) {
throw new IllegalArgumentException("Supplied value must be a valid byte literal between -128 and 127: [" + v + "]");
}
return (byte) v;
} | Returns the provided value unchanged. This can prevent javac from inlining a constant field, e.g.,
<pre>
public final static byte MAGIC_BYTE = ObjectUtils.CONST_BYTE(127);
</pre>
This way any jars that refer to this field do not have to recompile themselves if the field's value changes at some future date.
@param v the... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 490 | [
"v"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
addDeduping | private void addDeduping(E element) {
requireNonNull(hashTable); // safe because we check for null before calling this method
int mask = hashTable.length - 1;
int hash = element.hashCode();
for (int i = Hashing.smear(hash); ; i++) {
i &= mask;
Object previous = hashTable[i];
... | Adds each element of {@code elements} to the {@code ImmutableSet}, ignoring duplicate
elements (only the first duplicate element is added).
@param elements the elements to add
@return this {@code Builder} object
@throws NullPointerException if {@code elements} is null or contains a null element | java | android/guava/src/com/google/common/collect/ImmutableSet.java | 519 | [
"element"
] | void | true | 4 | 7.6 | google/guava | 51,352 | javadoc | false |
canReuseProjectReferences | function canReuseProjectReferences(): boolean {
return !forEachProjectReference(
oldProgram!.getProjectReferences(),
oldProgram!.getResolvedProjectReferences(),
(oldResolvedRef, parent, index) => {
const newRef = (parent ? parent.commandLine.projectRefere... | map with
- SourceFile if present
- false if sourceFile missing for source of project reference redirect
- undefined otherwise | typescript | src/compiler/program.ts | 2,317 | [] | true | 7 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
initMessageSource | protected void initMessageSource() {
ConfigurableListableBeanFactory beanFactory = getBeanFactory();
if (beanFactory.containsLocalBean(MESSAGE_SOURCE_BEAN_NAME)) {
this.messageSource = beanFactory.getBean(MESSAGE_SOURCE_BEAN_NAME, MessageSource.class);
// Make MessageSource aware of parent MessageSource.
i... | Initialize the {@link MessageSource}.
<p>Uses parent's {@code MessageSource} if none defined in this context.
@see #MESSAGE_SOURCE_BEAN_NAME | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 819 | [] | void | true | 7 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
poolSize | public ThreadPoolTaskSchedulerBuilder poolSize(int poolSize) {
return new ThreadPoolTaskSchedulerBuilder(poolSize, this.awaitTermination, this.awaitTerminationPeriod,
this.threadNamePrefix, this.taskDecorator, this.customizers);
} | Set the maximum allowed number of threads.
@param poolSize the pool size to set
@return a new builder instance | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskSchedulerBuilder.java | 79 | [
"poolSize"
] | ThreadPoolTaskSchedulerBuilder | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
sendFetchesInternal | private List<RequestFuture<ClientResponse>> sendFetchesInternal(Map<Node, FetchSessionHandler.FetchRequestData> fetchRequests,
ResponseHandler<ClientResponse> successHandler,
ResponseH... | Creates the {@link FetchRequest.Builder fetch request},
{@link NetworkClient#send(ClientRequest, long) enqueues/sends it, and adds the {@link RequestFuture callback}
for the response.
@param fetchRequests {@link Map} of {@link Node nodes} to their
{@link FetchSessionHandler.FetchRequestData reque... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java | 184 | [
"fetchRequests",
"successHandler",
"errorHandler"
] | true | 1 | 6.24 | apache/kafka | 31,560 | javadoc | false | |
template_global | def template_global(
self, name: T_template_global | str | None = None
) -> T_template_global | t.Callable[[T_template_global], T_template_global]:
"""Decorate a function to register it as a custom Jinja global. The name
is optional. The decorator may be used without parentheses.
..... | Decorate a function to register it as a custom Jinja global. The name
is optional. The decorator may be used without parentheses.
.. code-block:: python
@app.template_global
def double(n):
return 2 * n
The :meth:`add_template_global` method may be used to register a
function later rather than decorat... | python | src/flask/sansio/app.py | 776 | [
"self",
"name"
] | T_template_global | t.Callable[[T_template_global], T_template_global] | true | 2 | 6.72 | pallets/flask | 70,946 | sphinx | false |
configureLogLevel | private void configureLogLevel(String name, LogLevel level, BiConsumer<String, @Nullable LogLevel> configurer) {
if (this.loggerGroups != null) {
LoggerGroup group = this.loggerGroups.get(name);
if (group != null && group.hasMembers()) {
group.configureLogLevel(level, configurer);
return;
}
}
con... | Set logging levels based on relevant {@link Environment} properties.
@param system the logging system
@param environment the environment
@since 2.2.0 | java | core/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java | 402 | [
"name",
"level",
"configurer"
] | void | true | 4 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_dep_statuses | def get_dep_statuses(
self,
ti: TaskInstance,
session: Session,
dep_context: DepContext | None = None,
) -> Iterator[TIDepStatus]:
"""
Wrap around the private _get_dep_statuses method.
Contains some global checks for all dependencies.
:param ti: the ... | Wrap around the private _get_dep_statuses method.
Contains some global checks for all dependencies.
:param ti: the task instance to get the dependency status for
:param session: database session
:param dep_context: the context for which this dependency should be evaluated for | python | airflow-core/src/airflow/ti_deps/deps/base_ti_dep.py | 91 | [
"self",
"ti",
"session",
"dep_context"
] | Iterator[TIDepStatus] | true | 6 | 6.88 | apache/airflow | 43,597 | sphinx | false |
exists | async function exists(filename: string): Promise<boolean> {
try {
if ((await fs.promises.stat(filename)).isFile()) {
return true;
}
} catch (ex) {
// In case requesting the file statistics fail.
// we assume it does not exist.
return false;
}
return false;
} | Check if the given filename is a file.
If returns false in case the file does not exist or
the file stats cannot be accessed/queried or it
is no file at all.
@param filename
the filename to the checked
@returns
true in case the file exists, in any other case false. | typescript | extensions/gulp/src/main.ts | 26 | [
"filename"
] | true | 3 | 8.08 | microsoft/vscode | 179,840 | jsdoc | true | |
appendDisplayNames | private static Map<String, Integer> appendDisplayNames(final Calendar calendar, final Locale locale, final int field, final StringBuilder regex) {
Objects.requireNonNull(calendar, "calendar");
final Map<String, Integer> values = new HashMap<>();
final Locale actualLocale = LocaleUtils.toLocale(l... | Gets the short and long values displayed for a field
@param calendar The calendar to obtain the short and long values
@param locale The locale of display names
@param field The field of interest
@param regex The regular expression to build
@return The map of string display names to field values | java | src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 724 | [
"calendar",
"locale",
"field",
"regex"
] | true | 2 | 7.12 | apache/commons-lang | 2,896 | javadoc | false | |
searchsorted | def searchsorted(
arr: ArrayLike,
value: NumpyValueArrayLike | ExtensionArray,
side: Literal["left", "right"] = "left",
sorter: NumpySorter | None = None,
) -> npt.NDArray[np.intp] | np.intp:
"""
Find indices where elements should be inserted to maintain order.
Find the indices into a sorte... | Find indices where elements should be inserted to maintain order.
Find the indices into a sorted array `arr` (a) such that, if the
corresponding elements in `value` were inserted before the indices,
the order of `arr` would be preserved.
Assuming that `arr` is sorted:
====== ================================
`side` ... | python | pandas/core/algorithms.py | 1,243 | [
"arr",
"value",
"side",
"sorter"
] | npt.NDArray[np.intp] | np.intp | true | 13 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
withFilter | public StandardStackTracePrinter withFilter(Predicate<Throwable> predicate) {
Assert.notNull(predicate, "'predicate' must not be null");
return new StandardStackTracePrinter(this.options, this.maximumLength, this.lineSeparator,
this.filter.and(predicate), this.frameFilter, this.formatter, this.frameFormatter, t... | Return a new {@link StandardStackTracePrinter} from this one that will only include
throwables (excluding caused and suppressed) that match the given predicate.
@param predicate the predicate used to filter the throwable
@return a new {@link StandardStackTracePrinter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 201 | [
"predicate"
] | StandardStackTracePrinter | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
infer_automated_data_interval | def infer_automated_data_interval(timetable: Timetable, logical_date: datetime) -> DataInterval:
"""
Infer a data interval for a run against this DAG.
This method is used to bridge runs created prior to AIP-39
implementation, which do not have an explicit data interval. Therefore,
this method only ... | Infer a data interval for a run against this DAG.
This method is used to bridge runs created prior to AIP-39
implementation, which do not have an explicit data interval. Therefore,
this method only considers ``schedule_interval`` values valid prior to
Airflow 2.2.
DO NOT call this method if there is a known data inte... | python | airflow-core/src/airflow/models/dag.py | 99 | [
"timetable",
"logical_date"
] | DataInterval | true | 5 | 6 | apache/airflow | 43,597 | unknown | false |
initializeValueParameterDetail | private static @Nullable CacheParameterDetail initializeValueParameterDetail(
Method method, List<CacheParameterDetail> allParameters) {
CacheParameterDetail result = null;
for (CacheParameterDetail parameter : allParameters) {
if (parameter.isValue()) {
if (result == null) {
result = parameter;
... | Return the {@link CacheInvocationParameter} for the parameter holding the value
to cache.
<p>The method arguments must match the signature of the related method invocation
@param values the parameters value for a particular invocation
@return the {@link CacheInvocationParameter} instance for the value parameter | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CachePutOperation.java | 95 | [
"method",
"allParameters"
] | CacheParameterDetail | true | 3 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
as_series | def as_series(alist, trim=True):
"""
Return argument as a list of 1-d arrays.
The returned list contains array(s) of dtype double, complex double, or
object. A 1-d argument of shape ``(N,)`` is parsed into ``N`` arrays of
size one; a 2-d argument of shape ``(M,N)`` is parsed into ``M`` arrays
... | Return argument as a list of 1-d arrays.
The returned list contains array(s) of dtype double, complex double, or
object. A 1-d argument of shape ``(N,)`` is parsed into ``N`` arrays of
size one; a 2-d argument of shape ``(M,N)`` is parsed into ``M`` arrays
of size ``N`` (i.e., is "parsed by row"); and a higher dimens... | python | numpy/polynomial/polyutils.py | 63 | [
"alist",
"trim"
] | false | 10 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
load | private Configuration load(ResourceLoader resourceLoader, String location) throws IOException {
ConfigurationFactory configurationFactory = ConfigurationFactory.getInstance();
Resource resource = resourceLoader.getResource(location);
Configuration configuration = configurationFactory.getConfiguration(getLoggerCon... | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 306 | [
"resourceLoader",
"location"
] | Configuration | true | 2 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
close | @Override
public void close() throws IOException {
try {
IOUtils.close(dataLifecycleInitialisationService.get());
} catch (IOException e) {
throw new ElasticsearchException("unable to close the data stream lifecycle service", e);
}
} | Returns the look ahead time and lowers it when it to 2 hours if it is configured to more than 2 hours. | java | modules/data-streams/src/main/java/org/elasticsearch/datastreams/DataStreamsPlugin.java | 304 | [] | void | true | 2 | 7.04 | elastic/elasticsearch | 75,680 | javadoc | false |
handle_failure | def handle_failure(
self,
error: None | str,
test_mode: bool | None = None,
session: Session = NEW_SESSION,
) -> None:
"""
Handle Failure for a task instance.
:param error: if specified, log the specific exception if thrown
:param test_mode: doesn't r... | Handle Failure for a task instance.
:param error: if specified, log the specific exception if thrown
:param test_mode: doesn't record success or failure in the DB if True
:param session: SQLAlchemy ORM Session | python | airflow-core/src/airflow/models/taskinstance.py | 1,593 | [
"self",
"error",
"test_mode",
"session"
] | None | true | 4 | 6.88 | apache/airflow | 43,597 | sphinx | false |
matrix_power | def matrix_power(a, n):
"""
Raise a square matrix to the (integer) power `n`.
For positive integers `n`, the power is computed by repeated matrix
squarings and matrix multiplications. If ``n == 0``, the identity matrix
of the same shape as M is returned. If ``n < 0``, the inverse
is computed an... | Raise a square matrix to the (integer) power `n`.
For positive integers `n`, the power is computed by repeated matrix
squarings and matrix multiplications. If ``n == 0``, the identity matrix
of the same shape as M is returned. If ``n < 0``, the inverse
is computed and then raised to the ``abs(n)``.
.. note:: Stacks o... | python | numpy/linalg/_linalg.py | 657 | [
"a",
"n"
] | false | 13 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
insertWrapDetails | function insertWrapDetails(source, details) {
var length = details.length;
if (!length) {
return source;
}
var lastIndex = length - 1;
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
details = details.join(length > 2 ? ', ' : ' ');
return source.repl... | Inserts wrapper `details` in a comment at the top of the `source` body.
@private
@param {string} source The source to modify.
@returns {Array} details The details to insert.
@returns {string} Returns the modified source. | javascript | lodash.js | 6,332 | [
"source",
"details"
] | false | 4 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
equals | public abstract boolean equals(String str1, String str2); | Compares two CharSequences, returning {@code true} if they represent equal sequences of characters.
<p>
{@code null}s are handled without exceptions. Two {@code null} references are considered to be equal.
</p>
<p>
Case-sensitive examples
</p>
<pre>
Strings.CS.equals(null, null) = true
Strings.CS.equals(null, "abc") ... | java | src/main/java/org/apache/commons/lang3/Strings.java | 721 | [
"str1",
"str2"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
modelActionsLayer | function modelActionsLayer(client: Client, dmmfModelName: string): CompositeProxyLayer<string> {
// we use the javascript model name for display purposes
const jsModelName = dmmfToJSModelName(dmmfModelName)
const ownKeys = Object.keys(DMMF.ModelAction).concat('count')
return {
getKeys() {
return ownK... | Dynamically creates a model interface via a proxy.
@param client to trigger the request execution
@param dmmfModelName the dmmf name of the model
@returns | typescript | packages/client/src/runtime/core/model/applyModel.ts | 63 | [
"client",
"dmmfModelName"
] | true | 3 | 7.68 | prisma/prisma | 44,834 | jsdoc | false | |
indexOf | public static int indexOf(final short[] array, final short valueToFind) {
return indexOf(array, valueToFind, 0);
} | Finds the index of the given value in the array.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.
</p>
@param array the array to search for the object, may be {@code null}
@param valueToFind the value to find.
@return the index of the value within the array, {@link #IN... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,750 | [
"array",
"valueToFind"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
fit | public T fit(final T element) {
// Comparable API says throw NPE on null
Objects.requireNonNull(element, "element");
if (isAfter(element)) {
return minimum;
}
if (isBefore(element)) {
return maximum;
}
return element;
} | Fits the given element into this range by returning the given element or, if out of bounds, the range minimum if
below, or the range maximum if above.
<pre>{@code
Range<Integer> range = Range.between(16, 64);
range.fit(-9) --> 16
range.fit(0) --> 16
range.fit(15) --> 16
range.fit(16) --> 16
range.fit(17) --> 17
.... | java | src/main/java/org/apache/commons/lang3/Range.java | 340 | [
"element"
] | T | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
getShortClassName | public static String getShortClassName(String className) {
if (StringUtils.isEmpty(className)) {
return StringUtils.EMPTY;
}
final StringBuilder arrayPrefix = new StringBuilder();
// Handle array encoding
if (className.startsWith("[")) {
while (className.c... | Gets the class name minus the package name from a String.
<p>
The string passed in is assumed to be a class name - it is not checked. The string has to be formatted the way as the
JDK method {@code Class.getName()} returns it, and not the usual way as we write it, for example in import
statements, or as it is formatted... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 1,077 | [
"className"
] | String | true | 9 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
getProxy | public static Object getProxy(TargetSource targetSource) {
if (targetSource.getTargetClass() == null) {
throw new IllegalArgumentException("Cannot create class proxy for TargetSource with null target class");
}
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTargetSource(targetSource);
prox... | Create a proxy for the specified {@code TargetSource} that extends
the target class of the {@code TargetSource}.
@param targetSource the TargetSource that the proxy should invoke
@return the proxy object | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java | 159 | [
"targetSource"
] | Object | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
cov | def cov(m: Array, /, *, xp: ModuleType | None = None) -> Array:
"""
Estimate a covariance matrix.
Covariance indicates the level to which two variables vary together.
If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`,
then the covariance matrix element :math:`C_{ij}` is the cov... | Estimate a covariance matrix.
Covariance indicates the level to which two variables vary together.
If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`,
then the covariance matrix element :math:`C_{ij}` is the covariance of
:math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance
of :m... | python | sklearn/externals/array_api_extra/_lib/_funcs.py | 284 | [
"m",
"xp"
] | Array | true | 5 | 7.92 | scikit-learn/scikit-learn | 64,340 | numpy | false |
withAlias | default PemSslStore withAlias(@Nullable String alias) {
List<X509Certificate> certificates = certificates();
Assert.notNull(certificates, "'certificates' must not be null");
return of(type(), alias, password(), certificates, privateKey());
} | Return a new {@link PemSslStore} instance with a new alias.
@param alias the new alias
@return a new {@link PemSslStore} instance | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStore.java | 80 | [
"alias"
] | PemSslStore | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
assertNotReadOnlySystemAttributesMap | private void assertNotReadOnlySystemAttributesMap(Map<?, ?> map) {
try {
map.size();
}
catch (UnsupportedOperationException ex) {
throw new IllegalArgumentException("Security restricted maps are not supported", ex);
}
} | Add an individual entry.
@param name the name
@param value the value | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java | 105 | [
"map"
] | void | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
computeInPlace | public double computeInPlace(double... dataset) {
checkArgument(dataset.length > 0, "Cannot calculate quantiles of an empty dataset");
if (containsNaN(dataset)) {
return NaN;
}
// Calculate the quotient and remainder in the integer division x = k * (N-1) / q, i.e.
// index * (data... | Computes the quantile value of the given dataset, performing the computation in-place.
@param dataset the dataset to do the calculation on, which must be non-empty, and which will
be arbitrarily reordered by this method call
@return the quantile value | java | android/guava/src/com/google/common/math/Quantiles.java | 287 | [] | true | 3 | 7.92 | google/guava | 51,352 | javadoc | false | |
compare | private int compare(@Nullable String e1, @Nullable ElementType type1, @Nullable String e2,
@Nullable ElementType type2) {
if (e1 == null) {
return -1;
}
if (e2 == null) {
return 1;
}
Assert.state(type1 != null, "'type1' must not be null");
Assert.state(type2 != null, "'type2' must not be null");
... | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 334 | [
"e1",
"type1",
"e2",
"type2"
] | true | 6 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
cosine_distances | def cosine_distances(X, Y=None):
"""Compute cosine distance between samples in X and Y.
Cosine distance is defined as 1.0 minus the cosine similarity.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
... | Compute cosine distance between samples in X and Y.
Cosine distance is defined as 1.0 minus the cosine similarity.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
Matrix `X`.
Y : {array-like, sparse matrix} of shape (n_sample... | python | sklearn/metrics/pairwise.py | 1,133 | [
"X",
"Y"
] | false | 3 | 7.68 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
findThreads | public static Collection<Thread> findThreads(final Predicate<Thread> predicate) {
return findThreads(getSystemThreadGroup(), true, predicate);
} | Finds all active threads which match the given predicate.
@param predicate the predicate.
@return An unmodifiable {@link Collection} of active threads matching the given predicate.
@throws NullPointerException if the predicate is null.
@throws SecurityException if the current thread cannot access the system thread g... | java | src/main/java/org/apache/commons/lang3/ThreadUtils.java | 326 | [
"predicate"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
subarray | public static short[] subarray(final short[] array, int startIndexInclusive, int endIndexExclusive) {
if (array == null) {
return null;
}
startIndexInclusive = max0(startIndexInclusive);
endIndexExclusive = Math.min(endIndexExclusive, array.length);
final int newSize ... | Produces a new {@code short} array containing the elements between the start and end indices.
<p>
The start index is inclusive, the end index exclusive. Null array input produces null output.
</p>
@param array the input array.
@param startIndexInclusive the starting index. Undervalue (<0) is promoted t... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 7,951 | [
"array",
"startIndexInclusive",
"endIndexExclusive"
] | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
dropna | def dropna(self) -> Self:
"""
Return ExtensionArray without NA values.
Returns
-------
Self
An ExtensionArray of the same type as the original but with all
NA values removed.
See Also
--------
Series.dropna : Remove missing values... | Return ExtensionArray without NA values.
Returns
-------
Self
An ExtensionArray of the same type as the original but with all
NA values removed.
See Also
--------
Series.dropna : Remove missing values from a Series.
DataFrame.dropna : Remove missing values from a DataFrame.
api.extensions.ExtensionArray.isna ... | python | pandas/core/arrays/base.py | 1,307 | [
"self"
] | Self | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
computeInteractionMatrixAndResiduals | static void computeInteractionMatrixAndResiduals(const Mat& objectPoints, const Mat& R, const Mat& tvec,
Mat& L, Mat& s)
{
Mat objectPointsInCam;
int npoints = objectPoints.rows;
for (int i = 0; i < npoints; i++)
{
Mat curPt = objectPoints.row(i)... | @brief Compute the Interaction matrix and the residuals for the current pose.
@param objectPoints 3D object points.
@param R Current estimated rotation matrix.
@param tvec Current estimated translation vector.
@param L Interaction matrix for a vector of point features.
@param s Residuals. | cpp | modules/calib3d/src/solvepnp.cpp | 618 | [] | true | 2 | 6.48 | opencv/opencv | 85,374 | doxygen | false | |
stubString | function stubString() {
return '';
} | This method returns an empty string.
@static
@memberOf _
@since 4.13.0
@category Util
@returns {string} Returns the empty string.
@example
_.times(2, _.stubString);
// => ['', ''] | javascript | lodash.js | 16,207 | [] | false | 1 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
stopAsync | @CanIgnoreReturnValue
Service stopAsync(); | If the service is {@linkplain State#STARTING starting} or {@linkplain State#RUNNING running},
this initiates service shutdown and returns immediately. If the service is {@linkplain
State#NEW new}, it is {@linkplain State#TERMINATED terminated} without having been started nor
stopped. If the service has already been sto... | java | android/guava/src/com/google/common/util/concurrent/Service.java | 86 | [] | Service | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
chi2_kernel | def chi2_kernel(X, Y=None, gamma=1.0):
"""Compute the exponential chi-squared kernel between X and Y.
The chi-squared kernel is computed between each pair of rows in X and Y. X
and Y have to be non-negative. This kernel is most commonly applied to
histograms.
The chi-squared kernel is given by:
... | Compute the exponential chi-squared kernel between X and Y.
The chi-squared kernel is computed between each pair of rows in X and Y. X
and Y have to be non-negative. This kernel is most commonly applied to
histograms.
The chi-squared kernel is given by:
.. code-block:: text
k(x, y) = exp(-gamma Sum [(x - y)^2 ... | python | sklearn/metrics/pairwise.py | 1,842 | [
"X",
"Y",
"gamma"
] | false | 2 | 7.52 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
resolveArguments | @Override
protected Object[] resolveArguments(Object @Nullable [] args, @Nullable Locale locale) {
if (ObjectUtils.isEmpty(args)) {
return super.resolveArguments(args, locale);
}
List<Object> resolvedArgs = new ArrayList<>(args.length);
for (Object arg : args) {
if (arg instanceof MessageSourceResolvable... | Searches through the given array of objects, finds any MessageSourceResolvable
objects and resolves them.
<p>Allows for messages to have MessageSourceResolvables as arguments.
@param args array of arguments for a message
@param locale the locale to resolve through
@return an array of arguments with any MessageSourceRes... | java | spring-context/src/main/java/org/springframework/context/support/AbstractMessageSource.java | 336 | [
"args",
"locale"
] | true | 3 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_perform_double_linked_list_swap | def _perform_double_linked_list_swap(
candidate: BaseSchedulerNode,
group_head: BaseSchedulerNode,
group_tail: BaseSchedulerNode,
prev_dict: dict[BaseSchedulerNode, Optional[BaseSchedulerNode]],
next_dict: dict[BaseSchedulerNode, Optional[BaseSchedulerNode]],
head: BaseSchedulerNode,
) -> BaseSc... | Swap positions of candidate and group in doubly-linked list.
Transforms:
candidate_prev -> candidate -> group_head...group_tail -> group_tail_next
Into:
candidate_prev -> group_head...group_tail -> candidate -> group_tail_next
Args:
candidate: Node to swap with group
group_head: First node of group
group_... | python | torch/_inductor/comms.py | 494 | [
"candidate",
"group_head",
"group_tail",
"prev_dict",
"next_dict",
"head"
] | BaseSchedulerNode | true | 4 | 7.76 | pytorch/pytorch | 96,034 | google | false |
requireTimestamps | public boolean requireTimestamps() {
return requireTimestamps;
} | Build result representing that no offsets were found as part of the current event.
@return Map containing all the partitions the event was trying to get offsets for, and
null {@link OffsetAndTimestamp} as value | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ListOffsetsEvent.java | 63 | [] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
getSymbolNamesToImport | function getSymbolNamesToImport(sourceFile: SourceFile, checker: TypeChecker, symbolToken: Identifier, compilerOptions: CompilerOptions): string[] {
const parent = symbolToken.parent;
if ((isJsxOpeningLikeElement(parent) || isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicit... | @param forceImportKeyword Indicates that the user has already typed `import`, so the result must start with `import`.
(In other words, do not allow `const x = require("...")` for JS files.)
@internal | typescript | src/services/codefixes/importFixes.ts | 1,599 | [
"sourceFile",
"checker",
"symbolToken",
"compilerOptions"
] | true | 8 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
scanDirectory | private void scanDirectory(
File directory,
String packagePrefix,
Set<File> currentPath,
ImmutableSet.Builder<ResourceInfo> builder)
throws IOException {
File[] files = directory.listFiles();
if (files == null) {
logger.warning("Cannot read directory " + direc... | Recursively scan the given directory, adding resources for each file encountered. Symlinks
which have already been traversed in the current tree path will be skipped to eliminate
cycles; otherwise symlinks are traversed.
@param directory the root of the directory to scan
@param packagePrefix resource path prefix inside... | java | android/guava/src/com/google/common/reflect/ClassPath.java | 521 | [
"directory",
"packagePrefix",
"currentPath",
"builder"
] | void | true | 5 | 6.56 | google/guava | 51,352 | javadoc | false |
removeAll | @SuppressWarnings("unchecked") // removeAll() always creates an array of the same type as its input
public static <T> T[] removeAll(final T[] array, final int... indices) {
return (T[]) 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 | 5,246 | [
"array"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
compareExponentiallyScaledValues | public static int compareExponentiallyScaledValues(long idxA, int scaleA, long idxB, int scaleB) {
if (scaleA > scaleB) {
return -compareExponentiallyScaledValues(idxB, scaleB, idxA, scaleA);
}
// scaleA <= scaleB
int shifts = scaleB - scaleA;
long scaledDownB = idxB... | Compares the lower boundaries of two buckets, which may have different scales.
This is equivalent to a mathematically correct comparison of the lower bucket boundaries.
Note that this method allows for scales and indices of the full numeric range of the types.
@param idxA the index of the first bucket
@param ... | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialScaleUtils.java | 145 | [
"idxA",
"scaleA",
"idxB",
"scaleB"
] | true | 4 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
toObject | public static Long[] toObject(final long[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_LONG_OBJECT_ARRAY;
}
return setAll(new Long[array.length], i -> Long.valueOf(array[i]));
} | Converts an array of primitive longs to objects.
<p>This method returns {@code null} for a {@code null} input array.</p>
@param array a {@code long} array.
@return a {@link Long} array, {@code null} if null array input. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,780 | [
"array"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
add | private SimpleConfigurationMetadataRepository add(InputStream in, Charset charset) throws IOException {
try {
RawConfigurationMetadata metadata = this.reader.read(in, charset);
return create(metadata);
}
catch (IOException ex) {
throw ex;
}
catch (Exception ex) {
throw new IllegalStateException("F... | Build a {@link ConfigurationMetadataRepository} with the current state of this
builder.
@return this builder | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java | 94 | [
"in",
"charset"
] | SimpleConfigurationMetadataRepository | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
getCausalChain | public static List<Throwable> getCausalChain(Throwable throwable) {
checkNotNull(throwable);
List<Throwable> causes = new ArrayList<>(4);
causes.add(throwable);
// Keep a second pointer that slowly walks the causal chain. If the fast pointer ever catches
// the slower pointer, then there's a loop.
... | Gets a {@code Throwable} cause chain as a list. The first entry in the list will be {@code
throwable} followed by its cause hierarchy. Note that this is a snapshot of the cause chain and
will not reflect any subsequent changes to the cause chain.
<p>Here's an example of how it can be used to find specific types of exce... | java | android/guava/src/com/google/common/base/Throwables.java | 284 | [
"throwable"
] | true | 4 | 8.24 | google/guava | 51,352 | javadoc | false | |
_load_backend | def _load_backend(backend: str) -> types.ModuleType:
"""
Load a pandas plotting backend.
Parameters
----------
backend : str
The identifier for the backend. Either an entrypoint item registered
with importlib.metadata, "matplotlib", or a module name.
Returns
-------
typ... | Load a pandas plotting backend.
Parameters
----------
backend : str
The identifier for the backend. Either an entrypoint item registered
with importlib.metadata, "matplotlib", or a module name.
Returns
-------
types.ModuleType
The imported backend. | python | pandas/plotting/_core.py | 2,160 | [
"backend"
] | types.ModuleType | true | 9 | 6.32 | pandas-dev/pandas | 47,362 | numpy | false |
scanDigits | function scanDigits(): boolean {
const start = pos;
let isOctal = true;
while (isDigit(charCodeChecked(pos))) {
if (!isOctalDigit(charCodeUnchecked(pos))) {
isOctal = false;
}
pos++;
}
tokenValue = text.substring(start,... | Returns the char code for the character at the given position within `text`. If
`pos` is outside the bounds set for `text`, `CharacterCodes.EOF` is returned instead. | typescript | src/compiler/scanner.ts | 1,348 | [] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
baseToString | function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray(value)) {
// Recursively convert values (susceptible to call stack limits).
return arrayMap(value, baseToS... | The base implementation of `_.toString` which doesn't convert nullish
values to empty strings.
@private
@param {*} value The value to process.
@returns {string} Returns the string. | javascript | lodash.js | 4,286 | [
"value"
] | false | 7 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
posAngleRads | static double posAngleRads(double rads) {
if (rads < 0.0) {
return rads + Constants.M_2PI;
} else if (rads >= Constants.M_2PI) {
return rads - Constants.M_2PI;
} else {
return rads;
}
} | Normalizes radians to a value between 0.0 and two PI.
@param rads The input radians value.
@return The normalized radians value. | java | libs/h3/src/main/java/org/elasticsearch/h3/Vec2d.java | 307 | [
"rads"
] | true | 3 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
_ensure_listlike_indexer | def _ensure_listlike_indexer(self, key, axis=None, value=None) -> None:
"""
Ensure that a list-like of column labels are all present by adding them if
they do not already exist.
Parameters
----------
key : list-like of column labels
Target labels.
axi... | Ensure that a list-like of column labels are all present by adding them if
they do not already exist.
Parameters
----------
key : list-like of column labels
Target labels.
axis : key axis if known | python | pandas/core/indexing.py | 863 | [
"self",
"key",
"axis",
"value"
] | None | true | 11 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
segmentFor | Segment<K, V> segmentFor(int hash) {
// TODO(fry): Lazily create segments?
return segments[(hash >>> segmentShift) & segmentMask];
} | Returns the segment that should be used for a key with the given hash.
@param hash the hash code for the key
@return the segment | java | android/guava/src/com/google/common/cache/LocalCache.java | 1,755 | [
"hash"
] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
hexRing | public static long[] hexRing(long h3) {
final long[] ring = new long[hexRingSize(h3)];
for (int i = 0; i < ring.length; i++) {
ring[i] = hexRingPosToH3(h3, i);
assert ring[i] >= 0;
}
return ring;
} | Returns the neighbor indexes.
@param h3 Origin index
@return All neighbor indexes from the origin | java | libs/h3/src/main/java/org/elasticsearch/h3/H3.java | 364 | [
"h3"
] | true | 2 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
add | public <V> Member<V> add(String name, Extractor<T, V> extractor) {
Assert.notNull(name, "'name' must not be null");
Assert.notNull(extractor, "'extractor' must not be null");
return addMember(name, extractor);
} | Add a new member with an extracted value.
@param <V> the value type
@param name the member name
@param extractor {@link Extractor} to extract the value
@return the added {@link Member} which may be configured further | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 237 | [
"name",
"extractor"
] | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
whenHasPath | default ValueProcessor<T> whenHasPath(String path) {
return whenHasPath(MemberPath.of(path)::equals);
} | Return a new processor from this one that only applied to members with the
given path.
@param path the patch to match
@return a new {@link ValueProcessor} that only applies when the path matches | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 1,000 | [
"path"
] | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false | |
isQualifierMatch | public static boolean isQualifierMatch(
Predicate<String> qualifier, String beanName, @Nullable BeanFactory beanFactory) {
// Try quick bean name or alias match first...
if (qualifier.test(beanName)) {
return true;
}
if (beanFactory != null) {
for (String alias : beanFactory.getAliases(beanName)) {
... | Check whether the named bean declares a qualifier of the given name.
@param qualifier the qualifier to match
@param beanName the name of the candidate bean
@param beanFactory the factory from which to retrieve the named bean
@return {@code true} if either the bean definition (in the XML case)
or the bean's factory meth... | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java | 165 | [
"qualifier",
"beanName",
"beanFactory"
] | true | 15 | 7.68 | spring-projects/spring-framework | 59,386 | javadoc | false | |
standardFirstKey | protected K standardFirstKey() {
Entry<K, V> entry = firstEntry();
if (entry == null) {
throw new NoSuchElementException();
} else {
return entry.getKey();
}
} | A sensible definition of {@link #firstKey} in terms of {@code firstEntry}. If you override
{@code firstEntry}, you may wish to override {@code firstKey} to forward to this
implementation. | java | android/guava/src/com/google/common/collect/ForwardingNavigableMap.java | 196 | [] | K | true | 2 | 6.56 | google/guava | 51,352 | javadoc | false |
value_labels | def value_labels(self) -> dict[str, dict[int, str]]:
"""
Return a nested dict associating each variable name to its value and label.
This method retrieves the value labels from a Stata file. Value labels are
mappings between the coded values and their corresponding descriptive labels
... | Return a nested dict associating each variable name to its value and label.
This method retrieves the value labels from a Stata file. Value labels are
mappings between the coded values and their corresponding descriptive labels
in a Stata dataset.
Returns
-------
dict
A python dictionary.
See Also
--------
read_... | python | pandas/io/stata.py | 2,045 | [
"self"
] | dict[str, dict[int, str]] | true | 2 | 8.32 | pandas-dev/pandas | 47,362 | unknown | false |
invert | public static String[][] invert(final String[][] array) {
final String[][] newArray = new String[array.length][2];
for (int i = 0; i < array.length; i++) {
newArray[i][0] = array[i][1];
newArray[i][1] = array[i][0];
}
return newArray;
} | Used to invert an escape array into an unescape array.
@param array String[][] to be inverted.
@return String[][] inverted array. | java | src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java | 421 | [
"array"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
allows_duplicate_labels | def allows_duplicate_labels(self) -> bool:
"""
Whether this object allows duplicate labels.
Setting ``allows_duplicate_labels=False`` ensures that the
index (and columns of a DataFrame) are unique. Most methods
that accept and return a Series or DataFrame will propagate
... | Whether this object allows duplicate labels.
Setting ``allows_duplicate_labels=False`` ensures that the
index (and columns of a DataFrame) are unique. Most methods
that accept and return a Series or DataFrame will propagate
the value of ``allows_duplicate_labels``.
See :ref:`duplicates` for more.
See Also
--------
D... | python | pandas/core/flags.py | 68 | [
"self"
] | bool | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | unknown | false |
onSendAttempt | public void onSendAttempt(final long currentTimeMs) {
this.requestInFlight = true;
// Here we update the timer everytime we try to send a request.
this.lastSentMs = currentTimeMs;
} | @return True if no response has been received after the last send, indicating that there
is a request in-flight. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestState.java | 102 | [
"currentTimeMs"
] | void | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
construct_docker_push_command | def construct_docker_push_command(
image_params: CommonBuildParams,
) -> list[str]:
"""
Constructs docker push command based on the parameters passed.
:param image_params: parameters of the image
:return: Command to run as list of string
"""
return ["docker", "push", image_params.airflow_ima... | Constructs docker push command based on the parameters passed.
:param image_params: parameters of the image
:return: Command to run as list of string | python | dev/breeze/src/airflow_breeze/utils/docker_command_utils.py | 457 | [
"image_params"
] | list[str] | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
all | public KafkaFuture<Void> all() {
return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture<?>[0]));
} | Get a future which completes when the transaction specified by {@link AbortTransactionSpec}
in the respective call to {@link Admin#abortTransaction(AbortTransactionSpec, AbortTransactionOptions)}
returns successfully or fails due to an error or timeout.
@return the future | java | clients/src/main/java/org/apache/kafka/clients/admin/AbortTransactionResult.java | 41 | [] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
GetCompressedFileSizeW | int GetCompressedFileSizeW(String lpFileName, IntConsumer lpFileSizeHigh); | Retrieves the actual number of bytes of disk storage used to store a specified file.
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getcompressedfilesizew
@param lpFileName the path string
@param lpFileSizeHigh pointer to high-order DWORD for compressed file size (or null if not needed)
@return t... | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/lib/Kernel32Library.java | 96 | [
"lpFileName",
"lpFileSizeHigh"
] | true | 1 | 6.16 | elastic/elasticsearch | 75,680 | javadoc | false | |
from | static SslManagerBundle from(TrustManager... trustManagers) {
Assert.notNull(trustManagers, "'trustManagers' must not be null");
KeyManagerFactory defaultKeyManagerFactory = createDefaultKeyManagerFactory();
TrustManagerFactory defaultTrustManagerFactory = createDefaultTrustManagerFactory();
return of(defaultKe... | Factory method to create a new {@link SslManagerBundle} using the given
{@link TrustManager TrustManagers} and the default {@link KeyManagerFactory}.
@param trustManagers the trust managers to use
@return a new {@link SslManagerBundle} instance
@since 3.5.0 | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java | 149 | [] | SslManagerBundle | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
doProcessConfigurationClass | protected final @Nullable SourceClass doProcessConfigurationClass(
ConfigurationClass configClass, SourceClass sourceClass, Predicate<String> filter)
throws IOException {
if (configClass.getMetadata().isAnnotated(Component.class.getName())) {
// Recursively process any member (nested) classes first
proce... | Apply processing and build a complete {@link ConfigurationClass} by reading the
annotations, members and methods from the source class. This method can be called
multiple times as relevant sources are discovered.
@param configClass the configuration class being build
@param sourceClass a source class
@return the superc... | java | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java | 303 | [
"configClass",
"sourceClass",
"filter"
] | SourceClass | true | 15 | 7.84 | spring-projects/spring-framework | 59,386 | javadoc | false |
isUrlExcludedFactory | function isUrlExcludedFactory (excludePatterns = []) {
if (excludePatterns.length === 0) {
return () => false
}
return function isUrlExcluded (url) {
let urlLowerCased
for (const pattern of excludePatterns) {
if (typeof pattern === 'string') {
if (!urlLowerCased) {
// Convert... | Factory function to create a URL exclusion checker
@param {Array<string| RegExp>} [excludePatterns=[]] - Array of patterns to exclude
@returns {IsUrlExcluded} - A function that checks if a URL matches any of the exclude patterns | javascript | deps/undici/src/lib/mock/snapshot-utils.js | 68 | [] | false | 8 | 6.48 | nodejs/node | 114,839 | jsdoc | false | |
applyAsInt | int applyAsInt(double value) throws E; | Applies this function to the given argument.
@param value the function argument
@return the function result
@throws E Thrown when the function fails. | java | src/main/java/org/apache/commons/lang3/function/FailableDoubleToIntFunction.java | 53 | [
"value"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
downloaderFor | private ProviderDownload downloaderFor(DatabaseConfiguration database) {
if (database.provider() instanceof DatabaseConfiguration.Maxmind maxmind) {
return new MaxmindDownload(database.name(), maxmind);
} else if (database.provider() instanceof DatabaseConfiguration.Ipinfo ipinfo) {
... | 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 | 422 | [
"database"
] | ProviderDownload | true | 3 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
_shallow_copy | def _shallow_copy(self, values, name: Hashable = no_default):
"""
Create a new RangeIndex with the same class as the caller, don't copy the
data, use the same object attributes with passed in attributes taking
precedence.
*this is an internal non-public method*
Paramete... | Create a new RangeIndex with the same class as the caller, don't copy the
data, use the same object attributes with passed in attributes taking
precedence.
*this is an internal non-public method*
Parameters
----------
values : the values to create the new RangeIndex, optional
name : Label, defaults to self.name | python | pandas/core/indexes/range.py | 591 | [
"self",
"values",
"name"
] | true | 7 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
uniqueIndex | private static <K, V> ImmutableMap<K, V> uniqueIndex(
Iterator<V> values, Function<? super V, K> keyFunction, ImmutableMap.Builder<K, V> builder) {
checkNotNull(keyFunction);
while (values.hasNext()) {
V value = values.next();
builder.put(keyFunction.apply(value), value);
}
try {
... | Returns a map with the given {@code values}, indexed by keys derived from those values. In
other words, each input value produces an entry in the map whose key is the result of applying
{@code keyFunction} to that value. These entries appear in the same order as the input values.
Example usage:
{@snippet :
Color red = ... | java | android/guava/src/com/google/common/collect/Maps.java | 1,337 | [
"values",
"keyFunction",
"builder"
] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
get_action_id | def get_action_id(resource_type: AvpEntities, method: ResourceMethod | str, entity_id: str | None):
"""
Return action id.
Convention for action ID is <resource_type>.<method>. Example: Variable.GET.
:param resource_type: Resource type.
:param method: Resource method.
:param entity_id: The enti... | Return action id.
Convention for action ID is <resource_type>.<method>. Example: Variable.GET.
:param resource_type: Resource type.
:param method: Resource method.
:param entity_id: The entity ID. | python | providers/amazon/src/airflow/providers/amazon/aws/auth_manager/avp/entities.py | 60 | [
"resource_type",
"method",
"entity_id"
] | true | 3 | 6.72 | apache/airflow | 43,597 | sphinx | false | |
readResolve | Object readResolve() {
if (this.equals(ALL)) {
return all();
} else {
return this;
}
} | Returns a string representation of this range, such as {@code "[3..5)"} (other examples are
listed in the class documentation). | java | android/guava/src/com/google/common/collect/Range.java | 692 | [] | Object | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false |
generateClassElementDecorationExpression | function generateClassElementDecorationExpression(node: ClassExpression | ClassDeclaration, member: ClassElement) {
const allDecorators = getAllDecoratorsOfClassElement(member, node, /*useLegacyDecorators*/ true);
const decoratorExpressions = transformAllDecoratorsOfDeclaration(allDecorators);
... | Generates an expression used to evaluate class element decorators at runtime.
@param node The class node that contains the member.
@param member The class member. | typescript | src/compiler/transformers/legacyDecorators.ts | 604 | [
"node",
"member"
] | false | 4 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
deleteShareGroupOffsets | DeleteShareGroupOffsetsResult deleteShareGroupOffsets(String groupId, Set<String> topics, DeleteShareGroupOffsetsOptions options); | Delete offsets for a set of topics in a share group.
@param groupId The group for which to delete offsets.
@param topics The topics for which to delete offsets.
@param options The options to use when deleting offsets in a share group.
@return The DeleteShareGroupOffsetsResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 2,001 | [
"groupId",
"topics",
"options"
] | DeleteShareGroupOffsetsResult | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
__call__ | def __call__(self, x, pos: int | None = 0) -> str:
"""
Return the time of day as a formatted string.
Parameters
----------
x : float
The time of day specified as seconds since 00:00 (midnight),
with up to microsecond precision.
pos
Unu... | Return the time of day as a formatted string.
Parameters
----------
x : float
The time of day specified as seconds since 00:00 (midnight),
with up to microsecond precision.
pos
Unused
Returns
-------
str
A string in HH:MM:SS.mmmuuu format. Microseconds,
milliseconds and seconds are only displayed ... | python | pandas/plotting/_matplotlib/converter.py | 187 | [
"self",
"x",
"pos"
] | str | true | 4 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
toFloat | public static float toFloat(final String str, final float defaultValue) {
try {
return Float.parseFloat(str);
} catch (final RuntimeException e) {
return defaultValue;
}
} | Converts a {@link String} to a {@code float}, returning a default value if the conversion fails.
<p>
If the string {@code str} is {@code null}, the default value is returned.
</p>
<pre>
NumberUtils.toFloat(null, 1.1f) = 1.1f
NumberUtils.toFloat("", 1.1f) = 1.1f
NumberUtils.toFloat("1.5", 0.0f) = 1.5f
</pre... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,515 | [
"str",
"defaultValue"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
repeat | def repeat(self, repeats):
"""
Duplicate each string in the Series or Index.
Duplicates each string in the Series or Index, either by applying the
same repeat count to all elements or by using different repeat values
for each element.
Parameters
----------
... | Duplicate each string in the Series or Index.
Duplicates each string in the Series or Index, either by applying the
same repeat count to all elements or by using different repeat values
for each element.
Parameters
----------
repeats : int or sequence of int
Same value for all (int) or different value per (sequen... | python | pandas/core/strings/accessor.py | 1,676 | [
"self",
"repeats"
] | false | 1 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false | |
getAnnotatedMethods | private static ImmutableList<Method> getAnnotatedMethods(Class<?> clazz) {
try {
return subscriberMethodsCache.getUnchecked(clazz);
} catch (UncheckedExecutionException e) {
if (e.getCause() instanceof IllegalArgumentException) {
/*
* IllegalArgumentException is the one unchecked ex... | Returns all subscribers for the given listener grouped by the type of event they subscribe to. | java | android/guava/src/com/google/common/eventbus/SubscriberRegistry.java | 167 | [
"clazz"
] | true | 3 | 6 | google/guava | 51,352 | javadoc | false | |
prepare_code_snippet | def prepare_code_snippet(file_path: Path, line_no: int, context_lines_count: int = 5) -> str:
"""
Prepare code snippet with line numbers and a specific line marked.
:param file_path: File name
:param line_no: Line number
:param context_lines_count: The number of lines that will be cut before and a... | Prepare code snippet with line numbers and a specific line marked.
:param file_path: File name
:param line_no: Line number
:param context_lines_count: The number of lines that will be cut before and after.
:return: str | python | airflow-core/src/airflow/utils/code_utils.py | 53 | [
"file_path",
"line_no",
"context_lines_count"
] | str | true | 2 | 8.4 | apache/airflow | 43,597 | sphinx | false |
toByte | public Byte toByte() {
return Byte.valueOf(byteValue());
} | Gets this mutable as an instance of Byte.
@return a Byte instance containing the value from this mutable. | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 373 | [] | Byte | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
to_html | def to_html(
self,
buf: FilePath | WriteBuffer[str] | None = None,
encoding: str | None = None,
classes: str | list | tuple | None = None,
notebook: bool = False,
border: int | bool | None = None,
table_id: str | None = None,
render_links: bool = False,
... | Render a DataFrame to a html table.
Parameters
----------
buf : str, path object, file-like object, or None, default None
String, path object (implementing ``os.PathLike[str]``), or file-like
object implementing a string ``write()`` function. If None, the result is
returned as a string.
encoding : str, def... | python | pandas/io/formats/format.py | 895 | [
"self",
"buf",
"encoding",
"classes",
"notebook",
"border",
"table_id",
"render_links"
] | str | None | true | 2 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
_parse_possible_contraction | def _parse_possible_contraction(
positions, input_sets, output_set, idx_dict,
memory_limit, path_cost, naive_cost
):
"""Compute the cost (removed size + flops) and resultant indices for
performing the contraction specified by ``positions``.
Parameters
----------
positions : tupl... | Compute the cost (removed size + flops) and resultant indices for
performing the contraction specified by ``positions``.
Parameters
----------
positions : tuple of int
The locations of the proposed tensors to contract.
input_sets : list of sets
The indices found on each tensors.
output_set : set
The output... | python | numpy/_core/einsumfunc.py | 224 | [
"positions",
"input_sets",
"output_set",
"idx_dict",
"memory_limit",
"path_cost",
"naive_cost"
] | false | 3 | 6 | numpy/numpy | 31,054 | numpy | false | |
instantiate | public List<T> instantiate(@Nullable ClassLoader classLoader, Collection<String> names) {
Assert.notNull(names, "'names' must not be null");
return instantiate(names.stream().map((name) -> TypeSupplier.forName(classLoader, name)));
} | Instantiate the given set of class name, injecting constructor arguments as
necessary.
@param classLoader the source classloader
@param names the class names to instantiate
@return a list of instantiated instances
@since 2.4.8 | java | core/spring-boot/src/main/java/org/springframework/boot/util/Instantiator.java | 125 | [
"classLoader",
"names"
] | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false | |
parameterizedTypeToString | private static String parameterizedTypeToString(final ParameterizedType parameterizedType) {
final StringBuilder builder = new StringBuilder();
final Type useOwner = parameterizedType.getOwnerType();
final Class<?> raw = (Class<?>) parameterizedType.getRawType();
if (useOwner == null) {
... | Formats a {@link ParameterizedType} as a {@link String}.
@param parameterizedType {@link ParameterizedType} to format.
@return String. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,413 | [
"parameterizedType"
] | String | true | 4 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.