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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getReferenceForShorthandProperty | function getReferenceForShorthandProperty({ flags, valueDeclaration }: Symbol, search: Search, state: State): void {
const shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration)!;
const name = valueDeclaration && getNameOfDeclaration(valueDeclaration);
/*
... | Search within node "container" for references for a search value, where the search value is defined as a
tuple of(searchSymbol, searchText, searchLocation, and searchMeaning).
searchLocation: a node where the search value | typescript | src/services/findAllReferences.ts | 2,100 | [
"{ flags, valueDeclaration }",
"search",
"state"
] | true | 5 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
checkUnauthorizedTopics | private void checkUnauthorizedTopics(Cluster cluster) {
if (!cluster.unauthorizedTopics().isEmpty()) {
log.error("Topic authorization failed for topics {}", cluster.unauthorizedTopics());
unauthorizedTopics = new HashSet<>(cluster.unauthorizedTopics());
}
} | Updates the partition-leadership info in the metadata. Update is done by merging existing metadata with the input leader information and nodes.
This is called whenever partition-leadership updates are returned in a response from broker(ex - ProduceResponse & FetchResponse).
Note that the updates via Metadata RPC are ha... | java | clients/src/main/java/org/apache/kafka/clients/Metadata.java | 476 | [
"cluster"
] | void | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false |
fit | def fit(self, X, y):
"""Fit a semi-supervised label propagation model to X.
The input samples (labeled and unlabeled) are provided by matrix X,
and target labels are provided by matrix y. We conventionally apply the
label -1 to unlabeled samples in matrix y in a semi-supervised
... | Fit a semi-supervised label propagation model to X.
The input samples (labeled and unlabeled) are provided by matrix X,
and target labels are provided by matrix y. We conventionally apply the
label -1 to unlabeled samples in matrix y in a semi-supervised
classification.
Parameters
----------
X : {array-like, sparse m... | python | sklearn/semi_supervised/_label_propagation.py | 235 | [
"self",
"X",
"y"
] | false | 10 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getBlockIndent | function getBlockIndent(sourceFile: SourceFile, position: number, options: EditorSettings): number {
// move backwards until we find a line with a non-whitespace character,
// then find the first non-whitespace character for that line.
let current = position;
while (current > 0) {
... | @param assumeNewLineBeforeCloseBrace
`false` when called on text from a real source file.
`true` when we need to assume `position` is on a newline.
This is useful for codefixes. Consider
```
function f() {
|}
```
with `position` at `|`.
When inserting some text after an open brace, we would like to get inden... | typescript | src/services/formatting/smartIndenter.ts | 182 | [
"sourceFile",
"position",
"options"
] | true | 3 | 8.48 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toPrimitive | public static float[] toPrimitive(final Float[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_FLOAT_ARRAY;
}
final float[] result = new float[array.length];
for (int i = 0; i < array.length; i++) {
r... | Converts an array of object Floats to primitives.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array a {@link Float} array, may be {@code null}.
@return a {@code float} array, {@code null} if null array input.
@throws NullPointerException if an array element is {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 9,006 | [
"array"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
set | def set(
cls,
key: str,
value: Any,
*,
dag_id: str,
task_id: str,
run_id: str,
map_index: int = -1,
serialize: bool = True,
session: Session = NEW_SESSION,
) -> None:
"""
Store an XCom value.
:param key: Key to ... | Store an XCom value.
:param key: Key to store the XCom.
:param value: XCom value to store.
:param dag_id: DAG ID.
:param task_id: Task ID.
:param run_id: DAG run ID for the task.
:param map_index: Optional map index to assign XCom for a mapped task.
:param serialize: Optional parameter to specify if value should be se... | python | airflow-core/src/airflow/models/xcom.py | 161 | [
"cls",
"key",
"value",
"dag_id",
"task_id",
"run_id",
"map_index",
"serialize",
"session"
] | None | true | 7 | 6.8 | apache/airflow | 43,597 | sphinx | false |
parseUnsignedInt | @CanIgnoreReturnValue
public static int parseUnsignedInt(String string, int radix) {
checkNotNull(string);
long result = Long.parseLong(string, radix);
if ((result & INT_MASK) != result) {
throw new NumberFormatException(
"Input " + string + " in base " + radix + " is not in the range of a... | Returns the unsigned {@code int} value represented by a string with the given radix.
<p><b>Java 8+ users:</b> use {@link Integer#parseUnsignedInt(String, int)} instead.
@param string the string containing the unsigned integer representation to be parsed.
@param radix the radix to use while parsing {@code s}; must be be... | java | android/guava/src/com/google/common/primitives/UnsignedInts.java | 360 | [
"string",
"radix"
] | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false | |
use | def use(self, styles: dict[str, Any]) -> Styler:
"""
Set the styles on the current Styler.
Possibly uses styles from ``Styler.export``.
Parameters
----------
styles : dict(str, Any)
List of attributes to add to Styler. Dict keys should contain only:
... | Set the styles on the current Styler.
Possibly uses styles from ``Styler.export``.
Parameters
----------
styles : dict(str, Any)
List of attributes to add to Styler. Dict keys should contain only:
- "apply": list of styler functions, typically added with ``apply`` or
``map``.
- "table_attribut... | python | pandas/io/formats/style.py | 2,288 | [
"self",
"styles"
] | Styler | true | 9 | 7.92 | pandas-dev/pandas | 47,362 | numpy | false |
asPredicate | public static <I> Predicate<I> asPredicate(final FailablePredicate<I, ?> predicate) {
return input -> test(predicate, input);
} | Converts the given {@link FailablePredicate} into a standard {@link Predicate}.
@param <I> the type used by the predicates
@param predicate a {@link FailablePredicate}
@return a standard {@link Predicate}
@since 3.10 | java | src/main/java/org/apache/commons/lang3/Functions.java | 428 | [
"predicate"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
newPrototypeInstance | protected Object newPrototypeInstance() throws BeansException {
if (logger.isDebugEnabled()) {
logger.debug("Creating new instance of bean '" + this.targetBeanName + "'");
}
return getBeanFactory().getBean(getTargetBeanName());
} | Subclasses should call this method to create a new prototype instance.
@throws BeansException if bean creation failed | java | spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java | 65 | [] | Object | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
lastIndexOf | private static int lastIndexOf(boolean[] array, boolean target, int start, int end) {
for (int i = end - 1; i >= start; i--) {
if (array[i] == target) {
return i;
}
}
return -1;
} | Returns the index of the last appearance of the value {@code target} in {@code array}.
@param array an array of {@code boolean} values, possibly empty
@param target a primitive {@code boolean} value
@return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no
such index exists. | java | android/guava/src/com/google/common/primitives/Booleans.java | 217 | [
"array",
"target",
"start",
"end"
] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
instantiateConfigProviders | private Map<String, ConfigProvider> instantiateConfigProviders(
Map<String, String> indirectConfigs,
Map<String, ?> providerConfigProperties,
Predicate<String> classNameFilter
) {
final String configProviders = indirectConfigs.get(CONFIG_PROVIDERS_CONFIG);
if (co... | Instantiates and configures the ConfigProviders. The config providers configs are defined as follows:
config.providers : A comma-separated list of names for providers.
config.providers.{name}.class : The Java class name for a provider.
config.providers.{name}.param.{param-name} : A parameter to be passed to the above J... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 601 | [
"indirectConfigs",
"providerConfigProperties",
"classNameFilter"
] | true | 6 | 7.6 | apache/kafka | 31,560 | javadoc | false | |
getdomain | def getdomain(x):
"""
Return a domain suitable for given abscissae.
Find a domain suitable for a polynomial or Chebyshev series
defined at the values supplied.
Parameters
----------
x : array_like
1-d array of abscissae whose domain will be determined.
Returns
-------
... | Return a domain suitable for given abscissae.
Find a domain suitable for a polynomial or Chebyshev series
defined at the values supplied.
Parameters
----------
x : array_like
1-d array of abscissae whose domain will be determined.
Returns
-------
domain : ndarray
1-d array containing two values. If the inpu... | python | numpy/polynomial/polyutils.py | 194 | [
"x"
] | false | 3 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
entryIterator | @Override
Iterator<Entry<Cut<C>, Range<C>>> entryIterator() {
/*
* We want to start the iteration at the first range where the upper bound is in
* upperBoundWindow.
*/
Iterator<Range<C>> backingItr;
if (!upperBoundWindow.hasLowerBound()) {
backingItr = rangesByLowerBou... | upperBoundWindow represents the headMap/subMap/tailMap view of the entire "ranges by upper
bound" map; it's a constraint on the *keys*, and does not affect the values. | java | android/guava/src/com/google/common/collect/TreeRangeSet.java | 363 | [] | true | 6 | 6.72 | google/guava | 51,352 | javadoc | false | |
processRetryLogic | private void processRetryLogic(AcknowledgeRequestState acknowledgeRequestState,
AtomicBoolean shouldRetry,
long responseCompletionTimeMs) {
if (shouldRetry.get()) {
acknowledgeRequestState.onFailedAttempt(responseCompletionTimeMs)... | The method checks whether the leader for a topicIdPartition has changed.
@param nodeId The previous leader for the partition.
@param topicIdPartition The TopicIdPartition to check.
@return Returns true if leader information is available and leader has changed.
If the leader information is not available or if the leader... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 1,082 | [
"acknowledgeRequestState",
"shouldRetry",
"responseCompletionTimeMs"
] | void | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false |
setSubscriptionType | private void setSubscriptionType(SubscriptionType type) {
if (this.subscriptionType == SubscriptionType.NONE)
this.subscriptionType = type;
else if (this.subscriptionType != type)
throw new IllegalStateException(SUBSCRIPTION_EXCEPTION_MESSAGE);
} | This method sets the subscription type if it is not already set (i.e. when it is NONE),
or verifies that the subscription type is equal to the give type when it is set (i.e.
when it is not NONE)
@param type The given subscription type | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 185 | [
"type"
] | void | true | 3 | 7.04 | apache/kafka | 31,560 | javadoc | false |
emitWorker | function emitWorker(code: OpCode, args?: OperationArguments, location?: TextRange): void {
if (operations === undefined) {
operations = [];
operationArguments = [];
operationLocations = [];
}
if (labelOffsets === undefined) {
// mark entry... | Emits an operation.
@param code The OpCode for the operation.
@param args The optional arguments for the operation. | typescript | src/compiler/transformers/generators.ts | 2,721 | [
"code",
"args?",
"location?"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
writeYield | function writeYield(expression: Expression, operationLocation: TextRange | undefined): void {
lastOperationWasAbrupt = true;
writeStatement(
setEmitFlags(
setTextRange(
factory.createReturnStatement(
factory.createArrayLiteral... | Writes a Yield operation to the current label's statement list.
@param expression The expression to yield.
@param operationLocation The source map location for the operation. | typescript | src/compiler/transformers/generators.ts | 3,228 | [
"expression",
"operationLocation"
] | true | 2 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
acquirePermit | private boolean acquirePermit() {
if (getLimit() <= NO_LIMIT || acquireCount < getLimit()) {
acquireCount++;
return true;
}
return false;
} | Internal helper method for acquiring a permit. This method checks whether currently a permit can be acquired and - if so - increases the internal
counter. The return value indicates whether a permit could be acquired. This method must be called with the lock of this object held.
@return a flag whether a permit could be... | java | src/main/java/org/apache/commons/lang3/concurrent/TimedSemaphore.java | 310 | [] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
get_fieldstructure | def get_fieldstructure(adtype, lastname=None, parents=None,):
"""
Returns a dictionary with fields indexing lists of their parent fields.
This function is used to simplify access to fields nested in other fields.
Parameters
----------
adtype : np.dtype
Input datatype
lastname : opt... | Returns a dictionary with fields indexing lists of their parent fields.
This function is used to simplify access to fields nested in other fields.
Parameters
----------
adtype : np.dtype
Input datatype
lastname : optional
Last processed field name (used internally during recursion).
parents : dictionary
D... | python | numpy/lib/recfunctions.py | 226 | [
"adtype",
"lastname",
"parents"
] | false | 11 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
register | private void register(Map<String, PropertyDescriptor> candidates, PropertyDescriptor descriptor) {
if (!candidates.containsKey(descriptor.getName()) && isCandidate(descriptor)) {
candidates.put(descriptor.getName(), descriptor);
}
} | 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 | 151 | [
"candidates",
"descriptor"
] | void | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
init | final void init() {
/*
* requireNonNull is safe because this is called from the constructor after `futures` is set but
* before releaseResources could be called (because we have not yet set up any of the listeners
* that could call it, nor exposed this Future for users to call cancel() on).
*/
... | Must be called at the end of each subclass's constructor. This method performs the "real"
initialization; we can't put this in the constructor because, in the case where futures are
already complete, we would not initialize the subclass before calling {@link
#collectValueFromNonCancelledFuture}. As this is called after... | java | android/guava/src/com/google/common/util/concurrent/AggregateFuture.java | 113 | [] | void | true | 6 | 6.8 | google/guava | 51,352 | javadoc | false |
createWithExpectedSize | public static <E extends @Nullable Object> CompactHashSet<E> createWithExpectedSize(
int expectedSize) {
return new CompactHashSet<>(expectedSize);
} | Creates a {@code CompactHashSet} instance, with a high enough "initial capacity" that it
<i>should</i> hold {@code expectedSize} elements without growth.
@param expectedSize the number of elements you expect to add to the returned set
@return a new, empty {@code CompactHashSet} with enough capacity to hold {@code expec... | java | android/guava/src/com/google/common/collect/CompactHashSet.java | 122 | [
"expectedSize"
] | true | 1 | 6 | google/guava | 51,352 | javadoc | false | |
fatalError | public Optional<Throwable> fatalError() {
return fatalError;
} | Returns the current coordinator node.
@return the current coordinator node. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CoordinatorRequestManager.java | 262 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
coverage_error | def coverage_error(y_true, y_score, *, sample_weight=None):
"""Coverage error measure.
Compute how far we need to go through the ranked scores to cover all
true labels. The best value is equal to the average number
of labels in ``y_true`` per sample.
Ties in ``y_scores`` are broken by giving maxim... | Coverage error measure.
Compute how far we need to go through the ranked scores to cover all
true labels. The best value is equal to the average number
of labels in ``y_true`` per sample.
Ties in ``y_scores`` are broken by giving maximal rank that would have
been assigned to all tied values.
Note: Our implementation... | python | sklearn/metrics/_ranking.py | 1,421 | [
"y_true",
"y_score",
"sample_weight"
] | false | 3 | 7.44 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getBeanNamesForType | @Override
public String[] getBeanNamesForType(@Nullable ResolvableType type,
boolean includeNonSingletons, boolean allowEagerInit) {
Class<?> resolved = (type != null ? type.resolve() : null);
boolean isFactoryType = (resolved != null && FactoryBean.class.isAssignableFrom(resolved));
List<String> matches = n... | 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 | 371 | [
"type",
"includeNonSingletons",
"allowEagerInit"
] | true | 11 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false | |
readKeyStore | private KeyStore readKeyStore(Path path) {
try {
return KeyStoreUtil.readKeyStore(path, type, password);
} catch (SecurityException e) {
throw SslFileUtil.accessControlFailure(fileTypeForException(), List.of(path), e, configBasePath);
} catch (IOException e) {
... | @param path The path to the keystore file
@param password The password for the keystore
@param type The {@link KeyStore#getType() type} of the keystore (typically "PKCS12" or "jks").
See {@link KeyStoreUtil#inferKeyStoreType}.
@param algorithm The algorithm to use for the Trust Manager (see ... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/StoreTrustConfig.java | 92 | [
"path"
] | KeyStore | true | 4 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
clamp | function clamp(number, lower, upper) {
if (upper === undefined) {
upper = lower;
lower = undefined;
}
if (upper !== undefined) {
upper = toNumber(upper);
upper = upper === upper ? upper : 0;
}
if (lower !== undefined) {
lower = toNumber(lower);
... | Clamps `number` within the inclusive `lower` and `upper` bounds.
@static
@memberOf _
@since 4.0.0
@category Number
@param {number} number The number to clamp.
@param {number} [lower] The lower bound.
@param {number} upper The upper bound.
@returns {number} Returns the clamped number.
@example
_.clamp(-10, -5, 5);
// =>... | javascript | lodash.js | 14,088 | [
"number",
"lower",
"upper"
] | false | 6 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
tobytes | def tobytes(self, fill_value=None, order='C'):
"""
Return the array data as a string containing the raw bytes in the array.
The array is filled with a fill value before the string conversion.
Parameters
----------
fill_value : scalar, optional
Value used to ... | Return the array data as a string containing the raw bytes in the array.
The array is filled with a fill value before the string conversion.
Parameters
----------
fill_value : scalar, optional
Value used to fill in the masked values. Default is None, in which
case `MaskedArray.fill_value` is used.
order : {'C... | python | numpy/ma/core.py | 6,351 | [
"self",
"fill_value",
"order"
] | false | 1 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
afterPropertiesSet | @Override
public void afterPropertiesSet() throws Exception {
if (this.dataSource == null && this.nonTransactionalDataSource != null) {
this.dataSource = this.nonTransactionalDataSource;
}
if (this.applicationContext != null && this.resourceLoader == null) {
this.resourceLoader = this.applicationContext;
... | Set whether to wait for running jobs to complete on shutdown.
<p>Default is "false". Switch this to "true" if you prefer
fully completed jobs at the expense of a longer shutdown phase.
@see org.quartz.Scheduler#shutdown(boolean) | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java | 480 | [] | void | true | 7 | 7.2 | spring-projects/spring-framework | 59,386 | javadoc | false |
_shared_cache_filepath | def _shared_cache_filepath(self) -> Path:
"""Get the shared cache filepath for memoizer cache dumps.
Returns:
The path to the shared memoizer cache JSON file.
"""
return Path(cache_dir()) / "memoizer_cache.json" | Get the shared cache filepath for memoizer cache dumps.
Returns:
The path to the shared memoizer cache JSON file. | python | torch/_inductor/runtime/caching/interfaces.py | 271 | [
"self"
] | Path | true | 1 | 6.56 | pytorch/pytorch | 96,034 | unknown | false |
toString | @Override
public final String toString() {
Runnable state = get();
String result;
if (state == DONE) {
result = "running=[DONE]";
} else if (state instanceof Blocker) {
result = "running=[INTERRUPTED]";
} else if (state instanceof Thread) {
// getName is final on Thread, no need ... | Using this as the blocker object allows introspection and debugging tools to see that the
currentRunner thread is blocked on the progress of the interruptor thread, which can help
identify deadlocks. | java | android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java | 251 | [] | String | true | 4 | 6.56 | google/guava | 51,352 | javadoc | false |
getFraction | public static Fraction getFraction(String str) {
Objects.requireNonNull(str, "str");
// parse double format
int pos = str.indexOf('.');
if (pos >= 0) {
return getFraction(Double.parseDouble(str));
}
// parse X Y/Z format
pos = str.indexOf(' ');
... | Creates a Fraction from a {@link String}.
<p>
The formats accepted are:
</p>
<ol>
<li>{@code double} String containing a dot</li>
<li>'X Y/Z'</li>
<li>'Y/Z'</li>
<li>'X' (a simple whole number)</li>
</ol>
<p>
and a .
</p>
@param str the string to parse, must not be {@code null}
@return the new {@link Fraction} instance... | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 264 | [
"str"
] | Fraction | true | 5 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
failableStream | public static <T> FailableStream<T> failableStream(final Collection<T> stream) {
return failableStream(of(stream));
} | Converts the given {@link Collection} into a {@link FailableStream}. This is basically a simplified, reduced version
of the {@link Stream} class, with the same underlying element stream, except that failable objects, like
{@link FailablePredicate}, {@link FailableFunction}, or {@link FailableConsumer} may be applied, i... | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 521 | [
"stream"
] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
resolveItemDeprecation | protected final ItemDeprecation resolveItemDeprecation(MetadataGenerationEnvironment environment,
Element... elements) {
boolean deprecated = Arrays.stream(elements).anyMatch(environment::isDeprecated);
return deprecated ? environment.resolveItemDeprecation(getGetter()) : null;
} | Return if this property has been explicitly marked as nested (for example using an
annotation}.
@param environment the metadata generation environment
@return if the property has been marked as nested | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptor.java | 199 | [
"environment"
] | ItemDeprecation | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
authenticationException | public AuthenticationException authenticationException(String id) {
NodeConnectionState state = nodeState.get(id);
return state != null ? state.authenticationException : null;
} | Return authentication exception if an authentication error occurred
@param id The id of the node to check | java | clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java | 331 | [
"id"
] | AuthenticationException | true | 2 | 6.32 | apache/kafka | 31,560 | javadoc | false |
getCause | @Deprecated
public static Throwable getCause(final Throwable throwable, String[] methodNames) {
if (throwable == null) {
return null;
}
if (methodNames == null) {
final Throwable cause = throwable.getCause();
if (cause != null) {
return cau... | Introspects the {@link Throwable} to obtain the cause.
<p>
A {@code null} set of method names means use the default set. A {@code null} in the set of method names will be ignored.
</p>
@param throwable the throwable to introspect for a cause, may be null.
@param methodNames the method names, null treated as default s... | java | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | 230 | [
"throwable",
"methodNames"
] | Throwable | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
create | public static NodeApiVersions create(short apiKey, short minVersion, short maxVersion) {
return create(Collections.singleton(new ApiVersion()
.setApiKey(apiKey)
.setMinVersion(minVersion)
.setMaxVersion(maxVersion)));
} | Create a NodeApiVersions object with a single ApiKey. It is mainly used in tests.
@param apiKey ApiKey's id.
@param minVersion ApiKey's minimum version.
@param maxVersion ApiKey's maximum version.
@return A new NodeApiVersions object. | java | clients/src/main/java/org/apache/kafka/clients/NodeApiVersions.java | 96 | [
"apiKey",
"minVersion",
"maxVersion"
] | NodeApiVersions | true | 1 | 6.56 | apache/kafka | 31,560 | javadoc | false |
bracket_category_matcher | def bracket_category_matcher(title: str):
"""Categorize a commit based on the presence of a bracketed category in the title.
Args:
title (str): title to seaarch
Returns:
optional[str]
"""
pairs = [
("[dynamo]", "dynamo"),
("[torch... | Categorize a commit based on the presence of a bracketed category in the title.
Args:
title (str): title to seaarch
Returns:
optional[str] | python | scripts/release_notes/commitlist.py | 157 | [
"title"
] | true | 3 | 7.76 | pytorch/pytorch | 96,034 | google | false | |
_fill | def _fill(self, direction: Literal["ffill", "bfill"], limit: int | None = None):
"""
Shared function for `pad` and `backfill` to call Cython method.
Parameters
----------
direction : {'ffill', 'bfill'}
Direction passed to underlying Cython function. `bfill` will caus... | Shared function for `pad` and `backfill` to call Cython method.
Parameters
----------
direction : {'ffill', 'bfill'}
Direction passed to underlying Cython function. `bfill` will cause
values to be filled backwards. `ffill` and any other values will
default to a forward fill
limit : int, default None
Ma... | python | pandas/core/groupby/groupby.py | 4,013 | [
"self",
"direction",
"limit"
] | true | 8 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false | |
min | public static short min(short a, final short b, final short c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
} | Gets the minimum of three {@code short} values.
@param a value 1.
@param b value 2.
@param c value 3.
@return the smallest of the values. | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,331 | [
"a",
"b",
"c"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
quoteMatcher | public static StrMatcher quoteMatcher() {
return QUOTE_MATCHER;
} | Gets the matcher for the single or double quote character.
@return the matcher for a single or double quote. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 313 | [] | StrMatcher | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
sendListOffsetsRequestsAndResetPositions | private CompletableFuture<Void> sendListOffsetsRequestsAndResetPositions(
final Map<TopicPartition, AutoOffsetResetStrategy> partitionAutoOffsetResetStrategyMap) {
Map<TopicPartition, Long> timestampsToSearch = partitionAutoOffsetResetStrategyMap.entrySet().stream()
.collect(Collecto... | Make asynchronous ListOffsets request to fetch offsets by target times for the specified
partitions. Use the retrieved offsets to reset positions in the subscription state.
This also adds the request to the list of unsentRequests.
@param partitionAutoOffsetResetStrategyMap the mapping between partitions and AutoOffsetR... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java | 661 | [
"partitionAutoOffsetResetStrategyMap"
] | true | 5 | 7.44 | apache/kafka | 31,560 | javadoc | false | |
destructuringNeedsFlattening | function destructuringNeedsFlattening(node: Expression): boolean {
if (isObjectLiteralExpression(node)) {
for (const elem of node.properties) {
switch (elem.kind) {
case SyntaxKind.PropertyAssignment:
if (destructuringNeedsFlattening(e... | Visit nested elements at the top-level of a module.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 844 | [
"node"
] | true | 14 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
transpose | def transpose(a, axes=None):
"""
Returns an array with axes transposed.
For a 1-D array, this returns an unchanged view of the original array, as a
transposed vector is simply the same vector.
To convert a 1-D array into a 2-D column vector, an additional dimension
must be added, e.g., ``np.atl... | Returns an array with axes transposed.
For a 1-D array, this returns an unchanged view of the original array, as a
transposed vector is simply the same vector.
To convert a 1-D array into a 2-D column vector, an additional dimension
must be added, e.g., ``np.atleast_2d(a).T`` achieves this, as does
``a[:, np.newaxis]`... | python | numpy/_core/fromnumeric.py | 605 | [
"a",
"axes"
] | false | 1 | 6.4 | numpy/numpy | 31,054 | numpy | false | |
_update_version_in_provider_yaml | def _update_version_in_provider_yaml(
provider_id: str, type_of_change: TypeOfChange, min_airflow_version_bump: bool = False
) -> tuple[bool, bool, str]:
"""
Updates provider version based on the type of change selected by the user
:param type_of_change: type of change selected
:param provider_id: p... | Updates provider version based on the type of change selected by the user
:param type_of_change: type of change selected
:param provider_id: provider package
:param min_airflow_version_bump: if set, ensure that the version bump is at least feature version.
:return: tuple of two bools: (with_breaking_change, maybe_with_... | python | dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py | 572 | [
"provider_id",
"type_of_change",
"min_airflow_version_bump"
] | tuple[bool, bool, str] | true | 6 | 7.92 | apache/airflow | 43,597 | sphinx | false |
extractCauseUnchecked | public static ConcurrentRuntimeException extractCauseUnchecked(final ExecutionException ex) {
if (ex == null || ex.getCause() == null) {
return null;
}
ExceptionUtils.throwUnchecked(ex.getCause());
return new ConcurrentRuntimeException(ex.getMessage(), ex.getCause());
} | Inspects the cause of the specified {@link ExecutionException} and
creates a {@link ConcurrentRuntimeException} with the checked cause if
necessary. This method works exactly like
{@link #extractCause(ExecutionException)}. The only difference is that
the cause of the specified {@link ExecutionException} is extracted as... | java | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | 226 | [
"ex"
] | ConcurrentRuntimeException | true | 3 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
charSetMatcher | public static StrMatcher charSetMatcher(final char... chars) {
if (ArrayUtils.isEmpty(chars)) {
return NONE_MATCHER;
}
if (chars.length == 1) {
return new CharMatcher(chars[0]);
}
return new CharSetMatcher(chars);
} | Creates a matcher from a set of characters.
@param chars the characters to match, null or empty matches nothing.
@return a new matcher for the given char[]. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 255 | [] | StrMatcher | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
createEntries | @Override
Collection<Entry<K, V>> createEntries() {
if (this instanceof SetMultimap) {
return new EntrySet();
} else {
return new Entries();
}
} | {@inheritDoc}
<p>The iterator generated by the returned collection traverses the values for one key, followed
by the values of a second key, and so on.
<p>Each entry is an immutable snapshot of a key-value mapping in the multimap, taken at the
time the entry is returned by a method call to the collection or its iterato... | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 1,247 | [] | true | 2 | 6.4 | google/guava | 51,352 | javadoc | false | |
datapath | def datapath(strict_data_files: str) -> Callable[..., str]:
"""
Get the path to a data file.
Parameters
----------
path : str
Path to the file, relative to ``pandas/tests/``
Returns
-------
path including ``pandas/tests``.
Raises
------
ValueError
If the pa... | Get the path to a data file.
Parameters
----------
path : str
Path to the file, relative to ``pandas/tests/``
Returns
-------
path including ``pandas/tests``.
Raises
------
ValueError
If the path doesn't exist and the --no-strict-data-files option is not set. | python | pandas/conftest.py | 1,144 | [
"strict_data_files"
] | Callable[..., str] | true | 3 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
wrapper | def wrapper(fn: Callable[_P, _R]) -> Callable[_P, _R]:
"""Wrap the function to enable memoization.
Args:
fn: The function to wrap.
Returns:
A wrapped version of the function.
"""
# If caching is disabled, return the original f... | Wrap the function to enable memoization.
Args:
fn: The function to wrap.
Returns:
A wrapped version of the function. | python | torch/_inductor/runtime/caching/interfaces.py | 454 | [
"fn"
] | Callable[_P, _R] | true | 6 | 8.24 | pytorch/pytorch | 96,034 | google | false |
generateBitVectors | public static <E extends Enum<E>> long[] generateBitVectors(final Class<E> enumClass, final Iterable<? extends E> values) {
asEnum(enumClass);
Objects.requireNonNull(values, "values");
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
values.forEach(constant -> condensed.add(Object... | Creates a bit vector representation of the given subset of an Enum using as many {@code long}s as needed.
<p>This generates a value that is usable by {@link EnumUtils#processBitVectors}.</p>
<p>Use this method if you have more than 64 values in your Enum.</p>
@param enumClass the class of the enum we are working with, ... | java | src/main/java/org/apache/commons/lang3/EnumUtils.java | 178 | [
"enumClass",
"values"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
parseDelimitedList | function parseDelimitedList<T extends Node | undefined>(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray<NonNullable<T>> | undefined {
const saveParsingContext = parsingContext;
parsingContext |= 1 << kind;
const list: NonNullable<T>[] = [];
... | Reports a diagnostic error for the current token being an invalid name.
@param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName).
@param nameDiagnostic Diagnostic to report for all other cases.
@param tokenIfBlankName Current token if the name was invalid for being... | typescript | src/compiler/parser.ts | 3,492 | [
"kind",
"parseElement",
"considerSemicolonAsDelimiter?"
] | true | 12 | 6.8 | microsoft/TypeScript | 107,154 | jsdoc | false | |
findMatchingMethod | @Override
protected @Nullable Method findMatchingMethod() {
Method matchingMethod = super.findMatchingMethod();
// Second pass: look for method where arguments can be converted to parameter types.
if (matchingMethod == null) {
// Interpret argument array as individual method arguments.
matchingMethod = doF... | This implementation looks for a method with matching parameter types.
@see #doFindMatchingMethod | java | spring-beans/src/main/java/org/springframework/beans/support/ArgumentConvertingMethodInvoker.java | 112 | [] | Method | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
_date_or_empty | def _date_or_empty(*, task_instance: TaskInstance, attr: str) -> str:
"""
Fetch a date attribute or None of it does not exist.
:param task_instance: the task instance
:param attr: the attribute name
:meta private:
"""
result: datetime | None = getattr(task_instance, attr, None)
return ... | Fetch a date attribute or None of it does not exist.
:param task_instance: the task instance
:param attr: the attribute name
:meta private: | python | airflow-core/src/airflow/models/taskinstance.py | 347 | [
"task_instance",
"attr"
] | str | true | 2 | 7.04 | apache/airflow | 43,597 | sphinx | false |
isPrimary | protected boolean isPrimary(String beanName, Object beanInstance) {
String transformedBeanName = transformedBeanName(beanName);
if (containsBeanDefinition(transformedBeanName)) {
return getMergedLocalBeanDefinition(transformedBeanName).isPrimary();
}
return (getParentBeanFactory() instanceof DefaultListableB... | Return whether the bean definition for the given bean name has been
marked as a primary bean.
@param beanName the name of the bean
@param beanInstance the corresponding bean instance (can be {@code null})
@return whether the given bean qualifies as primary | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 2,181 | [
"beanName",
"beanInstance"
] | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
chooseRandomFlags | function chooseRandomFlags(experiments, additionalFlags) {
// Add additional flags to second config based on experiment percentages.
const extra_flags = [];
for (const [p, flags] of additionalFlags) {
if (random.choose(p)) {
for (const flag of flags.split(' ')) {
extra_flags.push('--second-confi... | Randomly chooses a configuration from experiments. The configuration
parameters are expected to be passed from a bundled V8 build. Constraints
mentioned below are enforced by PRESUBMIT checks on the V8 side.
@param {Object[]} experiments List of tuples (probability, first config name,
second config name, second d8 ... | javascript | deps/v8/tools/clusterfuzz/js_fuzzer/differential_script_mutator.js | 40 | [
"experiments",
"additionalFlags"
] | false | 3 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
getObject | @Override
public @Nullable Object getObject() throws IllegalAccessException {
if (this.fieldObject == null) {
throw new FactoryBeanNotInitializedException();
}
ReflectionUtils.makeAccessible(this.fieldObject);
if (this.targetObject != null) {
// instance field
return this.fieldObject.get(this.targetOb... | The bean name of this FieldRetrievingFactoryBean will be interpreted
as "staticField" pattern, if neither "targetClass" nor "targetObject"
nor "targetField" have been specified.
This allows for concise bean definitions with just an id/name. | java | spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java | 203 | [] | Object | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
group_tensors_by_device_and_dtype | def group_tensors_by_device_and_dtype(tensorlistlist, with_indices=False):
"""Pure Python implementation of torch._C._group_tensors_by_device_and_dtype.
Groups tensors by their device and dtype. This is useful before sending
tensors off to a foreach implementation, which requires tensors to be on
one d... | Pure Python implementation of torch._C._group_tensors_by_device_and_dtype.
Groups tensors by their device and dtype. This is useful before sending
tensors off to a foreach implementation, which requires tensors to be on
one device and dtype.
Args:
tensorlistlist: A list of lists of tensors (tensors can be None).
... | python | torch/_dynamo/polyfills/__init__.py | 446 | [
"tensorlistlist",
"with_indices"
] | false | 15 | 6.96 | pytorch/pytorch | 96,034 | google | false | |
parseNestedCustomElement | private @Nullable BeanDefinitionHolder parseNestedCustomElement(Element ele, @Nullable BeanDefinition containingBd) {
BeanDefinition innerDefinition = parseCustomElement(ele, containingBd);
if (innerDefinition == null) {
error("Incorrect usage of element '" + ele.getNodeName() + "' in a nested manner. " +
"... | Decorate the given bean definition through a namespace handler,
if applicable.
@param node the current child node
@param originalDef the current bean definition
@param containingBd the containing bean definition (if any)
@return the decorated bean definition | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java | 1,456 | [
"ele",
"containingBd"
] | BeanDefinitionHolder | true | 3 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
compareAndSet | public final boolean compareAndSet(double expect, double update) {
return value.compareAndSet(doubleToRawLongBits(expect), doubleToRawLongBits(update));
} | Atomically sets the value to the given updated value if the current value is <a
href="#bitEquals">bitwise equal</a> to the expected value.
@param expect the expected value
@param update the new value
@return {@code true} if successful. False return indicates that the actual value was not
bitwise equal to the expect... | java | android/guava/src/com/google/common/util/concurrent/AtomicDouble.java | 124 | [
"expect",
"update"
] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
contains | public boolean contains(Option option) {
return this.options.contains(option);
} | Returns if the given option is contained in this set.
@param option the option to check
@return {@code true} of the option is present | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java | 197 | [
"option"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
without | public Options without(Option option) {
return copy((options) -> options.remove(option));
} | Create a new {@link Options} instance that contains the options in this set
excluding the given option.
@param option the option to exclude
@return a new {@link Options} instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java | 229 | [
"option"
] | Options | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false |
toZoneId | private static ZoneId toZoneId(final TimeZone timeZone) {
return TimeZones.toTimeZone(timeZone).toZoneId();
} | Converts a {@link Date} to a {@link ZonedDateTime}.
@param date the Date to convert to a ZonedDateTime, not null.
@param timeZone the time zone, null maps to to the default time zone.
@return a new ZonedDateTime.
@since 3.19.0 | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,701 | [
"timeZone"
] | ZoneId | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
get_loop_body_lowp_fp | def get_loop_body_lowp_fp(_body: LoopBody) -> tuple[Optional[torch.dtype], bool]:
"""
Returns the low precision data type (torch.float16/torch.bfloat16) contained in the nodes
and if all the nodes can codegen with this data type without converting to float.
Otherwise returns None and True.
"""
s... | Returns the low precision data type (torch.float16/torch.bfloat16) contained in the nodes
and if all the nodes can codegen with this data type without converting to float.
Otherwise returns None and True. | python | torch/_inductor/codegen/cpp.py | 3,733 | [
"_body"
] | tuple[Optional[torch.dtype], bool] | true | 14 | 6 | pytorch/pytorch | 96,034 | unknown | false |
emit_metric | def emit_metric(
metric_name: str,
metrics: dict[str, Any],
) -> None:
"""
Upload a metric to DynamoDB (and from there, the HUD backend database).
Even if EMIT_METRICS is set to False, this function will still run the code to
validate and shape the metrics, skipping just the upload.
Parame... | Upload a metric to DynamoDB (and from there, the HUD backend database).
Even if EMIT_METRICS is set to False, this function will still run the code to
validate and shape the metrics, skipping just the upload.
Parameters:
metric_name:
Name of the metric. Every unique metric should have a different name
... | python | tools/stats/upload_metrics.py | 76 | [
"metric_name",
"metrics"
] | None | true | 4 | 6.96 | pytorch/pytorch | 96,034 | google | false |
_is_dtype_type | def _is_dtype_type(arr_or_dtype, condition) -> bool:
"""
Return true if the condition is satisfied for the arr_or_dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype object whose dtype we want to extract.
condition : callable[Union[np.dtype, Extension... | Return true if the condition is satisfied for the arr_or_dtype.
Parameters
----------
arr_or_dtype : array-like or dtype
The array-like or dtype object whose dtype we want to extract.
condition : callable[Union[np.dtype, ExtensionDtypeType]]
Returns
-------
bool : if the condition is satisfied for the arr_or_dtyp... | python | pandas/core/dtypes/common.py | 1,659 | [
"arr_or_dtype",
"condition"
] | bool | true | 8 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
recode_for_categories | def recode_for_categories(
codes: np.ndarray,
old_categories,
new_categories,
*,
copy: bool = True,
warn: bool = False,
) -> np.ndarray:
"""
Convert a set of codes for to a new set of categories
Parameters
----------
codes : np.ndarray
old_categories, new_categories : In... | Convert a set of codes for to a new set of categories
Parameters
----------
codes : np.ndarray
old_categories, new_categories : Index
copy: bool, default True
Whether to copy if the codes are unchanged.
warn : bool, default False
Whether to warn on silent-NA mapping.
Returns
-------
new_codes : np.ndarray[np.... | python | pandas/core/arrays/categorical.py | 3,055 | [
"codes",
"old_categories",
"new_categories",
"copy",
"warn"
] | np.ndarray | true | 7 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
isMaxValAllBitSetLiteral | static bool isMaxValAllBitSetLiteral(const EnumDecl *EnumDec) {
auto EnumConst = std::max_element(
EnumDec->enumerator_begin(), EnumDec->enumerator_end(),
[](const EnumConstantDecl *E1, const EnumConstantDecl *E2) {
return E1->getInitVal() < E2->getInitVal();
});
if (const Expr *InitExpr ... | Return the number of EnumConstantDecls in an EnumDecl. | cpp | clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp | 76 | [] | true | 3 | 6.56 | llvm/llvm-project | 36,021 | doxygen | false | |
skipToEndOfLine | private void skipToEndOfLine() {
for (; this.pos < this.in.length(); this.pos++) {
char c = this.in.charAt(this.pos);
if (c == '\r' || c == '\n') {
this.pos++;
break;
}
}
} | Advances the position until after the next newline character. If the line is
terminated by "\r\n", the '\n' must be consumed as whitespace by the caller. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 167 | [] | void | true | 4 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
loadEnvFile | function loadEnvFile(path = undefined) { // Provide optional value so that `loadEnvFile.length` returns 0
if (path != null) {
getValidatedPath ??= require('internal/fs/utils').getValidatedPath;
path = getValidatedPath(path);
_loadEnvFile(path);
} else {
_loadEnvFile();
}
} | Loads the `.env` file to process.env.
@param {string | URL | Buffer | undefined} path | javascript | lib/internal/process/per_thread.js | 356 | [] | false | 3 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
hasEntry | public boolean hasEntry(String name) {
NestedJarEntry lastEntry = this.lastEntry;
if (lastEntry != null && name.equals(lastEntry.getName())) {
return true;
}
ZipContent.Entry entry = getVersionedContentEntry(name);
if (entry != null) {
return true;
}
synchronized (this) {
ensureOpen();
return ... | Return if an entry with the given name exists.
@param name the name to check
@return if the entry exists | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java | 242 | [
"name"
] | true | 4 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
file_path_to_url | def file_path_to_url(path: str) -> str:
"""
converts an absolute native path to a FILE URL.
Parameters
----------
path : a path in native format
Returns
-------
a valid FILE URL
"""
# lazify expensive import (~30ms)
from urllib.request import pathname2url
return urljoi... | converts an absolute native path to a FILE URL.
Parameters
----------
path : a path in native format
Returns
-------
a valid FILE URL | python | pandas/io/common.py | 486 | [
"path"
] | str | true | 1 | 6 | pandas-dev/pandas | 47,362 | numpy | false |
to_string | def to_string(
self,
buf: FilePath | WriteBuffer[str] | None = None,
na_rep: str = "NaN",
float_format: str | None = None,
header: bool = True,
index: bool = True,
length: bool = False,
dtype: bool = False,
name: bool = False,
max_rows: int... | Render a string representation of the Series.
Parameters
----------
buf : StringIO-like, optional
Buffer to write to.
na_rep : str, optional
String representation of NaN to use, default 'NaN'.
float_format : one-parameter function, optional
Formatter function to apply to columns' elements if they are
f... | python | pandas/core/series.py | 1,491 | [
"self",
"buf",
"na_rep",
"float_format",
"header",
"index",
"length",
"dtype",
"name",
"max_rows",
"min_rows"
] | str | None | true | 6 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
addPropertyValues | public MutablePropertyValues addPropertyValues(@Nullable Map<?, ?> other) {
if (other != null) {
other.forEach((attrName, attrValue) -> addPropertyValue(
new PropertyValue(attrName.toString(), attrValue)));
}
return this;
} | Add all property values from the given Map.
@param other a Map with property values keyed by property name,
which must be a String
@return this in order to allow for adding multiple property values in a chain | java | spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java | 159 | [
"other"
] | MutablePropertyValues | true | 2 | 8.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
verifyIndex | private boolean verifyIndex(int i) {
if ((getLeftChildIndex(i) < size) && (compareElements(i, getLeftChildIndex(i)) > 0)) {
return false;
}
if ((getRightChildIndex(i) < size) && (compareElements(i, getRightChildIndex(i)) > 0)) {
return false;
}
if ((i > 0) && (compareElemen... | Fills the hole at {@code index} by moving in the least of its grandchildren to this position,
then recursively filling the new hole created.
@return the position of the new hole (where the lowest grandchild moved from, that had no
grandchild to replace it) | java | android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java | 729 | [
"i"
] | true | 9 | 6.72 | google/guava | 51,352 | javadoc | false | |
create | public static <T> EventListenerSupport<T> create(final Class<T> listenerInterface) {
return new EventListenerSupport<>(listenerInterface);
} | Creates an EventListenerSupport object which supports the specified
listener type.
@param <T> the type of the listener interface
@param listenerInterface the type of listener interface that will receive
events posted using this class.
@return an EventListenerSupport object which supports the specified
li... | java | src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java | 153 | [
"listenerInterface"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
processBitVectors | public static <E extends Enum<E>> EnumSet<E> processBitVectors(final Class<E> enumClass, final long... values) {
final EnumSet<E> results = EnumSet.noneOf(asEnum(enumClass));
final long[] lvalues = ArrayUtils.clone(Objects.requireNonNull(values, "values"));
ArrayUtils.reverse(lvalues);
s... | Convert a {@code long[]} created by {@link EnumUtils#generateBitVectors} into the set of
enum values that it represents.
<p>If you store this value, beware any changes to the enum that would affect ordinal values.</p>
@param enumClass the class of the enum we are working with, not {@code null}.
@param values the lo... | java | src/main/java/org/apache/commons/lang3/EnumUtils.java | 444 | [
"enumClass"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
next_gb_id | def next_gb_id(reg: dict[str, Any]) -> str:
"""Generate a random unused GB ID from GB0000-GB9999 range."""
used_ids = set(reg.keys())
max_attempts = 100
# Try random selection first
for _ in range(max_attempts):
candidate = f"GB{random.randint(0, 9999):04d}"
if candidate not in used... | Generate a random unused GB ID from GB0000-GB9999 range. | python | tools/dynamo/gb_id_mapping.py | 26 | [
"reg"
] | str | true | 5 | 6 | pytorch/pytorch | 96,034 | unknown | false |
createArray | private static Object createArray(Class<?> arrayType) {
Assert.notNull(arrayType, "Array type must not be null");
Class<?> componentType = arrayType.componentType();
if (componentType.isArray()) {
Object array = Array.newInstance(componentType, 1);
Array.set(array, 0, createArray(componentType));
return ... | Create the array for the given array type.
@param arrayType the desired type of the target array
@return a new array instance | java | spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java | 927 | [
"arrayType"
] | Object | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
__set_dag_run_state_to_running_or_queued | def __set_dag_run_state_to_running_or_queued(
*,
new_state: DagRunState,
dag: SerializedDAG,
run_id: str | None = None,
commit: bool = False,
session: SASession,
) -> list[TaskInstance]:
"""
Set the dag run for a specific logical date to running.
:param dag: the DAG of which to alte... | Set the dag run for a specific logical date to running.
:param dag: the DAG of which to alter state
:param run_id: the id of the DagRun
:param commit: commit DAG and tasks to be altered to the database
:param session: database session
:return: If commit is true, list of tasks that have been updated,
otherwise... | python | airflow-core/src/airflow/api/common/mark_tasks.py | 356 | [
"new_state",
"dag",
"run_id",
"commit",
"session"
] | list[TaskInstance] | true | 4 | 7.92 | apache/airflow | 43,597 | sphinx | false |
create_model_package_group | def create_model_package_group(self, package_group_name: str, package_group_desc: str = "") -> bool:
"""
Create a Model Package Group if it does not already exist.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.create_model_package_group`
:param package_group_name... | Create a Model Package Group if it does not already exist.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.create_model_package_group`
:param package_group_name: Name of the model package group to create if not already present.
:param package_group_desc: Description of the model package group, if it was ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 1,187 | [
"self",
"package_group_name",
"package_group_desc"
] | bool | true | 3 | 7.6 | apache/airflow | 43,597 | sphinx | false |
getRightHandSideOfAssignment | function getRightHandSideOfAssignment(rightHandSide: Expression): FunctionExpression | ArrowFunction | ConstructorDeclaration | undefined {
while (rightHandSide.kind === SyntaxKind.ParenthesizedExpression) {
rightHandSide = (rightHandSide as ParenthesizedExpression).expression;
}
switch (right... | Checks if position points to a valid position to add JSDoc comments, and if so,
returns the appropriate template. Otherwise returns an empty string.
Valid positions are
- outside of comments, statements, and expressions, and
- preceding a:
- function/constructor/method declaration
- cl... | typescript | src/services/jsDoc.ts | 634 | [
"rightHandSide"
] | true | 2 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
build | @Override
public String build() {
return toString();
} | Implement the {@link Builder} interface.
@return the builder as a String
@since 3.2
@see #toString() | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,564 | [] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
detectAndParse | public static Duration detectAndParse(String value, DurationFormat.@Nullable Unit unit) {
return parse(value, detect(value), unit);
} | Detect the style then parse the value to return a duration.
@param value the value to parse
@param unit the duration unit to use if the value doesn't specify one ({@code null}
will default to ms)
@return the parsed duration
@throws IllegalArgumentException if the value is not a known style or cannot be
parsed | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DurationFormatterUtils.java | 146 | [
"value",
"unit"
] | Duration | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false |
deleteRecords | DeleteRecordsResult deleteRecords(Map<TopicPartition, RecordsToDelete> recordsToDelete,
DeleteRecordsOptions options); | Delete records whose offset is smaller than the given offset of the corresponding partition.
<p>
This operation is supported by brokers with version 0.11.0.0 or higher.
@param recordsToDelete The topic partitions and related offsets from which records deletion starts.
@param options The options to use when dele... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 702 | [
"recordsToDelete",
"options"
] | DeleteRecordsResult | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
addAndGet | public short addAndGet(final Number operand) {
this.value += operand.shortValue();
return value;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately after the addition operation. This method is not thread safe.
@param operand the quantity to add, not null.
@throws NullPointerException if {@code operand} is null.
@return the value associated wi... | java | src/main/java/org/apache/commons/lang3/mutable/MutableShort.java | 112 | [
"operand"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
createPrincipalBuilder | public static KafkaPrincipalBuilder createPrincipalBuilder(Map<String, ?> configs,
KerberosShortNamer kerberosShortNamer,
SslPrincipalMapper sslPrincipalMapper) {
Class<?> principalBuild... | @return a mutable RecordingMap. The elements got from RecordingMap are marked as "used". | java | clients/src/main/java/org/apache/kafka/common/network/ChannelBuilders.java | 219 | [
"configs",
"kerberosShortNamer",
"sslPrincipalMapper"
] | KafkaPrincipalBuilder | true | 5 | 6.72 | apache/kafka | 31,560 | javadoc | false |
prepareAcquire | private void prepareAcquire() {
if (isShutdown()) {
throw new IllegalStateException("TimedSemaphore is shut down!");
}
if (task == null) {
task = startTimer();
}
} | Prepares an acquire operation. Checks for the current state and starts the internal timer if necessary. This method must be called with the lock of this
object held. | java | src/main/java/org/apache/commons/lang3/concurrent/TimedSemaphore.java | 422 | [] | void | true | 3 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
appendSeparator | public StrBuilder appendSeparator(final String standard, final String defaultIfEmpty) {
final String str = isEmpty() ? defaultIfEmpty : standard;
if (str != null) {
append(str);
}
return this;
} | Appends one of both separators to the StrBuilder.
If the builder is currently empty it will append the defaultIfEmpty-separator
Otherwise it will append the standard-separator
Appending a null separator will have no effect.
The separator is appended using {@link #append(String)}.
<p>
This method is for example useful f... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,359 | [
"standard",
"defaultIfEmpty"
] | StrBuilder | true | 3 | 7.44 | apache/commons-lang | 2,896 | javadoc | false |
_convert_slice_indexer | def _convert_slice_indexer(self, key: slice, kind: Literal["loc", "getitem"]):
"""
Convert a slice indexer.
By definition, these are labels unless 'iloc' is passed in.
Floats are not allowed as the start, step, or stop of the slice.
Parameters
----------
key : l... | Convert a slice indexer.
By definition, these are labels unless 'iloc' is passed in.
Floats are not allowed as the start, step, or stop of the slice.
Parameters
----------
key : label of the slice bound
kind : {'loc', 'getitem'} | python | pandas/core/indexes/base.py | 4,046 | [
"self",
"key",
"kind"
] | true | 12 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false | |
equals | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MetricNameTemplate other = (MetricNameTemplate) o;
return Objects.equals(name, other.name) && Objects.equals(group, other.group) ... | Get the set of tag names for the metric.
@return the ordered set of tag names; never null but possibly empty | java | clients/src/main/java/org/apache/kafka/common/MetricNameTemplate.java | 114 | [
"o"
] | true | 6 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
bean | public AbstractBeanDefinition bean(Class<?> type, Object...args) {
GroovyBeanDefinitionWrapper current = this.currentBeanDefinition;
try {
Closure<?> callable = null;
Collection<Object> constructorArgs = null;
if (!ObjectUtils.isEmpty(args)) {
int index = args.length;
Object lastArg = args[index - ... | Define an inner bean definition.
@param type the bean type
@param args the constructors arguments and closure configurer
@return the bean definition | java | spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java | 315 | [
"type"
] | AbstractBeanDefinition | true | 4 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
paired_cosine_distances | def paired_cosine_distances(X, Y):
"""
Compute the paired cosine distances between X and Y.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
An array where each row is a sample and each column is a feat... | Compute the paired cosine distances between X and Y.
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
An array where each row is a sample and each column is a feature.
Y : {array-like, sparse matrix} of shape (n_samples, n_featur... | python | sklearn/metrics/pairwise.py | 1,266 | [
"X",
"Y"
] | false | 1 | 6.48 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
unmodifiableValueCollection | private static <V extends @Nullable Object> Collection<V> unmodifiableValueCollection(
Collection<V> collection) {
if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<V>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiable... | Returns an unmodifiable view of the specified collection, preserving the interface for
instances of {@code SortedSet}, {@code Set}, {@code List} and {@code Collection}, in that order
of preference.
@param collection the collection for which to return an unmodifiable view
@return an unmodifiable view of the collection | java | android/guava/src/com/google/common/collect/Multimaps.java | 1,031 | [
"collection"
] | true | 4 | 7.6 | google/guava | 51,352 | javadoc | false | |
getAutowireCapableBeanFactory | @Override
public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
assertBeanFactoryActive();
return this.beanFactory;
} | Return the underlying bean factory of this context,
available for registering bean definitions.
<p><b>NOTE:</b> You need to call {@link #refresh()} to initialize the
bean factory and its contained beans with application context semantics
(autodetecting BeanFactoryPostProcessors, etc).
@return the internal bean factory ... | java | spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java | 334 | [] | AutowireCapableBeanFactory | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
escapeRegExp | function escapeRegExp(string) {
string = toString(string);
return (string && reHasRegExpChar.test(string))
? string.replace(reRegExpChar, '\\$&')
: string;
} | Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
"?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
@static
@memberOf _
@since 3.0.0
@category String
@param {string} [string=''] The string to escape.
@returns {string} Returns the escaped string.
@example
_.escapeRegExp('[lodash](https://lodash... | javascript | lodash.js | 14,380 | [
"string"
] | false | 3 | 7.04 | lodash/lodash | 61,490 | jsdoc | false | |
alterStreamsGroupOffsets | default AlterStreamsGroupOffsetsResult alterStreamsGroupOffsets(String groupId, Map<TopicPartition, OffsetAndMetadata> offsets) {
return alterStreamsGroupOffsets(groupId, offsets, new AlterStreamsGroupOffsetsOptions());
} | <p>Alters offsets for the specified group. In order to succeed, the group must be empty.
<p>This is a convenience method for {@link #alterStreamsGroupOffsets(String, Map, AlterStreamsGroupOffsetsOptions)} with default options.
See the overload for more details.
@param groupId The group for which to alter offsets.
@para... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,305 | [
"groupId",
"offsets"
] | AlterStreamsGroupOffsetsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
_get_func_name | def _get_func_name(func):
"""Get function full name.
Parameters
----------
func : callable
The function object.
Returns
-------
name : str
The function name.
"""
parts = []
module = inspect.getmodule(func)
if module:
parts.append(module.__name__)
... | Get function full name.
Parameters
----------
func : callable
The function object.
Returns
-------
name : str
The function name. | python | sklearn/utils/_testing.py | 453 | [
"func"
] | false | 3 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
xContentType | @Deprecated
public static XContentType xContentType(byte[] bytes, int offset, int length) {
int totalLength = bytes.length;
if (totalLength == 0 || length == 0) {
return null;
} else if ((offset + length) > totalLength) {
return null;
}
byte first = by... | Guesses the content type based on the provided bytes.
@deprecated the content type should not be guessed except for few cases where we effectively don't know the content type.
The REST layer should move to reading the Content-Type header instead. There are other places where auto-detection may be needed.
This method is... | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentFactory.java | 278 | [
"bytes",
"offset",
"length"
] | XContentType | true | 15 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.