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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hasStaticLocalVariable | static bool hasStaticLocalVariable(const Stmt *Cond) {
if (const auto *DRE = dyn_cast<DeclRefExpr>(Cond)) {
if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
if (VD->isStaticLocal())
return true;
if (const auto *BD = dyn_cast<BindingDecl>(DRE->getDecl()))
if (const auto *DD = dyn_ca... | returns true iff `Cond` involves at least one static local variable. | cpp | clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp | 225 | [] | true | 8 | 6.88 | llvm/llvm-project | 36,021 | doxygen | false | |
getTypeArguments | private static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass, final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
if (type instanceof Class<?>) {
return getTypeArguments((Class<?>) type, toClass, subtypeVarAssigns);
}
if (type instanceof Parame... | Gets a map of the type arguments of {@code type} in the context of {@code toClass}.
@param type the type in question.
@param toClass the class.
@param subtypeVarAssigns a map with type variables.
@return the {@link Map} with type arguments. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 884 | [
"type",
"toClass",
"subtypeVarAssigns"
] | true | 9 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
invoke | @Override
public @Nullable Object invoke(final MethodInvocation invocation) throws Throwable {
Class<?> targetClass = (invocation.getThis() != null ? AopUtils.getTargetClass(invocation.getThis()) : null);
final Method userMethod = BridgeMethodResolver.getMostSpecificMethod(invocation.getMethod(), targetClass);
... | Intercept the given method invocation, submit the actual calling of the method to
the correct task executor and return immediately to the caller.
@param invocation the method to intercept and make asynchronous
@return {@link Future} if the original method returns {@code Future}; {@code null}
otherwise. | java | spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionInterceptor.java | 99 | [
"invocation"
] | Object | true | 7 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
handleResponse | LookupResult<T> handleResponse(Set<T> keys, AbstractResponse response); | Callback that is invoked when a lookup request returns successfully. The handler
should parse the response, check for errors, and return a result indicating
which keys were mapped to a brokerId successfully and which keys received
a fatal error (e.g. a topic authorization failure).
Note that keys which receive a retria... | java | clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminApiLookupStrategy.java | 84 | [
"keys",
"response"
] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
truncatedEquals | public static boolean truncatedEquals(final Calendar cal1, final Calendar cal2, final int field) {
return truncatedCompareTo(cal1, cal2, field) == 0;
} | Determines if two calendars are equal up to no more than the specified
most significant field.
@param cal1 the first calendar, not {@code null}.
@param cal2 the second calendar, not {@code null}.
@param field the field from {@link Calendar}.
@return {@code true} if equal; otherwise {@code false}.
@throws NullPointerExc... | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,824 | [
"cal1",
"cal2",
"field"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
header_data_from_array_1_0 | def header_data_from_array_1_0(array):
""" Get the dictionary of header metadata from a numpy.ndarray.
Parameters
----------
array : numpy.ndarray
Returns
-------
d : dict
This has the appropriate entries for writing its string representation
to the header of the file.
... | Get the dictionary of header metadata from a numpy.ndarray.
Parameters
----------
array : numpy.ndarray
Returns
-------
d : dict
This has the appropriate entries for writing its string representation
to the header of the file. | python | numpy/lib/_format_impl.py | 369 | [
"array"
] | false | 4 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
clone | public static int[] clone(final int[] array) {
return array != null ? array.clone() : null;
} | Clones an array or returns {@code null}.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array the array to clone, may be {@code null}.
@return the cloned array, {@code null} if {@code null} input. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1,518 | [
"array"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
codeActionForFixWorker | function codeActionForFixWorker(
changes: textChanges.ChangeTracker,
sourceFile: SourceFile,
symbolName: string,
fix: ImportFix,
includeSymbolNameInDescription: boolean,
program: Program,
preferences: UserPreferences,
): DiagnosticOrDiagnosticAndArguments {
const quotePreference... | @param forceImportKeyword Indicates that the user has already typed `import`, so the result must start with `import`.
(In other words, do not allow `const x = require("...")` for JS files.)
@internal | typescript | src/services/codefixes/importFixes.ts | 1,711 | [
"changes",
"sourceFile",
"symbolName",
"fix",
"includeSymbolNameInDescription",
"program",
"preferences"
] | true | 13 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
create_program_file | def create_program_file(python_code: str) -> str:
"""
Create a temporary Python file from the generated code.
Args:
python_code: String containing Python code to write
Returns:
Path to the created temporary file
"""
import hashlib
# Generate a deterministic filename based ... | Create a temporary Python file from the generated code.
Args:
python_code: String containing Python code to write
Returns:
Path to the created temporary file | python | tools/experimental/torchfuzz/codegen.py | 722 | [
"python_code"
] | str | true | 1 | 6.72 | pytorch/pytorch | 96,034 | google | false |
fuzz_spec | def fuzz_spec(template: str = "default") -> Spec:
"""
Generate a random Spec (either TensorSpec or ScalarSpec) using template's distribution preferences.
Args:
template: Template name to determine configuration and distribution
Returns:
Spec: Either a TensorSpec or ScalarSpec according... | Generate a random Spec (either TensorSpec or ScalarSpec) using template's distribution preferences.
Args:
template: Template name to determine configuration and distribution
Returns:
Spec: Either a TensorSpec or ScalarSpec according to template's distribution | python | tools/experimental/torchfuzz/ops_fuzzer.py | 226 | [
"template"
] | Spec | true | 5 | 7.44 | pytorch/pytorch | 96,034 | google | false |
destroyPrototypeInstance | protected void destroyPrototypeInstance(Object target) {
if (logger.isDebugEnabled()) {
logger.debug("Destroying instance of bean '" + this.targetBeanName + "'");
}
if (getBeanFactory() instanceof ConfigurableBeanFactory cbf) {
cbf.destroyBean(getTargetBeanName(), target);
}
else if (target instanceof D... | Subclasses should call this method to destroy an obsolete prototype instance.
@param target the bean instance to destroy | java | spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java | 76 | [
"target"
] | void | true | 5 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
get_table_primary_key | def get_table_primary_key(
self,
table: str,
database: str,
schema: str | None = "public",
cluster_identifier: str | None = None,
workgroup_name: str | None = None,
db_user: str | None = None,
secret_arn: str | None = None,
statement_name: str | No... | Return the table primary key.
Copied from ``RedshiftSQLHook.get_table_primary_key()``
:param table: Name of the target table
:param database: the name of the database
:param schema: Name of the target schema, public by default
:param cluster_identifier: unique identifier of a cluster
:param workgroup_name: name of th... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_data.py | 195 | [
"self",
"table",
"database",
"schema",
"cluster_identifier",
"workgroup_name",
"db_user",
"secret_arn",
"statement_name",
"with_event",
"wait_for_completion",
"poll_interval"
] | list[str] | None | true | 6 | 7.52 | apache/airflow | 43,597 | sphinx | false |
isocalendar | def isocalendar(self) -> DataFrame:
"""
Calculate year, week, and day according to the ISO 8601 standard.
Returns
-------
DataFrame
With columns year, week and day.
See Also
--------
Timestamp.isocalendar : Function return a 3-tuple containin... | Calculate year, week, and day according to the ISO 8601 standard.
Returns
-------
DataFrame
With columns year, week and day.
See Also
--------
Timestamp.isocalendar : Function return a 3-tuple containing ISO year,
week number, and weekday for the given Timestamp object.
datetime.date.isocalendar : Return a na... | python | pandas/core/arrays/datetimes.py | 1,554 | [
"self"
] | DataFrame | true | 2 | 8.48 | pandas-dev/pandas | 47,362 | unknown | false |
crossOverUp | int crossOverUp(int index, E x) {
if (index == 0) {
queue[0] = x;
return 0;
}
int parentIndex = getParentIndex(index);
E parentElement = elementData(parentIndex);
if (parentIndex != 0) {
/*
* This is a guard for the case of the childless aunt node. Since th... | Moves an element one level up from a min level to a max level (or vice versa). Returns the
new position of the element. | java | android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java | 633 | [
"index",
"x"
] | true | 7 | 6 | google/guava | 51,352 | javadoc | false | |
equalsPropertyValues | private boolean equalsPropertyValues(AbstractBeanDefinition other) {
if (!hasPropertyValues()) {
return !other.hasPropertyValues();
}
return ObjectUtils.nullSafeEquals(this.propertyValues, other.propertyValues);
} | Clone this bean definition.
To be implemented by concrete subclasses.
@return the cloned bean definition object | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java | 1,332 | [
"other"
] | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false | |
poll | @Override
public ConsumerRecords<K, V> poll(final Duration timeout) {
Timer timer = time.timer(timeout);
acquireAndEnsureOpen();
try {
kafkaConsumerMetrics.recordPollStart(timer.currentTimeMs());
if (subscriptions.hasNoSubscriptionOrUserAssignment()) {
... | poll implementation using {@link ApplicationEventHandler}.
1. Poll for background events. If there's a fetch response event, process the record and return it. If it is
another type of event, process it.
2. Send fetches if needed.
If the timeout expires, return an empty ConsumerRecord.
@param timeout timeout of the ... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 835 | [
"timeout"
] | true | 4 | 7.6 | apache/kafka | 31,560 | javadoc | false | |
readLines | @Deprecated
@InlineMe(
replacement = "Files.asCharSource(file, charset).readLines(callback)",
imports = "com.google.common.io.Files")
@CanIgnoreReturnValue // some processors won't return a useful result
@ParametricNullness
public
static <T extends @Nullable Object> T readLines(
File file, C... | Streams lines from a {@link File}, stopping when our callback returns false, or we have read
all of the lines.
@param file the file to read from
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@param callback the {@link LineProcessor} to use ... | java | android/guava/src/com/google/common/io/Files.java | 576 | [
"file",
"charset",
"callback"
] | T | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false |
processTemplateIntoString | public static String processTemplateIntoString(Template template, Object model)
throws IOException, TemplateException {
StringWriter result = new StringWriter(1024);
template.process(model, result);
return result.toString();
} | Process the specified FreeMarker template with the given model and write
the result to a String.
<p>When using this method to prepare text for a mail to be sent with Spring's
mail support, consider wrapping IO/TemplateException in MailPreparationException.
@param model the model object, typically a Map that contains mo... | java | spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerTemplateUtils.java | 47 | [
"template",
"model"
] | String | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
parseIdentifierNameErrorOnUnicodeEscapeSequence | function parseIdentifierNameErrorOnUnicodeEscapeSequence(): Identifier {
if (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape()) {
parseErrorAtCurrentToken(Diagnostics.Unicode_escape_sequence_cannot_appear_here);
}
return createIdentifier(tokenIsIdentifierOrKeyword(... | 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 | 2,696 | [] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
mayNeedHiddenThis | private boolean mayNeedHiddenThis() {
Class<?> declaringClass = constructor.getDeclaringClass();
if (declaringClass.getEnclosingConstructor() != null) {
// Enclosed in a constructor, needs hidden this
return true;
}
Method enclosingMethod = declaringClass.getEnclosingMethod();
... | {@inheritDoc}
<p>{@code [<E>]} will be returned for ArrayList's constructor. When both the class and the
constructor have type parameters, the class parameters are prepended before those of the
constructor's. This is an arbitrary rule since no existing language spec mandates one way or
the other. From the declaration s... | java | android/guava/src/com/google/common/reflect/Invokable.java | 489 | [] | true | 4 | 6.88 | google/guava | 51,352 | javadoc | false | |
pop | def pop(self, name: str, default: t.Any = _sentinel) -> t.Any:
"""Get and remove an attribute by name. Like :meth:`dict.pop`.
:param name: Name of attribute to pop.
:param default: Value to return if the attribute is not present,
instead of raising a ``KeyError``.
.. versio... | Get and remove an attribute by name. Like :meth:`dict.pop`.
:param name: Name of attribute to pop.
:param default: Value to return if the attribute is not present,
instead of raising a ``KeyError``.
.. versionadded:: 0.11 | python | src/flask/ctx.py | 78 | [
"self",
"name",
"default"
] | t.Any | true | 3 | 6.88 | pallets/flask | 70,946 | sphinx | false |
newReference | public static <V> AtomicReference<@Nullable V> newReference() {
return new AtomicReference<>();
} | Creates an {@code AtomicReference} instance with no initial value.
@return a new {@code AtomicReference} with no initial value | java | android/guava/src/com/google/common/util/concurrent/Atomics.java | 37 | [] | true | 1 | 6 | google/guava | 51,352 | javadoc | false | |
readHeader | private void readHeader() throws IOException {
// read first 6 bytes into buffer to check magic and FLG/BD descriptor flags
if (in.remaining() < 6) {
throw new IOException(PREMATURE_EOS);
}
if (MAGIC != in.getInt()) {
throw new IOException(NOT_SUPPORTED);
... | Reads the magic number and frame descriptor from input buffer.
@throws IOException | java | clients/src/main/java/org/apache/kafka/common/compress/Lz4BlockInputStream.java | 115 | [] | void | true | 7 | 7.04 | apache/kafka | 31,560 | javadoc | false |
request | function request(...args) {
let options = {};
if (typeof args[0] === 'string') {
const urlStr = ArrayPrototypeShift(args);
options = urlToHttpOptions(new URL(urlStr));
} else if (isURL(args[0])) {
options = urlToHttpOptions(ArrayPrototypeShift(args));
}
if (args[0] && typeof args[0] !== 'functio... | Makes a request to a secure web server.
@param {...any} args
@returns {ClientRequest} | javascript | lib/https.js | 612 | [] | false | 6 | 7.28 | nodejs/node | 114,839 | jsdoc | false | |
getHostAndPortFromBracketedHost | private static String[] getHostAndPortFromBracketedHost(String hostPortString) {
checkArgument(
hostPortString.charAt(0) == '[',
"Bracketed host-port string must start with a bracket: %s",
hostPortString);
int colonIndex = hostPortString.indexOf(':');
int closeBracketIndex = hostPort... | Parses a bracketed host-port string, throwing IllegalArgumentException if parsing fails.
@param hostPortString the full bracketed host-port specification. Port might not be specified.
@return an array with 2 strings: host and port, in that order.
@throws IllegalArgumentException if parsing the bracketed host-port strin... | java | android/guava/src/com/google/common/net/HostAndPort.java | 210 | [
"hostPortString"
] | true | 4 | 7.6 | google/guava | 51,352 | javadoc | false | |
run | public int run(boolean waitForProcess, Collection<String> args, Map<String, String> environmentVariables)
throws IOException {
ProcessBuilder builder = new ProcessBuilder(this.command);
builder.directory(this.workingDirectory);
builder.command().addAll(args);
builder.environment().putAll(environmentVariables... | Creates new {@link RunProcess} instance for the specified working directory and
command.
@param workingDirectory the working directory of the child process or {@code null}
to run in the working directory of the current Java process
@param command the program to execute and its arguments | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/RunProcess.java | 74 | [
"waitForProcess",
"args",
"environmentVariables"
] | true | 4 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getLocalPropertyHandler | @Override
protected @Nullable PropertyHandler getLocalPropertyHandler(String propertyName) {
FieldPropertyHandler propertyHandler = this.fieldMap.get(propertyName);
if (propertyHandler == null) {
Field field = ReflectionUtils.findField(getWrappedClass(), propertyName);
if (field != null) {
propertyHandle... | Create a new DirectFieldAccessor for the given object,
registering a nested path that the object is in.
@param object the object wrapped by this DirectFieldAccessor
@param nestedPath the nested path of the object
@param parent the containing DirectFieldAccessor (must not be {@code null}) | java | spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java | 75 | [
"propertyName"
] | PropertyHandler | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
strict | function strict(...args) {
innerOk(strict, ...args);
} | Expose a strict only variant of assert.
@param {...any} args
@returns {void} | javascript | lib/assert.js | 881 | [] | false | 1 | 6.16 | nodejs/node | 114,839 | jsdoc | false | |
createProxyClassAndInstance | @Override
protected Object createProxyClassAndInstance(Enhancer enhancer, Callback[] callbacks) {
Class<?> proxyClass = enhancer.createClass();
Object proxyInstance = null;
if (objenesis.isWorthTrying()) {
try {
proxyInstance = objenesis.newInstance(proxyClass, enhancer.getUseCache());
}
catch (Thr... | Create a new ObjenesisCglibAopProxy for the given AOP configuration.
@param config the AOP configuration as AdvisedSupport object | java | spring-aop/src/main/java/org/springframework/aop/framework/ObjenesisCglibAopProxy.java | 60 | [
"enhancer",
"callbacks"
] | Object | true | 7 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
secure | public static RandomUtils secure() {
return SECURE;
} | Gets the singleton instance based on {@link SecureRandom#SecureRandom()} which uses the default algorithm
and provider of {@link SecureRandom}.
<p>
The method {@link SecureRandom#SecureRandom()} is called on-demand.
</p>
@return the singleton instance based on {@link SecureRandom#SecureRandom()}.
@see SecureRandom#Secu... | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 250 | [] | RandomUtils | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
get_dagrun | def get_dagrun(self, session: Session = NEW_SESSION) -> DagRun:
"""
Return the DagRun for this TaskInstance.
:param session: SQLAlchemy ORM Session
:return: DagRun
"""
info: Any = inspect(self)
if info.attrs.dag_run.loaded_value is not NO_VALUE:
if ge... | Return the DagRun for this TaskInstance.
:param session: SQLAlchemy ORM Session
:return: DagRun | python | airflow-core/src/airflow/models/taskinstance.py | 1,005 | [
"self",
"session"
] | DagRun | true | 6 | 7.6 | apache/airflow | 43,597 | sphinx | false |
_prepareBenchpressSetup | async function _prepareBenchpressSetup(): Promise<BenchpressSetup> {
const module = await loadBenchpressModule();
const {
SeleniumWebDriverAdapter,
Options,
JsonFileReporter,
RegressionSlopeValidator,
Validator,
MultiReporter,
ConsoleReporter,
SizeValidator,
MultiMetric,
Runn... | @license
Copyright Google LLC
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE file at https://angular.io/license | typescript | modules/utilities/perf_util.ts | 71 | [] | true | 5 | 6.56 | angular/angular | 99,544 | jsdoc | true | |
from_spmatrix | def from_spmatrix(cls, data: _SparseMatrixLike) -> Self:
"""
Create a SparseArray from a scipy.sparse matrix.
Parameters
----------
data : scipy.sparse.sp_matrix
This should be a SciPy sparse matrix where the size
of the second dimension is 1. In other wo... | Create a SparseArray from a scipy.sparse matrix.
Parameters
----------
data : scipy.sparse.sp_matrix
This should be a SciPy sparse matrix where the size
of the second dimension is 1. In other words, a
sparse matrix with a single column.
Returns
-------
SparseArray
Examples
--------
>>> import scipy.spars... | python | pandas/core/arrays/sparse/array.py | 522 | [
"cls",
"data"
] | Self | true | 2 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
resolveTargetType | protected @Nullable Class<?> resolveTargetType(TypedStringValue value) throws ClassNotFoundException {
if (value.hasTargetType()) {
return value.getTargetType();
}
return value.resolveTargetType(this.beanFactory.getBeanClassLoader());
} | Resolve the target type in the given TypedStringValue.
@param value the TypedStringValue to resolve
@return the resolved target type (or {@code null} if none specified)
@throws ClassNotFoundException if the specified type cannot be resolved
@see TypedStringValue#resolveTargetType | java | spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java | 322 | [
"value"
] | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false | |
deprecate | def deprecate(
klass: type[Warning],
name: str,
alternative: Callable[..., Any],
version: str,
alt_name: str | None = None,
stacklevel: int = 2,
msg: str | None = None,
) -> Callable[[F], F]:
"""
Return a new function that emits a deprecation warning on use.
To use this method f... | Return a new function that emits a deprecation warning on use.
To use this method for a deprecated function, another function
`alternative` with the same signature must exist. The deprecated
function will emit a deprecation warning, and in the docstring
it will contain the deprecation directive with the provided versi... | python | pandas/util/_decorators.py | 29 | [
"klass",
"name",
"alternative",
"version",
"alt_name",
"stacklevel",
"msg"
] | Callable[[F], F] | true | 9 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
setConfigLocations | public void setConfigLocations(String @Nullable ... locations) {
if (locations != null) {
Assert.noNullElements(locations, "Config locations must not be null");
this.configLocations = new String[locations.length];
for (int i = 0; i < locations.length; i++) {
this.configLocations[i] = resolvePath(location... | Set the config locations for this application context.
<p>If not set, the implementation may use a default as appropriate. | java | spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java | 76 | [] | void | true | 3 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
hasPrevious | @Override
public boolean hasPrevious() {
checkTokenized();
return tokenPos > 0;
} | Checks whether there are any previous tokens that can be iterated to.
@return true if there are previous tokens. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 578 | [] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
_validate_extra_conf | def _validate_extra_conf(conf: dict[Any, Any]) -> bool:
"""
Check configuration values are either strings or ints.
:param conf: configuration variable
"""
if conf:
if not isinstance(conf, dict):
raise ValueError("'conf' argument must be a dict")
... | Check configuration values are either strings or ints.
:param conf: configuration variable | python | providers/alibaba/src/airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py | 315 | [
"conf"
] | bool | true | 5 | 6.4 | apache/airflow | 43,597 | sphinx | false |
getX509CertificateChain | public List<? extends X509Certificate> getX509CertificateChain() {
try {
final Certificate[] certificates = store.getCertificateChain(alias);
if (certificates == null || certificates.length == 0) {
return List.of();
}
return... | If this entry is a private key entry (see {@link #isKeyEntry()}), returns the certificate chain that is stored in the entry.
If the entry contains any certificates that are not X.509 certificates, they are ignored.
If the entry is not a private key entry, or it does not contain any X.509 certificates, then an empty lis... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/KeyStoreUtil.java | 286 | [] | true | 4 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false | |
findProperty | private <T> @Nullable ConfigurationProperty findProperty(ConfigurationPropertyName name, Bindable<T> target,
Context context) {
if (name.isEmpty() || target.hasBindRestriction(BindRestriction.NO_DIRECT_PROPERTY)) {
return null;
}
for (ConfigurationPropertySource source : context.getSources()) {
Configura... | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources} or create a new instance using
the type of the {@link Bindable} if the result of the binding is {@code null}.
@param name the configuration property name to bind
@param target the target bindable
@param h... | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | 473 | [
"name",
"target",
"context"
] | ConfigurationProperty | true | 4 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
append | public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
final int precision, final char padChar, final CharSequence ellipsis) {
Validate.isTrue(ellipsis == null || precision < 0 || ellipsis.length() <= precision,
"Specified ... | Handles the common {@link Formattable} operations of truncate-pad-append.
@param seq the string to handle, not null.
@param formatter the destination formatter, not null.
@param flags the flags for formatting, see {@link Formattable}.
@param width the width of the output, see {@link Formattable}.
@param precision ... | java | src/main/java/org/apache/commons/lang3/text/FormattableUtils.java | 94 | [
"seq",
"formatter",
"flags",
"width",
"precision",
"padChar",
"ellipsis"
] | Formatter | true | 7 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
cloneException | private static <T extends Throwable> @Nullable T cloneException(T exception) {
try {
return SerializationUtils.clone(exception);
}
catch (Exception ex) {
return null; // exception parameter cannot be cloned
}
} | Rewrite the call stack of the specified {@code exception} so that it matches
the current call stack up to (included) the specified method invocation.
<p>Clone the specified exception. If the exception is not {@code serializable},
the original exception is returned. If no common ancestor can be found, returns
the origin... | java | spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheResultInterceptor.java | 148 | [
"exception"
] | T | true | 2 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
round | def round(self, decimals: int = 0, *args, **kwargs):
"""
Round each value in the array a to the given number of decimals.
Parameters
----------
decimals : int, default 0
Number of decimal places to round to. If decimals is negative,
it specifies the numbe... | Round each value in the array a to the given number of decimals.
Parameters
----------
decimals : int, default 0
Number of decimal places to round to. If decimals is negative,
it specifies the number of positions to the left of the decimal point.
*args, **kwargs
Additional arguments and keywords have no ef... | python | pandas/core/arrays/masked.py | 463 | [
"self",
"decimals"
] | true | 2 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false | |
invokeBeanSupplier | private T invokeBeanSupplier(@Nullable Executable executable, ThrowingSupplier<T> beanSupplier) {
if (executable instanceof Method method) {
return SimpleInstantiationStrategy.instantiateWithFactoryMethod(method, beanSupplier);
}
return beanSupplier.get();
} | Return a new {@link BeanInstanceSupplier} instance that uses
direct bean name injection shortcuts for specific parameters.
@param beanNames the bean names to use as shortcut (aligned with the
constructor or factory method parameters)
@return a new {@link BeanInstanceSupplier} instance that uses the
given shortcut bean ... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 227 | [
"executable",
"beanSupplier"
] | T | true | 2 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
cloneBuffer | function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;
} | Creates a clone of `buffer`.
@private
@param {Buffer} buffer The buffer to clone.
@param {boolean} [isDeep] Specify a deep clone.
@returns {Buffer} Returns the cloned buffer. | javascript | lodash.js | 4,607 | [
"buffer",
"isDeep"
] | false | 3 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
_extract_template_params | def _extract_template_params(bundle_instance: BaseDagBundle) -> dict:
"""
Extract template parameters from a bundle instance's view_url_template method.
:param bundle_instance: The bundle instance to extract parameters from
:return: Dictionary of template parameters
"""
... | Extract template parameters from a bundle instance's view_url_template method.
:param bundle_instance: The bundle instance to extract parameters from
:return: Dictionary of template parameters | python | airflow-core/src/airflow/dag_processing/bundles/manager.py | 297 | [
"bundle_instance"
] | dict | true | 4 | 7.76 | apache/airflow | 43,597 | sphinx | false |
newInstance | public static CorrelationIdConverter newInstance(String @Nullable [] options) {
String pattern = (!ObjectUtils.isEmpty(options)) ? options[0] : null;
return new CorrelationIdConverter(CorrelationIdFormatter.of(pattern));
} | Factory method to create a new {@link CorrelationIdConverter}.
@param options options, may be null or first element contains name of property to
format.
@return instance of PropertiesPatternConverter. | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/CorrelationIdConverter.java | 65 | [
"options"
] | CorrelationIdConverter | true | 2 | 7.36 | spring-projects/spring-boot | 79,428 | javadoc | false |
_allclose_dense_sparse | def _allclose_dense_sparse(x, y, rtol=1e-7, atol=1e-9):
"""Check allclose for sparse and dense data.
Both x and y need to be either sparse or dense, they
can't be mixed.
Parameters
----------
x : {array-like, sparse matrix}
First array to compare.
y : {array-like, sparse matrix}
... | Check allclose for sparse and dense data.
Both x and y need to be either sparse or dense, they
can't be mixed.
Parameters
----------
x : {array-like, sparse matrix}
First array to compare.
y : {array-like, sparse matrix}
Second array to compare.
rtol : float, default=1e-7
Relative tolerance; see numpy.a... | python | sklearn/utils/validation.py | 2,184 | [
"x",
"y",
"rtol",
"atol"
] | false | 7 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
resetIdempotentProducerId | private void resetIdempotentProducerId() {
if (isTransactional())
throw new IllegalStateException("Cannot reset producer state for a transactional producer. " +
"You must either abort the ongoing transaction or reinitialize the transactional producer instead");
log.debug(... | This method resets the producer ID and epoch and sets the state to UNINITIALIZED, which will trigger a new
InitProducerId request. This method is only called when the producer epoch is exhausted; we will bump the epoch
instead. | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 620 | [] | void | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
ensure_key_mapped | def ensure_key_mapped(
values: ArrayLike | Index | Series, key: Callable | None, levels=None
) -> ArrayLike | Index | Series:
"""
Applies a callable key function to the values function and checks
that the resulting value has the same shape. Can be called on Index
subclasses, Series, DataFrames, or n... | Applies a callable key function to the values function and checks
that the resulting value has the same shape. Can be called on Index
subclasses, Series, DataFrames, or ndarrays.
Parameters
----------
values : Series, DataFrame, Index subclass, or ndarray
key : Optional[Callable], key to be called on the values array
... | python | pandas/core/sorting.py | 551 | [
"values",
"key",
"levels"
] | ArrayLike | Index | Series | true | 6 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
get_sorted_triggers | def get_sorted_triggers(cls, capacity: int, alive_triggerer_ids: list[int] | Select, session: Session):
"""
Get sorted triggers based on capacity and alive triggerer ids.
:param capacity: The capacity of the triggerer.
:param alive_triggerer_ids: The alive triggerer ids as a list or a s... | Get sorted triggers based on capacity and alive triggerer ids.
:param capacity: The capacity of the triggerer.
:param alive_triggerer_ids: The alive triggerer ids as a list or a select query.
:param session: The database session. | python | airflow-core/src/airflow/models/trigger.py | 365 | [
"cls",
"capacity",
"alive_triggerer_ids",
"session"
] | true | 3 | 7.2 | apache/airflow | 43,597 | sphinx | false | |
equalsConstructorArgumentValues | private boolean equalsConstructorArgumentValues(AbstractBeanDefinition other) {
if (!hasConstructorArgumentValues()) {
return !other.hasConstructorArgumentValues();
}
return ObjectUtils.nullSafeEquals(this.constructorArgumentValues, other.constructorArgumentValues);
} | Clone this bean definition.
To be implemented by concrete subclasses.
@return the cloned bean definition object | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java | 1,325 | [
"other"
] | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false | |
cleanUp | void cleanUp() {
if (threadStarted) {
return;
}
Reference<?> reference;
while ((reference = queue.poll()) != null) {
/*
* This is for the benefit of phantom references. Weak and soft references will have already
* been cleared by this point.
*/
reference.clear();
... | Repeatedly dequeues references from the queue and invokes {@link
FinalizableReference#finalizeReferent()} on them until the queue is empty. This method is a
no-op if the background thread was created successfully. | java | android/guava/src/com/google/common/base/FinalizableReferenceQueue.java | 236 | [] | void | true | 4 | 6.24 | google/guava | 51,352 | javadoc | false |
maybeTransitionToErrorState | public synchronized void maybeTransitionToErrorState(RuntimeException exception) {
if (exception instanceof ClusterAuthorizationException
|| exception instanceof TransactionalIdAuthorizationException
|| exception instanceof ProducerFencedException
|| exception ins... | Returns the first inflight sequence for a given partition. This is the base sequence of an inflight batch with
the lowest sequence number.
@return the lowest inflight sequence if the transaction manager is tracking inflight requests for this partition.
If there are no inflight requests being tracked for this pa... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 766 | [
"exception"
] | void | true | 11 | 6.88 | apache/kafka | 31,560 | javadoc | false |
toIntegerObject | public static Integer toIntegerObject(final boolean bool, final Integer trueValue, final Integer falseValue) {
return bool ? trueValue : falseValue;
} | Converts a boolean to an Integer specifying the conversion values.
<pre>
BooleanUtils.toIntegerObject(true, Integer.valueOf(1), Integer.valueOf(0)) = Integer.valueOf(1)
BooleanUtils.toIntegerObject(false, Integer.valueOf(1), Integer.valueOf(0)) = Integer.valueOf(0)
</pre>
@param bool the to convert
@param trueVal... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 958 | [
"bool",
"trueValue",
"falseValue"
] | Integer | true | 2 | 7.2 | apache/commons-lang | 2,896 | javadoc | false |
expireAfterWrite | @Deprecated // GoodTime
@CanIgnoreReturnValue
public CacheBuilder<K, V> expireAfterWrite(long duration, TimeUnit unit) {
checkState(
expireAfterWriteNanos == UNSET_INT,
"expireAfterWrite was already set to %s ns",
expireAfterWriteNanos);
checkArgument(duration >= 0, "duration cannot ... | Specifies that each entry should be automatically removed from the cache once a fixed duration
has elapsed after the entry's creation, or the most recent replacement of its value.
<p>When {@code duration} is zero, this method hands off to {@link #maximumSize(long)
maximumSize}{@code (0)}, ignoring any otherwise-specifi... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 756 | [
"duration",
"unit"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
transformConstructorBodyWorker | function transformConstructorBodyWorker(statementsOut: Statement[], statementsIn: NodeArray<Statement>, statementOffset: number, superPath: readonly number[], superPathDepth: number, initializerStatements: readonly Statement[]) {
const superStatementIndex = superPath[superPathDepth];
const superStatem... | Determines whether to emit a function-like declaration. We should not emit the
declaration if it does not have a body.
@param node The declaration node. | typescript | src/compiler/transformers/ts.ts | 1,345 | [
"statementsOut",
"statementsIn",
"statementOffset",
"superPath",
"superPathDepth",
"initializerStatements"
] | false | 3 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
generate_config_file | def generate_config_file(
self,
eks_cluster_name: str,
pod_namespace: str | None,
credentials_file,
) -> Generator[str, None, None]:
"""
Write the kubeconfig file given an EKS Cluster.
:param eks_cluster_name: The name of the cluster to generate kubeconfig fi... | Write the kubeconfig file given an EKS Cluster.
:param eks_cluster_name: The name of the cluster to generate kubeconfig file for.
:param pod_namespace: The namespace to run within kubernetes. | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 595 | [
"self",
"eks_cluster_name",
"pod_namespace",
"credentials_file"
] | Generator[str, None, None] | true | 2 | 7.12 | apache/airflow | 43,597 | sphinx | false |
expireAfterWrite | @J2ObjCIncompatible
@GwtIncompatible // Duration
@SuppressWarnings("GoodTime") // Duration decomposition
@IgnoreJRERequirement // No more dangerous than wherever the caller got the Duration from
@CanIgnoreReturnValue
public CacheBuilder<K, V> expireAfterWrite(Duration duration) {
return expireAfterWrite(t... | Specifies that each entry should be automatically removed from the cache once a fixed duration
has elapsed after the entry's creation, or the most recent replacement of its value.
<p>When {@code duration} is zero, this method hands off to {@link #maximumSize(long)
maximumSize}{@code (0)}, ignoring any otherwise-specifi... | java | android/guava/src/com/google/common/cache/CacheBuilder.java | 724 | [
"duration"
] | true | 1 | 6.24 | google/guava | 51,352 | javadoc | false | |
isNarrowingExpression | function isNarrowingExpression(expr: Expression): boolean {
switch (expr.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.ThisKeyword:
return true;
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
... | 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,241 | [
"expr"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
format | @Deprecated
@Override
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
if (obj instanceof Date) {
return format((Date) obj, toAppendTo);
}
if (obj instanceof Calendar) {
return format((Calendar) obj, toAppendTo... | Formats a {@link Date}, {@link Calendar} or
{@link Long} (milliseconds) object.
@deprecated Use {{@link #format(Date)}, {{@link #format(Calendar)}, {{@link #format(long)}.
@param obj the object to format.
@param toAppendTo the buffer to append to.
@param pos the position; ignored.
@return the buffer passed in. | java | src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java | 1,238 | [
"obj",
"toAppendTo",
"pos"
] | StringBuffer | true | 4 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
toArray | function toArray(value) {
if (!value) {
return [];
}
if (isArrayLike(value)) {
return isString(value) ? stringToArray(value) : copyArray(value);
}
if (symIterator && value[symIterator]) {
return iteratorToArray(value[symIterator]());
}
var tag = getTag(v... | Converts `value` to an array.
@static
@since 0.1.0
@memberOf _
@category Lang
@param {*} value The value to convert.
@returns {Array} Returns the converted array.
@example
_.toArray({ 'a': 1, 'b': 2 });
// => [1, 2]
_.toArray('abc');
// => ['a', 'b', 'c']
_.toArray(1);
// => []
_.toArray(null);
// => [] | javascript | lodash.js | 12,426 | [
"value"
] | false | 8 | 7.68 | lodash/lodash | 61,490 | jsdoc | false | |
_if_else | def _if_else(
cls,
cond: npt.NDArray[np.bool_] | bool,
left: ArrayLike | Scalar,
right: ArrayLike | Scalar,
) -> pa.Array:
"""
Choose values based on a condition.
Analogous to pyarrow.compute.if_else, with logic
to fallback to numpy for unsupported ty... | Choose values based on a condition.
Analogous to pyarrow.compute.if_else, with logic
to fallback to numpy for unsupported types.
Parameters
----------
cond : npt.NDArray[np.bool_] or bool
left : ArrayLike | Scalar
right : ArrayLike | Scalar
Returns
-------
pa.Array | python | pandas/core/arrays/arrow/array.py | 2,501 | [
"cls",
"cond",
"left",
"right"
] | pa.Array | true | 5 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
BinarySection | BinarySection(BinarySection &&) = delete; | Patcher used to apply simple changes to sections of the input binary. | cpp | bolt/include/bolt/Core/BinarySection.h | 108 | [] | true | 2 | 6.64 | llvm/llvm-project | 36,021 | doxygen | false | |
createTypeDescriptor | private TypeDescriptor createTypeDescriptor(TypeElement element) {
TypeDescriptor descriptor = new TypeDescriptor();
process(descriptor, element.asType());
this.typeDescriptors.put(element, descriptor);
return descriptor;
} | Return the {@link PrimitiveType} of the specified type or {@code null} if the type
does not represent a valid wrapper type.
@param typeMirror a type
@return the primitive type or {@code null} if the type is not a wrapper type | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | 228 | [
"element"
] | TypeDescriptor | true | 1 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
randomFloat | public float randomFloat() {
return randomFloat(0, Float.MAX_VALUE);
} | Generates a random float between 0 (inclusive) and Float.MAX_VALUE (exclusive).
@return the random float.
@see #randomFloat(float, float)
@since 3.16.0 | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 358 | [] | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false | |
closeNow | public final void closeNow() {
if (closed)
throw new IllegalStateException("Attempt to close a channel that has already been closed");
handleCloseOnAuthenticationFailure(channel);
closed = true;
} | Close the channel now, regardless of whether the delay has expired or not. | java | clients/src/main/java/org/apache/kafka/common/network/Selector.java | 1,418 | [] | void | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false |
recordsIterator | private Iterator<Record> recordsIterator() {
return new AbstractIterator<>() {
private final Iterator<? extends RecordBatch> batches = batches().iterator();
private Iterator<Record> records;
@Override
protected Record makeNext() {
if (records != n... | 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 | 73 | [] | true | 4 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
invokeJoinpointUsingReflection | public static @Nullable Object invokeJoinpointUsingReflection(@Nullable Object target, Method method, @Nullable Object[] args)
throws Throwable {
// Use reflection to invoke the method.
try {
Method originalMethod = BridgeMethodResolver.findBridgedMethod(method);
ReflectionUtils.makeAccessible(originalMet... | Invoke the given target via reflection, as part of an AOP method invocation.
@param target the target object
@param method the method to invoke
@param args the arguments for the method
@return the invocation result, if any
@throws Throwable if thrown by the target method
@throws org.springframework.aop.AopInvocationExc... | java | spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java | 351 | [
"target",
"method",
"args"
] | Object | true | 6 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
apply_self_termination_task | def apply_self_termination_task(
self,
worker: CeleryTestWorker,
method: TaskTermination.Method,
) -> AsyncResult:
"""Apply a task that will terminate itself.
Args:
worker (CeleryTestWorker): Take the queue of this worker.
method (TaskTermination.Meth... | Apply a task that will terminate itself.
Args:
worker (CeleryTestWorker): Take the queue of this worker.
method (TaskTermination.Method): The method to terminate the task.
Returns:
AsyncResult: The result of applying the task. | python | t/smoke/operations/task_termination.py | 21 | [
"self",
"worker",
"method"
] | AsyncResult | true | 1 | 6.56 | celery/celery | 27,741 | google | false |
listConfigResources | default ListConfigResourcesResult listConfigResources() {
return listConfigResources(Set.of(), new ListConfigResourcesOptions());
} | List all configuration resources available in the cluster with the default options.
<p>
This is a convenience method for {@link #listConfigResources(Set, ListConfigResourcesOptions)}
with default options. See the overload for more details.
@return The ListConfigurationResourcesResult. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,797 | [] | ListConfigResourcesResult | true | 1 | 6.16 | apache/kafka | 31,560 | javadoc | false |
contains | @Override
public boolean contains(String propertyName) {
return (getPropertyValue(propertyName) != null ||
(this.processedProperties != null && this.processedProperties.contains(propertyName)));
} | Get the raw property value, if any.
@param propertyName the name to search for
@return the raw property value, or {@code null} if none found
@since 4.0
@see #getPropertyValue(String)
@see PropertyValue#getValue() | java | spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java | 314 | [
"propertyName"
] | true | 3 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
logn | def logn(n, x):
"""
Take log base n of x.
If `x` contains negative inputs, the answer is computed and returned in the
complex domain.
Parameters
----------
n : array_like
The integer base(s) in which the log is taken.
x : array_like
The value(s) whose log base `n` is (are... | Take log base n of x.
If `x` contains negative inputs, the answer is computed and returned in the
complex domain.
Parameters
----------
n : array_like
The integer base(s) in which the log is taken.
x : array_like
The value(s) whose log base `n` is (are) required.
Returns
-------
out : ndarray or scalar
The ... | python | numpy/lib/_scimath_impl.py | 349 | [
"n",
"x"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
item | def item(self):
"""
Return the first element of the underlying data as a Python scalar.
Returns
-------
scalar
The first element of Series or Index.
Raises
------
ValueError
If the data is not length = 1.
See Also
... | Return the first element of the underlying data as a Python scalar.
Returns
-------
scalar
The first element of Series or Index.
Raises
------
ValueError
If the data is not length = 1.
See Also
--------
Index.values : Returns an array representing the data in the Index.
Series.head : Returns the first `n` ro... | python | pandas/core/base.py | 401 | [
"self"
] | false | 2 | 6.48 | pandas-dev/pandas | 47,362 | unknown | false | |
getType | String getType(TypeElement element, TypeMirror type) {
if (type == null) {
return null;
}
return type.accept(this.typeExtractor, resolveTypeDescriptor(element));
} | Return the type of the specified {@link TypeMirror} including all its generic
information.
@param element the {@link TypeElement} in which this {@code type} is declared
@param type the type to handle
@return a representation of the type including all its generic information | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | 134 | [
"element",
"type"
] | String | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
getFromAlreadyDoneTrustedFuture | @ParametricNullness
@SuppressWarnings("nullness") // TODO(b/147136275): Remove once our checker understands & and |.
/*
* TODO: b/112550045 - Use this from Futures.getDone when applicable? Note the small difference in
* failure message between the two at present.
*/
final V getFromAlreadyDoneTrustedFutur... | Returns the result of this future or throws in case of failure, just like {@link #get()} except
that this method <i>also</i> throws if this future is not done.
<p>This method computes its result based on the internal state of {@link AbstractFuture}, so it
does not necessarily return the same result as {@link #get()} if... | java | android/guava/src/com/google/common/util/concurrent/AbstractFuture.java | 265 | [] | V | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false |
oneHot | public static Boolean oneHot(final Boolean... array) {
return Boolean.valueOf(oneHot(ArrayUtils.toPrimitive(array)));
} | Performs a one-hot on an array of booleans.
<p>
This implementation returns true if one, and only one, of the supplied values is true.
</p>
<p>
Null array elements map to false, like {@code Boolean.parseBoolean(null)} and its callers return false.
</p>
<p>
See also <a href="https://en.wikipedia.org/wiki/One-hot">One-ho... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 313 | [] | Boolean | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
indexChunks | Tuple<Integer, String> indexChunks(String name, InputStream is, int chunk, final Checksum checksum, long timestamp) throws IOException {
// we have to calculate and return md5 sums as a matter of course (see actualMd5 being return below),
// but we don't have to do it *twice* -- so if the passed-in chec... | This method fetches the database file for the given database from the passed-in source, then indexes that database
file into the .geoip_databases Elasticsearch index, deleting any old versions of the database from the index if they exist.
@param name The name of the database to be downloaded and indexed into an Elastic... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloader.java | 334 | [
"name",
"is",
"chunk",
"checksum",
"timestamp"
] | true | 5 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false | |
getEndpointAnnotationElements | Set<TypeElement> getEndpointAnnotationElements() {
return this.endpointAnnotations.stream()
.map(this.elements::getTypeElement)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
} | Collect the annotations that are annotated or meta-annotated with the specified
{@link TypeElement annotation}.
@param element the element to inspect
@param annotationType the annotation to discover
@return the annotations that are annotated or meta-annotated with this annotation | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 363 | [] | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
moveToEnd | public static void moveToEnd(MutablePropertySources propertySources) {
PropertySource<?> propertySource = propertySources.remove(NAME);
if (propertySource != null) {
propertySources.addLast(propertySource);
}
} | Move the 'defaultProperties' property source so that it's the last source in the
given {@link MutablePropertySources}.
@param propertySources the property sources to update | java | core/spring-boot/src/main/java/org/springframework/boot/env/DefaultPropertiesPropertySource.java | 127 | [
"propertySources"
] | void | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
get_partitions | def get_partitions(
self,
database_name: str,
table_name: str,
expression: str = "",
page_size: int | None = None,
max_items: int | None = None,
) -> set[tuple]:
"""
Retrieve the partition values for a table.
.. seealso::
- :extern... | Retrieve the partition values for a table.
.. seealso::
- :external+boto3:py:class:`Glue.Paginator.GetPartitions`
:param database_name: The name of the catalog database where the partitions reside.
:param table_name: The name of the partitions' table.
:param expression: An expression filtering the partitions to b... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue_catalog.py | 87 | [
"self",
"database_name",
"table_name",
"expression",
"page_size",
"max_items"
] | set[tuple] | true | 3 | 7.44 | apache/airflow | 43,597 | sphinx | false |
on_chain_start | def on_chain_start(self, chain, **headers) -> dict:
"""Method that is called on chain stamping start.
Arguments:
chain (chain): Chain that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: headers to u... | Method that is called on chain stamping start.
Arguments:
chain (chain): Chain that is stamped.
headers (Dict): Partial headers that could be merged with existing headers.
Returns:
Dict: headers to update. | python | celery/canvas.py | 144 | [
"self",
"chain"
] | dict | true | 1 | 6.88 | celery/celery | 27,741 | google | false |
reduceRight | function reduceRight(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduceRight : baseReduce,
initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
} | This method is like `_.reduce` except that it iterates over elements of
`collection` from right to left.
@static
@memberOf _
@since 0.1.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [iteratee=_.identity] The function invoked per iteration.
@param {*} [accumula... | javascript | lodash.js | 9,813 | [
"collection",
"iteratee",
"accumulator"
] | false | 2 | 7.04 | lodash/lodash | 61,490 | jsdoc | false | |
ensureBuilderMapNonNull | Map<K, ImmutableCollection.Builder<V>> ensureBuilderMapNonNull() {
Map<K, ImmutableCollection.Builder<V>> result = builderMap;
if (result == null) {
result = Platform.preservesInsertionOrderOnPutsMap();
builderMap = result;
}
return result;
} | Creates a new builder with a hint for the number of distinct keys. | java | android/guava/src/com/google/common/collect/ImmutableMultimap.java | 184 | [] | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false | |
conforms | function conforms(source) {
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
} | Creates a function that invokes the predicate properties of `source` with
the corresponding property values of a given object, returning `true` if
all predicates return truthy, else `false`.
**Note:** The created function is equivalent to `_.conformsTo` with
`source` partially applied.
@static
@memberOf _
@since 4.0.0
... | javascript | lodash.js | 15,480 | [
"source"
] | false | 1 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
inferKeyTypeOrObjectUnderJ2cl | static <K extends Enum<K>> Class<K> inferKeyTypeOrObjectUnderJ2cl(Map<K, ?> map) {
if (map instanceof EnumBiMap) {
return ((EnumBiMap<K, ?>) map).keyTypeOrObjectUnderJ2cl;
}
if (map instanceof EnumHashBiMap) {
return ((EnumHashBiMap<K, ?>) map).keyTypeOrObjectUnderJ2cl;
}
checkArgument(!... | Returns a new bimap with the same mappings as the specified map. If the specified map is an
{@code EnumBiMap}, the new bimap has the same types as the provided map. Otherwise, the
specified map must contain at least one mapping, in order to determine the key and value types.
@param map the map whose mappings are to be ... | java | android/guava/src/com/google/common/collect/EnumBiMap.java | 97 | [
"map"
] | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false | |
__call__ | def __call__(self, X, Y=None, eval_gradient=False):
"""Return the kernel k(X, Y) and optionally its gradient.
Parameters
----------
X : ndarray of shape (n_samples_X, n_features)
Left argument of the returned kernel k(X, Y)
Y : ndarray of shape (n_samples_Y, n_featu... | Return the kernel k(X, Y) and optionally its gradient.
Parameters
----------
X : ndarray of shape (n_samples_X, n_features)
Left argument of the returned kernel k(X, Y)
Y : ndarray of shape (n_samples_Y, n_features), default=None
Right argument of the returned kernel k(X, Y). If None, k(X, X)
if evaluated... | python | sklearn/gaussian_process/kernels.py | 2,028 | [
"self",
"X",
"Y",
"eval_gradient"
] | false | 10 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
parameterizeWithOwner | public static final ParameterizedType parameterizeWithOwner(final Type owner, final Class<?> rawClass, final Map<TypeVariable<?>, Type> typeVariableMap) {
Objects.requireNonNull(rawClass, "rawClass");
Objects.requireNonNull(typeVariableMap, "typeVariableMap");
return parameterizeWithOwner(owner,... | Creates a parameterized type instance.
@param owner the owning type.
@param rawClass the raw class to create a parameterized type instance for.
@param typeVariableMap the map used for parameterization.
@return {@link ParameterizedType}.
@throws NullPointerException if either {@code rawClass} or {@code ... | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,446 | [
"owner",
"rawClass",
"typeVariableMap"
] | ParameterizedType | true | 1 | 6.24 | apache/commons-lang | 2,896 | javadoc | false |
_check_data_length | def _check_data_length(
self,
columns: Sequence[Hashable],
data: Sequence[ArrayLike],
) -> None:
"""Checks if length of data is equal to length of column names.
One set of trailing commas is allowed. self.index_col not False
results in a ParserError previously when l... | Checks if length of data is equal to length of column names.
One set of trailing commas is allowed. self.index_col not False
results in a ParserError previously when lengths do not match.
Parameters
----------
columns: list of column names
data: list of array-likes containing the data column-wise. | python | pandas/io/parsers/base_parser.py | 608 | [
"self",
"columns",
"data"
] | None | true | 7 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false |
convert_cmake_value_to_python_value | def convert_cmake_value_to_python_value(
cmake_value: str, cmake_type: str
) -> CMakeValue:
r"""Convert a CMake value in a string form to a Python value.
Args:
cmake_value (string): The CMake value in a string form (e.g., "ON", "OFF", "1").
cmake_type (string): The CMake type of :attr:`cmake_va... | r"""Convert a CMake value in a string form to a Python value.
Args:
cmake_value (string): The CMake value in a string form (e.g., "ON", "OFF", "1").
cmake_type (string): The CMake type of :attr:`cmake_value`.
Returns:
A Python value corresponding to :attr:`cmake_value` with type :attr:`cmake_type`. | python | tools/setup_helpers/cmake_utils.py | 15 | [
"cmake_value",
"cmake_type"
] | CMakeValue | true | 7 | 8.08 | pytorch/pytorch | 96,034 | google | false |
successful | def successful(self):
"""Return true if all tasks successful.
Returns:
bool: true if all of the tasks finished
successfully (i.e. didn't raise an exception).
"""
return all(result.successful() for result in self.results) | Return true if all tasks successful.
Returns:
bool: true if all of the tasks finished
successfully (i.e. didn't raise an exception). | python | celery/result.py | 616 | [
"self"
] | false | 1 | 6.08 | celery/celery | 27,741 | unknown | false | |
join | public static String join(final boolean[] array, final char delimiter, final int startIndex, final int endIndex) {
if (array == null) {
return null;
}
if (endIndex - startIndex <= 0) {
return EMPTY;
}
final StringBuilder stringBuilder = new StringBuilder(a... | Joins the elements of the provided array into a single String containing the provided list of elements.
<p>
No delimiter is added before or after the list. Null objects or empty strings within the array are represented
by empty strings.
</p>
<pre>
StringUtils.join(null, *) = null
StringUtils.join([], *... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 3,856 | [
"array",
"delimiter",
"startIndex",
"endIndex"
] | String | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
get | @Override
public @Nullable V get(@Nullable Object key) {
int entry = findEntryByKey(key);
return (entry == ABSENT) ? null : values[entry];
} | Returns {@code true} if this BiMap contains an entry whose value is equal to {@code value} (or,
equivalently, if this inverse view contains a key that is equal to {@code value}).
<p>Due to the property that values in a BiMap are unique, this will tend to execute in
faster-than-linear time.
@param value the object to se... | java | android/guava/src/com/google/common/collect/HashBiMap.java | 270 | [
"key"
] | V | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false |
valueSize | public int valueSize() {
return buffer.getInt(valueSizeOffset());
} | The length of the value in bytes
@return the size in bytes of the value (0 if the value is null) | java | clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java | 181 | [] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
register | @CanIgnoreReturnValue
@ParametricNullness
public <C extends @Nullable Closeable> C register(@ParametricNullness C closeable) {
if (closeable != null) {
stack.addFirst(closeable);
}
return closeable;
} | Registers the given {@code closeable} to be closed when this {@code Closer} is {@linkplain
#close closed}.
@return the given {@code closeable} | java | android/guava/src/com/google/common/io/Closer.java | 107 | [
"closeable"
] | C | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false |
trimResults | public Splitter trimResults(CharMatcher trimmer) {
checkNotNull(trimmer);
return new Splitter(strategy, omitEmptyStrings, trimmer, limit);
} | Returns a splitter that behaves equivalently to {@code this} splitter, but removes all leading
or trailing characters matching the given {@code CharMatcher} from each returned substring. For
example, {@code Splitter.on(',').trimResults(CharMatcher.is('_')).split("_a ,_b_ ,c__")}
returns an iterable containing {@code ["... | java | android/guava/src/com/google/common/base/Splitter.java | 355 | [
"trimmer"
] | Splitter | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false |
run_flow | def run_flow(
self,
flow_name: str,
poll_interval: int = 20,
wait_for_completion: bool = True,
max_attempts: int = 60,
) -> str:
"""
Execute an AppFlow run.
:param flow_name: The flow name
:param poll_interval: Time (seconds) to wait between t... | Execute an AppFlow run.
:param flow_name: The flow name
:param poll_interval: Time (seconds) to wait between two consecutive calls to check the run status
:param wait_for_completion: whether to wait for the run to end to return
:param max_attempts: the number of polls to do before timing out/returning a failure.
:retu... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/appflow.py | 46 | [
"self",
"flow_name",
"poll_interval",
"wait_for_completion",
"max_attempts"
] | str | true | 2 | 7.76 | apache/airflow | 43,597 | sphinx | false |
unstack | def unstack(self, unstacker, fill_value) -> BlockManager:
"""
Return a BlockManager with all blocks unstacked.
Parameters
----------
unstacker : reshape._Unstacker
fill_value : Any
fill_value for newly introduced missing values.
Returns
-----... | Return a BlockManager with all blocks unstacked.
Parameters
----------
unstacker : reshape._Unstacker
fill_value : Any
fill_value for newly introduced missing values.
Returns
-------
unstacked : BlockManager | python | pandas/core/internals/managers.py | 1,699 | [
"self",
"unstacker",
"fill_value"
] | BlockManager | true | 6 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
firstNode | private @Nullable AvlNode<E> firstNode() {
AvlNode<E> root = rootReference.get();
if (root == null) {
return null;
}
AvlNode<E> node;
if (range.hasLowerBound()) {
// The cast is safe because of the hasLowerBound check.
E endpoint = uncheckedCastNullableTToT(range.getLowerEndpoint()... | Returns the first node in the tree that is in range. | java | android/guava/src/com/google/common/collect/TreeMultiset.java | 400 | [] | true | 8 | 6.88 | google/guava | 51,352 | javadoc | false | |
partitionsNeedingValidation | public synchronized Map<TopicPartition, FetchPosition> partitionsNeedingValidation(long nowMs) {
Map<TopicPartition, FetchPosition> result = new HashMap<>();
assignment.forEach((tp, tps) -> {
if (tps.awaitingValidation() && !tps.awaitingRetryBackoff(nowMs) && tps.position != null) {
... | Request reset for partitions that require a position, using the configured reset strategy.
@param initPartitionsToInclude Initializing partitions to include in the reset. Assigned partitions that
require a positions but are not included in this set won't be reset.
@throws NoOffsetForParti... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 882 | [
"nowMs"
] | true | 4 | 6.24 | 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.