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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
escape | @Override
protected final char @Nullable [] escape(char c) {
if (c < replacementsLength) {
char[] chars = replacements[c];
if (chars != null) {
return chars;
}
}
if (c >= safeMin && c <= safeMax) {
return null;
}
return escapeUnsafe(c);
} | Escapes a single character using the replacement array and safe range values. If the given
character does not have an explicit replacement and lies outside the safe range then {@link
#escapeUnsafe} is called.
@return the replacement characters, or {@code null} if no escaping was required | java | android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java | 122 | [
"c"
] | true | 5 | 6.56 | google/guava | 51,352 | javadoc | false | |
set_dag_run_state_to_failed | def set_dag_run_state_to_failed(
*,
dag: SerializedDAG,
run_id: str | None = None,
commit: bool = False,
session: SASession = NEW_SESSION,
) -> list[TaskInstance]:
"""
Set the dag run's state to failed.
Set for a specific logical date and its task instances to failed.
:param dag: t... | Set the dag run's state to failed.
Set for a specific logical date and its task instances to failed.
:param dag: the DAG of which to alter state
:param run_id: the DAG run_id to start looking from
:param commit: commit DAG and tasks to be altered to the database
:param session: database session
:return: If commit is ... | python | airflow-core/src/airflow/api/common/mark_tasks.py | 267 | [
"dag",
"run_id",
"commit",
"session"
] | list[TaskInstance] | true | 6 | 8 | apache/airflow | 43,597 | sphinx | false |
findMainClass | public static @Nullable String findMainClass(File rootDirectory) throws IOException {
return doWithMainClasses(rootDirectory, MainClass::getName);
} | Find the main class from a given directory.
@param rootDirectory the root directory to search
@return the main class or {@code null}
@throws IOException if the directory cannot be read | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 87 | [
"rootDirectory"
] | String | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
upper | def upper(a):
"""
Return an array with the elements converted to uppercase.
Calls :meth:`str.upper` element-wise.
For 8-bit strings, this method is locale-dependent.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
Input array.
Returns... | Return an array with the elements converted to uppercase.
Calls :meth:`str.upper` element-wise.
For 8-bit strings, this method is locale-dependent.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
Input array.
Returns
-------
out : ndarray
Output array of ``StringDTy... | python | numpy/_core/strings.py | 1,086 | [
"a"
] | false | 1 | 6 | numpy/numpy | 31,054 | numpy | false | |
toString | @Override
public String toString() {
return "FastDateFormat[" + printer.getPattern() + "," + printer.getLocale() + "," + printer.getTimeZone().getID() + "]";
} | Gets a debugging string version of this formatter.
@return a debug string. | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 632 | [] | String | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
getPropertyName | private String getPropertyName(VariableElement parameter, String fallback) {
AnnotationMirror nameAnnotation = this.environment.getNameAnnotation(parameter);
if (nameAnnotation != null) {
return this.environment.getAnnotationElementStringValue(nameAnnotation, "value");
}
return fallback;
} | Return the {@link PropertyDescriptor} instances that are valid candidates for the
specified {@link TypeElement type} based on the specified {@link ExecutableElement
factory method}, if any.
@param type the target type
@param factoryMethod the method that triggered the metadata for that {@code type}
or {@code null}
@ret... | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolver.java | 106 | [
"parameter",
"fallback"
] | String | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
shouldProxyTargetClass | protected boolean shouldProxyTargetClass(Class<?> beanClass, @Nullable String beanName) {
return (this.beanFactory instanceof ConfigurableListableBeanFactory clbf &&
AutoProxyUtils.shouldProxyTargetClass(clbf, beanName));
} | Determine whether the given bean should be proxied with its target class rather than its interfaces.
<p>Checks the {@link AutoProxyUtils#PRESERVE_TARGET_CLASS_ATTRIBUTE "preserveTargetClass" attribute}
of the corresponding bean definition.
@param beanClass the class of the bean
@param beanName the name of the bean
@ret... | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java | 505 | [
"beanClass",
"beanName"
] | true | 2 | 7.2 | spring-projects/spring-framework | 59,386 | javadoc | false | |
arrayIncludes | function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
} | A specialized version of `_.includes` for arrays without support for
specifying an index to search from.
@private
@param {Array} [array] The array to inspect.
@param {*} target The value to search for.
@returns {boolean} Returns `true` if `target` is found, else `false`. | javascript | lodash.js | 612 | [
"array",
"value"
] | false | 3 | 6.16 | lodash/lodash | 61,490 | jsdoc | false | |
toString | @Override
public String toString() {
return set.toString();
} | Gets a string representation of the set.
@return string representation of the set | java | src/main/java/org/apache/commons/lang3/CharSet.java | 278 | [] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
getNameLabelValue | function getNameLabelValue(promQuery: string, tokens: Array<string | Prism.Token>): string {
let nameLabelValue = '';
for (const token of tokens) {
if (typeof token === 'string') {
nameLabelValue = token;
break;
}
}
return nameLabelValue;
} | Checks if an error is a cancelled request error.
Used to avoid logging cancelled request errors.
@param {unknown} error - Error to check
@returns {boolean} True if the error is a cancelled request error | typescript | packages/grafana-prometheus/src/language_provider.ts | 407 | [
"promQuery",
"tokens"
] | true | 2 | 7.04 | grafana/grafana | 71,362 | jsdoc | false | |
buildFlattenedMap | @SuppressWarnings({"rawtypes", "unchecked"})
private void buildFlattenedMap(Map<String, Object> result, Map<String, Object> source, @Nullable String path) {
source.forEach((key, value) -> {
if (StringUtils.hasText(path)) {
if (key.startsWith("[")) {
key = path + key;
}
else {
key = path + '.... | Return a flattened version of the given map, recursively following any nested Map
or Collection values. Entries from the resulting map retain the same order as the
source. When called with the Map from a {@link MatchCallback} the result will
contain the same values as the {@link MatchCallback} Properties.
@param source... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java | 312 | [
"result",
"source",
"path"
] | void | true | 8 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
tryChangeModuleExportsObject | function tryChangeModuleExportsObject(object: ObjectLiteralExpression, useSitesToUnqualify: Map<Node, Node> | undefined): [readonly Statement[], ModuleExportsChanged] | undefined {
const statements = mapAllOrFail(object.properties, prop => {
switch (prop.kind) {
case SyntaxKind.GetAccessor:
... | Convert `module.exports = { ... }` to individual exports..
We can't always do this if the module has interesting members -- then it will be a default export instead. | typescript | src/services/codefixes/convertToEsModule.ts | 349 | [
"object",
"useSitesToUnqualify"
] | true | 4 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
estimateSizeInBytes | public static int estimateSizeInBytes(byte magic,
long baseOffset,
CompressionType compressionType,
Iterable<Record> records) {
int size = 0;
if (magic <= RecordBatch.MAGIC_VALUE... | Get an iterator over the deep records.
@return An iterator over the records | java | clients/src/main/java/org/apache/kafka/common/record/AbstractRecords.java | 93 | [
"magic",
"baseOffset",
"compressionType",
"records"
] | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
nextBits | public int nextBits(final int bits) {
if (bits > MAX_BITS || bits <= 0) {
throw new IllegalArgumentException("number of bits must be between 1 and " + MAX_BITS);
}
int result = 0;
int generatedBits = 0; // number of generated bits up to now
while (generatedBits < bits... | Generates a random integer with the specified number of bits.
<p>This method efficiently generates random bits by using a byte cache and bit manipulation:
<ul>
<li>Uses a byte array cache to avoid frequent calls to the underlying random number generator</li>
<li>Extracts bits from each byte using bit shifting and m... | java | src/main/java/org/apache/commons/lang3/CachedRandomBits.java | 101 | [
"bits"
] | true | 5 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
main | def main() -> int:
"""Start celery umbrella command.
This function is the main entrypoint for the CLI.
:return: The exit code of the CLI.
"""
return celery(auto_envvar_prefix="CELERY") | Start celery umbrella command.
This function is the main entrypoint for the CLI.
:return: The exit code of the CLI. | python | celery/bin/celery.py | 220 | [] | int | true | 1 | 7.04 | celery/celery | 27,741 | unknown | false |
createObjectPool | protected ObjectPool createObjectPool() {
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setMaxTotal(getMaxSize());
config.setMaxIdle(getMaxIdle());
config.setMinIdle(getMinIdle());
config.setMaxWaitMillis(getMaxWait());
config.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionR... | Subclasses can override this if they want to return a specific Commons pool.
They should apply any configuration properties to the pool here.
<p>Default is a GenericObjectPool instance with the given pool size.
@return an empty Commons {@code ObjectPool}.
@see GenericObjectPool
@see #setMaxSize | java | spring-aop/src/main/java/org/springframework/aop/target/CommonsPool2TargetSource.java | 213 | [] | ObjectPool | true | 1 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
readField | public static Object readField(final Field field, final Object target, final boolean forceAccess) throws IllegalAccessException {
Objects.requireNonNull(field, "field");
return setAccessible(field, forceAccess).get(target);
} | Reads a {@link Field}.
@param field
the field to use.
@param target
the object to call on, may be {@code null} for {@code static} fields.
@param forceAccess
whether to break scope restrictions using the
{@link AccessibleObject#setAccessible(boolean)} method.
@return the field... | java | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | 400 | [
"field",
"target",
"forceAccess"
] | Object | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
doStart | private void doStart(String beanName, Lifecycle bean) {
if (logger.isTraceEnabled()) {
logger.trace("Starting bean '" + beanName + "' of type [" + bean.getClass().getName() + "]");
}
try {
bean.start();
}
catch (Throwable ex) {
throw new ApplicationContextException("Failed to start bean '" + beanName... | Start the specified bean as part of the given set of Lifecycle beans,
making sure that any beans that it depends on are started first.
@param lifecycleBeans a Map with bean name as key and Lifecycle instance as value
@param beanName the name of the bean to start | java | spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java | 415 | [
"beanName",
"bean"
] | void | true | 4 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
build | abstract Map<String, List<TopicPartition>> build(); | Builds the assignment.
@return Map from each member to the list of partitions assigned to them. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java | 557 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
_enum_to_json | def _enum_to_json(cls, enum_value: Optional[Enum]) -> Optional[str]:
"""Convert enum value to JSON string.
Args:
enum_value: Enum value
Returns:
Optional[str]: JSON string representation or None
"""
if enum_value is None:
return None
... | Convert enum value to JSON string.
Args:
enum_value: Enum value
Returns:
Optional[str]: JSON string representation or None | python | torch/_inductor/codegen/cuda/serialization.py | 462 | [
"cls",
"enum_value"
] | Optional[str] | true | 2 | 7.44 | pytorch/pytorch | 96,034 | google | false |
bindSwitchStatement | function bindSwitchStatement(node: SwitchStatement): void {
const postSwitchLabel = createBranchLabel();
bind(node.expression);
const saveBreakTarget = currentBreakTarget;
const savePreSwitchCaseFlow = preSwitchCaseFlow;
currentBreakTarget = postSwitchLabel;
preSwit... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 1,716 | [
"node"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
createNotWritablePropertyException | @Override
protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) {
PropertyMatches matches = PropertyMatches.forProperty(propertyName, getRootClass());
throw new NotWritablePropertyException(getRootClass(), getNestedPath() + propertyName,
matches.buildErrorMessage(), mat... | Convert the given value for the specified property to the latter's type.
<p>This method is only intended for optimizations in a BeanFactory.
Use the {@code convertIfNecessary} methods for programmatic conversion.
@param value the value to convert
@param propertyName the target property
(note that nested or indexed prop... | java | spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java | 202 | [
"propertyName"
] | NotWritablePropertyException | true | 1 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
createIfAbsent | public static <K, V> V createIfAbsent(final ConcurrentMap<K, V> map, final K key,
final ConcurrentInitializer<V> init) throws ConcurrentException {
if (map == null || init == null) {
return null;
}
final V value = map.get(key);
if (value == null) {
re... | Checks if a concurrent map contains a key and creates a corresponding
value if not. This method first checks the presence of the key in the
given map. If it is already contained, its value is returned. Otherwise
the {@code get()} method of the passed in {@link ConcurrentInitializer}
is called. With the resulting object... | java | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | 151 | [
"map",
"key",
"init"
] | V | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
createOffsetFetchRequest | OffsetFetchRequestState createOffsetFetchRequest(final Set<TopicPartition> partitions,
final long deadlineMs) {
return jitter.isPresent() ?
new OffsetFetchRequestState(
partitions,
retryBackoffMs,
... | Enqueue a request to fetch committed offsets, that will be sent on the next call to {@link #poll(long)}.
@param partitions Partitions to fetch offsets for.
@param deadlineMs Time until which the request should be retried if it fails
with expected retriable errors.
@return Future that... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 526 | [
"partitions",
"deadlineMs"
] | OffsetFetchRequestState | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false |
isAfterRange | public boolean isAfterRange(final Range<T> otherRange) {
if (otherRange == null) {
return false;
}
return isAfter(otherRange.maximum);
} | Checks whether this range is completely after the specified range.
<p>This method may fail if the ranges have two different comparators or element types.</p>
@param otherRange the range to check, null returns false.
@return true if this range is completely after the specified range.
@throws RuntimeException if ranges ... | java | src/main/java/org/apache/commons/lang3/Range.java | 435 | [
"otherRange"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
endLabeledBlock | function endLabeledBlock() {
Debug.assert(peekBlockKind() === CodeBlockKind.Labeled);
const block = endBlock() as LabeledBlock;
if (!block.isScript) {
markLabel(block.breakLabel);
}
} | Ends a code block that supports `break` statements that are defined in generated code. | typescript | src/compiler/transformers/generators.ts | 2,407 | [] | false | 2 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
size | @Override
public int size() {
return valueList.size();
} | A builder for creating immutable sorted map instances, especially {@code public static final}
maps ("constant maps"). Example:
{@snippet :
static final ImmutableSortedMap<Integer, String> INT_TO_WORD =
new ImmutableSortedMap.Builder<Integer, String>(Ordering.natural())
.put(1, "one")
.put(2, "two")
... | java | android/guava/src/com/google/common/collect/ImmutableSortedMap.java | 828 | [] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
remove | public static boolean[] remove(final boolean[] array, final int index) {
return (boolean[]) remove((Object) array, index);
} | Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts one from their
indices).
<p>
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the
returned array... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,683 | [
"array",
"index"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
socketDescription | public String socketDescription() {
Socket socket = transportLayer.socketChannel().socket();
if (socket.getInetAddress() == null)
return socket.getLocalAddress().toString();
return socket.getInetAddress().toString();
} | Returns the port to which this channel's socket is connected or 0 if the socket has never been connected.
If the socket was connected prior to being closed, then this method will continue to return the
connected port number after the socket is closed. | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 382 | [] | String | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
getBeansOfType | @Override
@SuppressWarnings("unchecked")
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
throws BeansException {
boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type));
Map<String, T> matches = new LinkedHashMa... | Add a new singleton bean.
<p>Will overwrite any existing instance for the given name.
@param name the name of the bean
@param bean the bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java | 412 | [
"type",
"includeNonSingletons",
"allowEagerInit"
] | true | 11 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
write | void write(@Nullable Object instance, JsonValueWriter valueWriter) {
T extracted = this.valueExtractor.extract(instance);
if (ValueExtractor.skip(extracted)) {
return;
}
Object value = getValueToWrite(extracted, valueWriter);
valueWriter.write(this.name, value);
} | Writes the given instance using details configure by this member.
@param instance the instance to write
@param valueWriter the JSON value writer to use | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 648 | [
"instance",
"valueWriter"
] | void | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
removeDuplicates | static <K, V> Entry<K, V>[] removeDuplicates(
Entry<K, V>[] entries, int n, int newN, IdentityHashMap<Entry<K, V>, Boolean> duplicates) {
Entry<K, V>[] newEntries = createEntryArray(newN);
for (int in = 0, out = 0; in < n; in++) {
Entry<K, V> entry = entries[in];
Boolean status = duplicates.ge... | Constructs a new entry array where each duplicated key from the original appears only once, at
its first position but with its final value. The {@code duplicates} map is modified.
@param entries the original array of entries including duplicates
@param n the number of valid entries in {@code entries}
@param newN the ex... | java | guava/src/com/google/common/collect/RegularImmutableMap.java | 185 | [
"entries",
"n",
"newN",
"duplicates"
] | true | 4 | 8.08 | google/guava | 51,352 | javadoc | false | |
get_kernel_binary_remote_cache | def get_kernel_binary_remote_cache(
caching_enabled: bool, caching_available: bool
) -> Any | None:
"""
Get or create the class instance of the CUTLASSKernelBinaryRemoteCache.
Args:
caching_enabled: Whether binary remote caching is enabled
caching_available: ... | Get or create the class instance of the CUTLASSKernelBinaryRemoteCache.
Args:
caching_enabled: Whether binary remote caching is enabled
caching_available: Whether we're in fbcode environment
Returns:
CUTLASSKernelBinaryRemoteCache: The class instance of the kernel binary remote cache | python | torch/_inductor/codecache.py | 4,071 | [
"caching_enabled",
"caching_available"
] | Any | None | true | 3 | 7.28 | pytorch/pytorch | 96,034 | google | false |
deleteIfPossible | private void deleteIfPossible(Path local, Throwable cause) {
try {
Files.delete(local);
}
catch (IOException ex) {
cause.addSuppressed(ex);
}
} | Create a new {@link UrlJarFile} or {@link UrlNestedJarFile} instance.
@param jarFileUrl the jar file URL
@param closeAction the action to call when the file is closed
@return a new {@link JarFile} instance
@throws IOException on I/O error | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java | 110 | [
"local",
"cause"
] | void | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
alterClientQuotas | default AlterClientQuotasResult alterClientQuotas(Collection<ClientQuotaAlteration> entries) {
return alterClientQuotas(entries, new AlterClientQuotasOptions());
} | Alters client quota configurations with the specified alterations.
<p>
This is a convenience method for {@link #alterClientQuotas(Collection, AlterClientQuotasOptions)}
with default options. See the overload for more details.
<p>
This operation is supported by brokers with version 2.6.0 or higher.
@param entries the al... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,396 | [
"entries"
] | AlterClientQuotasResult | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
scanIdentifierParts | function scanIdentifierParts(): string {
let result = "";
let start = pos;
while (pos < end) {
let ch = codePointUnchecked(pos);
if (isIdentifierPart(ch, languageVersion)) {
pos += charSize(ch);
}
else if (ch === CharacterCo... | Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or
a literal component of a TemplateExpression. | typescript | src/compiler/scanner.ts | 1,781 | [] | true | 10 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
delete_cluster | def delete_cluster(self, name: str) -> dict:
"""
Delete the Amazon EKS Cluster control plane.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.delete_cluster`
:param name: The name of the cluster to delete.
:return: Returns descriptive information about the delete... | Delete the Amazon EKS Cluster control plane.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.delete_cluster`
:param name: The name of the cluster to delete.
:return: Returns descriptive information about the deleted EKS Cluster. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 248 | [
"self",
"name"
] | dict | true | 1 | 6.24 | apache/airflow | 43,597 | sphinx | false |
incrementAndGet | public double incrementAndGet() {
value++;
return value;
} | Increments this instance's value by 1; this method returns the value associated with the instance
immediately after the increment operation. This method is not thread safe.
@return the value associated with the instance after it is incremented.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java | 309 | [] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
textCharacters | @Override
public char[] textCharacters() throws IOException {
try {
return parser.getTextCharacters();
} catch (IOException e) {
throw handleParserException(e);
}
} | Handle parser exception depending on type.
This converts known exceptions to XContentParseException and rethrows them. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentParser.java | 218 | [] | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
getDigits | public static String getDigits(final String str) {
if (isEmpty(str)) {
return str;
}
final int len = str.length();
final char[] buffer = new char[len];
int count = 0;
for (int i = 0; i < len; i++) {
final char tempChar = str.charAt(i);
... | Checks if a String {@code str} contains Unicode digits, if yes then concatenate all the digits in {@code str} and return it as a String.
<p>
An empty ("") String will be returned if no digits found in {@code str}.
</p>
<pre>
StringUtils.getDigits(null) = null
StringUtils.getDigits("") ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 2,042 | [
"str"
] | String | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
get_variable | def get_variable(
self, key: str, team_name: str | None = None, session: Session = NEW_SESSION
) -> str | None:
"""
Get Airflow Variable from Metadata DB.
:param key: Variable Key
:param team_name: Team name associated to the task trying to access the variable (if any)
... | Get Airflow Variable from Metadata DB.
:param key: Variable Key
:param team_name: Team name associated to the task trying to access the variable (if any)
:param session: SQLAlchemy Session
:return: Variable Value | python | airflow-core/src/airflow/secrets/metastore.py | 54 | [
"self",
"key",
"team_name",
"session"
] | str | None | true | 2 | 7.92 | apache/airflow | 43,597 | sphinx | false |
createFileIfNecessary | private void createFileIfNecessary(File file) throws IOException {
if (file.exists()) {
return;
}
File parent = file.getParentFile();
if (!parent.isDirectory() && !parent.mkdirs()) {
throw new IllegalStateException(
"Cannot create parent directory for '" + this.outputFile.getAbsolutePath() + "'");
... | Creates a new {@code BuildPropertiesWriter} that will write to the given
{@code outputFile}.
@param outputFile the output file | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/BuildPropertiesWriter.java | 62 | [
"file"
] | void | true | 5 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
secure | public static RandomStringUtils secure() {
return SECURE;
} | Gets the singleton instance based on {@link SecureRandom#SecureRandom()} which uses a secure random number generator (RNG) implementing the default
random number algorithm.
<p>
The method {@link SecureRandom#SecureRandom()} is called on-demand.
</p>
@return the singleton instance based on {@link SecureRandom#SecureRand... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 639 | [] | RandomStringUtils | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
shouldGenerateIdAsFallback | protected boolean shouldGenerateIdAsFallback() {
return false;
} | Should an ID be generated instead if the passed in {@link Element} does not
specify an "id" attribute explicitly?
<p>Disabled by default; subclasses can override this to enable ID generation
as fallback: The parser will first check for an "id" attribute in this case,
only falling back to a generated ID if no value was ... | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java | 174 | [] | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false | |
getDefaultOutcome | protected ConditionOutcome getDefaultOutcome(ConditionContext context, AnnotationAttributes annotationAttributes) {
boolean match = Boolean
.parseBoolean(context.getEnvironment().getProperty(this.prefix + "defaults.enabled", "true"));
return new ConditionOutcome(match, ConditionMessage.forCondition(this.annotati... | Return the default outcome that should be used if property is not set. By default
this method will use the {@code <prefix>.defaults.enabled} property, matching if it
is {@code true} or if it is not configured.
@param context the condition context
@param annotationAttributes the annotation attributes
@return the default... | java | module/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/OnEndpointElementCondition.java | 84 | [
"context",
"annotationAttributes"
] | ConditionOutcome | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
chop | public ConfigurationPropertyName chop(int size) {
if (size >= getNumberOfElements()) {
return this;
}
return new ConfigurationPropertyName(this.elements.chop(size));
} | Return a new {@link ConfigurationPropertyName} by chopping this name to the given
{@code size}. For example, {@code chop(1)} on the name {@code foo.bar} will return
{@code foo}.
@param size the size to chop
@return the chopped name | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 251 | [
"size"
] | ConfigurationPropertyName | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
findLogger | private @Nullable LoggerConfig findLogger(String name) {
Configuration configuration = getLoggerContext().getConfiguration();
if (configuration instanceof AbstractConfiguration abstractConfiguration) {
return abstractConfiguration.getLogger(name);
}
return configuration.getLoggers().get(name);
} | 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 | 477 | [
"name"
] | LoggerConfig | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
getJavaDoc | String getJavaDoc(Element element) {
if (element instanceof RecordComponentElement) {
return getJavaDoc((RecordComponentElement) element);
}
String javadoc = (element != null) ? this.env.getElementUtils().getDocComment(element) : null;
javadoc = (javadoc != null) ? cleanUpJavaDoc(javadoc) : null;
return (j... | Extract the target element type from the specified container type or {@code null}
if no element type was found.
@param type a type, potentially wrapping an element type
@return the element type or {@code null} if no specific type was found | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | 179 | [
"element"
] | String | true | 6 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
retainAll | void retainAll(final Set<TopicPartition> partitions) {
try {
lock.lock();
completedFetches.removeIf(cf -> maybeDrain(partitions, cf));
if (maybeDrain(partitions, nextInLineFetch))
nextInLineFetch = null;
} finally {
lock.unlock();
... | Updates the buffer to retain only the fetch data that corresponds to the given partitions. Any previously
{@link CompletedFetch fetched data} is removed if its partition is not in the given set of partitions.
@param partitions {@link Set} of {@link TopicPartition}s for which any buffered data should be kept | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java | 212 | [
"partitions"
] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
descendingMultiset | @Override
public ImmutableSortedMultiset<E> descendingMultiset() {
ImmutableSortedMultiset<E> result = descendingMultiset;
if (result == null) {
return descendingMultiset =
this.isEmpty()
? emptyMultiset(Ordering.from(comparator()).reverse())
: new DescendingImmutab... | Returns an immutable sorted multiset containing the elements of a sorted multiset, sorted by
the same {@code Comparator}. That behavior differs from {@link #copyOf(Iterable)}, which always
uses the natural ordering of the elements.
<p>Despite the method name, this method attempts to avoid actually copying the data when... | java | android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java | 355 | [] | true | 3 | 6.56 | google/guava | 51,352 | javadoc | false | |
adjustYear | private int adjustYear(final int twoDigitYear) {
final int trial = century + twoDigitYear;
return twoDigitYear >= startYear ? trial : trial + 100;
} | Adjusts dates to be within appropriate century
@param twoDigitYear The year to adjust
@return A value between centuryStart(inclusive) to centuryStart+100(exclusive) | java | src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 863 | [
"twoDigitYear"
] | true | 2 | 6.72 | apache/commons-lang | 2,896 | javadoc | false | |
_normalize_json | def _normalize_json(
data: Any,
key_string: str,
normalized_dict: dict[str, Any],
separator: str,
) -> dict[str, Any]:
"""
Main recursive function
Designed for the most basic use case of pd.json_normalize(data)
intended as a performance improvement, see #15621
Parameters
-------... | Main recursive function
Designed for the most basic use case of pd.json_normalize(data)
intended as a performance improvement, see #15621
Parameters
----------
data : Any
Type dependent on types contained within nested Json
key_string : str
New key (with separator(s) in) for data
normalized_dict : dict
The... | python | pandas/io/json/_normalize.py | 151 | [
"data",
"key_string",
"normalized_dict",
"separator"
] | dict[str, Any] | true | 5 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
apply_along_fields | def apply_along_fields(func, arr):
"""
Apply function 'func' as a reduction across fields of a structured array.
This is similar to `numpy.apply_along_axis`, but treats the fields of a
structured array as an extra axis. The fields are all first cast to a
common type following the type-promotion rul... | Apply function 'func' as a reduction across fields of a structured array.
This is similar to `numpy.apply_along_axis`, but treats the fields of a
structured array as an extra axis. The fields are all first cast to a
common type following the type-promotion rules from `numpy.result_type`
applied to the field's dtypes.
... | python | numpy/lib/recfunctions.py | 1,186 | [
"func",
"arr"
] | false | 2 | 7.84 | numpy/numpy | 31,054 | numpy | false | |
isInvalidReadOnlyPropertyType | private boolean isInvalidReadOnlyPropertyType(@Nullable Class<?> returnType, Class<?> beanClass) {
return (returnType != null && (ClassLoader.class.isAssignableFrom(returnType) ||
ProtectionDomain.class.isAssignableFrom(returnType) ||
(AutoCloseable.class.isAssignableFrom(returnType) &&
!AutoCloseable.c... | Create a new CachedIntrospectionResults instance for the given class.
@param beanClass the bean class to analyze
@throws BeansException in case of introspection failure | java | spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java | 362 | [
"returnType",
"beanClass"
] | true | 5 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false | |
repeat | public static String repeat(final String repeat, final int count) {
// Performance tuned for 2.0 (JDK1.4)
if (repeat == null) {
return null;
}
if (count <= 0) {
return EMPTY;
}
final int inputLength = repeat.length();
if (count == 1 || inpu... | Repeats a String {@code repeat} times to form a new String.
<pre>
StringUtils.repeat(null, 2) = null
StringUtils.repeat("", 0) = ""
StringUtils.repeat("", 2) = ""
StringUtils.repeat("a", 3) = "aaa"
StringUtils.repeat("ab", 2) = "abab"
StringUtils.repeat("a", -2) = ""
</pre>
@param repeat the String to repeat, may ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 6,064 | [
"repeat",
"count"
] | String | true | 9 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
extractFromStream | private void extractFromStream(ZipInputStream zipStream, boolean overwrite, File outputDirectory)
throws IOException {
ZipEntry entry = zipStream.getNextEntry();
String canonicalOutputPath = outputDirectory.getCanonicalPath() + File.separator;
while (entry != null) {
File file = new File(outputDirectory, en... | Detect if the project should be extracted.
@param request the generation request
@param response the generation response
@return if the project should be extracted | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java | 111 | [
"zipStream",
"overwrite",
"outputDirectory"
] | void | true | 7 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
isDirective | function isDirective(node: TSESTree.Node, ancestors: TSESTree.Node[]): boolean {
const parent = ancestors[ancestors.length - 1],
grandparent = ancestors[ancestors.length - 2];
return (parent.type === 'Program' || parent.type === 'BlockStatement' &&
(/Function/u.test(grandparent.type))) &&
directives(... | @param node any node
@param ancestors the given node's ancestors
@returns whether the given node is considered a directive in its current position | typescript | .eslint-plugin-local/code-no-unused-expressions.ts | 101 | [
"node",
"ancestors"
] | true | 4 | 7.6 | microsoft/vscode | 179,840 | jsdoc | false | |
simplify_index_in_vec_range | def simplify_index_in_vec_range(index: sympy.Expr, var: sympy.Expr, vec_length: int):
"""
Simplifies the index expression within the range of a vectorized loop.
Given a vectorized loop variable `var` in the range of a loop with `vec_length`,
this function transforms the `index` into an equivalent form. ... | Simplifies the index expression within the range of a vectorized loop.
Given a vectorized loop variable `var` in the range of a loop with `vec_length`,
this function transforms the `index` into an equivalent form. It handles
simplifications for cases where `var` can be expressed as `vec_length * a + b`,
where `b` range... | python | torch/_inductor/codegen/cpp.py | 402 | [
"index",
"var",
"vec_length"
] | true | 8 | 8.32 | pytorch/pytorch | 96,034 | unknown | false | |
getFirst | @ParametricNullness
public static <T extends @Nullable Object> T getFirst(
Iterable<? extends T> iterable, @ParametricNullness T defaultValue) {
return Iterators.getNext(iterable.iterator(), defaultValue);
} | Returns the first element in {@code iterable} or {@code defaultValue} if the iterable is empty.
The {@link Iterators} analog to this method is {@link Iterators#getNext}.
<p>If no default value is desired (and the caller instead wants a {@link
NoSuchElementException} to be thrown), it is recommended that {@code
iterable... | java | android/guava/src/com/google/common/collect/Iterables.java | 836 | [
"iterable",
"defaultValue"
] | T | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false |
tryLockMemory | @Override
public void tryLockMemory() {
int result = libc.mlockall(MCL_CURRENT);
if (result == 0) {
isMemoryLocked = true;
return;
}
// mlockall failed for some reason
int errno = libc.errno();
String errMsg = libc.strerror(errno);
log... | Return the current rlimit for the given resource.
If getrlimit fails, returns {@link ProcessLimits#UNKNOWN}.
If the rlimit is unlimited, returns {@link ProcessLimits#UNLIMITED}. | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/PosixNativeAccess.java | 86 | [] | void | true | 5 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
resolveValue | private @Nullable Object resolveValue(RegisteredBean registeredBean, Field field) {
String beanName = registeredBean.getBeanName();
Class<?> beanClass = registeredBean.getBeanClass();
ConfigurableBeanFactory beanFactory = registeredBean.getBeanFactory();
DependencyDescriptor descriptor = new DependencyDescripto... | Resolve the field value for the specified registered bean and set it
using reflection.
@param registeredBean the registered bean
@param instance the bean instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredFieldValueResolver.java | 169 | [
"registeredBean",
"field"
] | Object | true | 3 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
getSourceDir | function getSourceDir(): string {
const projectDir = process.cwd()
const sourceRootFromTsConfig = getSourceDirFromTypeScriptConfig()
if (sourceRootFromTsConfig) {
return path.join(projectDir, sourceRootFromTsConfig)
}
// Check common source directories if there's no tsconfig.json
for (const dir of ['... | Determines the absolute path to the source directory. | typescript | packages/cli/src/utils/client-output-path.ts | 24 | [] | true | 3 | 7.04 | prisma/prisma | 44,834 | jsdoc | false | |
close | @Override
public void close() throws IOException {
this.internalDelegate.close();
} | @param settings the Elasticsearch settings object
@return a {@link ScriptEngine} for painless scripts for use in {@link IngestScript} and
{@link IngestConditionalScript} contexts, including all available {@link PainlessExtension}s.
@throws IOException when the underlying script engine cannot be created | java | libs/logstash-bridge/src/main/java/org/elasticsearch/logstashbridge/script/ScriptServiceBridge.java | 127 | [] | void | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
simpleQuote | private static StringBuilder simpleQuote(final StringBuilder sb, final String value) {
for (int i = 0; i < value.length(); ++i) {
final char c = value.charAt(i);
switch (c) {
case '\\':
case '^':
case '$':
case '.':
case '|':
... | Gets a cache of Strategies for a particular field
@param field The Calendar field
@return a cache of Locale to Strategy | java | src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 762 | [
"sb",
"value"
] | StringBuilder | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
unique | function unique<I>(list: L.List<I>) {
return Array.from(new Set(list))
} | Narrow a list to only have unique values.
@param list
@returns | typescript | helpers/blaze/unique.ts | 8 | [
"list"
] | false | 1 | 6.16 | prisma/prisma | 44,834 | jsdoc | false | |
ensureClassesSensitiveToVerificationAreInitialized | private static void ensureClassesSensitiveToVerificationAreInitialized() {
var classesToInitialize = Set.of(
"sun.net.www.protocol.http.HttpURLConnection",
"sun.nio.ch.DatagramChannelImpl",
"sun.nio.ch.ServerSocketChannelImpl"
);
for (String className : classe... | If bytecode verification is enabled, ensure these classes get loaded before transforming/retransforming them.
For these classes, the order in which we transform and verify them matters. Verification during class transformation is at least an
unforeseen (if not unsupported) scenario: we are loading a class, and while we... | java | libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java | 121 | [] | void | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
geterr | def geterr():
"""
Get the current way of handling floating-point errors.
Returns
-------
res : dict
A dictionary with keys "divide", "over", "under", and "invalid",
whose values are from the strings "ignore", "print", "log", "warn",
"raise", and "call". The keys represent po... | Get the current way of handling floating-point errors.
Returns
-------
res : dict
A dictionary with keys "divide", "over", "under", and "invalid",
whose values are from the strings "ignore", "print", "log", "warn",
"raise", and "call". The keys represent possible floating-point
exceptions, and the valu... | python | numpy/_core/_ufunc_config.py | 112 | [] | false | 1 | 6.16 | numpy/numpy | 31,054 | unknown | false | |
getTopicMetadata | public List<PartitionInfo> getTopicMetadata(String topic, boolean allowAutoTopicCreation, Timer timer) {
MetadataRequest.Builder request = new MetadataRequest.Builder(Collections.singletonList(topic), allowAutoTopicCreation);
Map<String, List<PartitionInfo>> topicMetadata = getTopicMetadata(request, tim... | Fetches the {@link PartitionInfo partition information} for the given topic in the cluster, or {@code null}.
@param timer Timer bounding how long this method can block
@return The {@link List list} of {@link PartitionInfo partition information}, or {@code null} if the topic is
unknown | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/TopicMetadataFetcher.java | 70 | [
"topic",
"allowAutoTopicCreation",
"timer"
] | true | 1 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
swap | public static void swap(final boolean[] array, final int offset1, final int offset2) {
swap(array, offset1, offset2, 1);
} | Swaps two elements in the given boolean array.
<p>There is no special handling for multi-dimensional arrays. This method
does nothing for a {@code null} or empty input array or for overflow indices.
Negative indices are promoted to 0(zero).</p>
Examples:
<ul>
<li>ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]</li... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 8,023 | [
"array",
"offset1",
"offset2"
] | void | true | 1 | 7.2 | apache/commons-lang | 2,896 | javadoc | false |
arithmetic_op | def arithmetic_op(left: ArrayLike, right: Any, op):
"""
Evaluate an arithmetic operation `+`, `-`, `*`, `/`, `//`, `%`, `**`, ...
Note: the caller is responsible for ensuring that numpy warnings are
suppressed (with np.errstate(all="ignore")) if needed.
Parameters
----------
left : np.ndar... | Evaluate an arithmetic operation `+`, `-`, `*`, `/`, `//`, `%`, `**`, ...
Note: the caller is responsible for ensuring that numpy warnings are
suppressed (with np.errstate(all="ignore")) if needed.
Parameters
----------
left : np.ndarray or ExtensionArray
right : object
Cannot be a DataFrame or Index. Series is ... | python | pandas/core/ops/array_ops.py | 242 | [
"left",
"right",
"op"
] | true | 6 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false | |
maybeBindReferencePointcutParameter | private void maybeBindReferencePointcutParameter() {
if (this.numberOfRemainingUnboundArguments > 1) {
throw new AmbiguousBindingException("Still " + this.numberOfRemainingUnboundArguments +
" unbound args at reference pointcut binding stage, with no way to determine between them");
}
List<String> varNam... | Parse the string pointcut expression looking for this(), target() and args() expressions.
If we find one, try and extract a candidate variable name and bind it. | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | 531 | [] | void | true | 13 | 7.12 | spring-projects/spring-framework | 59,386 | javadoc | false |
castPath | function castPath(value, object) {
if (isArray(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
} | Casts `value` to a path array if it's not one.
@private
@param {*} value The value to inspect.
@param {Object} [object] The object to query keys on.
@returns {Array} Returns the cast property path array. | javascript | lodash.js | 4,556 | [
"value",
"object"
] | false | 3 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
all_py_loaded_overloads | def all_py_loaded_overloads() -> Iterator[torch._ops.OpOverload]:
"""
Warning: the set of overloads this will report is very subtle. It is precisely
the set of torch.ops functions that have actually been accessed from Python
(e.g., we actually called torch.ops.aten.blah at some point. This is DIFFEREN... | Warning: the set of overloads this will report is very subtle. It is precisely
the set of torch.ops functions that have actually been accessed from Python
(e.g., we actually called torch.ops.aten.blah at some point. This is DIFFERENT
from the set of registered operators, which will in general be a larger set,
as this... | python | torch/_dispatch/python.py | 29 | [] | Iterator[torch._ops.OpOverload] | true | 4 | 6.72 | pytorch/pytorch | 96,034 | unknown | false |
hasVolatileName | bool hasVolatileName(const BinaryFunction &BF) {
for (const StringRef &Name : BF.getNames())
if (getLTOCommonName(Name))
return true;
return false;
} | Return true if the function name can change across compilations. | cpp | bolt/lib/Profile/DataReader.cpp | 46 | [] | true | 2 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false | |
readEscapeCharacter | private char readEscapeCharacter() throws JSONException {
char escaped = this.in.charAt(this.pos++);
switch (escaped) {
case 'u':
if (this.pos + 4 > this.in.length()) {
throw syntaxError("Unterminated escape sequence");
}
String hex = this.in.substring(this.pos, this.pos + 4);
this.pos += 4;... | Unescapes the character identified by the character or characters that immediately
follow a backslash. The backslash '\' should have already been read. This supports
both unicode escapes "u000A" and two-character escapes "\n".
@return the unescaped char
@throws NumberFormatException if any unicode escape sequences are ... | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 235 | [] | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false | |
toScaledBigDecimal | public static BigDecimal toScaledBigDecimal(final BigDecimal value, final int scale, final RoundingMode roundingMode) {
if (value == null) {
return BigDecimal.ZERO;
}
return value.setScale(scale, roundingMode == null ? RoundingMode.HALF_EVEN : roundingMode);
} | Converts a {@link BigDecimal} to a {@link BigDecimal} whose scale is the specified value with a {@link RoundingMode} applied. If the input {@code value}
is {@code null}, we simply return {@code BigDecimal.ZERO}.
@param value the {@link BigDecimal} to convert, may be null.
@param scale the number of digits... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,643 | [
"value",
"scale",
"roundingMode"
] | BigDecimal | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
configure | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder;
} | Configure the application. Normally all you would need to do is to add sources
(e.g. config classes) because other settings have sensible defaults. You might
choose (for instance) to add default command line arguments, or set an active
Spring profile.
@param builder a builder for the application context
@return the app... | java | core/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializer.java | 225 | [
"builder"
] | SpringApplicationBuilder | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
declareSymbolAndAddToSymbolTable | function declareSymbolAndAddToSymbolTable(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags): Symbol | undefined {
switch (container.kind) {
// Modules, source files, and classes need specialized handling for how their
// members are declared (for example, a mem... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 2,263 | [
"node",
"symbolFlags",
"symbolExcludes"
] | true | 2 | 6.8 | microsoft/TypeScript | 107,154 | jsdoc | false | |
findDefaultScheduler | protected Scheduler findDefaultScheduler() {
if (this.beanFactory != null) {
return this.beanFactory.getBean(Scheduler.class);
}
else {
throw new IllegalStateException(
"No Scheduler specified, and cannot find a default Scheduler without a BeanFactory");
}
} | Return the Quartz Scheduler instance that this accessor operates on. | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessorBean.java | 115 | [] | Scheduler | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
collectConditions | List<Condition> collectConditions(@Nullable AnnotatedTypeMetadata metadata) {
if (metadata == null || !metadata.isAnnotated(Conditional.class.getName())) {
return Collections.emptyList();
}
List<Condition> conditions = new ArrayList<>();
for (String[] conditionClasses : getConditionClasses(metadata)) {
f... | Return the {@linkplain Condition conditions} that should be applied when
considering the given annotated type.
@param metadata the metadata of the annotated type
@return the ordered list of conditions for that type | java | spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java | 114 | [
"metadata"
] | true | 3 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
toString | public static String toString(final URLClassLoader classLoader) {
return classLoader != null ? classLoader + Arrays.toString(classLoader.getURLs()) : "null";
} | Converts the given URLClassLoader to a String in the format {@code "URLClassLoader.toString() + [URL1, URL2, ...]"}.
@param classLoader to URLClassLoader to convert.
@return the formatted string. | java | src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java | 77 | [
"classLoader"
] | String | true | 2 | 7.52 | apache/commons-lang | 2,896 | javadoc | false |
_enqueue_task_instances_with_queued_state | def _enqueue_task_instances_with_queued_state(
self, task_instances: list[TI], executor: BaseExecutor, session: Session
) -> None:
"""
Enqueue task_instances which should have been set to queued with the executor.
:param task_instances: TaskInstances to enqueue
:param execut... | Enqueue task_instances which should have been set to queued with the executor.
:param task_instances: TaskInstances to enqueue
:param executor: The executor to enqueue tasks for
:param session: The session object | python | airflow-core/src/airflow/jobs/scheduler_job_runner.py | 785 | [
"self",
"task_instances",
"executor",
"session"
] | None | true | 5 | 6.4 | apache/airflow | 43,597 | sphinx | false |
predict_proba | def predict_proba(self, X):
"""
Predict class probabilities for X.
The predicted class probabilities of an input sample are computed as
the mean predicted class probabilities of the trees in the forest.
The class probability of a single tree is the fraction of samples of
... | Predict class probabilities for X.
The predicted class probabilities of an input sample are computed as
the mean predicted class probabilities of the trees in the forest.
The class probability of a single tree is the fraction of samples of
the same class in a leaf.
Parameters
----------
X : {array-like, sparse matrix... | python | sklearn/ensemble/_forest.py | 921 | [
"self",
"X"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getSourceArchiveFile | private static File getSourceArchiveFile() {
try {
ProtectionDomain domain = Context.class.getProtectionDomain();
CodeSource codeSource = (domain != null) ? domain.getCodeSource() : null;
URL location = (codeSource != null) ? codeSource.getLocation() : null;
File source = (location != null) ? findSource(l... | Create a new {@link Context} instance with the specified value.
@param archiveFile the source archive file
@param workingDir the working directory | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/Context.java | 77 | [] | File | true | 7 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
acquisitionLockTimeoutMs | @Override
public Optional<Integer> acquisitionLockTimeoutMs() {
return delegate.acquisitionLockTimeoutMs();
} | Returns the acquisition lock timeout for the last set of records fetched from the cluster.
@return The acquisition lock timeout in milliseconds, or {@code Optional.empty()} if the timeout is not known. | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaShareConsumer.java | 722 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
longToShortArray | public static short[] longToShortArray(final long src, final int srcPos, final short[] dst, final int dstPos, final int nShorts) {
if (0 == nShorts) {
return dst;
}
if ((nShorts - 1) * Short.SIZE + srcPos >= Long.SIZE) {
throw new IllegalArgumentException("(nShorts - 1) *... | Converts a long into an array of short using the default (little-endian, LSB0) byte and bit ordering.
@param src the long to convert.
@param srcPos the position in {@code src}, in bits, from where to start the conversion.
@param dst the destination array.
@param dstPos the position in {@code dst} where to cop... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 1,199 | [
"src",
"srcPos",
"dst",
"dstPos",
"nShorts"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
transform | public static <I extends @Nullable Object, O extends @Nullable Object>
ListenableFuture<O> transform(
ListenableFuture<I> input, Function<? super I, ? extends O> function, Executor executor) {
return AbstractTransformFuture.create(input, function, executor);
} | Returns a new {@code Future} whose result is derived from the result of the given {@code
Future}. If {@code input} fails, the returned {@code Future} fails with the same exception (and
the function is not invoked). Example usage:
{@snippet :
ListenableFuture<QueryResult> queryFuture = ...;
ListenableFuture<List<Row>> r... | java | android/guava/src/com/google/common/util/concurrent/Futures.java | 488 | [
"input",
"function",
"executor"
] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
invokeOnPartitionsRevokedOrLostToReleaseAssignment | private CompletableFuture<Void> invokeOnPartitionsRevokedOrLostToReleaseAssignment() {
SortedSet<TopicPartition> droppedPartitions = new TreeSet<>(TOPIC_PARTITION_COMPARATOR);
droppedPartitions.addAll(subscriptions.assignedPartitions());
log.info("Member {} is triggering callbacks to release as... | Release member assignment by calling the user defined callbacks for onPartitionsRevoked or
onPartitionsLost.
<ul>
<li>If the member is part of the group (epoch > 0), this will invoke onPartitionsRevoked.
This will be the case when releasing assignment because the member is intentionally
leaving the group (a... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMembershipManager.java | 320 | [] | true | 3 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
createLabel | function createLabel(label: Label | undefined): Expression {
if (label !== undefined && label > 0) {
if (labelExpressions === undefined) {
labelExpressions = [];
}
const expression = factory.createNumericLiteral(Number.MAX_SAFE_INTEGER);
if... | Creates an expression that can be used to indicate the value for a label.
@param label A label. | typescript | src/compiler/transformers/generators.ts | 2,521 | [
"label"
] | true | 6 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
symlinkSync | function symlinkSync(target, path, type) {
validateOneOf(type, 'type', ['dir', 'file', 'junction', null, undefined]);
if (isWindows && type == null) {
const absoluteTarget = pathModule.resolve(`${path}`, '..', `${target}`);
if (statSync(absoluteTarget, { throwIfNoEntry: false })?.isDirectory()) {
type... | Synchronously creates the link called `path`
pointing to `target`.
@param {string | Buffer | URL} target
@param {string | Buffer | URL} path
@param {string | null} [type]
@returns {void} | javascript | lib/fs.js | 1,832 | [
"target",
"path",
"type"
] | false | 10 | 6.4 | nodejs/node | 114,839 | jsdoc | false | |
castSlice | function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
} | Casts `array` to a slice if it's needed.
@private
@param {Array} array The array to inspect.
@param {number} start The start position.
@param {number} [end=array.length] The end position.
@returns {Array} Returns the cast slice. | javascript | lodash.js | 4,583 | [
"array",
"start",
"end"
] | false | 4 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
get_last_lines_of_file | def get_last_lines_of_file(file_name: str, num_lines: int = 2) -> tuple[list[str], list[str]]:
"""
Get last lines of a file efficiently, without reading the whole file (with some limitations).
Assumptions ara that line length not bigger than ~180 chars.
:param file_name: name of the file
:param num... | Get last lines of a file efficiently, without reading the whole file (with some limitations).
Assumptions ara that line length not bigger than ~180 chars.
:param file_name: name of the file
:param num_lines: number of lines to return (max)
:return: Tuple - last lines of the file in two variants: original and with remo... | python | dev/breeze/src/airflow_breeze/utils/parallel.py | 90 | [
"file_name",
"num_lines"
] | tuple[list[str], list[str]] | true | 1 | 7.2 | apache/airflow | 43,597 | sphinx | false |
getSingletonFactoryBeanForTypeCheck | private @Nullable FactoryBean<?> getSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) {
Boolean lockFlag = isCurrentThreadAllowedToHoldSingletonLock();
if (lockFlag == null) {
this.singletonLock.lock();
}
else {
boolean locked = (lockFlag && this.singletonLock.tryLock());
if (!l... | Obtain a "shortcut" singleton FactoryBean instance to use for a
{@code getObjectType()} call, without full initialization of the FactoryBean.
@param beanName the name of the bean
@param mbd the bean definition for the bean
@return the FactoryBean instance, or {@code null} to indicate
that we couldn't obtain a shortcut ... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 991 | [
"beanName",
"mbd"
] | true | 14 | 7.68 | spring-projects/spring-framework | 59,386 | javadoc | false | |
afterPropertiesSet | @Override
public void afterPropertiesSet() throws ParseException {
Assert.notNull(this.cronExpression, "Property 'cronExpression' is required");
if (this.name == null) {
this.name = this.beanName;
}
if (this.group == null) {
this.group = Scheduler.DEFAULT_GROUP;
}
if (this.jobDetail != null) {
th... | Associate a textual description with this trigger. | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java | 235 | [] | void | true | 9 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
forciblyCast | @SuppressWarnings("unchecked")
public static <T> T forciblyCast(Object argument) {
return (T) argument;
} | There are some situations where we cannot appease javac's type checking, and we
need to forcibly cast an object's type. Please don't use this method unless you
have no choice.
@param argument the object to cast
@param <T> the inferred type to which to cast the argument
@return a cast version of the argument | java | libs/core/src/main/java/org/elasticsearch/core/Types.java | 27 | [
"argument"
] | T | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
dispose | function dispose() {
if (state < TransformationState.Disposed) {
// Clean up emit nodes on parse tree
for (const node of nodes) {
disposeEmitNodes(getSourceFileOfNode(getParseTreeNode(node)));
}
// Release references to external entries for... | Ends a block scope. The previous set of block hoisted variables are restored. Any hoisted declarations are returned. | typescript | src/compiler/transformer.ts | 646 | [] | false | 2 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
semaphores | def semaphores(self, min_size: sympy.Expr) -> str:
"""
Lazily allocate a graph-wide semaphores buffer with at least min_size. This is a single buffer shared by
all kernels and zero initialized once at graph start. Each kernel must leave the buffer zeroed on exit.
Warning: multiple cal... | Lazily allocate a graph-wide semaphores buffer with at least min_size. This is a single buffer shared by
all kernels and zero initialized once at graph start. Each kernel must leave the buffer zeroed on exit.
Warning: multiple calls to this function will return the same buffer.
Args:
min_size: the number of int... | python | torch/_inductor/codegen/common.py | 1,625 | [
"self",
"min_size"
] | str | true | 3 | 7.92 | pytorch/pytorch | 96,034 | google | false |
createLauncherManifest | Manifest createLauncherManifest(UnaryOperator<String> libraryTransformer); | Create the {@link Manifest} for the launcher jar, applying the specified operator
on each classpath entry.
@param libraryTransformer the operator to apply on each classpath entry
@return the manifest to use for the launcher jar | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/JarStructure.java | 57 | [
"libraryTransformer"
] | Manifest | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false |
idxmin | def idxmin(self, skipna: bool = True) -> Series:
"""
Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA values... | Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that
value is returned.
Parameters
----------
skipna : bool, default True
Exclude NA values.
Returns
-------
Series
Indexes of minima in each group.
Raises
------
ValueError
When there are no valid ... | python | pandas/core/groupby/generic.py | 1,544 | [
"self",
"skipna"
] | Series | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
disconnect | @Override
public void disconnect(String nodeId) {
if (connectionStates.isDisconnected(nodeId)) {
log.debug("Client requested disconnect from node {}, which is already disconnected", nodeId);
return;
}
log.info("Client requested disconnect from node {}", nodeId);
... | Disconnects the connection to a particular node, if there is one.
Any pending ClientRequests for this connection will receive disconnections.
@param nodeId The id of the node | java | clients/src/main/java/org/apache/kafka/clients/NetworkClient.java | 384 | [
"nodeId"
] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.