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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
patch_trigger_dag_run_post_body | def patch_trigger_dag_run_post_body():
"""
Post-process the generated `TriggerDAGRunPostBody` model to explicitly include `"logical_date": None`
in the `to_dict()` output if it was not set.
Why this is needed:
- The Airflow API server expects the `logical_date` field to always b... | Post-process the generated `TriggerDAGRunPostBody` model to explicitly include `"logical_date": None`
in the `to_dict()` output if it was not set.
Why this is needed:
- The Airflow API server expects the `logical_date` field to always be present in the request payload,
even if its value is `null`.
- By default, the ... | python | dev/breeze/src/airflow_breeze/commands/release_management_commands.py | 3,594 | [] | false | 10 | 6 | apache/airflow | 43,597 | unknown | false | |
toIntegerObject | public static Integer toIntegerObject(final Boolean bool) {
if (bool == null) {
return null;
}
return bool.booleanValue() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
} | Converts a Boolean to an Integer using the convention that
{@code zero} is {@code false}.
<p>{@code null} will be converted to {@code null}.</p>
<pre>
BooleanUtils.toIntegerObject(Boolean.TRUE) = Integer.valueOf(1)
BooleanUtils.toIntegerObject(Boolean.FALSE) = Integer.valueOf(0)
</pre>
@param bool the Boolean to ... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 976 | [
"bool"
] | Integer | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
forFactoryMethod | public static <T> BeanInstanceSupplier<T> forFactoryMethod(
Class<?> declaringClass, String methodName, Class<?>... parameterTypes) {
Assert.notNull(declaringClass, "'declaringClass' must not be null");
Assert.hasText(methodName, "'methodName' must not be empty");
Assert.notNull(parameterTypes, "'parameterTyp... | Create a new {@link BeanInstanceSupplier} that
resolves arguments for the specified factory method.
@param <T> the type of instance supplied
@param declaringClass the class that declares the factory method
@param methodName the factory method name
@param parameterTypes the factory method parameter types
@return a new {... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 131 | [
"declaringClass",
"methodName"
] | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
standardPeek | protected @Nullable E standardPeek() {
try {
return element();
} catch (NoSuchElementException caught) {
return null;
}
} | A sensible definition of {@link #peek} in terms of {@link #element}. If you override {@link
#element}, you may wish to override {@link #peek} to forward to this implementation.
@since 7.0 | java | android/guava/src/com/google/common/collect/ForwardingQueue.java | 107 | [] | E | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false |
create | static MethodDescriptor create(String beanName, Class<?> beanClass, String methodName) {
try {
Class<?> declaringClass = beanClass;
String methodNameToUse = methodName;
// Parse fully-qualified method name if necessary.
int indexOfDot = methodName.lastIndexOf('.');
if (indexOfDot > 0) {
String cla... | Create a {@link MethodDescriptor} for the supplied bean class and method name.
<p>The supplied {@code methodName} may be a {@linkplain Method#getName()
simple method name} or a {@linkplain ClassUtils#getQualifiedMethodName(Method)
qualified method name}.
<p>If the method name is fully qualified, this utility will parse... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/MethodDescriptor.java | 51 | [
"beanName",
"beanClass",
"methodName"
] | MethodDescriptor | true | 4 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false |
customizeBeanRegistrationCodeFragments | default BeanRegistrationCodeFragments customizeBeanRegistrationCodeFragments(
GenerationContext generationContext, BeanRegistrationCodeFragments codeFragments) {
return codeFragments;
} | Customize the {@link BeanRegistrationCodeFragments} that will be used to
generate the bean registration code. Custom code fragments can be used if
default code generation isn't suitable.
@param generationContext the generation context
@param codeFragments the existing code fragments
@return the code fragments to use, m... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotContribution.java | 46 | [
"generationContext",
"codeFragments"
] | BeanRegistrationCodeFragments | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
resolveEntity | @Override
public @Nullable InputSource resolveEntity(@Nullable String publicId, @Nullable String systemId)
throws SAXException, IOException {
if (systemId != null) {
if (systemId.endsWith(DTD_SUFFIX)) {
return this.dtdResolver.resolveEntity(publicId, systemId);
}
else if (systemId.endsWith(XSD_SUFFI... | Create a new DelegatingEntityResolver that delegates to
the given {@link EntityResolver EntityResolvers}.
@param dtdResolver the EntityResolver to resolve DTDs with
@param schemaResolver the EntityResolver to resolve XML schemas with | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/DelegatingEntityResolver.java | 80 | [
"publicId",
"systemId"
] | InputSource | true | 4 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
toString | public static String toString(long x, int radix) {
checkArgument(
radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX,
"radix (%s) must be between Character.MIN_RADIX and Character.MAX_RADIX",
radix);
if (x == 0) {
// Simply return "0"
return "0";
} else if (x > ... | Returns a string representation of {@code x} for the given radix, where {@code x} is treated as
unsigned.
<p><b>Java 8+ users:</b> use {@link Long#toUnsignedString(long, int)} instead.
@param x the value to convert to a string.
@param radix the radix to use while working with {@code x}
@throws IllegalArgumentException ... | java | android/guava/src/com/google/common/primitives/UnsignedLongs.java | 459 | [
"x",
"radix"
] | String | true | 7 | 6.72 | google/guava | 51,352 | javadoc | false |
getTargetShadowMatch | private ShadowMatch getTargetShadowMatch(Method method, Class<?> targetClass) {
Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
if (targetMethod.getDeclaringClass().isInterface() && targetMethod.getDeclaringClass() != targetClass &&
obtainPointcutExpression().getPointcutExpression().c... | Get a new pointcut expression based on a target class's loader rather than the default. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java | 442 | [
"method",
"targetClass"
] | ShadowMatch | true | 6 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
supportsEventType | @Override
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
return ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(eventType)
|| ApplicationPreparedEvent.class.isAssignableFrom(eventType)
|| ApplicationFailedEvent.class.isAssignableFrom(eventType);
} | Factory method that creates an {@link EnvironmentPostProcessorApplicationListener}
with a specific {@link EnvironmentPostProcessorsFactory}.
@param postProcessorsFactory the environment post processor factory
@return an {@link EnvironmentPostProcessorApplicationListener} instance | java | core/spring-boot/src/main/java/org/springframework/boot/support/EnvironmentPostProcessorApplicationListener.java | 110 | [
"eventType"
] | true | 3 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false | |
append | public StrBuilder append(final long value) {
return append(String.valueOf(value));
} | Appends a long value to the string builder using {@code String.valueOf}.
@param value the value to append
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 547 | [
"value"
] | StrBuilder | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
getThrowStatementOwner | function getThrowStatementOwner(throwStatement: ThrowStatement): Node | undefined {
let child: Node = throwStatement;
while (child.parent) {
const parent = child.parent;
if (isFunctionBlock(parent) || parent.kind === SyntaxKind.SourceFile) {
return parent... | For lack of a better name, this function takes a throw statement and returns the
nearest ancestor that is a try-block (whose try statement has a catch clause),
function-block, or source file. | typescript | src/services/documentHighlights.ts | 225 | [
"throwStatement"
] | true | 7 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toObject | public static Integer[] toObject(final int[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_INTEGER_OBJECT_ARRAY;
}
return setAll(new Integer[array.length], i -> Integer.valueOf(array[i]));
} | Converts an array of primitive ints to objects.
<p>This method returns {@code null} for a {@code null} input array.</p>
@param array an {@code int} array.
@return an {@link Integer} array, {@code null} if null array input. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,762 | [
"array"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
equals | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final A... | Constructs an instance of {@link MultipartKey} to hold the specified objects.
@param keys the set of objects that make up the key. Each key may be null. | java | src/main/java/org/apache/commons/lang3/time/AbstractFormatCache.java | 58 | [
"obj"
] | true | 4 | 6.72 | apache/commons-lang | 2,896 | javadoc | false | |
append | public StrBuilder append(final char[] chars, final int startIndex, final int length) {
if (chars == null) {
return appendNull();
}
if (startIndex < 0 || startIndex > chars.length) {
throw new StringIndexOutOfBoundsException("Invalid startIndex: " + length);
}
... | Appends a char array to the string builder.
Appending null will call {@link #appendNull()}.
@param chars the char array to append
@param startIndex the start index, inclusive, must be valid
@param length the length to append, must be valid
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 390 | [
"chars",
"startIndex",
"length"
] | StrBuilder | true | 7 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
hasIndexedElement | public boolean hasIndexedElement() {
for (int i = 0; i < getNumberOfElements(); i++) {
if (isIndexed(i)) {
return true;
}
}
return false;
} | Return {@code true} if any element in the name is indexed.
@return if the element has one or more indexed elements
@since 2.2.10 | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 106 | [] | true | 3 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
create_rot_n | def create_rot_n(n: int) -> list[Instruction]:
"""
Returns a "simple" sequence of instructions that rotates TOS to the n-th
position in the stack. For Python < 3.11, returns a single ROT_*
instruction. If no such instruction exists, an error is raised and the
caller is expected to generate an equiva... | Returns a "simple" sequence of instructions that rotates TOS to the n-th
position in the stack. For Python < 3.11, returns a single ROT_*
instruction. If no such instruction exists, an error is raised and the
caller is expected to generate an equivalent sequence of instructions.
For Python >= 3.11, any rotation can be ... | python | torch/_dynamo/bytecode_transformation.py | 233 | [
"n"
] | list[Instruction] | true | 4 | 6 | pytorch/pytorch | 96,034 | unknown | false |
addFilter | function addFilter(
query: string,
vectorSelectorPositions: VectorSelectorPosition[],
filter: QueryBuilderLabelFilter
): string {
let newQuery = '';
let prev = 0;
for (let i = 0; i < vectorSelectorPositions.length; i++) {
// This is basically just doing splice on a string for each matched vector select... | Parse the string and get all VectorSelector positions in the query together with parsed representation of the vector
selector.
@param query | typescript | packages/grafana-prometheus/src/add_label_to_query.ts | 65 | [
"query",
"vectorSelectorPositions",
"filter"
] | true | 8 | 6.56 | grafana/grafana | 71,362 | jsdoc | false | |
_vander_nd | def _vander_nd(vander_fs, points, degrees):
r"""
A generalization of the Vandermonde matrix for N dimensions
The result is built by combining the results of 1d Vandermonde matrices,
.. math::
W[i_0, \ldots, i_M, j_0, \ldots, j_N] = \prod_{k=0}^N{V_k(x_k)[i_0, \ldots, i_M, j_k]}
where
... | r"""
A generalization of the Vandermonde matrix for N dimensions
The result is built by combining the results of 1d Vandermonde matrices,
.. math::
W[i_0, \ldots, i_M, j_0, \ldots, j_N] = \prod_{k=0}^N{V_k(x_k)[i_0, \ldots, i_M, j_k]}
where
.. math::
N &= \texttt{len(points)} = \texttt{len(degrees)} = \text... | python | numpy/polynomial/polyutils.py | 364 | [
"vander_fs",
"points",
"degrees"
] | false | 4 | 6 | numpy/numpy | 31,054 | numpy | false | |
replaceIgnoreCase | @Deprecated
public static String replaceIgnoreCase(final String text, final String searchString, final String replacement, final int max) {
return Strings.CI.replace(text, searchString, replacement, max);
} | Case insensitively replaces a String with another String inside a larger String, for the first {@code max} values of the search String.
<p>
A {@code null} reference passed to this method is a no-op.
</p>
<pre>
StringUtils.replaceIgnoreCase(null, *, *, *) = null
StringUtils.replaceIgnoreCase("", *, *, *) ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 6,665 | [
"text",
"searchString",
"replacement",
"max"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
set_table_attributes | def set_table_attributes(self, attributes: str) -> Styler:
"""
Set the table attributes added to the ``<table>`` HTML element.
These are items in addition to automatic (by default) ``id`` attribute.
Parameters
----------
attributes : str
Table attributes to ... | Set the table attributes added to the ``<table>`` HTML element.
These are items in addition to automatic (by default) ``id`` attribute.
Parameters
----------
attributes : str
Table attributes to be added to the ``<table>`` HTML element.
Returns
-------
Styler
Instance of class with specified table attributes... | python | pandas/io/formats/style.py | 2,197 | [
"self",
"attributes"
] | Styler | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
throwIfNot | private static void throwIfNot(ConfigDataResource resource, boolean check) {
if (!check) {
throw new ConfigDataResourceNotFoundException(resource);
}
} | Throw a {@link ConfigDataNotFoundException} if the specified {@link Resource} does
not exist.
@param resource the config data resource
@param resourceToCheck the resource to check | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataResourceNotFoundException.java | 144 | [
"resource",
"check"
] | void | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
copyPropertySources | private void copyPropertySources(ConfigurableEnvironment source, ConfigurableEnvironment target) {
removePropertySources(target.getPropertySources(), isServletEnvironment(target.getClass(), this.classLoader));
for (PropertySource<?> propertySource : source.getPropertySources()) {
if (!SERVLET_ENVIRONMENT_SOURCE_... | Converts the given {@code environment} to the given {@link StandardEnvironment}
type. If the environment is already of the same type, no conversion is performed
and it is returned unchanged.
@param environment the Environment to convert
@param type the type to convert the Environment to
@return the converted Environmen... | java | core/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java | 101 | [
"source",
"target"
] | void | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
extractSource | @Override
public Object extractSource(Object sourceCandidate, @Nullable Resource definingResource) {
return sourceCandidate;
} | Simply returns the supplied {@code sourceCandidate} as-is.
@param sourceCandidate the source metadata
@return the supplied {@code sourceCandidate} | java | spring-beans/src/main/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractor.java | 44 | [
"sourceCandidate",
"definingResource"
] | Object | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
_addsub_object_array | def _addsub_object_array(self, other: npt.NDArray[np.object_], op) -> np.ndarray:
"""
Add or subtract array-like of DateOffset objects
Parameters
----------
other : np.ndarray[object]
op : {operator.add, operator.sub}
Returns
-------
np.ndarray[o... | Add or subtract array-like of DateOffset objects
Parameters
----------
other : np.ndarray[object]
op : {operator.add, operator.sub}
Returns
-------
np.ndarray[object]
Except in fastpath case with length 1 where we operate on the
contained scalar. | python | pandas/core/arrays/datetimelike.py | 1,343 | [
"self",
"other",
"op"
] | np.ndarray | true | 4 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
withHashes | public StandardStackTracePrinter withHashes(boolean hashes) {
return withHashes((!hashes) ? null : DEFAULT_FRAME_HASHER);
} | Return a new {@link StandardStackTracePrinter} from this one that changes if hashes
should be generated and printed for each stacktrace.
@param hashes if hashes should be added
@return a new {@link StandardStackTracePrinter} instance | java | core/spring-boot/src/main/java/org/springframework/boot/logging/StandardStackTracePrinter.java | 272 | [
"hashes"
] | StandardStackTracePrinter | true | 2 | 7.36 | spring-projects/spring-boot | 79,428 | javadoc | false |
addAll | @CanIgnoreReturnValue
public static <T extends @Nullable Object> boolean addAll(
Collection<T> addTo, Iterator<? extends T> iterator) {
checkNotNull(addTo);
checkNotNull(iterator);
boolean wasModified = false;
while (iterator.hasNext()) {
wasModified |= addTo.add(iterator.next());
}
... | Adds all elements in {@code iterator} to {@code collection}. The iterator will be left
exhausted: its {@code hasNext()} method will return {@code false}.
@return {@code true} if {@code collection} was modified as a result of this operation | java | android/guava/src/com/google/common/collect/Iterators.java | 363 | [
"addTo",
"iterator"
] | true | 2 | 7.76 | google/guava | 51,352 | javadoc | false | |
createMimeMessage | MimeMessage createMimeMessage(InputStream contentStream) throws MailException; | Create a new JavaMail MimeMessage for the underlying JavaMail Session
of this sender, using the given input stream as the message source.
@param contentStream the raw MIME input stream for the message
@return the new MimeMessage instance
@throws org.springframework.mail.MailParseException
in case of message creation fa... | java | spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSender.java | 88 | [
"contentStream"
] | MimeMessage | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
removeAdvisor | @Override
public boolean removeAdvisor(Advisor advisor) {
int index = indexOf(advisor);
if (index == -1) {
return false;
}
else {
removeAdvisor(index);
return true;
}
} | Remove a proxied interface.
<p>Does nothing if the given interface isn't proxied.
@param ifc the interface to remove from the proxy
@return {@code true} if the interface was removed; {@code false}
if the interface was not found and hence could not be removed | java | spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java | 315 | [
"advisor"
] | true | 2 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
findImplementation | private static ErrorOnUnknown findImplementation() {
ErrorOnUnknown best = new ErrorOnUnknown() {
@Override
public String errorMessage(String parserName, String unknownField, Iterable<String> candidates) {
return "[" + parserName + "] unknown field [" + unknownField + "]"... | Priority that this error message handler should be used. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ErrorOnUnknown.java | 38 | [] | ErrorOnUnknown | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
fit | def fit(self, X, y=None, sample_weight=None):
"""Perform DBSCAN clustering from features, or distance matrix.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features), or \
(n_samples, n_samples)
Training instances to cluster, or dis... | Perform DBSCAN clustering from features, or distance matrix.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features), or \
(n_samples, n_samples)
Training instances to cluster, or distances between instances if
``metric='precomputed'``. If a sparse matrix is provided, it will... | python | sklearn/cluster/_dbscan.py | 397 | [
"self",
"X",
"y",
"sample_weight"
] | false | 8 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
ToggleInspectedElement | function ToggleInspectedElement({
dispatch,
state,
orientation,
}: {
dispatch: LayoutDispatch,
state: LayoutState,
orientation: 'horizontal' | 'vertical',
}) {
let iconType: IconType;
if (orientation === 'horizontal') {
iconType = state.inspectedElementHidden
? 'panel-right-open'
: 'pane... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js | 123 | [] | false | 6 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
postProcessBeanFactory | @Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
super.postProcessBeanFactory(beanFactory);
if (!ObjectUtils.isEmpty(this.basePackages)) {
this.scanner.scan(this.basePackages);
}
if (!this.annotatedClasses.isEmpty()) {
this.reader.register(ClassUtils.toClassA... | Perform a scan within the specified base packages. Note that {@link #refresh()}
must be called in order for the context to fully process the new class.
@param basePackages the packages to check for annotated classes
@see #register(Class...)
@see #refresh() | java | core/spring-boot/src/main/java/org/springframework/boot/web/context/servlet/AnnotationConfigServletWebApplicationContext.java | 202 | [
"beanFactory"
] | void | true | 3 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
range | function range(from: number, to: number): number[] {
return _range(from, to)
} | Create a list of numbers from `from` to `to` (both inclusive).
@param from
@param to
@returns | typescript | helpers/blaze/range.ts | 21 | [
"from",
"to"
] | true | 1 | 6.8 | prisma/prisma | 44,834 | jsdoc | false | |
synchronizedNavigableSet | @GwtIncompatible // NavigableSet
@J2ktIncompatible // Synchronized
public static <E extends @Nullable Object> NavigableSet<E> synchronizedNavigableSet(
NavigableSet<E> navigableSet) {
return Synchronized.navigableSet(navigableSet);
} | Returns a synchronized (thread-safe) navigable set backed by the specified navigable set. In
order to guarantee serial access, it is critical that <b>all</b> access to the backing
navigable set is accomplished through the returned navigable set (or its views).
<p>It is imperative that the user manually synchronize on t... | java | android/guava/src/com/google/common/collect/Sets.java | 2,046 | [
"navigableSet"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
when | public Member<T> when(Predicate<? super @Nullable T> predicate) {
Assert.notNull(predicate, "'predicate' must not be null");
this.valueExtractor = this.valueExtractor.when(predicate);
return this;
} | Only include this member when the given predicate matches.
@param predicate the predicate to test
@return a {@link Member} which may be configured further | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 440 | [
"predicate"
] | true | 1 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
infer_objects | def infer_objects(self, copy: bool | lib.NoDefault = lib.no_default) -> Self:
"""
Attempt to infer better dtypes for object columns.
Attempts soft conversion of object-dtyped
columns, leaving non-object and unconvertible
columns unchanged. The inference rules are the
sam... | Attempt to infer better dtypes for object columns.
Attempts soft conversion of object-dtyped
columns, leaving non-object and unconvertible
columns unchanged. The inference rules are the
same as during normal Series/DataFrame construction.
Parameters
----------
copy : bool, default False
This keyword is now ignore... | python | pandas/core/generic.py | 6,670 | [
"self",
"copy"
] | Self | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false |
decoratorElidingVisitor | function decoratorElidingVisitor(node: Node): VisitResult<Node | undefined> {
return isDecorator(node) ? undefined : visitor(node);
} | Specialized visitor that visits the immediate children of a class with TypeScript syntax.
@param node The node to visit. | typescript | src/compiler/transformers/ts.ts | 617 | [
"node"
] | true | 2 | 6.48 | microsoft/TypeScript | 107,154 | jsdoc | false | |
run_fwd_maybe_bwd | def run_fwd_maybe_bwd(
gm: torch.fx.GraphModule,
args: Sequence[Any],
only_fwd: bool = False,
disable_clone: bool = False,
) -> Any:
"""
Runs a forward and possibly backward iteration for a given mod and args.
When disable_clone is True, we will use args as-is without cloning.
This is h... | Runs a forward and possibly backward iteration for a given mod and args.
When disable_clone is True, we will use args as-is without cloning.
This is higher fidelity but we may destroy the args in the process. | python | torch/_dynamo/debug_utils.py | 364 | [
"gm",
"args",
"only_fwd",
"disable_clone"
] | Any | true | 6 | 6 | pytorch/pytorch | 96,034 | unknown | false |
wrap | function wrap(value, wrapper) {
return partial(castFunction(wrapper), value);
} | Creates a function that provides `value` to `wrapper` as its first
argument. Any additional arguments provided to the function are appended
to those provided to the `wrapper`. The wrapper is invoked with the `this`
binding of the created function.
@static
@memberOf _
@since 0.1.0
@category Function
@param {*} value The... | javascript | lodash.js | 11,063 | [
"value",
"wrapper"
] | false | 1 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
poke | def poke(self, context: Context):
"""
Check subscribed queue for messages and write them to xcom with the ``messages`` key.
:param context: the context object
:return: ``True`` if message is available or ``False``
"""
message_batch: list[Any] = []
# perform mult... | Check subscribed queue for messages and write them to xcom with the ``messages`` key.
:param context: the context object
:return: ``True`` if message is available or ``False`` | python | providers/amazon/src/airflow/providers/amazon/aws/sensors/sqs.py | 186 | [
"self",
"context"
] | true | 6 | 8.4 | apache/airflow | 43,597 | sphinx | false | |
map | public static MappedByteBuffer map(File file, MapMode mode) throws IOException {
return mapInternal(file, mode, -1);
} | Fully maps a file in to memory as per {@link
FileChannel#map(java.nio.channels.FileChannel.MapMode, long, long)} using the requested {@link
MapMode}.
<p>Files are mapped from offset 0 to its length.
<p>This only works for files ≤ {@link Integer#MAX_VALUE} bytes.
@param file the file to map
@param mode the mode to use w... | java | android/guava/src/com/google/common/io/Files.java | 667 | [
"file",
"mode"
] | MappedByteBuffer | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false |
get | static ConfigurationPropertyCaching get(Iterable<ConfigurationPropertySource> sources,
@Nullable Object underlyingSource) {
Assert.notNull(sources, "'sources' must not be null");
if (underlyingSource == null) {
return new ConfigurationPropertySourcesCaching(sources);
}
for (ConfigurationPropertySource sou... | Get for a specific configuration property source in the specified configuration
property sources.
@param sources the configuration property sources
@param underlyingSource the
{@link ConfigurationPropertySource#getUnderlyingSource() underlying source} that
must match
@return a caching instance that controls the matchin... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyCaching.java | 104 | [
"sources",
"underlyingSource"
] | ConfigurationPropertyCaching | true | 4 | 7.12 | spring-projects/spring-boot | 79,428 | javadoc | false |
maybeClose | private static void maybeClose(Object object, String name) {
if (object instanceof AutoCloseable) {
Utils.closeQuietly((AutoCloseable) object, name);
}
} | Get a list of configured instances of the given class specified by the given configuration key. The configuration
may specify either null or an empty string to indicate no configured instances. In both cases, this method
returns an empty list to indicate no configured instances.
@param classNames The list of class... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 509 | [
"object",
"name"
] | void | true | 2 | 7.92 | apache/kafka | 31,560 | javadoc | false |
dateFormat | public DateTimeFormatters dateFormat(@Nullable String pattern) {
if (isIso(pattern)) {
this.dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
this.datePattern = "yyyy-MM-dd";
}
else {
this.dateFormatter = formatter(pattern);
this.datePattern = pattern;
}
return this;
} | Configures the date format using the given {@code pattern}.
@param pattern the pattern for formatting dates
@return {@code this} for chained method invocation | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/DateTimeFormatters.java | 48 | [
"pattern"
] | DateTimeFormatters | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
matrix_transpose | def matrix_transpose(x, /):
"""
Transposes a matrix (or a stack of matrices) ``x``.
This function is Array API compatible.
Parameters
----------
x : array_like
Input array having shape (..., M, N) and whose two innermost
dimensions form ``MxN`` matrices.
Returns
------... | Transposes a matrix (or a stack of matrices) ``x``.
This function is Array API compatible.
Parameters
----------
x : array_like
Input array having shape (..., M, N) and whose two innermost
dimensions form ``MxN`` matrices.
Returns
-------
out : ndarray
An array containing the transpose for each matrix an... | python | numpy/_core/fromnumeric.py | 684 | [
"x"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
getDependentBeans | public String[] getDependentBeans(String beanName) {
Set<String> dependentBeans = this.dependentBeanMap.get(beanName);
if (dependentBeans == null) {
return new String[0];
}
synchronized (this.dependentBeanMap) {
return StringUtils.toStringArray(dependentBeans);
}
} | Return the names of all beans which depend on the specified bean, if any.
@param beanName the name of the bean
@return the array of dependent bean names, or an empty array if none | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java | 667 | [
"beanName"
] | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false | |
increment | public CheckIntervalData increment(final int delta) {
return delta == 0 ? this : new CheckIntervalData(getEventCount() + delta,
getCheckIntervalStart());
} | Returns a new instance of {@link CheckIntervalData} with the event counter
incremented by the given delta. If the delta is 0, this object is returned.
@param delta the delta
@return the updated instance | java | src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java | 230 | [
"delta"
] | CheckIntervalData | true | 2 | 7.68 | apache/commons-lang | 2,896 | javadoc | false |
JAVA_CTRL_CHARS_UNESCAPE | public static String[][] JAVA_CTRL_CHARS_UNESCAPE() {
return JAVA_CTRL_CHARS_UNESCAPE.clone();
} | Reverse of {@link #JAVA_CTRL_CHARS_ESCAPE()} for unescaping purposes.
@return the mapping table. | java | src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java | 464 | [] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
ofExisting | static ConfigDataEnvironmentContributor ofExisting(PropertySource<?> propertySource,
ConversionService conversionService) {
return new ConfigDataEnvironmentContributor(Kind.EXISTING, null, null, false, propertySource,
asConfigurationPropertySource(propertySource), null, null, null, conversionService);
} | Factory method to create a contributor that wraps an {@link Kind#EXISTING existing}
property source. The contributor provides access to existing properties, but
doesn't actively import any additional contributors.
@param propertySource the property source to wrap
@param conversionService the conversion service to use
@... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java | 424 | [
"propertySource",
"conversionService"
] | ConfigDataEnvironmentContributor | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
worker_direct | def worker_direct(hostname: str | Queue) -> Queue:
"""Return the :class:`kombu.Queue` being a direct route to a worker.
Arguments:
hostname (str, ~kombu.Queue): The fully qualified node name of
a worker (e.g., ``w1@example.com``). If passed a
:class:`kombu.Queue` instance it wi... | Return the :class:`kombu.Queue` being a direct route to a worker.
Arguments:
hostname (str, ~kombu.Queue): The fully qualified node name of
a worker (e.g., ``w1@example.com``). If passed a
:class:`kombu.Queue` instance it will simply return
that instead. | python | celery/utils/nodenames.py | 38 | [
"hostname"
] | Queue | true | 2 | 8.16 | celery/celery | 27,741 | google | false |
shouldInject | protected boolean shouldInject(@Nullable PropertyValues pvs) {
if (this.isField) {
return true;
}
return !checkPropertySkipping(pvs);
} | Whether the property values should be injected.
@param pvs property values to check
@return whether the property values should be injected
@since 6.0.10 | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java | 251 | [
"pvs"
] | true | 2 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toString | @Override
public String toString() {
StringBuilder bld;
if (metadata.isFull()) {
bld = new StringBuilder("FullFetchRequest(toSend=(");
String prefix = "";
for (TopicPartition partition : toSend.keySet()) {
bld.append(pre... | Get the full set of partitions involved in this fetch request. | java | clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java | 178 | [] | String | true | 4 | 6.8 | apache/kafka | 31,560 | javadoc | false |
rhoInit | Ptr<RHO_HEST> rhoInit(void){
/* Select an optimized implementation of RHO here. */
#if 1
/**
* For now, only the generic C implementation is available. In the future,
* SSE2/AVX/AVX2/FMA/NEON versions may be added, and they will be selected
* depending on cv::checkHardwareSupport()'s return valu... | External access to context constructor.
@return A pointer to the context if successful; NULL if an error occurred. | cpp | modules/calib3d/src/rho.cpp | 446 | [] | true | 3 | 8.24 | opencv/opencv | 85,374 | doxygen | false | |
resolve | @SuppressWarnings("unchecked")
public <T> @Nullable T resolve(RegisteredBean registeredBean) {
return (T) resolveObject(registeredBean);
} | Resolve the field value for the specified registered bean.
@param registeredBean the registered bean
@return the resolved field value | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredFieldValueResolver.java | 137 | [
"registeredBean"
] | T | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false |
_pre_import_airflow_modules | def _pre_import_airflow_modules(file_path: str, log: FilteringBoundLogger) -> None:
"""
Pre-import Airflow modules found in the given file.
This prevents modules from being re-imported in each processing process,
saving CPU time and memory.
(The default value of "parsing_pre_import_modules" is set ... | Pre-import Airflow modules found in the given file.
This prevents modules from being re-imported in each processing process,
saving CPU time and memory.
(The default value of "parsing_pre_import_modules" is set to True)
:param file_path: Path to the file to scan for imports
:param log: Logger instance to use for warn... | python | airflow-core/src/airflow/dag_processing/processor.py | 155 | [
"file_path",
"log"
] | None | true | 3 | 7.04 | apache/airflow | 43,597 | sphinx | false |
wsgi_app | def wsgi_app(
self, environ: WSGIEnvironment, start_response: StartResponse
) -> cabc.Iterable[bytes]:
"""The actual WSGI application. This is not implemented in
:meth:`__call__` so that middlewares can be applied without
losing a reference to the app object. Instead of doing this::
... | The actual WSGI application. This is not implemented in
:meth:`__call__` so that middlewares can be applied without
losing a reference to the app object. Instead of doing this::
app = MyMiddleware(app)
It's a better idea to do this instead::
app.wsgi_app = MyMiddleware(app.wsgi_app)
Then you still have the ... | python | src/flask/app.py | 1,536 | [
"self",
"environ",
"start_response"
] | cabc.Iterable[bytes] | true | 4 | 6.72 | pallets/flask | 70,946 | sphinx | false |
isKey | function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepPr... | Checks if `value` is a property name and not a property path.
@private
@param {*} value The value to check.
@param {Object} [object] The object to query keys on.
@returns {boolean} Returns `true` if `value` is a property name, else `false`. | javascript | lodash.js | 6,405 | [
"value",
"object"
] | false | 10 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
forCondition | public static Builder forCondition(Class<? extends Annotation> condition, Object... details) {
return new ConditionMessage().andCondition(condition, details);
} | Factory method for a builder to construct a new {@link ConditionMessage} for a
condition.
@param condition the condition
@param details details of the condition
@return a {@link Builder} builder
@see #forCondition(String, Object...)
@see #andCondition(String, Object...) | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | 182 | [
"condition"
] | Builder | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
committed | @Override
public synchronized Map<TopicPartition, OffsetAndMetadata> committed(final Set<TopicPartition> partitions) {
ensureNotClosed();
return partitions.stream()
.filter(committed::containsKey)
.collect(Collectors.toMap(tp -> tp, tp -> subscriptions.isAssigned(tp) ?
... | 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 | 404 | [
"partitions"
] | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
getFixesInfoForNonUMDImport | function getFixesInfoForNonUMDImport({ sourceFile, program, cancellationToken, host, preferences }: CodeFixContextBase, symbolToken: Identifier, useAutoImportProvider: boolean): readonly (FixInfo & { fix: ImportFixWithModuleSpecifier; })[] | undefined {
const checker = program.getTypeChecker();
const compiler... | @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,570 | [
"{ sourceFile, program, cancellationToken, host, preferences }",
"symbolToken",
"useAutoImportProvider"
] | true | 2 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
extractMessage | private @Nullable String extractMessage(@Nullable HttpEntity entity) {
if (entity != null) {
try {
JSONObject error = getContentAsJson(entity);
if (error.has("message")) {
return error.getString("message");
}
}
catch (Exception ex) {
// Ignore
}
}
return null;
} | Retrieves the meta-data of the service at the specified URL.
@param url the URL
@return the response | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java | 211 | [
"entity"
] | String | true | 4 | 8.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_previous_ti | def get_previous_ti(
self,
state: DagRunState | None = None,
session: Session = NEW_SESSION,
) -> TaskInstance | None:
"""
Return the task instance for the task that ran before this task instance.
:param session: SQLAlchemy ORM Session
:param state: If passed... | Return the task instance for the task that ran before this task instance.
:param session: SQLAlchemy ORM Session
:param state: If passed, it only take into account instances of a specific state. | python | airflow-core/src/airflow/models/taskinstance.py | 866 | [
"self",
"state",
"session"
] | TaskInstance | None | true | 2 | 7.04 | apache/airflow | 43,597 | sphinx | false |
computeReplacement | public static @Nullable String computeReplacement(UnicodeEscaper escaper, int cp) {
return stringOrNull(escaper.escape(cp));
} | Returns a string that would replace the given character in the specified escaper, or {@code
null} if no replacement should be made. This method is intended for use in tests through the
{@code EscaperAsserts} class; production users of {@link UnicodeEscaper} should limit
themselves to its public interface.
@param cp the... | java | android/guava/src/com/google/common/escape/Escapers.java | 184 | [
"escaper",
"cp"
] | String | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
updateIndexSetting | private void updateIndexSetting(ProjectId projectId, UpdateSettingsRequest updateSettingsRequest, ActionListener<Void> listener) {
assert updateSettingsRequest.indices() != null && updateSettingsRequest.indices().length == 1
: "Data stream lifecycle service updates the settings for one index at a ti... | This method sends requests to delete any indices in the datastream that exceed its retention policy. It returns the set of indices
it has sent delete requests for.
@param project The project metadata from which to get index metadata
@param dataStream The data stream
@param i... | java | modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleService.java | 1,146 | [
"projectId",
"updateSettingsRequest",
"listener"
] | void | true | 3 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
next | public String next(int length) throws JSONException {
if (this.pos + length > this.in.length()) {
throw syntaxError(length + " is out of bounds");
}
String result = this.in.substring(this.pos, this.pos + length);
this.pos += length;
return result;
} | Returns the current position and the entire input string.
@return the current position and the entire input string. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 498 | [
"length"
] | String | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
_raise_or_return | def _raise_or_return():
"""Depending on the value of raise_unknown, either raise an error or return
'unknown'.
"""
if raise_unknown:
input = input_name if input_name else "data"
raise ValueError(f"Unknown label type for {input}: {y!r}")
else:
r... | Depending on the value of raise_unknown, either raise an error or return
'unknown'. | python | sklearn/utils/multiclass.py | 319 | [] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | unknown | false | |
round | def round(self, decimals: int = 0) -> Self | Index: # type: ignore[override]
"""
Round each value in the Index to the given number of decimals.
Parameters
----------
decimals : int, optional
Number of decimal places to round to. If decimals is negative,
... | Round each value in the Index to the given number of decimals.
Parameters
----------
decimals : int, optional
Number of decimal places to round to. If decimals is negative,
it specifies the number of positions to the left of the decimal point
e.g. ``round(11.0, -1) == 10.0``.
Returns
-------
Index or Rang... | python | pandas/core/indexes/range.py | 1,349 | [
"self",
"decimals"
] | Self | Index | true | 5 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
isDependent | private boolean isDependent(String beanName, String dependentBeanName, @Nullable Set<String> alreadySeen) {
if (alreadySeen != null && alreadySeen.contains(beanName)) {
return false;
}
String canonicalName = canonicalName(beanName);
Set<String> dependentBeans = this.dependentBeanMap.get(canonicalName);
if ... | Determine whether the specified dependent bean has been registered as
dependent on the given bean or on any of its transitive dependencies.
@param beanName the name of the bean to check
@param dependentBeanName the name of the dependent bean
@since 4.0 | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java | 630 | [
"beanName",
"dependentBeanName",
"alreadySeen"
] | true | 8 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false | |
baseKeys | function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
} | The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
@private
@param {Object} object The object to query.
@returns {Array} Returns the array of property names. | javascript | lodash.js | 3,524 | [
"object"
] | false | 4 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
prepareMethodOverride | protected void prepareMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException {
int count = ClassUtils.getMethodCountForName(getBeanClass(), mo.getMethodName());
if (count == 0) {
throw new BeanDefinitionValidationException(
"Invalid method override: no method with name '" + mo.getMethodN... | Validate and prepare the given method override.
Checks for existence of a method with the specified name,
marking it as not overloaded if none found.
@param mo the MethodOverride object to validate
@throws BeanDefinitionValidationException in case of validation failure | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java | 1,265 | [
"mo"
] | void | true | 3 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
setThreadFactory | @CanIgnoreReturnValue
public ThreadFactoryBuilder setThreadFactory(ThreadFactory backingThreadFactory) {
this.backingThreadFactory = checkNotNull(backingThreadFactory);
return this;
} | Sets the backing {@link ThreadFactory} for new threads created with this ThreadFactory. Threads
will be created by invoking #newThread(Runnable) on this backing {@link ThreadFactory}.
@param backingThreadFactory the backing {@link ThreadFactory} which will be delegated to during
thread creation.
@return this for th... | java | android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java | 164 | [
"backingThreadFactory"
] | ThreadFactoryBuilder | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false |
resolveAutowiredArgument | private @Nullable Object resolveAutowiredArgument(RegisteredBean registeredBean, DependencyDescriptor descriptor,
@Nullable ValueHolder argumentValue, Set<String> autowiredBeanNames) {
TypeConverter typeConverter = registeredBean.getBeanFactory().getTypeConverter();
if (argumentValue != null) {
return (argum... | Resolve arguments for the specified registered bean.
@param registeredBean the registered bean
@return the resolved constructor or factory method arguments | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 328 | [
"registeredBean",
"descriptor",
"argumentValue",
"autowiredBeanNames"
] | Object | true | 4 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
fastIpv6ToBufferUnsafe | inline size_t fastIpv6ToBufferUnsafe(const in6_addr& in6Addr, char* str) {
#ifdef _MSC_VER
const uint16_t* bytes = reinterpret_cast<const uint16_t*>(&in6Addr.u.Word);
#else
const uint16_t* bytes = reinterpret_cast<const uint16_t*>(&in6Addr.s6_addr16);
#endif
char* buf = str;
for (int i = 0; i < 8; ++i) {
w... | Helper for working with unsigned char* or uint8_t* ByteArray values | cpp | folly/detail/IPAddressSource.h | 246 | [] | true | 3 | 6.4 | facebook/folly | 30,157 | doxygen | false | |
flat | public <T> BiConsumer<T, BiConsumer<String, Object>> flat(Joiner joiner, Consumer<Pairs<T>> pairs) {
return (!this.include) ? none() : new Pairs<>(joiner, pairs)::flat;
} | Add pairs using flat naming.
@param <T> the item type
@param joiner the function used to join the prefix and name
@param pairs callback to add all the pairs
@return a {@link BiConsumer} for use with the {@link JsonWriter} | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java | 70 | [
"joiner",
"pairs"
] | true | 2 | 7.84 | spring-projects/spring-boot | 79,428 | javadoc | false | |
mean_tweedie_deviance | def mean_tweedie_deviance(y_true, y_pred, *, sample_weight=None, power=0):
"""Mean Tweedie deviance regression loss.
Read more in the :ref:`User Guide <mean_tweedie_deviance>`.
Parameters
----------
y_true : array-like of shape (n_samples,)
Ground truth (correct) target values.
y_pred... | Mean Tweedie deviance regression loss.
Read more in the :ref:`User Guide <mean_tweedie_deviance>`.
Parameters
----------
y_true : array-like of shape (n_samples,)
Ground truth (correct) target values.
y_pred : array-like of shape (n_samples,)
Estimated target values.
sample_weight : array-like of shape (n_s... | python | sklearn/metrics/_regression.py | 1,402 | [
"y_true",
"y_pred",
"sample_weight",
"power"
] | false | 13 | 7.6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_get_single_internal | def _get_single_internal(self, index):
"""
Return the ring at the specified index. The first index, 0, will
always return the exterior ring. Indices > 0 will return the
interior ring at the given index (e.g., poly[1] and poly[2] would
return the first and second interior ring, re... | Return the ring at the specified index. The first index, 0, will
always return the exterior ring. Indices > 0 will return the
interior ring at the given index (e.g., poly[1] and poly[2] would
return the first and second interior ring, respectively).
CAREFUL: Internal/External are not the same as Interior/Exterior!
Ret... | python | django/contrib/gis/geos/polygon.py | 127 | [
"self",
"index"
] | false | 3 | 6.4 | django/django | 86,204 | unknown | false | |
_unique | def _unique(values, *, return_inverse=False, return_counts=False):
"""Helper function to find unique values with support for python objects.
Uses pure python method for object dtype, and numpy method for
all other dtypes.
Parameters
----------
values : ndarray
Values to check for unkno... | Helper function to find unique values with support for python objects.
Uses pure python method for object dtype, and numpy method for
all other dtypes.
Parameters
----------
values : ndarray
Values to check for unknowns.
return_inverse : bool, default=False
If True, also return the indices of the unique valu... | python | sklearn/utils/_encode.py | 14 | [
"values",
"return_inverse",
"return_counts"
] | false | 2 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
topK | public List<T> topK() {
@SuppressWarnings("nullness") // safe because we pass sort() a range that contains real Ts
T[] castBuffer = (T[]) buffer;
sort(castBuffer, 0, bufferSize, comparator);
if (bufferSize > k) {
Arrays.fill(buffer, k, buffer.length, null);
bufferSize = k;
threshold = ... | Returns the top {@code k} elements offered to this {@code TopKSelector}, or all elements if
fewer than {@code k} have been offered, in the order specified by the factory used to create
this {@code TopKSelector}.
<p>The returned list is an unmodifiable copy and will not be affected by further changes to
this {@code TopK... | java | android/guava/src/com/google/common/collect/TopKSelector.java | 282 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
getGroup | private ConfigurationMetadataGroup getGroup(ConfigurationMetadataSource source) {
if (source == null) {
return this.allGroups.computeIfAbsent(ROOT_GROUP, (key) -> new ConfigurationMetadataGroup(ROOT_GROUP));
}
return this.allGroups.get(source.getGroupId());
} | Merge the content of the specified repository to this repository.
@param repository the repository to include | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java | 99 | [
"source"
] | ConfigurationMetadataGroup | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
createApplicationContext | protected ConfigurableApplicationContext createApplicationContext() {
ConfigurableApplicationContext context = this.applicationContextFactory
.create(this.properties.getWebApplicationType());
Assert.state(context != null, "ApplicationContextFactory created null context");
return context;
} | Strategy method used to create the {@link ApplicationContext}. By default this
method will respect any explicitly set application context class or factory before
falling back to a suitable default.
@return the application context (not yet refreshed)
@see #setApplicationContextFactory(ApplicationContextFactory) | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 579 | [] | ConfigurableApplicationContext | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
coo_to_sparse_series | def coo_to_sparse_series(
A: scipy.sparse.coo_matrix, dense_index: bool = False
) -> Series:
"""
Convert a scipy.sparse.coo_matrix to a Series with type sparse.
Parameters
----------
A : scipy.sparse.coo_matrix
dense_index : bool, default False
Returns
-------
Series
Raise... | Convert a scipy.sparse.coo_matrix to a Series with type sparse.
Parameters
----------
A : scipy.sparse.coo_matrix
dense_index : bool, default False
Returns
-------
Series
Raises
------
TypeError if A is not a coo_matrix | python | pandas/core/arrays/sparse/scipy_sparse.py | 176 | [
"A",
"dense_index"
] | Series | true | 2 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
_push_lazy | def _push_lazy(self, node: int, start: int, end: int) -> None:
"""
Push lazy updates down to children.
Args:
node: Current node index
start: Start index of the segment
end: End index of the segment
"""
lazy_node = self.lazy[node]
if la... | Push lazy updates down to children.
Args:
node: Current node index
start: Start index of the segment
end: End index of the segment | python | torch/_inductor/codegen/segmented_tree.py | 93 | [
"self",
"node",
"start",
"end"
] | None | true | 4 | 6.88 | pytorch/pytorch | 96,034 | google | false |
compare | public static int compare(byte a, byte b) {
return Byte.compare(a, b);
} | Compares the two specified {@code byte} values. The sign of the value returned is the same as
that of {@code ((Byte) a).compareTo(b)}.
<p><b>Note:</b> this method behaves identically to {@link Byte#compare}.
@param a the first {@code byte} to compare
@param b the second {@code byte} to compare
@return a negative value ... | java | android/guava/src/com/google/common/primitives/SignedBytes.java | 91 | [
"a",
"b"
] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
checkInterceptorNames | private void checkInterceptorNames() {
if (!ObjectUtils.isEmpty(this.interceptorNames)) {
String finalName = this.interceptorNames[this.interceptorNames.length - 1];
if (this.targetName == null && this.targetSource == EMPTY_TARGET_SOURCE) {
// The last name in the chain may be an Advisor/Advice or a target/... | Check the interceptorNames list whether it contains a target name as final element.
If found, remove the final name from the list and set it as targetName. | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java | 362 | [] | void | true | 7 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
asfreq | def asfreq(self, fill_value=None):
"""
Return the values at the new freq, essentially a reindex.
Parameters
----------
fill_value : scalar, optional
Value to use for missing values, applied during upsampling (note
this does not fill NaNs that already were... | Return the values at the new freq, essentially a reindex.
Parameters
----------
fill_value : scalar, optional
Value to use for missing values, applied during upsampling (note
this does not fill NaNs that already were present).
Returns
-------
DataFrame or Series
Values at the specified freq.
See Also
---... | python | pandas/core/resample.py | 1,055 | [
"self",
"fill_value"
] | false | 1 | 6 | pandas-dev/pandas | 47,362 | numpy | false | |
register_extension_dtype | def register_extension_dtype(cls: type_t[ExtensionDtypeT]) -> type_t[ExtensionDtypeT]:
"""
Register an ExtensionType with pandas as class decorator.
This enables operations like ``.astype(name)`` for the name
of the ExtensionDtype.
Returns
-------
callable
A class decorator.
S... | Register an ExtensionType with pandas as class decorator.
This enables operations like ``.astype(name)`` for the name
of the ExtensionDtype.
Returns
-------
callable
A class decorator.
See Also
--------
api.extensions.ExtensionDtype : The base class for creating custom pandas
data types.
Series : One-dimensi... | python | pandas/core/dtypes/base.py | 488 | [
"cls"
] | type_t[ExtensionDtypeT] | true | 1 | 6.48 | pandas-dev/pandas | 47,362 | unknown | false |
getMergedBeanDefinition | protected RootBeanDefinition getMergedBeanDefinition(String beanName, BeanDefinition bd)
throws BeanDefinitionStoreException {
return getMergedBeanDefinition(beanName, bd, null);
} | Return a RootBeanDefinition for the given top-level bean, by merging with
the parent if the given bean's definition is a child bean definition.
@param beanName the name of the bean definition
@param bd the original bean definition (Root/ChildBeanDefinition)
@return a (potentially merged) RootBeanDefinition for the give... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,380 | [
"beanName",
"bd"
] | RootBeanDefinition | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
sourcesToAbsolute | function sourcesToAbsolute(baseURL, data) {
data.sources = data.sources.map((source) => {
source = (data.sourceRoot || '') + source;
if (isAbsolute(source)) {
return pathToFileURL(source).href;
}
return new URL(source, baseURL).href;
});
// The sources array is now resolved to absolute URLs,... | Read source map from file.
@param {string} mapURL - file url of the source map
@returns {object} deserialized source map JSON object | javascript | lib/internal/source_map/source_map_cache.js | 322 | [
"baseURL",
"data"
] | false | 3 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
max | def max(
self,
numeric_only: bool = False,
*args,
engine: Literal["cython", "numba"] | None = None,
engine_kwargs: dict[str, bool] | None = None,
**kwargs,
):
"""
Calculate the rolling maximum.
Parameters
----------
numeric_onl... | Calculate the rolling maximum.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
*args : iterable, optional
Positional arguments passed into ``func``.
engine : str, default None
* ``'cython'`` : Runs the operation through C-extensions from cython.
* ``... | python | pandas/core/window/rolling.py | 2,449 | [
"self",
"numeric_only",
"engine",
"engine_kwargs"
] | true | 1 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
getSource | public Source getSource(T service) {
Source source = this.sources.get(service);
Assert.state(source != null,
() -> "Unable to find service " + ObjectUtils.identityToString(source));
return source;
} | Get the source of the given service.
@param service the service instance
@return the source of the service | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java | 179 | [
"service"
] | Source | true | 1 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
topicPartitionsAwaitingReconciliation | Map<Uuid, SortedSet<Integer>> topicPartitionsAwaitingReconciliation() {
if (currentTargetAssignment == LocalAssignment.NONE) {
return Collections.emptyMap();
}
if (currentAssignment == LocalAssignment.NONE) {
return currentTargetAssignment.partitions;
}
fi... | @return Map of topics partitions received in a target assignment that have not been
reconciled yet because topic names are not in metadata or reconciliation hasn't finished.
The values in the map are the sets of partitions contained in the target assignment but
missing from the currently reconciled assignment, for each... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 1,350 | [] | true | 5 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
_node_metadata_hook | def _node_metadata_hook(
node: torch.fx.Node,
metadata: Optional[dict[str, Any]] = None,
fake_mode: Optional[FakeTensorMode] = None,
) -> None:
"""
Hook for adding the appropriate metadata to nodes that are created during a
pass using graph.create_node. An example of how to use it:
```
... | Hook for adding the appropriate metadata to nodes that are created during a
pass using graph.create_node. An example of how to use it:
```
with _set_node_metadata_hook(gm,
functools.partial(_node_metadata_hook, metadata={"stack_trace": "file"})
):
pass(gm)
```
This hook should not work for all generic cases -... | python | torch/_export/passes/_node_metadata_hook.py | 15 | [
"node",
"metadata",
"fake_mode"
] | None | true | 9 | 6.72 | pytorch/pytorch | 96,034 | unknown | false |
validateRange | protected int validateRange(final int startIndex, int endIndex) {
if (startIndex < 0) {
throw new StringIndexOutOfBoundsException(startIndex);
}
if (endIndex > size) {
endIndex = size;
}
if (startIndex > endIndex) {
throw new StringIndexOutOfBo... | Validates parameters defining a range of the builder.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end index, exclusive, must be valid except
that if too large it is treated as end of string
@return the new string
@throws IndexOutOfBoundsException if the index is invalid | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 3,047 | [
"startIndex",
"endIndex"
] | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
_extended_gcd | def _extended_gcd(self, a: int, b: int) -> tuple[int, int, int]:
"""
Extended Euclidean algorithms to solve Bezout's identity:
a*x + b*y = gcd(x, y)
Finds one particular solution for x, y: s, t
Returns: gcd, s, t
"""
s, old_s = 0, 1
t, old_t = 1, 0
... | Extended Euclidean algorithms to solve Bezout's identity:
a*x + b*y = gcd(x, y)
Finds one particular solution for x, y: s, t
Returns: gcd, s, t | python | pandas/core/indexes/range.py | 885 | [
"self",
"a",
"b"
] | tuple[int, int, int] | true | 2 | 6.08 | pandas-dev/pandas | 47,362 | unknown | false |
run | @SuppressWarnings("InfiniteLoopStatement")
@Override
public void run() {
while (true) {
try {
if (!cleanUp(queue.remove())) {
break;
}
} catch (InterruptedException e) {
// ignore
}
}
} | Loops continuously, pulling references off the queue and cleaning them up. | java | android/guava/src/com/google/common/base/internal/Finalizer.java | 139 | [] | void | true | 4 | 7.04 | google/guava | 51,352 | javadoc | false |
ofInnerBean | public static RegisteredBean ofInnerBean(RegisteredBean parent, BeanDefinitionHolder innerBean) {
Assert.notNull(innerBean, "'innerBean' must not be null");
return ofInnerBean(parent, innerBean.getBeanName(), innerBean.getBeanDefinition());
} | Create a new {@link RegisteredBean} instance for an inner-bean.
@param parent the parent of the inner-bean
@param innerBean a {@link BeanDefinitionHolder} for the inner bean
@return a new {@link RegisteredBean} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/support/RegisteredBean.java | 108 | [
"parent",
"innerBean"
] | RegisteredBean | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
is_constant_match | def is_constant_match(self, *values: Any) -> bool:
"""
Check if this variable is a python constant matching one of the given values.
Examples:
var.is_constant_match(None) # True if var is constant None
var.is_constant_match(True, False) # True if var is constant True o... | Check if this variable is a python constant matching one of the given values.
Examples:
var.is_constant_match(None) # True if var is constant None
var.is_constant_match(True, False) # True if var is constant True or False
var.is_constant_match(NotImplemented) # True if var is constant NotImplemented | python | torch/_dynamo/variables/base.py | 386 | [
"self"
] | bool | true | 1 | 6.8 | pytorch/pytorch | 96,034 | unknown | false |
wrapAndThrow | public static <R> R wrapAndThrow(final Throwable throwable) {
throw new UndeclaredThrowableException(throwUnchecked(throwable));
} | Throws a checked exception without adding the exception to the throws
clause of the calling method. For checked exceptions, this method throws
an UndeclaredThrowableException wrapping the checked exception. For
Errors and RuntimeExceptions, the original exception is rethrown.
<p>
The downside to using this approach is ... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 1,075 | [
"throwable"
] | R | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
isVariableName | @Contract("null -> false")
static boolean isVariableName(@Nullable String name) {
if (!StringUtils.hasLength(name)) {
return false;
}
if (!Character.isJavaIdentifierStart(name.charAt(0))) {
return false;
}
for (int i = 1; i < name.length(); i++) {
if (!Character.isJavaIdentifierPart(name.charAt(i)))... | Determine whether the given Advisor contains an AspectJ advice.
@param advisor the Advisor to check | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJProxyUtils.java | 80 | [
"name"
] | true | 5 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.