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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
start_python_pipeline | def start_python_pipeline(
self,
variables: dict,
py_file: str,
py_options: list[str],
py_interpreter: str = "python3",
py_requirements: list[str] | None = None,
py_system_site_packages: bool = False,
process_line_callback: Callable[[str], None] | None = N... | Start Apache Beam python pipeline.
:param variables: Variables passed to the pipeline.
:param py_file: Path to the python file to execute.
:param py_options: Additional options.
:param py_interpreter: Python version of the Apache Beam pipeline.
If None, this defaults to the python3.
To track python versions su... | python | providers/apache/beam/src/airflow/providers/apache/beam/hooks/beam.py | 243 | [
"self",
"variables",
"py_file",
"py_options",
"py_interpreter",
"py_requirements",
"py_system_site_packages",
"process_line_callback",
"is_dataflow_job_id_exist_callback"
] | true | 7 | 6.32 | apache/airflow | 43,597 | sphinx | false | |
poll | @Override
public List<ClientResponse> poll(long timeout, long now) {
ensureActive();
if (!abortedSends.isEmpty()) {
// If there are aborted sends because of unsupported version exceptions or disconnects,
// handle them immediately without waiting for Selector#poll.
... | Do actual reads and writes to sockets.
@param timeout The maximum amount of time to wait (in ms) for responses if there are none immediately,
must be non-negative. The actual timeout will be the minimum of timeout, request timeout and
metadata timeout
@param now The current time in millise... | java | clients/src/main/java/org/apache/kafka/clients/NetworkClient.java | 629 | [
"timeout",
"now"
] | true | 4 | 7.92 | apache/kafka | 31,560 | javadoc | false | |
common_dtype_categorical_compat | def common_dtype_categorical_compat(
objs: Sequence[Index | ArrayLike], dtype: DtypeObj
) -> DtypeObj:
"""
Update the result of find_common_type to account for NAs in a Categorical.
Parameters
----------
objs : list[np.ndarray | ExtensionArray | Index]
dtype : np.dtype or ExtensionDtype
... | Update the result of find_common_type to account for NAs in a Categorical.
Parameters
----------
objs : list[np.ndarray | ExtensionArray | Index]
dtype : np.dtype or ExtensionDtype
Returns
-------
np.dtype or ExtensionDtype | python | pandas/core/dtypes/cast.py | 1,232 | [
"objs",
"dtype"
] | DtypeObj | true | 7 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
subscription | public synchronized Set<String> subscription() {
if (hasAutoAssignedPartitions())
return this.subscription;
return Collections.emptySet();
} | Check whether a topic matches a subscribed pattern.
@return true if pattern subscription is in use and the topic matches the subscribed pattern, false otherwise | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 369 | [] | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
preProcessParsedConfig | protected Map<String, Object> preProcessParsedConfig(Map<String, Object> parsedValues) {
return parsedValues;
} | Called directly after user configs got parsed (and thus default values is not set).
This allows to check user's config.
@param parsedValues unmodifiable map of current configuration
@return a map of updates that should be applied to the configuration (will be validated to prevent bad updates) | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 159 | [
"parsedValues"
] | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false | |
start_java_pipeline | def start_java_pipeline(
self,
variables: dict,
jar: str,
job_class: str | None = None,
process_line_callback: Callable[[str], None] | None = None,
is_dataflow_job_id_exist_callback: Callable[[], bool] | None = None,
) -> None:
"""
Start Apache Beam Ja... | Start Apache Beam Java pipeline.
:param variables: Variables passed to the job.
:param jar: Name of the jar for the pipeline
:param job_class: Name of the java class for the pipeline.
:param process_line_callback: (optional) Callback that can be used to process each line of
the stdout and stderr file descriptors. | python | providers/apache/beam/src/airflow/providers/apache/beam/hooks/beam.py | 324 | [
"self",
"variables",
"jar",
"job_class",
"process_line_callback",
"is_dataflow_job_id_exist_callback"
] | None | true | 3 | 6.88 | apache/airflow | 43,597 | sphinx | false |
_shallow_copy | def _shallow_copy(self, values, name: Hashable = no_default) -> Self:
"""
Create a new Index with the same class as the caller, don't copy the
data, use the same object attributes with passed in attributes taking
precedence.
*this is an internal non-public method*
Param... | Create a new Index with the same class as the caller, don't copy the
data, use the same object attributes with passed in attributes taking
precedence.
*this is an internal non-public method*
Parameters
----------
values : the values to create the new Index, optional
name : Label, defaults to self.name | python | pandas/core/indexes/base.py | 763 | [
"self",
"values",
"name"
] | Self | true | 2 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
getPemSslStore | private static @Nullable PemSslStore getPemSslStore(String propertyName, PemSslBundleProperties.Store properties,
ResourceLoader resourceLoader) {
PemSslStoreDetails details = asPemSslStoreDetails(properties);
PemSslStore pemSslStore = PemSslStore.load(details, resourceLoader);
if (properties.isVerifyKeys()) {... | Get an {@link SslBundle} for the given {@link PemSslBundleProperties}.
@param properties the source properties
@param resourceLoader the resource loader used to load content
@return an {@link SslBundle} instance
@since 3.3.5 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/PropertiesSslBundle.java | 129 | [
"propertyName",
"properties",
"resourceLoader"
] | PemSslStore | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
definePackageForExploded | private Package definePackageForExploded(String name, URL sealBase, Supplier<Package> call) {
synchronized (this.definePackageLock) {
if (this.definePackageCallType == null) {
// We're not part of a call chain which means that the URLClassLoader
// is trying to define a package for our exploded JAR. We use... | Create a new {@link LaunchedClassLoader} instance.
@param exploded if the underlying archive is exploded
@param rootArchive the root archive or {@code null}
@param urls the URLs from which to load classes and resources
@param parent the parent class loader for delegation | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/LaunchedClassLoader.java | 136 | [
"name",
"sealBase",
"call"
] | Package | true | 3 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
deduceRelativeDir | private @Nullable String deduceRelativeDir(File sourceDirectory, File workingDir) {
String sourcePath = sourceDirectory.getAbsolutePath();
String workingPath = workingDir.getAbsolutePath();
if (sourcePath.equals(workingPath) || !sourcePath.startsWith(workingPath)) {
return null;
}
String relativePath = sou... | Create a new {@link Context} instance with the specified value.
@param archiveFile the source archive file
@param workingDir the working directory | java | loader/spring-boot-jarmode-tools/src/main/java/org/springframework/boot/jarmode/tools/Context.java | 110 | [
"sourceDirectory",
"workingDir"
] | String | true | 4 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
add_categories | def add_categories(self, new_categories) -> Self:
"""
Add new categories.
`new_categories` will be included at the last/highest place in the
categories and will be unused directly after this call.
Parameters
----------
new_categories : category or list-like of c... | Add new categories.
`new_categories` will be included at the last/highest place in the
categories and will be unused directly after this call.
Parameters
----------
new_categories : category or list-like of category
The new categories to be included.
Returns
-------
Categorical
Categorical with new categorie... | python | pandas/core/arrays/categorical.py | 1,343 | [
"self",
"new_categories"
] | Self | true | 5 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false |
run_beam_command_async | async def run_beam_command_async(
self,
cmd: list[str],
log: Logger,
working_directory: str | None = None,
process_line_callback: Callable[[str], None] | None = None,
) -> int:
"""
Run pipeline command in subprocess.
:param cmd: Parts of the command t... | Run pipeline command in subprocess.
:param cmd: Parts of the command to be run in subprocess
:param working_directory: Working directory
:param log: logger
:param process_line_callback: Optional callback which can be used to process
stdout and stderr to detect job id | python | providers/apache/beam/src/airflow/providers/apache/beam/hooks/beam.py | 614 | [
"self",
"cmd",
"log",
"working_directory",
"process_line_callback"
] | int | true | 2 | 6.72 | apache/airflow | 43,597 | sphinx | false |
toProtocolTextSpanWithContext | function toProtocolTextSpanWithContext(span: TextSpan, contextSpan: TextSpan | undefined, scriptInfo: ScriptInfo): protocol.TextSpanWithContext {
const textSpan = toProtocolTextSpan(span, scriptInfo);
const contextTextSpan = contextSpan && toProtocolTextSpan(contextSpan, scriptInfo);
return contextTextSp... | @param projects Projects initially known to contain {@link initialLocation}
@param defaultProject The default project containing {@link initialLocation}
@param initialLocation Where the search operation was triggered
@param getResultsForPosition This is where you plug in `findReferences`, `renameLocation`, etc
@par... | typescript | src/server/session.ts | 3,990 | [
"span",
"contextSpan",
"scriptInfo"
] | true | 3 | 7.12 | microsoft/TypeScript | 107,154 | jsdoc | false | |
_get_changes_classified | def _get_changes_classified(
changes: list[Change], with_breaking_changes: bool, maybe_with_new_features: bool
) -> ClassifiedChanges:
"""
Pre-classifies changes based on their type_of_change attribute derived based on release manager's call.
The classification is based on the decision made by the rele... | Pre-classifies changes based on their type_of_change attribute derived based on release manager's call.
The classification is based on the decision made by the release manager when classifying the release.
If we switch to semantic commits, this process could be automated. This list is still supposed to be
manually rev... | python | dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py | 1,011 | [
"changes",
"with_breaking_changes",
"maybe_with_new_features"
] | ClassifiedChanges | true | 12 | 7.44 | apache/airflow | 43,597 | sphinx | false |
populateFunctionNames | static void populateFunctionNames(cl::opt<std::string> &FunctionNamesFile,
cl::list<std::string> &FunctionNames) {
if (FunctionNamesFile.empty())
return;
std::ifstream FuncsFile(FunctionNamesFile, std::ios::in);
std::string FuncName;
while (std::getline(FuncsFile, FuncName)... | Return true if the function \p BF should be disassembled. | cpp | bolt/lib/Rewrite/RewriteInstance.cpp | 3,289 | [] | true | 3 | 7.04 | llvm/llvm-project | 36,021 | doxygen | false | |
write | @Override
public long write(ByteBuffer[] srcs) throws IOException {
return write(srcs, 0, srcs.length);
} | Writes a sequence of bytes to this channel from the given buffers.
@param srcs The buffers from which bytes are to be retrieved
@return returns no.of bytes consumed by SSLEngine.wrap , possibly zero.
@throws IOException If some other I/O error occurs | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 784 | [
"srcs"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
mean | def mean(self, numeric_only: bool = False, **kwargs):
"""
Calculate the rolling weighted window mean.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
**kwargs
Keyword arguments to configure the `... | Calculate the rolling weighted window mean.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
**kwargs
Keyword arguments to configure the ``SciPy`` weighted window type.
Returns
-------
Series or DataFrame
Return type is the same as the original object wit... | python | pandas/core/window/rolling.py | 1,357 | [
"self",
"numeric_only"
] | true | 1 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false | |
close | @Override
public void close() {
if (sslFactory != null) sslFactory.close();
} | Constructs an SSL channel builder. ListenerName is provided only
for server channel builder and will be null for client channel builder. | java | clients/src/main/java/org/apache/kafka/common/network/SslChannelBuilder.java | 115 | [] | void | true | 2 | 6.48 | apache/kafka | 31,560 | javadoc | false |
nop | @SuppressWarnings("unchecked")
static <E extends Throwable> FailableIntToFloatFunction<E> nop() {
return NOP;
} | Gets the NOP singleton.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailableIntToFloatFunction.java | 41 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
renameFile | private void renameFile(File file, File dest) {
if (!file.renameTo(dest)) {
throw new IllegalStateException("Unable to rename '" + file + "' to '" + dest + "'");
}
} | Repackage to the given destination so that it can be launched using '
{@literal java -jar}'.
@param destination the destination file (may be the same as the source)
@param libraries the libraries required to run the archive
@param lastModifiedTime an optional last modified time to apply to the archive and
its contents
... | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java | 148 | [
"file",
"dest"
] | void | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false |
findResolvableAssignmentAndTriggerMetadataUpdate | private TopicIdPartitionSet findResolvableAssignmentAndTriggerMetadataUpdate() {
final TopicIdPartitionSet assignmentReadyToReconcile = new TopicIdPartitionSet();
final HashMap<Uuid, SortedSet<Integer>> unresolved = new HashMap<>(currentTargetAssignment.partitions);
// Try to resolve topic name... | Build set of TopicIdPartition (topic ID, topic name and partition id) from the target assignment
received from the broker (topic IDs and list of partitions).
<p>
This will:
<ol type="1">
<li>Try to find topic names in the metadata cache</li>
<li>For topics not found in metadata, try to find names in the local t... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 1,067 | [] | TopicIdPartitionSet | true | 3 | 6.56 | apache/kafka | 31,560 | javadoc | false |
reorder | function reorder(array, indexes) {
var arrLength = array.length,
length = nativeMin(indexes.length, arrLength),
oldArray = copyArray(array);
while (length--) {
var index = indexes[length];
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
}
... | Reorder `array` according to the specified indexes where the element at
the first index is assigned as the first element, the element at
the second index is assigned as the second element, and so on.
@private
@param {Array} array The array to reorder.
@param {Array} indexes The arranged array indexes.
@returns {Array} ... | javascript | lodash.js | 6,692 | [
"array",
"indexes"
] | false | 3 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
findAdvisorBeans | public List<Advisor> findAdvisorBeans() {
// Determine list of advisor bean names, if not cached already.
String[] advisorNames = this.cachedAdvisorBeanNames;
if (advisorNames == null) {
// Do not initialize FactoryBeans here: We need to leave all regular beans
// uninitialized to let the auto-proxy creator... | Find all eligible Advisor beans in the current bean factory,
ignoring FactoryBeans and excluding beans that are currently in creation.
@return the list of {@link org.springframework.aop.Advisor} beans
@see #isEligibleBean | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java | 66 | [] | true | 11 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
swapCase | public static String swapCase(final String str) {
if (isEmpty(str)) {
return str;
}
final int strLen = str.length();
final int[] newCodePoints = new int[strLen]; // cannot be longer than the char array
int outOffset = 0;
for (int i = 0; i < strLen;) {
... | Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.
<ul>
<li>Upper case character converts to Lower case</li>
<li>Title case character converts to Lower case</li>
<li>Lower case character converts to Upper case</li>
</ul>
<p>
For a word based algorithm, see {@link org.a... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,601 | [
"str"
] | String | true | 6 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
getExplicitBeanName | private @Nullable String getExplicitBeanName(AnnotationMetadata metadata) {
List<String> names = metadata.getAnnotations().stream(COMPONENT_ANNOTATION_CLASSNAME)
.map(annotation -> annotation.getString(MergedAnnotation.VALUE))
.filter(StringUtils::hasText)
.map(String::trim)
.distinct()
.toList();... | Get the explicit bean name for the underlying class, as configured via
{@link org.springframework.stereotype.Component @Component} and taking into
account {@link org.springframework.core.annotation.AliasFor @AliasFor}
semantics for annotation attribute overrides for {@code @Component}'s
{@code value} attribute.
@param ... | java | spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java | 191 | [
"metadata"
] | String | true | 3 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
_compute_score_samples | def _compute_score_samples(self, X, subsample_features):
"""
Compute the score of each samples in X going through the extra trees.
Parameters
----------
X : array-like or sparse matrix
Data matrix.
subsample_features : bool
Whether features shoul... | Compute the score of each samples in X going through the extra trees.
Parameters
----------
X : array-like or sparse matrix
Data matrix.
subsample_features : bool
Whether features should be subsampled.
Returns
-------
scores : ndarray of shape (n_samples,)
The score of each sample in X. | python | sklearn/ensemble/_iforest.py | 582 | [
"self",
"X",
"subsample_features"
] | false | 2 | 6.16 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
f_oneway | def f_oneway(*args):
"""Perform a 1-way ANOVA.
The one-way ANOVA tests the null hypothesis that 2 or more groups have
the same population mean. The test is applied to samples from two or
more groups, possibly with differing sizes.
Read more in the :ref:`User Guide <univariate_feature_selection>`.
... | Perform a 1-way ANOVA.
The one-way ANOVA tests the null hypothesis that 2 or more groups have
the same population mean. The test is applied to samples from two or
more groups, possibly with differing sizes.
Read more in the :ref:`User Guide <univariate_feature_selection>`.
Parameters
----------
*args : {array-like, ... | python | sklearn/feature_selection/_univariate_selection.py | 41 | [] | false | 4 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
fromParts | public static HostAndPort fromParts(String host, int port) {
checkArgument(isValidPort(port), "Port out of range: %s", port);
HostAndPort parsedHost = fromString(host);
checkArgument(!parsedHost.hasPort(), "Host has a port: %s", host);
return new HostAndPort(parsedHost.host, port, parsedHost.hasBracketl... | Build a HostAndPort instance from separate host and port values.
<p>Note: Non-bracketed IPv6 literals are allowed. Use {@link #requireBracketsForIPv6()} to
prohibit these.
@param host the host string to parse. Must not contain a port number.
@param port a port number from [0..65535]
@return if parsing was successful, a... | java | android/guava/src/com/google/common/net/HostAndPort.java | 133 | [
"host",
"port"
] | HostAndPort | true | 1 | 6.88 | google/guava | 51,352 | javadoc | false |
strictLastIndexOf | function strictLastIndexOf(array, value, fromIndex) {
var index = fromIndex + 1;
while (index--) {
if (array[index] === value) {
return index;
}
}
return index;
} | A specialized version of `_.lastIndexOf` which performs strict equality
comparisons of values, i.e. `===`.
@private
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} fromIndex The index to search from.
@returns {number} Returns the index of the matched value, else `-1`... | javascript | lodash.js | 1,320 | [
"array",
"value",
"fromIndex"
] | false | 3 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
getCombinedPathLength | function getCombinedPathLength(error: EngineValidationError) {
let score = 0
if (Array.isArray(error['selectionPath'])) {
score += error['selectionPath'].length
}
if (Array.isArray(error['argumentPath'])) {
score += error['argumentPath'].length
}
return score
} | Function that attempts to pick the best error from the list
by ranking them. In most cases, highest ranking error would be the one
which has the longest combined "selectionPath" + "argumentPath". Justification
for that is that type that made it deeper into validation tree before failing
is probably closer to the one us... | typescript | packages/client/src/runtime/core/errorRendering/applyUnionError.ts | 110 | [
"error"
] | false | 3 | 7.12 | prisma/prisma | 44,834 | jsdoc | false | |
getCauseType | @SuppressWarnings("unchecked")
protected Class<? extends T> getCauseType() {
Class<? extends T> type = (Class<? extends T>) ResolvableType
.forClass(AbstractFailureAnalyzer.class, getClass())
.resolveGeneric();
Assert.state(type != null, "Unable to resolve generic");
return type;
} | Return the cause type being handled by the analyzer. By default the class generic
is used.
@return the cause type | java | core/spring-boot/src/main/java/org/springframework/boot/diagnostics/AbstractFailureAnalyzer.java | 54 | [] | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
vsplit | def vsplit(ary, indices_or_sections):
"""
Split an array into multiple sub-arrays vertically (row-wise).
Please refer to the ``split`` documentation. ``vsplit`` is equivalent
to ``split`` with `axis=0` (default), the array is always split along the
first axis regardless of the array dimension.
... | Split an array into multiple sub-arrays vertically (row-wise).
Please refer to the ``split`` documentation. ``vsplit`` is equivalent
to ``split`` with `axis=0` (default), the array is always split along the
first axis regardless of the array dimension.
See Also
--------
split : Split an array into multiple sub-array... | python | numpy/lib/_shape_base_impl.py | 935 | [
"ary",
"indices_or_sections"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | unknown | false | |
toString | @Override
public String toString() {
final StringBuilder sb = new StringBuilder("StoreTrustConfig{");
sb.append("path=").append(truststorePath);
sb.append(", password=").append(password.length == 0 ? "<empty>" : "<non-empty>");
sb.append(", type=").append(type);
sb.append(", ... | Verifies that the keystore contains at least 1 trusted certificate entry. | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/StoreTrustConfig.java | 155 | [] | String | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
hermval3d | def hermval3d(x, y, z, c):
"""
Evaluate a 3-D Hermite series at points (x, y, z).
This function returns the values:
.. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * H_i(x) * H_j(y) * H_k(z)
The parameters `x`, `y`, and `z` are converted to arrays only if
they are tuples or a lists, otherwise th... | Evaluate a 3-D Hermite series at points (x, y, z).
This function returns the values:
.. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * H_i(x) * H_j(y) * H_k(z)
The parameters `x`, `y`, and `z` are converted to arrays only if
they are tuples or a lists, otherwise they are treated as a scalars and
they must have the same... | python | numpy/polynomial/hermite.py | 1,003 | [
"x",
"y",
"z",
"c"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
parsePropPath | function parsePropPath(name) {
// foo[x][y][z]
// foo.x.y.z
// foo-x-y-z
// foo x y z
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
return match[0] === '[]' ? '' : match[1] || match[0];
});
} | It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
@param {string} name - The name of the property to get.
@returns An array of strings. | javascript | lib/helpers/formDataToJSON.js | 12 | [
"name"
] | false | 3 | 6.08 | axios/axios | 108,381 | jsdoc | false | |
_write_array_header | def _write_array_header(fp, d, version=None):
""" Write the header for an array and returns the version used
Parameters
----------
fp : filelike object
d : dict
This has the appropriate entries for writing its string representation
to the header of the file.
version : tuple or N... | Write the header for an array and returns the version used
Parameters
----------
fp : filelike object
d : dict
This has the appropriate entries for writing its string representation
to the header of the file.
version : tuple or None
None means use oldest that works. Providing an explicit version will
r... | python | numpy/lib/_format_impl.py | 445 | [
"fp",
"d",
"version"
] | false | 6 | 6.08 | numpy/numpy | 31,054 | numpy | false | |
get_data_home | def get_data_home(data_home=None) -> str:
"""Return the path of the scikit-learn data directory.
This folder is used by some large dataset loaders to avoid downloading the
data several times.
By default the data directory is set to a folder named 'scikit_learn_data' in the
user home folder.
A... | Return the path of the scikit-learn data directory.
This folder is used by some large dataset loaders to avoid downloading the
data several times.
By default the data directory is set to a folder named 'scikit_learn_data' in the
user home folder.
Alternatively, it can be set by the 'SCIKIT_LEARN_DATA' environment
va... | python | sklearn/datasets/_base.py | 48 | [
"data_home"
] | str | true | 2 | 8.32 | scikit-learn/scikit-learn | 64,340 | numpy | false |
calculateLast | function calculateLast(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {
const data = field.values;
return { last: data[data.length - 1] };
} | @returns an object with a key for each selected stat
NOTE: This will also modify the 'field.state' object,
leaving values in a cache until cleared. | typescript | packages/grafana-data/src/transformations/fieldReducer.ts | 622 | [
"field",
"ignoreNulls",
"nullAsZero"
] | true | 1 | 6.96 | grafana/grafana | 71,362 | jsdoc | false | |
setAccessible | static boolean setAccessible(final AccessibleObject accessibleObject) {
if (!isAccessible(accessibleObject)) {
accessibleObject.setAccessible(true);
return true;
}
return false;
} | Delegates to {@link AccessibleObject#setAccessible(boolean)} only if {@link AccessibleObject#isAccessible()} returns false. This avoid a
permission check if there is a security manager.
@param accessibleObject The accessible object.
@return Whether {@link AccessibleObject#setAccessible(boolean)} was called. | java | src/main/java/org/apache/commons/lang3/reflect/AccessibleObjects.java | 44 | [
"accessibleObject"
] | true | 2 | 7.28 | apache/commons-lang | 2,896 | javadoc | false | |
initializeConnectionProvider | void initializeConnectionProvider() {
final DataSource dataSourceToUse = this.dataSource;
Assert.state(dataSourceToUse != null, "DataSource must not be null");
final DataSource nonTxDataSourceToUse =
(this.nonTransactionalDataSource != null ? this.nonTransactionalDataSource : dataSourceToUse);
// Register ... | Name used for the non-transactional ConnectionProvider for Quartz.
This provider will delegate to the local Spring-managed DataSource.
@see org.quartz.utils.DBConnectionManager#addConnectionProvider
@see SchedulerFactoryBean#setDataSource | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java | 132 | [] | void | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
toScaledBigDecimal | public static BigDecimal toScaledBigDecimal(final BigDecimal value) {
return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
} | Converts a {@link BigDecimal} to a {@link BigDecimal} with a scale of two that has been rounded using {@code RoundingMode.HALF_EVEN}. If the supplied
{@code value} is null, then {@code BigDecimal.ZERO} is returned.
<p>
Note, the scale of a {@link BigDecimal} is the number of digits to the right of the decimal point.
</... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,629 | [
"value"
] | BigDecimal | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
get_commands | def get_commands():
"""
Return a dictionary mapping command names to their callback applications.
Look for a management.commands package in django.core, and in each
installed application -- if a commands package exists, register all
commands in that package.
Core commands are always included. ... | Return a dictionary mapping command names to their callback applications.
Look for a management.commands package in django.core, and in each
installed application -- if a commands package exists, register all
commands in that package.
Core commands are always included. If a settings module has been
specified, also in... | python | django/core/management/__init__.py | 53 | [] | false | 3 | 6.24 | django/django | 86,204 | unknown | false | |
fromValid | public static HostSpecifier fromValid(String specifier) {
// Verify that no port was specified, and strip optional brackets from
// IPv6 literals.
HostAndPort parsedHost = HostAndPort.fromString(specifier);
Preconditions.checkArgument(!parsedHost.hasPort());
String host = parsedHost.getHost();
... | Returns a {@code HostSpecifier} built from the provided {@code specifier}, which is already
known to be valid. If the {@code specifier} might be invalid, use {@link #from(String)}
instead.
<p>The specifier must be in one of these formats:
<ul>
<li>A domain name, like {@code google.com}
<li>A IPv4 address string, li... | java | android/guava/src/com/google/common/net/HostSpecifier.java | 71 | [
"specifier"
] | HostSpecifier | true | 4 | 6.88 | google/guava | 51,352 | javadoc | false |
toBigInteger | public static BigInteger toBigInteger(InetAddress address) {
return new BigInteger(1, address.getAddress());
} | Returns a BigInteger representing the address.
<p>Unlike {@code coerceToInteger}, IPv6 addresses are not coerced to IPv4 addresses.
@param address {@link InetAddress} to convert
@return {@code BigInteger} representation of the address
@since 28.2 | java | android/guava/src/com/google/common/net/InetAddresses.java | 1,072 | [
"address"
] | BigInteger | true | 1 | 6.16 | google/guava | 51,352 | javadoc | false |
__from_arrow__ | def __from_arrow__(self, array: pa.Array | pa.ChunkedArray) -> DatetimeArray:
"""
Construct DatetimeArray from pyarrow Array/ChunkedArray.
Note: If the units in the pyarrow Array are the same as this
DatetimeDtype, then values corresponding to the integer representation
of ``NaT... | Construct DatetimeArray from pyarrow Array/ChunkedArray.
Note: If the units in the pyarrow Array are the same as this
DatetimeDtype, then values corresponding to the integer representation
of ``NaT`` (e.g. one nanosecond before :attr:`pandas.Timestamp.min`)
are converted to ``NaT``, regardless of the null indicator in... | python | pandas/core/dtypes/dtypes.py | 933 | [
"self",
"array"
] | DatetimeArray | true | 3 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
sum | @Override
public long sum() {
long sum = base;
Cell[] as = cells;
if (as != null) {
int n = as.length;
for (int i = 0; i < n; ++i) {
Cell a = as[i];
if (a != null) sum += a.value;
}
}
return sum;
} | Returns the current sum. The returned value is <em>NOT</em> an atomic snapshot; invocation in
the absence of concurrent updates returns an accurate result, but concurrent updates that occur
while the sum is being calculated might not be incorporated.
@return the sum | java | android/guava/src/com/google/common/cache/LongAdder.java | 97 | [] | true | 4 | 8.08 | google/guava | 51,352 | javadoc | false | |
on | public static Splitter on(String separator) {
checkArgument(separator.length() != 0, "The separator may not be the empty string.");
if (separator.length() == 1) {
return Splitter.on(separator.charAt(0));
}
return new Splitter(
(splitter, toSplit) ->
new SplittingIterator(splitt... | Returns a splitter that uses the given fixed string as a separator. For example, {@code
Splitter.on(", ").split("foo, bar,baz")} returns an iterable containing {@code ["foo",
"bar,baz"]}.
@param separator the literal, nonempty string to recognize as a separator
@return a splitter, with default settings, that recognizes... | java | android/guava/src/com/google/common/base/Splitter.java | 166 | [
"separator"
] | Splitter | true | 5 | 7.76 | google/guava | 51,352 | javadoc | false |
nextGraph | public String nextGraph(final int count) {
return next(count, 33, 126, false, false);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of characters which match the POSIX [:graph:] regular expression character
class. This class contains all visible ASCII characters (i.e. anything except spaces and control characters).
</p>
@param coun... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 906 | [
"count"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
combine | @Override
public double combine(List<Sample> samples, MetricConfig config, long now) {
return totalCount();
} | Return the computed frequency describing the number of occurrences of the values in the bucket for the given
center point, relative to the total number of occurrences in the samples.
@param config the metric configuration
@param now the current time in milliseconds
@param centerValue the value correspondin... | java | clients/src/main/java/org/apache/kafka/common/metrics/stats/Frequencies.java | 156 | [
"samples",
"config",
"now"
] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
selectReadReplica | Node selectReadReplica(final TopicPartition partition, final Node leaderReplica, final long currentTimeMs) {
Optional<Integer> nodeId = subscriptions.preferredReadReplica(partition, currentTimeMs);
if (nodeId.isPresent()) {
Optional<Node> node = nodeId.flatMap(id -> metadata.fetch().nodeIfO... | Determine from which replica to read: the <i>preferred</i> or the <i>leader</i>. The preferred replica is used
iff:
<ul>
<li>A preferred replica was previously set</li>
<li>We're still within the lease time for the preferred replica</li>
<li>The replica is still online/available</li>
</ul>
If any of the abo... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractFetch.java | 374 | [
"partition",
"leaderReplica",
"currentTimeMs"
] | Node | true | 3 | 7.44 | apache/kafka | 31,560 | javadoc | false |
markAsUninitialized | private void markAsUninitialized(LoggerContext loggerContext) {
loggerContext.setExternalContext(null);
} | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 497 | [
"loggerContext"
] | void | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
minimizeCapacity | public StrBuilder minimizeCapacity() {
if (buffer.length > length()) {
buffer = ArrayUtils.arraycopy(buffer, 0, 0, size, () -> new char[length()]);
}
return this;
} | Minimizes the capacity to the actual length of the string.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,475 | [] | StrBuilder | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
readString | static String readString(DataBlock data, long pos, long len) {
try {
if (len > Integer.MAX_VALUE) {
throw new IllegalStateException("String is too long to read");
}
ByteBuffer buffer = ByteBuffer.allocate((int) len);
buffer.order(ByteOrder.LITTLE_ENDIAN);
data.readFully(buffer, pos);
return new ... | Read a string value from the given data block.
@param data the source data
@param pos the position to read from
@param len the number of bytes to read
@return the contents as a string | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipString.java | 261 | [
"data",
"pos",
"len"
] | String | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
permitted_dag_filter_factory | def permitted_dag_filter_factory(
method: ResourceMethod, filter_class=PermittedDagFilter
) -> Callable[[BaseUser, BaseAuthManager], PermittedDagFilter]:
"""
Create a callable for Depends in FastAPI that returns a filter of the permitted dags for the user.
:param method: whether filter readable or writ... | Create a callable for Depends in FastAPI that returns a filter of the permitted dags for the user.
:param method: whether filter readable or writable.
:return: The callable that can be used as Depends in FastAPI. | python | airflow-core/src/airflow/api_fastapi/core_api/security.py | 212 | [
"method",
"filter_class"
] | Callable[[BaseUser, BaseAuthManager], PermittedDagFilter] | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
resolveBeforeInstantiation | @SuppressWarnings("deprecation")
protected @Nullable Object resolveBeforeInstantiation(String beanName, RootBeanDefinition mbd) {
Object bean = null;
if (!Boolean.FALSE.equals(mbd.beforeInstantiationResolved)) {
// Make sure bean class is actually resolved at this point.
if (!mbd.isSynthetic() && hasInstanti... | Apply before-instantiation post-processors, resolving whether there is a
before-instantiation shortcut for the specified bean.
@param beanName the name of the bean
@param mbd the bean definition for the bean
@return the shortcut-determined bean instance, or {@code null} if none | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,125 | [
"beanName",
"mbd"
] | Object | true | 6 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
getCodePointSize | private static int getCodePointSize(byte[] bytes, int i) {
int b = Byte.toUnsignedInt(bytes[i]);
if ((b & 0b1_0000000) == 0b0_0000000) {
return 1;
}
if ((b & 0b111_00000) == 0b110_00000) {
return 2;
}
if ((b & 0b1111_0000) == 0b1110_0000) {
return 3;
}
return 4;
} | Read a string value from the given data block.
@param data the source data
@param pos the position to read from
@param len the number of bytes to read
@return the contents as a string | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipString.java | 294 | [
"bytes",
"i"
] | true | 4 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
argsort | def argsort(self, axis=np._NoValue, kind=None, order=None, endwith=True,
fill_value=None, *, stable=False):
"""
Return an ndarray of indices that sort the array along the
specified axis. Masked values are filled beforehand to
`fill_value`.
Parameters
---... | Return an ndarray of indices that sort the array along the
specified axis. Masked values are filled beforehand to
`fill_value`.
Parameters
----------
axis : int, optional
Axis along which to sort. If None, the default, the flattened array
is used.
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optio... | python | numpy/ma/core.py | 5,605 | [
"self",
"axis",
"kind",
"order",
"endwith",
"fill_value",
"stable"
] | false | 8 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
offload_chosen_sets | def offload_chosen_sets(
fwd_module: fx.GraphModule,
bwd_module: fx.GraphModule,
) -> None:
"""
Add offload and reload nodes to the forward and backward graphs.
This function adds device_put operations without any stream handling.
Args:
fwd_module: Forward module graph
bwd_modul... | Add offload and reload nodes to the forward and backward graphs.
This function adds device_put operations without any stream handling.
Args:
fwd_module: Forward module graph
bwd_module: Backward module graph | python | torch/_functorch/_activation_offloading/activation_offloading.py | 306 | [
"fwd_module",
"bwd_module"
] | None | true | 3 | 6.4 | pytorch/pytorch | 96,034 | google | false |
execute | private @Nullable Object execute(CacheOperationInvoker invoker, Method method, CacheOperationContexts contexts) {
if (contexts.isSynchronized()) {
// Special handling of synchronized invocation
return executeSynchronized(invoker, method, contexts);
}
// Process any early evictions
processCacheEvicts(cont... | Execute the underlying operation (typically in case of cache miss) and return
the result of the invocation. If an exception occurs it will be wrapped in a
{@link CacheOperationInvoker.ThrowableWrapper}: the exception can be handled
or modified but it <em>must</em> be wrapped in a
{@link CacheOperationInvoker.ThrowableW... | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 427 | [
"invoker",
"method",
"contexts"
] | Object | true | 4 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
elementSet | @Override
public ImmutableSet<E> elementSet() {
ImmutableSet<E> result = elementSet;
return (result == null) ? elementSet = new ElementSet<>(Arrays.asList(entries), this) : result;
} | Maximum allowed length of a hash table bucket before falling back to a j.u.HashMap based
implementation. Experimentally determined. | java | guava/src/com/google/common/collect/RegularImmutableMultiset.java | 182 | [] | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false | |
compress_rowcols | def compress_rowcols(x, axis=None):
"""
Suppress the rows and/or columns of a 2-D array that contain
masked values.
The suppression behavior is selected with the `axis` parameter.
- If axis is None, both rows and columns are suppressed.
- If axis is 0, only rows are suppressed.
- If axis i... | Suppress the rows and/or columns of a 2-D array that contain
masked values.
The suppression behavior is selected with the `axis` parameter.
- If axis is None, both rows and columns are suppressed.
- If axis is 0, only rows are suppressed.
- If axis is 1 or -1, only columns are suppressed.
Parameters
----------
x : a... | python | numpy/ma/extras.py | 899 | [
"x",
"axis"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
synchronizedBiMap | @J2ktIncompatible // Synchronized
public static <K extends @Nullable Object, V extends @Nullable Object>
BiMap<K, V> synchronizedBiMap(BiMap<K, V> bimap) {
return Synchronized.biMap(bimap, null);
} | Returns a synchronized (thread-safe) bimap backed by the specified bimap. In order to guarantee
serial access, it is critical that <b>all</b> access to the backing bimap is accomplished
through the returned bimap.
<p>It is imperative that the user manually synchronize on the returned map when accessing any
of its colle... | java | android/guava/src/com/google/common/collect/Maps.java | 1,623 | [
"bimap"
] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
execute | def execute(self, context: Context) -> None:
"""
Transfers Google APIs json data to S3.
:param context: The context that is being provided when executing.
"""
self.log.info("Transferring data from %s to s3", self.google_api_service_name)
if self.google_api_endpoint_para... | Transfers Google APIs json data to S3.
:param context: The context that is being provided when executing. | python | providers/amazon/src/airflow/providers/amazon/aws/transfers/google_api_to_s3.py | 140 | [
"self",
"context"
] | None | true | 3 | 7.04 | apache/airflow | 43,597 | sphinx | false |
reset_option | def reset_option(pat: str) -> None:
"""
Reset one or more options to their default value.
This method resets the specified pandas option(s) back to their default
values. It allows partial string matching for convenience, but users should
exercise caution to avoid unintended resets due to changes in... | Reset one or more options to their default value.
This method resets the specified pandas option(s) back to their default
values. It allows partial string matching for convenience, but users should
exercise caution to avoid unintended resets due to changes in option names
in future versions.
Parameters
----------
pat... | python | pandas/_config/config.py | 344 | [
"pat"
] | None | true | 6 | 8.32 | pandas-dev/pandas | 47,362 | numpy | false |
_maybe_convert_timedelta | def _maybe_convert_timedelta(self, other) -> int | npt.NDArray[np.int64]:
"""
Convert timedelta-like input to an integer multiple of self.freq
Parameters
----------
other : timedelta, np.timedelta64, DateOffset, int, np.ndarray
Returns
-------
converted ... | Convert timedelta-like input to an integer multiple of self.freq
Parameters
----------
other : timedelta, np.timedelta64, DateOffset, int, np.ndarray
Returns
-------
converted : int, np.ndarray[int64]
Raises
------
IncompatibleFrequency : if the input cannot be written as a multiple
of self.freq. Note Incompati... | python | pandas/core/indexes/period.py | 363 | [
"self",
"other"
] | int | npt.NDArray[np.int64] | true | 6 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
from_tuples | def from_tuples(
cls,
data,
closed: IntervalClosedType = "right",
name: Hashable | None = None,
copy: bool = False,
dtype: Dtype | None = None,
) -> IntervalIndex:
"""
Construct an IntervalIndex from an array-like of tuples.
Parameters
... | Construct an IntervalIndex from an array-like of tuples.
Parameters
----------
data : array-like (1-dimensional)
Array of tuples.
closed : {'left', 'right', 'both', 'neither'}, default 'right'
Whether the intervals are closed on the left-side, right-side, both
or neither.
name : str, optional
Name of t... | python | pandas/core/indexes/interval.py | 397 | [
"cls",
"data",
"closed",
"name",
"copy",
"dtype"
] | IntervalIndex | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
match | public Optional<String> match() {
return this.match;
} | @return the optional match string, where:
if present, the name that's matched exactly
if empty, matches the default name
if null, matches any specified name | java | clients/src/main/java/org/apache/kafka/common/quota/ClientQuotaFilterComponent.java | 88 | [] | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false | |
getAnnotation | AnnotationMirror getAnnotation(Element element, String type) {
if (element != null) {
for (AnnotationMirror annotation : element.getAnnotationMirrors()) {
if (type.equals(annotation.getAnnotationType().toString())) {
return annotation;
}
}
}
return null;
} | Resolve the {@link SourceMetadata} for the specified property.
@param field the field of the property (can be {@code null})
@param getter the getter of the property (can be {@code null})
@return the {@link SourceMetadata} for the specified property | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | 258 | [
"element",
"type"
] | AnnotationMirror | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
requestUpdateForNewTopics | public synchronized int requestUpdateForNewTopics() {
// Override the timestamp of last refresh to let immediate update.
this.lastRefreshMs = 0;
this.needPartialUpdate = true;
this.equivalentResponseCount = 0;
this.requestVersion++;
return this.updateVersion;
} | Request an immediate update of the current cluster metadata info, because the caller is interested in
metadata that is being newly requested.
@return The current updateVersion before the update | java | clients/src/main/java/org/apache/kafka/clients/Metadata.java | 213 | [] | true | 1 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
fix_invalid | def fix_invalid(a, mask=nomask, copy=True, fill_value=None):
"""
Return input with invalid data masked and replaced by a fill value.
Invalid data means values of `nan`, `inf`, etc.
Parameters
----------
a : array_like
Input array, a (subclass of) ndarray.
mask : sequence, optional
... | Return input with invalid data masked and replaced by a fill value.
Invalid data means values of `nan`, `inf`, etc.
Parameters
----------
a : array_like
Input array, a (subclass of) ndarray.
mask : sequence, optional
Mask. Must be convertible to an array of booleans with the same
shape as `data`. True ind... | python | numpy/ma/core.py | 763 | [
"a",
"mask",
"copy",
"fill_value"
] | false | 3 | 7.6 | numpy/numpy | 31,054 | numpy | false | |
parseProperties | public Set<Property> parseProperties(@Nullable final List<String> propertyNames) {
if (propertyNames != null) {
final Set<Property> parsedProperties = new HashSet<>();
for (String propertyName : propertyNames) {
parsedProperties.add(Property.parseProperty(this.properties,... | Parse the given list of property names.
@param propertyNames a list of property names to parse, or null to use the default properties for this database
@throws IllegalArgumentException if any of the property names are not valid
@return a set of parsed and validated properties | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/Database.java | 232 | [
"propertyNames"
] | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false | |
mean | def mean(self, axis: Axis = 0, *args, **kwargs):
"""
Mean of non-NA/null values
Returns
-------
mean : float
"""
nv.validate_mean(args, kwargs)
valid_vals = self._valid_sp_values
sp_sum = valid_vals.sum()
ct = len(valid_vals)
if s... | Mean of non-NA/null values
Returns
-------
mean : float | python | pandas/core/arrays/sparse/array.py | 1,581 | [
"self",
"axis"
] | true | 3 | 6.56 | pandas-dev/pandas | 47,362 | unknown | false | |
servicesByState | ImmutableSetMultimap<State, Service> servicesByState() {
ImmutableSetMultimap.Builder<State, Service> builder = ImmutableSetMultimap.builder();
monitor.enter();
try {
for (Entry<State, Service> entry : servicesByState.entries()) {
if (!(entry.getValue() instanceof NoOpService)) {
... | Marks the {@link State} as ready to receive transitions. Returns true if no transitions have
been observed yet. | java | android/guava/src/com/google/common/util/concurrent/ServiceManager.java | 630 | [] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
has_fit_parameter | def has_fit_parameter(estimator, parameter):
"""Check whether the estimator's fit method supports the given parameter.
Parameters
----------
estimator : object
An estimator to inspect.
parameter : str
The searched parameter.
Returns
-------
is_parameter : bool
... | Check whether the estimator's fit method supports the given parameter.
Parameters
----------
estimator : object
An estimator to inspect.
parameter : str
The searched parameter.
Returns
-------
is_parameter : bool
Whether the parameter was found to be a named parameter of the
estimator's fit method.
... | python | sklearn/utils/validation.py | 1,472 | [
"estimator",
"parameter"
] | false | 2 | 7.2 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
visitForInStatement | function visitForInStatement(node: ForInStatement): VisitResult<Statement> {
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & NodeFlags.BlockScoped)) {
const exportStatements = appendExportsOfVariableDeclarationList(/*statements*/ undefined, node.initializer, /*isForIn... | Visits the body of a ForInStatement to hoist declarations.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 932 | [
"node"
] | true | 5 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
check_status | def check_status(
self,
job_name: str,
key: str,
describe_function: Callable,
check_interval: int,
max_ingestion_time: int | None = None,
non_terminal_states: set | None = None,
) -> dict:
"""
Check status of a SageMaker resource.
:par... | Check status of a SageMaker resource.
:param job_name: name of the resource to check status, can be a job but
also pipeline for instance.
:param key: the key of the response dict that points to the state
:param describe_function: the function used to retrieve the status
:param args: the arguments for the function
... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 712 | [
"self",
"job_name",
"key",
"describe_function",
"check_interval",
"max_ingestion_time",
"non_terminal_states"
] | dict | true | 7 | 8.08 | apache/airflow | 43,597 | sphinx | false |
restrict | def restrict(self, support, indices=False):
"""Restrict the features to those in support using feature selection.
This function modifies the estimator in-place.
Parameters
----------
support : array-like
Boolean mask or list of indices (as returned by the get_suppor... | Restrict the features to those in support using feature selection.
This function modifies the estimator in-place.
Parameters
----------
support : array-like
Boolean mask or list of indices (as returned by the get_support
member of feature selectors).
indices : bool, default=False
Whether support is a list... | python | sklearn/feature_extraction/_dict_vectorizer.py | 403 | [
"self",
"support",
"indices"
] | false | 3 | 7.04 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
bucket_all_gather_by_mb | def bucket_all_gather_by_mb(
gm: torch.fx.GraphModule,
bucket_cap_mb_by_bucket_idx: Callable[[int], float],
filter_wait_node: Callable[[torch.fx.Node], bool] | None = None,
mode: BucketMode = "default",
) -> list[list[torch.fx.Node]]:
"""
Identifies all all_gather nodes and groups them into buck... | Identifies all all_gather nodes and groups them into buckets,
based on size limit `bucket_cap_mb_by_bucket_idx`.
Args:
gm (torch.fx.GraphModule): GraphModule where to bucket all_gathers.
bucket_cap_mb_by_bucket_idx (Callable[[int], float]): Callable to specify cap of the bucket
in megabytes by bucket i... | python | torch/_inductor/fx_passes/bucketing.py | 350 | [
"gm",
"bucket_cap_mb_by_bucket_idx",
"filter_wait_node",
"mode"
] | list[list[torch.fx.Node]] | true | 3 | 7.44 | pytorch/pytorch | 96,034 | google | false |
offsetsForTimes | @Override
public Map<TopicPartition, OffsetAndTimestamp> offsetsForTimes(Map<TopicPartition, Long> timestampsToSearch, Duration timeout) {
return delegate.offsetsForTimes(timestampsToSearch, timeout);
} | Look up the offsets for the given partitions by timestamp. The returned offset for each partition is the
earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partition.
This is a blocking call. The consumer does not have to be assigned the partitions.
If the message forma... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 1,613 | [
"timestampsToSearch",
"timeout"
] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
argmax | def argmax(self, axis=None, fill_value=None, out=None, *,
keepdims=np._NoValue):
"""
Returns array of indices of the maximum values along the given axis.
Masked values are treated as if they had the value fill_value.
Parameters
----------
axis : {None, in... | Returns array of indices of the maximum values along the given axis.
Masked values are treated as if they had the value fill_value.
Parameters
----------
axis : {None, integer}
If None, the index is into the flattened array, otherwise along
the specified axis
fill_value : scalar or None, optional
Value use... | python | numpy/ma/core.py | 5,733 | [
"self",
"axis",
"fill_value",
"out",
"keepdims"
] | false | 3 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
make_sparse_coded_signal | def make_sparse_coded_signal(
n_samples,
*,
n_components,
n_features,
n_nonzero_coefs,
random_state=None,
):
"""Generate a signal as a sparse combination of dictionary elements.
Returns matrices `Y`, `D` and `X` such that `Y = XD` where `X` is of shape
`(n_samples, n_components)`, `... | Generate a signal as a sparse combination of dictionary elements.
Returns matrices `Y`, `D` and `X` such that `Y = XD` where `X` is of shape
`(n_samples, n_components)`, `D` is of shape `(n_components, n_features)`, and
each row of `X` has exactly `n_nonzero_coefs` non-zero elements.
Read more in the :ref:`User Guide... | python | sklearn/datasets/_samples_generator.py | 1,529 | [
"n_samples",
"n_components",
"n_features",
"n_nonzero_coefs",
"random_state"
] | false | 2 | 7.12 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_init_file | def _init_file(self, ti, *, identifier: str | None = None):
"""
Create log directory and give it permissions that are configured.
See above _prepare_log_folder method for more detailed explanation.
:param ti: task instance object
:return: relative log path of the given task ins... | Create log directory and give it permissions that are configured.
See above _prepare_log_folder method for more detailed explanation.
:param ti: task instance object
:return: relative log path of the given task instance | python | airflow-core/src/airflow/utils/log/file_task_handler.py | 821 | [
"self",
"ti",
"identifier"
] | true | 4 | 8.24 | apache/airflow | 43,597 | sphinx | false | |
max | public static short max(short a, final short b, final short c) {
if (b > a) {
a = b;
}
if (c > a) {
a = c;
}
return a;
} | Gets the maximum of three {@code short} values.
@param a value 1.
@param b value 2.
@param c value 3.
@return the largest of the values. | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,084 | [
"a",
"b",
"c"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
merge | def merge(*lists):
"""
Merge lists while trying to keep the relative order of the elements.
Warn if the lists have the same elements in a different relative order.
For static assets it can be important to have them included in the DOM
in a certain order. In JavaScript you may no... | Merge lists while trying to keep the relative order of the elements.
Warn if the lists have the same elements in a different relative order.
For static assets it can be important to have them included in the DOM
in a certain order. In JavaScript you may not be able to reference a
global or in CSS you might want to ove... | python | django/forms/widgets.py | 201 | [] | false | 4 | 6.08 | django/django | 86,204 | unknown | false | |
prependIfMissing | @Deprecated
public static String prependIfMissing(final String str, final CharSequence prefix, final CharSequence... prefixes) {
return Strings.CS.prependIfMissing(str, prefix, prefixes);
} | Prepends the prefix to the start of the string if the string does not already start with any of the prefixes.
<pre>
StringUtils.prependIfMissing(null, null) = null
StringUtils.prependIfMissing("abc", null) = "abc"
StringUtils.prependIfMissing("", "xyz") = "xyz"
StringUtils.prependIfMissing("abc", "xyz") = "xyzabc"
Stri... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 5,607 | [
"str",
"prefix"
] | String | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
isTypeAnnotationContext | function isTypeAnnotationContext(context: FormattingContext): boolean {
const contextKind = context.contextNode.kind;
return contextKind === SyntaxKind.PropertyDeclaration ||
contextKind === SyntaxKind.PropertySignature ||
contextKind === SyntaxKind.Parameter ||
contextKind === Synt... | A rule takes a two tokens (left/right) and a particular context
for which you're meant to look at them. You then declare what should the
whitespace annotation be between these tokens via the action param.
@param debugName Name to print
@param left The left side of the comparison
@param right The right side of the... | typescript | src/services/formatting/rules.ts | 558 | [
"context"
] | true | 5 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
close | @Override
public void close() {
lock.lock();
try {
idempotentCloser.close(
this::drainAll,
() -> log.warn("The fetch buffer was already closed")
);
} finally {
lock.unlock();
}
} | Return the set of {@link TopicIdPartition partitions} for which we have data in the buffer.
@return {@link TopicIdPartition Partition} set | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetchBuffer.java | 206 | [] | void | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false |
AST_MATCHER | AST_MATCHER(Decl, declHasNoReturnAttr) {
return Node.hasAttr<NoReturnAttr>() || Node.hasAttr<CXX11NoReturnAttr>() ||
Node.hasAttr<C11NoReturnAttr>();
} | matches a Decl if it has a "no return" attribute of any kind | cpp | clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp | 25 | [] | true | 3 | 6.48 | llvm/llvm-project | 36,021 | doxygen | false | |
toString | @Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
KeyStore keyStore = this.keyStore.get();
creator.append("keyStore.type", (keyStore != null) ? keyStore.getType() : "none");
String keyStorePassword = getKeyStorePassword();
creator.append("keyStorePassword", (keyStorePa... | Create a new {@link JksSslStoreBundle} instance.
@param keyStoreDetails the key store details
@param trustStoreDetails the trust store details
@param resourceLoader the resource loader used to load content
@since 3.3.5 | java | core/spring-boot/src/main/java/org/springframework/boot/ssl/jks/JksSslStoreBundle.java | 146 | [] | String | true | 4 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
joinWith | public static String joinWith(final String delimiter, final Object... array) {
if (array == null) {
throw new IllegalArgumentException("Object varargs must not be null");
}
return join(array, delimiter);
} | Joins the elements of the provided varargs into a single String containing the provided elements.
<p>
No delimiter is added before or after the list. {@code null} elements and separator are treated as empty Strings ("").
</p>
<pre>
StringUtils.joinWith(",", {"a", "b"}) = "a,b"
StringUtils.joinWith(",", {"a", "b"... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 4,725 | [
"delimiter"
] | String | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
invokeExactMethod | public static Object invokeExactMethod(final Object object, final String methodName, final Object[] args, final Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
final Class<?> cls = Objects.requireNonNull(object, "object").getClass();
... | Invokes a method whose parameter types match exactly the parameter types given.
<p>
This uses reflection to invoke the method obtained from a call to {@link #getAccessibleMethod(Class, String, Class[])}.
</p>
@param object Invokes a method on this object.
@param methodName Gets a method with this name.
@par... | java | src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | 625 | [
"object",
"methodName",
"args",
"parameterTypes"
] | Object | true | 1 | 6.24 | apache/commons-lang | 2,896 | javadoc | false |
visitor | function visitor(node: Node): VisitResult<Node | undefined> {
if (node.transformFlags & TransformFlags.ContainsJsx) {
return visitorWorker(node);
}
else {
return node;
}
} | Transform JSX-specific syntax in a SourceFile.
@param node A SourceFile node. | typescript | src/compiler/transformers/jsx.ts | 207 | [
"node"
] | true | 3 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
nullToEmpty | public static String[] nullToEmpty(final String[] array) {
return nullTo(array, EMPTY_STRING_ARRAY);
} | Defensive programming technique to change a {@code null}
reference to an empty one.
<p>
This method returns an empty array for a {@code null} input array.
</p>
<p>
As a memory optimizing technique an empty array passed in will be overridden with
the empty {@code public static} references in this class.
</p>
@param arra... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,622 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
registerJavaDate | private void registerJavaDate(DateTimeFormatters dateTimeFormatters) {
DateFormatterRegistrar dateFormatterRegistrar = new DateFormatterRegistrar();
String datePattern = dateTimeFormatters.getDatePattern();
if (datePattern != null) {
DateFormatter dateFormatter = new DateFormatter(datePattern);
dateFormatte... | Create a new WebConversionService that configures formatters with the provided
date, time, and date-time formats, or registers the default if no custom format is
provided.
@param dateTimeFormatters the formatters to use for date, time, and date-time
formatting
@since 2.3.0 | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java | 91 | [
"dateTimeFormatters"
] | void | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
channelBuilderConfigs | @SuppressWarnings("unchecked")
static Map<String, Object> channelBuilderConfigs(final AbstractConfig config, final ListenerName listenerName) {
Map<String, Object> parsedConfigs;
if (listenerName == null)
parsedConfigs = (Map<String, Object>) config.values();
else
par... | @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 | 195 | [
"config",
"listenerName"
] | true | 5 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
put | @CanIgnoreReturnValue
@Override
public boolean put(@ParametricNullness K key, @ParametricNullness V value) {
addNode(key, value, null);
return true;
} | Stores a key-value pair in the multimap.
@param key key to store in the multimap
@param value value to store in the multimap
@return {@code true} always | java | android/guava/src/com/google/common/collect/LinkedListMultimap.java | 601 | [
"key",
"value"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
advisorsPreFiltered | protected boolean advisorsPreFiltered() {
return false;
} | Return whether the Advisors returned by the subclass are pre-filtered
to match the bean's target class already, allowing the ClassFilter check
to be skipped when building advisors chains for AOP invocations.
<p>Default is {@code false}. Subclasses may override this if they
will always return pre-filtered Advisors.
@ret... | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java | 520 | [] | true | 1 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
clientInstanceId | @Override
public Uuid clientInstanceId(Duration timeout) {
return delegate.clientInstanceId(timeout);
} | Determines the client's unique client instance ID used for telemetry. This ID is unique to
this specific client instance and will not change after it is initially generated.
The ID is useful for correlating client operations with telemetry sent to the broker and
to its eventual monitoring destinations.
<p>
If telemetry... | java | clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java | 1,390 | [
"timeout"
] | Uuid | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
get_config | def get_config(self, key: str) -> str | None:
"""
Get Airflow Configuration.
:param key: Configuration Option Key
:return: Configuration Option Value
"""
if self.config_prefix is None:
return None
return self._get_secret(self.config_prefix, key, self... | Get Airflow Configuration.
:param key: Configuration Option Key
:return: Configuration Option Value | python | providers/amazon/src/airflow/providers/amazon/aws/secrets/secrets_manager.py | 241 | [
"self",
"key"
] | str | None | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false |
createMap | protected Map<String, Object> createMap() {
Map<String, Object> result = new LinkedHashMap<>();
process((properties, map) -> merge(result, map));
return result;
} | Template method that subclasses may override to construct the object
returned by this factory.
<p>Invoked lazily the first time {@link #getObject()} is invoked in
case of a shared singleton; else, on each {@link #getObject()} call.
<p>The default implementation returns the merged {@code Map} instance.
@return the objec... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java | 121 | [] | true | 1 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.