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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
from_frame | def from_frame(
cls,
df: DataFrame,
sortorder: int | None = None,
names: Sequence[Hashable] | Hashable | None = None,
) -> MultiIndex:
"""
Make a MultiIndex from a DataFrame.
Parameters
----------
df : DataFrame
DataFrame to be con... | Make a MultiIndex from a DataFrame.
Parameters
----------
df : DataFrame
DataFrame to be converted to MultiIndex.
sortorder : int, optional
Level of sortedness (must be lexicographically sorted by that
level).
names : list-like, optional
If no names are provided, use the column names, or tuple of colum... | python | pandas/core/indexes/multi.py | 656 | [
"cls",
"df",
"sortorder",
"names"
] | MultiIndex | true | 3 | 7.92 | pandas-dev/pandas | 47,362 | numpy | false |
register_writer | def register_writer(klass: ExcelWriter_t) -> None:
"""
Add engine to the excel writer registry.io.excel.
You must use this method to integrate with ``to_excel``.
Parameters
----------
klass : ExcelWriter
"""
if not callable(klass):
raise ValueError("Can only register callables ... | Add engine to the excel writer registry.io.excel.
You must use this method to integrate with ``to_excel``.
Parameters
----------
klass : ExcelWriter | python | pandas/io/excel/_util.py | 34 | [
"klass"
] | None | true | 2 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
_get_additional_distribution_info | def _get_additional_distribution_info(provider_distribution_path: Path) -> str:
"""Returns additional info for the package.
:param provider_distribution_path: path for the package
:return: additional information for the path (empty string if missing)
"""
additional_info_file_path = provider_distrib... | Returns additional info for the package.
:param provider_distribution_path: path for the package
:return: additional information for the path (empty string if missing) | python | dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py | 654 | [
"provider_distribution_path"
] | str | true | 5 | 7.6 | apache/airflow | 43,597 | sphinx | false |
cos | public static double cos(double a) {
if (a < 0.0) {
a = -a;
}
if (a > SIN_COS_MAX_VALUE_FOR_INT_MODULO) {
return Math.cos(a);
}
// index: possibly outside tables range.
int index = (int) (a * SIN_COS_INDEXER + 0.5);
double delta = (a - inde... | Returns the trigonometric cosine of an angle.
<p>Error is around 1E-15.
<p>Special cases:
<ul>
<li>If the argument is {@code NaN} or an infinity, then the result is {@code NaN}.
</ul>
@param a an angle, in radians.
@return the cosine of the argument.
@see Math#cos(double) | java | libs/geo/src/main/java/org/elasticsearch/geometry/simplify/SloppyMath.java | 77 | [
"a"
] | true | 3 | 8.24 | elastic/elasticsearch | 75,680 | javadoc | false | |
_import_helper | def _import_helper(file_path: str, overwrite: bool) -> None:
"""
Load connections from a file and save them to the DB.
:param overwrite: Whether to skip or overwrite on collision.
"""
connections_dict = load_connections_dict(file_path)
with create_session() as session:
for conn_id, conn... | Load connections from a file and save them to the DB.
:param overwrite: Whether to skip or overwrite on collision. | python | airflow-core/src/airflow/cli/commands/connection_command.py | 330 | [
"file_path",
"overwrite"
] | None | true | 4 | 7.2 | apache/airflow | 43,597 | sphinx | false |
loadClassInLaunchedClassLoader | private Class<?> loadClassInLaunchedClassLoader(String name) throws ClassNotFoundException {
try {
String internalName = name.replace('.', '/') + ".class";
try (InputStream inputStream = getParent().getResourceAsStream(internalName);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
i... | 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 | 94 | [
"name"
] | true | 3 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false | |
hashCode | @Override
public int hashCode() {
if (hash == 0) {
hash = bytes().hashCode();
}
return hash;
} | Whether a {@link String} view of the data is already materialized. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/Text.java | 136 | [] | true | 2 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false | |
compressionType | CompressionType compressionType(); | Get the compression type of this record batch.
@return The compression type | java | clients/src/main/java/org/apache/kafka/common/record/RecordBatch.java | 182 | [] | CompressionType | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
increment | public static InetAddress increment(InetAddress address) {
byte[] addr = address.getAddress();
int i = addr.length - 1;
while (i >= 0 && addr[i] == (byte) 0xff) {
addr[i] = 0;
i--;
}
checkArgument(i >= 0, "Incrementing %s would wrap.", address);
addr[i]++;
return bytesToInetAdd... | Returns a new InetAddress that is one more than the passed in address. This method works for
both IPv4 and IPv6 addresses.
@param address the InetAddress to increment
@return a new InetAddress that is one more than the passed in address
@throws IllegalArgumentException if InetAddress is at the end of its range
@since 1... | java | android/guava/src/com/google/common/net/InetAddresses.java | 1,202 | [
"address"
] | InetAddress | true | 3 | 8.08 | google/guava | 51,352 | javadoc | false |
zipObject | function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
} | This method is like `_.fromPairs` except that it accepts two arrays,
one of property identifiers and one of corresponding values.
@static
@memberOf _
@since 0.4.0
@category Array
@param {Array} [props=[]] The property identifiers.
@param {Array} [values=[]] The property values.
@returns {Object} Returns the new object.... | javascript | lodash.js | 8,758 | [
"props",
"values"
] | false | 3 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
findThreadById | public static Thread findThreadById(final long threadId, final ThreadGroup threadGroup) {
Objects.requireNonNull(threadGroup, "threadGroup");
final Thread thread = findThreadById(threadId);
if (thread != null && threadGroup.equals(thread.getThreadGroup())) {
return thread;
}
... | Finds the active thread with the specified id if it belongs to the specified thread group.
@param threadId The thread id.
@param threadGroup The thread group.
@return The thread which belongs to a specified thread group and the thread's id match the specified id. {@code null} is returned if no such thread
ex... | java | src/main/java/org/apache/commons/lang3/ThreadUtils.java | 224 | [
"threadId",
"threadGroup"
] | Thread | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
notmasked_contiguous | def notmasked_contiguous(a, axis=None):
"""
Find contiguous unmasked data in a masked array along the given axis.
Parameters
----------
a : array_like
The input array.
axis : int, optional
Axis along which to perform the operation.
If None (default), applies to a flatten... | Find contiguous unmasked data in a masked array along the given axis.
Parameters
----------
a : array_like
The input array.
axis : int, optional
Axis along which to perform the operation.
If None (default), applies to a flattened version of the array, and this
is the same as `flatnotmasked_contiguous`.... | python | numpy/ma/extras.py | 2,032 | [
"a",
"axis"
] | false | 5 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
getErrorResponse | @Override
public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) {
JoinGroupResponseData data = new JoinGroupResponseData()
.setThrottleTimeMs(throttleTimeMs)
.setErrorCode(Errors.forException(e).code())
.setGenerationId(UNKNOWN_GENERATION_ID)
... | Get the client's join reason.
@param request The JoinGroupRequest.
@return The join reason. | java | clients/src/main/java/org/apache/kafka/common/requests/JoinGroupRequest.java | 191 | [
"throttleTimeMs",
"e"
] | AbstractResponse | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false |
forms_of_context | def forms_of_context() -> Sequence[str]:
"""Return the compile context forms provided by this class.
Returns:
A sequence containing the available compile context forms:
- "torch_version_hash": PyTorch version hash
- "triton_version_hash": Triton version hash (if avai... | Return the compile context forms provided by this class.
Returns:
A sequence containing the available compile context forms:
- "torch_version_hash": PyTorch version hash
- "triton_version_hash": Triton version hash (if available)
- "runtime": Runtime type (CUDA/HIP/None)
- "runtime_version": Runtim... | python | torch/_inductor/runtime/caching/context.py | 123 | [] | Sequence[str] | true | 1 | 6.08 | pytorch/pytorch | 96,034 | unknown | false |
init_RISCV_32Bit | private static void init_RISCV_32Bit() {
addProcessors(new Processor(Processor.Arch.BIT_32, Processor.Type.RISC_V), "riscv32");
} | Gets a {@link Processor} object the given value {@link String}. The {@link String} must be like a value returned by the {@code "os.arch"} system
property.
@param value A {@link String} like a value returned by the {@code os.arch} System Property.
@return A {@link Processor} when it exists, else {@code null}. | java | src/main/java/org/apache/commons/lang3/ArchUtils.java | 123 | [] | void | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
_post_process_frame | def _post_process_frame(frame, feature_names, target_names):
"""Post process a dataframe to select the desired columns in `X` and `y`.
Parameters
----------
frame : dataframe
The dataframe to split into `X` and `y`.
feature_names : list of str
The list of feature names to populate ... | Post process a dataframe to select the desired columns in `X` and `y`.
Parameters
----------
frame : dataframe
The dataframe to split into `X` and `y`.
feature_names : list of str
The list of feature names to populate `X`.
target_names : list of str
The list of target names to populate `y`.
Returns
----... | python | sklearn/datasets/_arff_parser.py | 75 | [
"frame",
"feature_names",
"target_names"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
defaultValues | public Map<String, Object> defaultValues() {
Map<String, Object> defaultValues = new HashMap<>();
for (ConfigKey key : configKeys.values()) {
if (key.defaultValue != NO_DEFAULT_VALUE)
defaultValues.put(key.name, key.defaultValue);
}
return defaultValues;
} | Returns unmodifiable set of properties names defined in this {@linkplain ConfigDef}
@return new unmodifiable {@link Set} instance containing the keys | java | clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java | 120 | [] | true | 2 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
compareZeroThreshold | public int compareZeroThreshold(ZeroBucket other) {
return compareExponentiallyScaledValues(index(), scale(), other.index(), other.scale());
} | Compares the zero threshold of this bucket with another one.
@param other The other zero bucket to compare against.
@return A negative integer, zero, or a positive integer if this bucket's threshold is less than,
equal to, or greater than the other's. | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ZeroBucket.java | 234 | [
"other"
] | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false | |
get_previous_dagrun | def get_previous_dagrun(
dag_run: DagRun, state: DagRunState | None = None, session: Session = NEW_SESSION
) -> DagRun | None:
"""
Return the previous DagRun, if there is one.
:param dag_run: the dag run
:param session: SQLAlchemy ORM Session
:param state: the dag ru... | Return the previous DagRun, if there is one.
:param dag_run: the dag run
:param session: SQLAlchemy ORM Session
:param state: the dag run state | python | airflow-core/src/airflow/models/dagrun.py | 945 | [
"dag_run",
"state",
"session"
] | DagRun | None | true | 4 | 6.56 | apache/airflow | 43,597 | sphinx | false |
calculateValueDelta | function calculateValueDelta(srcValue: number, targetValue: number, changeRate: number): number {
const valueSpan = targetValue - srcValue;
return valueSpan * changeRate;
} | Calculate the next `CssPropertyValue` based on the source and a target one.
@param srcValue The source value
@param targetValue The target values (it's either the final or the initial value)
@param changeRate The change rate relative to the target (i.e. 1 = target value; 0 = source value)
@returns The newly generated v... | typescript | adev/src/app/features/home/animation/calculations/calc-css-value.ts | 119 | [
"srcValue",
"targetValue",
"changeRate"
] | true | 1 | 6.64 | angular/angular | 99,544 | jsdoc | false | |
describe_tuning_job | def describe_tuning_job(self, name: str) -> dict:
"""
Get the tuning job info associated with the name.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.describe_hyper_parameter_tuning_job`
:param name: the name of the tuning job
:return: A dict contains all... | Get the tuning job info associated with the name.
.. seealso::
- :external+boto3:py:meth:`SageMaker.Client.describe_hyper_parameter_tuning_job`
:param name: the name of the tuning job
:return: A dict contains all the tuning job info | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 643 | [
"self",
"name"
] | dict | true | 1 | 6.24 | apache/airflow | 43,597 | sphinx | false |
set_context | def set_context(self, ti) -> None:
"""
Accept the run-time context (i.e. the current task) and configure the formatter accordingly.
:param ti:
:return:
"""
# Returns if there is no formatter or if the prefix has already been set
if ti.raw or self.formatter is Non... | Accept the run-time context (i.e. the current task) and configure the formatter accordingly.
:param ti:
:return: | python | airflow-core/src/airflow/utils/log/task_handler_with_custom_formatter.py | 41 | [
"self",
"ti"
] | None | true | 6 | 8.08 | apache/airflow | 43,597 | sphinx | false |
or | default FailablePredicate<T, E> or(final FailablePredicate<? super T, E> other) {
Objects.requireNonNull(other);
return t -> test(t) || other.test(t);
} | Returns a composed {@link FailablePredicate} like {@link Predicate#and(Predicate)}.
@param other a predicate that will be logically-ORed with this predicate.
@return a composed {@link FailablePredicate} like {@link Predicate#and(Predicate)}.
@throws NullPointerException if other is null | java | src/main/java/org/apache/commons/lang3/function/FailablePredicate.java | 93 | [
"other"
] | true | 2 | 7.36 | apache/commons-lang | 2,896 | javadoc | false | |
is_trivial_mask_graph | def is_trivial_mask_graph(graph_module: GraphModule) -> bool:
"""Mask graph is trivial when it only gates via the default full op."""
graph = graph_module.graph
nodes = list(graph.nodes)
placeholders = [n for n in nodes if n.op == "placeholder"]
output = [n for n in nodes if n.op == "output"]
as... | Mask graph is trivial when it only gates via the default full op. | python | torch/_inductor/kernel/flex/flex_flash_attention.py | 158 | [
"graph_module"
] | bool | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
aot_compile | def aot_compile(
f: Callable,
args: tuple[Any, ...],
kwargs: Optional[dict[str, Any]] = None,
*,
dynamic_shapes: Optional[dict[str, Any]] = None,
options: Optional[dict[str, Any]] = None,
remove_runtime_assertions: bool = False,
disable_constraint_solver: bool = False,
same_signature... | Note: this function is not stable yet
Traces either an nn.Module's forward function or just a callable with PyTorch
operations inside, generates executable cpp code from the program, and returns
the path to the generated shared library
Args:
f: the `nn.Module` or callable to trace.
args: example positional i... | python | torch/_export/__init__.py | 80 | [
"f",
"args",
"kwargs",
"dynamic_shapes",
"options",
"remove_runtime_assertions",
"disable_constraint_solver",
"same_signature"
] | Union[list[Any], str] | true | 3 | 8 | pytorch/pytorch | 96,034 | google | false |
response | def response(self, *args: t.Any, **kwargs: t.Any) -> Response:
"""Serialize the given arguments as JSON, and return a
:class:`~flask.Response` object with it. The response mimetype
will be "application/json" and can be changed with
:attr:`mimetype`.
If :attr:`compact` is ``False... | Serialize the given arguments as JSON, and return a
:class:`~flask.Response` object with it. The response mimetype
will be "application/json" and can be changed with
:attr:`mimetype`.
If :attr:`compact` is ``False`` or debug mode is enabled, the
output will be formatted to be easier to read.
Either positional or keyw... | python | src/flask/json/provider.py | 189 | [
"self"
] | Response | true | 5 | 6.72 | pallets/flask | 70,946 | sphinx | false |
function | static <T, R, E extends Throwable> FailableFunction<T, R, E> function(final FailableFunction<T, R, E> function) {
return function;
} | Starts a fluent chain like {@code function(foo::bar).andThen(...).andThen(...).apply(...);}
@param <T> Input type.
@param <R> Return type.
@param <E> The type of thrown exception or error.
@param function the argument to return.
@return the argument
@since 3.14.0 | java | src/main/java/org/apache/commons/lang3/function/FailableFunction.java | 48 | [
"function"
] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
equals | @Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof NameMatchMethodPointcut that &&
this.mappedNamePatterns.equals(that.mappedNamePatterns)));
} | Determine if the given method name matches the mapped name pattern.
<p>The default implementation checks for {@code xxx*}, {@code *xxx},
{@code *xxx*}, and {@code xxx*yyy} matches, as well as direct equality.
<p>Can be overridden in subclasses.
@param methodName the method name to check
@param mappedNamePattern the met... | java | spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java | 113 | [
"other"
] | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
checkQualifiers | protected @Nullable Boolean checkQualifiers(BeanDefinitionHolder bdHolder, Annotation[] annotationsToSearch) {
boolean qualifierFound = false;
if (!ObjectUtils.isEmpty(annotationsToSearch)) {
SimpleTypeConverter typeConverter = new SimpleTypeConverter();
for (Annotation annotation : annotationsToSearch) {
... | Match the given qualifier annotations against the candidate bean definition.
@return {@code false} if a qualifier has been found but not matched,
{@code true} if a qualifier has been found and matched,
{@code null} if no qualifier has been found at all | java | spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java | 175 | [
"bdHolder",
"annotationsToSearch"
] | Boolean | true | 14 | 7.04 | spring-projects/spring-framework | 59,386 | javadoc | false |
_getitem_tuple_same_dim | def _getitem_tuple_same_dim(self, tup: tuple):
"""
Index with indexers that should return an object of the same dimension
as self.obj.
This is only called after a failed call to _getitem_lowerdim.
"""
retval = self.obj
# Selecting columns before rows is significa... | Index with indexers that should return an object of the same dimension
as self.obj.
This is only called after a failed call to _getitem_lowerdim. | python | pandas/core/indexing.py | 1,031 | [
"self",
"tup"
] | true | 4 | 6 | pandas-dev/pandas | 47,362 | unknown | false | |
appendSeparator | public StrBuilder appendSeparator(final char standard, final char defaultIfEmpty) {
if (isNotEmpty()) {
append(standard);
} else {
append(defaultIfEmpty);
}
return this;
} | Append one of both separators to the builder
If the builder is currently empty it will append the defaultIfEmpty-separator
Otherwise it will append the standard-separator
The separator is appended using {@link #append(char)}.
@param standard the separator if builder is not empty
@param defaultIfEmpty the separator if b... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 1,237 | [
"standard",
"defaultIfEmpty"
] | StrBuilder | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
availablePartitionsForTopic | public List<PartitionInfo> availablePartitionsForTopic(String topic) {
return availablePartitionsByTopic.getOrDefault(topic, Collections.emptyList());
} | Get the list of available partitions for this topic
@param topic The topic name
@return A list of partitions | java | clients/src/main/java/org/apache/kafka/common/Cluster.java | 313 | [
"topic"
] | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false | |
apply_patch | def apply_patch(patch_file: str, target_dir: str | None, strip_count: int) -> None:
"""
Applies the downloaded patch to the specified directory using the given strip count.
Args:
patch_file (str): The path to the patch file.
target_dir (Optional[str]): The directory to apply the patch to. I... | Applies the downloaded patch to the specified directory using the given strip count.
Args:
patch_file (str): The path to the patch file.
target_dir (Optional[str]): The directory to apply the patch to. If None, uses PyTorch installation path.
strip_count (int): The number of leading directories to strip fr... | python | tools/nightly_hotpatch.py | 136 | [
"patch_file",
"target_dir",
"strip_count"
] | None | true | 7 | 7.04 | pytorch/pytorch | 96,034 | google | false |
commaMatcher | public static StrMatcher commaMatcher() {
return COMMA_MATCHER;
} | Gets the matcher for the comma character.
@return the matcher for a comma. | java | src/main/java/org/apache/commons/lang3/text/StrMatcher.java | 286 | [] | StrMatcher | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
matchFieldNamesWithDots | private boolean matchFieldNamesWithDots(String name, int dotIndex, List<FilterPath> nextFilters) {
String prefixName = name.substring(0, dotIndex);
String suffixName = name.substring(dotIndex + 1);
List<FilterPath> prefixFilterPath = new ArrayList<>();
boolean prefixMatch = matches(prefi... | check if the name matches filter nodes
if the name equals the filter node name, the node will add to nextFilters.
if the filter node is a final node, it means the name matches the pattern, and return true
if the name don't equal a final node, then return false, continue to check the inner filter node
if current node is... | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/support/filtering/FilterPath.java | 118 | [
"name",
"dotIndex",
"nextFilters"
] | true | 3 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false | |
getHandlerMappings | private Map<String, Object> getHandlerMappings() {
Map<String, Object> handlerMappings = this.handlerMappings;
if (handlerMappings == null) {
synchronized (this) {
handlerMappings = this.handlerMappings;
if (handlerMappings == null) {
if (logger.isTraceEnabled()) {
logger.trace("Loading Namesp... | Load the specified NamespaceHandler mappings lazily. | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultNamespaceHandlerResolver.java | 150 | [] | true | 6 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
notifyStarted | protected final void notifyStarted() {
monitor.enter();
try {
// We have to examine the internal state of the snapshot here to properly handle the stop
// while starting case.
if (snapshot.state != STARTING) {
IllegalStateException failure =
new IllegalStateException(
... | Implementing classes should invoke this method once their service has started. It will cause
the service to transition from {@link State#STARTING} to {@link State#RUNNING}.
@throws IllegalStateException if the service is not {@link State#STARTING}. | java | android/guava/src/com/google/common/util/concurrent/AbstractService.java | 383 | [] | void | true | 3 | 6.56 | google/guava | 51,352 | javadoc | false |
invokeInitMethods | protected void invokeInitMethods(String beanName, Object bean, @Nullable RootBeanDefinition mbd)
throws Throwable {
boolean isInitializingBean = (bean instanceof InitializingBean);
if (isInitializingBean && (mbd == null || !mbd.hasAnyExternallyManagedInitMethod("afterPropertiesSet"))) {
if (logger.isTraceEna... | Give a bean a chance to initialize itself after all its properties are set,
and a chance to know about its owning bean factory (this object).
<p>This means checking whether the bean implements {@link InitializingBean}
or defines any custom init methods, and invoking the necessary callback(s)
if it does.
@param beanName... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,856 | [
"beanName",
"bean",
"mbd"
] | void | true | 12 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
max | public static byte max(final byte... array) {
// Validates input
validateArray(array);
// Finds and returns max
byte max = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
}
}
return m... | Returns the maximum value in an array.
@param array an array, must not be null or empty.
@return the maximum value in the array.
@throws NullPointerException if {@code array} is {@code null}.
@throws IllegalArgumentException if {@code array} is empty.
@since 3.4 Changed signature from max(byte[]) to max(byte...). | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 822 | [] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
lazyTransform | @J2ktIncompatible
@GwtIncompatible // TODO
public static <I extends @Nullable Object, O extends @Nullable Object> Future<O> lazyTransform(
Future<I> input, Function<? super I, ? extends O> function) {
checkNotNull(input);
checkNotNull(function);
return new Future<O>() {
@Override
publ... | Like {@link #transform(ListenableFuture, Function, Executor)} except that the transformation
{@code function} is invoked on each call to {@link Future#get() get()} on the returned future.
<p>The returned {@code Future} reflects the input's cancellation state directly, and any
attempt to cancel the returned Future is li... | java | android/guava/src/com/google/common/util/concurrent/Futures.java | 514 | [
"input",
"function"
] | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false | |
buildSafePointcut | public final Pointcut buildSafePointcut() {
Pointcut pc = getPointcut();
MethodMatcher safeMethodMatcher = MethodMatchers.intersection(
new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher());
return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher);
} | Build a 'safe' pointcut that excludes the AspectJ advice method itself.
@return a composable pointcut that builds on the original AspectJ expression pointcut
@see #getPointcut() | java | spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java | 194 | [] | Pointcut | true | 1 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
transitionToSendingLeaveGroup | private void transitionToSendingLeaveGroup(boolean dueToExpiredPollTimer) {
if (state == MemberState.FATAL) {
log.warn("Member {} with epoch {} won't send leave group request because it is in " +
"FATAL state", memberId, memberEpoch);
return;
}
if (state =... | Reset member epoch to the value required for the leave the group heartbeat request, and
transition to the {@link MemberState#LEAVING} state so that a heartbeat request is sent
out with it.
@param dueToExpiredPollTimer True if the leave group is due to an expired poll timer. This
will indica... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 428 | [
"dueToExpiredPollTimer"
] | void | true | 4 | 6.88 | apache/kafka | 31,560 | javadoc | false |
replaceFirst | public StrBuilder replaceFirst(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
break;
}
}
}
return th... | Replaces the first instance of the search character with the
replace character in the builder.
@param search the search character
@param replace the replace character
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,627 | [
"search",
"replace"
] | StrBuilder | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
are_dependents_done | def are_dependents_done(self, session: Session = NEW_SESSION) -> bool:
"""
Check whether the immediate dependents of this task instance have succeeded or have been skipped.
This is meant to be used by wait_for_downstream.
This is useful when you do not want to start processing the next... | Check whether the immediate dependents of this task instance have succeeded or have been skipped.
This is meant to be used by wait_for_downstream.
This is useful when you do not want to start processing the next
schedule of a task until the dependents are done. For instance,
if the task DROPs and recreates a table.
... | python | airflow-core/src/airflow/models/taskinstance.py | 797 | [
"self",
"session"
] | bool | true | 3 | 7.04 | apache/airflow | 43,597 | sphinx | false |
sourceOutput | public Builder sourceOutput(Path sourceOutput) {
this.sourceOutput = sourceOutput;
return this;
} | Set the output directory for generated sources.
@param sourceOutput the location of generated sources
@return this builder for method chaining | java | spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java | 221 | [
"sourceOutput"
] | Builder | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
now | function now(): number {
if (supportsPerformanceNow) {
return performance.now();
}
return Date.now();
} | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow strict-local | javascript | packages/react-devtools-shared/src/PerformanceLoggingUtils.js | 38 | [] | false | 2 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
transitionTo | private void transitionTo(State target, RuntimeException error) {
if (!currentState.isTransitionValid(currentState, target)) {
String idString = transactionalId == null ? "" : "TransactionalId " + transactionalId + ": ";
String message = idString + "Invalid transition attempted from sta... | Check if the transaction is in the prepared state.
@return true if the current state is PREPARED_TRANSACTION | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 1,120 | [
"target",
"error"
] | void | true | 8 | 7.04 | apache/kafka | 31,560 | javadoc | false |
cancel | @CanIgnoreReturnValue
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
public boolean cancel(boolean mayInterruptIfRunning) {
logger.get().log(FINER, "cancelling {0}", this);
boolean cancelled = future.cancel(mayInterruptIfRunning);
if (cancelled) {
close();
... | Attempts to cancel execution of this step. This attempt will fail if the step has already
completed, has already been cancelled, or could not be cancelled for some other reason. If
successful, and this step has not started when {@code cancel} is called, this step should never
run.
<p>If successful, causes the objects c... | java | android/guava/src/com/google/common/util/concurrent/ClosingFuture.java | 1,086 | [
"mayInterruptIfRunning"
] | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false | |
dtypes | def dtypes(self) -> DtypeObj:
"""
Return the dtype object of the underlying data.
See Also
--------
DataFrame.dtypes : Return the dtypes in the DataFrame.
Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.dtypes
dtype('int64')
... | Return the dtype object of the underlying data.
See Also
--------
DataFrame.dtypes : Return the dtypes in the DataFrame.
Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.dtypes
dtype('int64') | python | pandas/core/series.py | 677 | [
"self"
] | DtypeObj | true | 1 | 6.24 | pandas-dev/pandas | 47,362 | unknown | false |
next | public String next(final int count, final boolean letters, final boolean numbers) {
return next(count, 0, 0, letters, numbers);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments.
</p>
@param count the length of random string to create.
@param letters if {@code true}, generated string may include alphabetic characters.... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 709 | [
"count",
"letters",
"numbers"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
is_due | def is_due(self, last_run_at: datetime) -> tuple[bool, datetime]:
"""Return tuple of ``(is_due, next_time_to_check)``.
Notes:
- next time to check is in seconds.
- ``(True, 20)``, means the task should be run now, and the next
time to check is in 20 seconds.
... | Return tuple of ``(is_due, next_time_to_check)``.
Notes:
- next time to check is in seconds.
- ``(True, 20)``, means the task should be run now, and the next
time to check is in 20 seconds.
- ``(False, 12.3)``, means the task is not due, but that the
scheduler should check again in 12.3 sec... | python | celery/schedules.py | 138 | [
"self",
"last_run_at"
] | tuple[bool, datetime] | true | 2 | 6.72 | celery/celery | 27,741 | unknown | false |
english_capitalize | def english_capitalize(s):
""" Apply English case rules to convert the first character of an ASCII
string to upper case.
This is an internal utility function to replace calls to str.capitalize()
such that we can avoid changing behavior with changing locales.
Parameters
----------
s : str
... | Apply English case rules to convert the first character of an ASCII
string to upper case.
This is an internal utility function to replace calls to str.capitalize()
such that we can avoid changing behavior with changing locales.
Parameters
----------
s : str
Returns
-------
capitalized : str
Examples
--------
>>> fr... | python | numpy/_core/_string_helpers.py | 72 | [
"s"
] | false | 3 | 7.36 | numpy/numpy | 31,054 | numpy | false | |
nested | @SuppressWarnings("unchecked")
void nested(T item, BiConsumer<String, Object> pairs) {
LinkedHashMap<String, Object> result = new LinkedHashMap<>();
this.addedPairs.forEach((addedPair) -> {
addedPair.accept(item, joining((name, value) -> {
List<String> nameParts = List.of(name.split("\\."));
Map<S... | Add pairs using the given callback.
@param <V> the value type
@param pairs callback provided with the item and consumer that can be called to
actually add the pairs | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java | 191 | [
"item",
"pairs"
] | void | true | 3 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
maybeTriggerWakeup | public void maybeTriggerWakeup() {
if (!wakeupDisabled.get() && wakeup.get()) {
log.debug("Raising WakeupException in response to user wakeup");
wakeup.set(false);
throw new WakeupException();
}
} | Check whether there is pending request. This includes both requests that
have been transmitted (i.e. in-flight requests) and those which are awaiting transmission.
@return A boolean indicating whether there is pending request | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java | 527 | [] | void | true | 3 | 7.92 | apache/kafka | 31,560 | javadoc | false |
decide_loop_order_to_match | def decide_loop_order_to_match(self, other: "MemoryDep") -> Optional[list[int]]:
"""
Can return None if not able to decide loop orders.
"""
assert self.num_vars == other.num_vars
# ignore broadcast for now since broadcast causes extra 0 strides
# which makes it hard to d... | Can return None if not able to decide loop orders. | python | torch/_inductor/dependencies.py | 104 | [
"self",
"other"
] | Optional[list[int]] | true | 8 | 6 | pytorch/pytorch | 96,034 | unknown | false |
poll_query_status | def poll_query_status(
self, query_execution_id: str, max_polling_attempts: int | None = None, sleep_time: int | None = None
) -> str | None:
"""
Poll the state of a submitted query until it reaches final state.
:param query_execution_id: ID of submitted athena query
:param ... | Poll the state of a submitted query until it reaches final state.
:param query_execution_id: ID of submitted athena query
:param max_polling_attempts: Number of times to poll for query state before function exits
:param sleep_time: Time (in seconds) to wait between two consecutive query status checks.
:return: One of ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py | 272 | [
"self",
"query_execution_id",
"max_polling_attempts",
"sleep_time"
] | str | None | true | 3 | 8.24 | apache/airflow | 43,597 | sphinx | false |
assignedTopicIds | public synchronized Set<Uuid> assignedTopicIds() {
return assignedTopicIds;
} | @return Topic IDs received in an assignment that have not been reconciled yet, so we need metadata for them. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 957 | [] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
create | public static ConfigurationMetadataRepositoryJsonBuilder create(InputStream... inputStreams) throws IOException {
ConfigurationMetadataRepositoryJsonBuilder builder = create();
for (InputStream inputStream : inputStreams) {
builder = builder.withJsonResource(inputStream);
}
return builder;
} | Create a new builder instance using {@link StandardCharsets#UTF_8} as the default
charset and the specified JSON resource.
@param inputStreams the source input streams
@return a new {@link ConfigurationMetadataRepositoryJsonBuilder} instance.
@throws IOException on error | java | configuration-metadata/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java | 153 | [] | ConfigurationMetadataRepositoryJsonBuilder | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OffsetAndMetadata that = (OffsetAndMetadata) o;
return offset == that.offset &&
Objects.equals(metadata, that.metadata) &&
... | Get the leader epoch of the previously consumed record (if one is known). Log truncation is detected
if there exists a leader epoch which is larger than this epoch and begins at an offset earlier than
the committed offset.
@return the leader epoch or empty if not known | java | clients/src/main/java/org/apache/kafka/clients/consumer/OffsetAndMetadata.java | 104 | [
"o"
] | true | 6 | 6.88 | apache/kafka | 31,560 | javadoc | false | |
extendWith | public PatternBank extendWith(Map<String, String> extraPatterns) {
if (extraPatterns == null || extraPatterns.isEmpty()) {
return this;
}
var extendedBank = new LinkedHashMap<>(bank);
extendedBank.putAll(extraPatterns);
return new PatternBank(extendedBank);
} | Extends a pattern bank with extra patterns, returning a new pattern bank.
<p>
The returned bank will be the same reference as the original pattern bank if the extra patterns map is null or empty.
@param extraPatterns the patterns to extend this bank with (may be empty or null)
@return the extended pattern bank | java | libs/grok/src/main/java/org/elasticsearch/grok/PatternBank.java | 55 | [
"extraPatterns"
] | PatternBank | true | 3 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
createProxyClass | private Class<?> createProxyClass(Class<?> beanClass, @Nullable String beanName,
Object @Nullable [] specificInterceptors, TargetSource targetSource) {
return (Class<?>) buildProxy(beanClass, beanName, specificInterceptors, targetSource, true);
} | Create an AOP proxy for the given bean.
@param beanClass the class of the bean
@param beanName the name of the bean
@param specificInterceptors the set of interceptors that is
specific to this bean (may be empty, but not null)
@param targetSource the TargetSource for the proxy,
already pre-configured to access the bean... | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java | 434 | [
"beanClass",
"beanName",
"specificInterceptors",
"targetSource"
] | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false | |
compute_list_like | def compute_list_like(
self,
op_name: Literal["agg", "apply"],
selected_obj: Series | DataFrame,
kwargs: dict[str, Any],
) -> tuple[list[Hashable] | Index, list[Any]]:
"""
Compute agg/apply results for like-like input.
Parameters
----------
op... | Compute agg/apply results for like-like input.
Parameters
----------
op_name : {"agg", "apply"}
Operation being performed.
selected_obj : Series or DataFrame
Data to perform operation on.
kwargs : dict
Keyword arguments to pass to the functions.
Returns
-------
keys : list[Hashable] or Index
Index lab... | python | pandas/core/apply.py | 416 | [
"self",
"op_name",
"selected_obj",
"kwargs"
] | tuple[list[Hashable] | Index, list[Any]] | true | 8 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
findThreads | @Deprecated
public static Collection<Thread> findThreads(final ThreadGroup threadGroup, final boolean recurse, final ThreadPredicate predicate) {
return findThreads(threadGroup, recurse, (Predicate<Thread>) predicate::test);
} | Finds all active threads which match the given predicate and which belongs to the given thread group (or one of its subgroups).
@param threadGroup the thread group.
@param recurse if {@code true} then evaluate the predicate recursively on all threads in all subgroups of the given group.
@param predicate the predi... | java | src/main/java/org/apache/commons/lang3/ThreadUtils.java | 365 | [
"threadGroup",
"recurse",
"predicate"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
opj_int_add_no_overflow | static INLINE OPJ_INT32 opj_int_add_no_overflow(OPJ_INT32 a, OPJ_INT32 b)
{
void* pa = &a;
void* pb = &b;
OPJ_UINT32* upa = (OPJ_UINT32*)pa;
OPJ_UINT32* upb = (OPJ_UINT32*)pb;
OPJ_UINT32 ures = *upa + *upb;
void* pures = &ures;
OPJ_INT32* ipres = (OPJ_INT32*)pures;
return *ipres;
} | Addition two signed integers with a wrap-around behaviour.
Assumes complement-to-two signed integers.
@param a
@param b
@return Returns a + b | cpp | 3rdparty/openjpeg/openjp2/opj_intmath.h | 297 | [
"a",
"b"
] | true | 1 | 6.88 | opencv/opencv | 85,374 | doxygen | false | |
_validate_teams_exist_in_database | def _validate_teams_exist_in_database(cls, team_names: set[str]) -> None:
"""
Validate that all specified team names exist in the database.
:param team_names: Set of team names to validate
:raises AirflowConfigException: If any team names don't exist in the database
"""
... | Validate that all specified team names exist in the database.
:param team_names: Set of team names to validate
:raises AirflowConfigException: If any team names don't exist in the database | python | airflow-core/src/airflow/executors/executor_loader.py | 164 | [
"cls",
"team_names"
] | None | true | 3 | 6.56 | apache/airflow | 43,597 | sphinx | false |
readHugePageSizes | HugePageSizeVec readHugePageSizes() {
HugePageSizeVec sizeVec = readRawHugePageSizes();
if (sizeVec.empty()) {
return sizeVec; // nothing to do
}
std::sort(sizeVec.begin(), sizeVec.end());
size_t defaultHugePageSize = getDefaultHugePageSize();
struct PageSizeLess {
bool operator()(const HugePageSi... | Get list of supported huge page sizes and their mount points, if
hugetlbfs file systems are mounted for those sizes. | cpp | folly/io/HugePages.cpp | 125 | [] | true | 11 | 7.12 | facebook/folly | 30,157 | doxygen | false | |
between | public static JavaUnicodeEscaper between(final int codePointLow, final int codePointHigh) {
return new JavaUnicodeEscaper(codePointLow, codePointHigh, true);
} | Constructs a {@link JavaUnicodeEscaper} between the specified values (inclusive).
@param codePointLow
above which to escape.
@param codePointHigh
below which to escape.
@return the newly created {@link UnicodeEscaper} instance. | java | src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java | 61 | [
"codePointLow",
"codePointHigh"
] | JavaUnicodeEscaper | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
compressed | def compressed(self):
"""
Return all the non-masked data as a 1-D array.
Returns
-------
data : ndarray
A new `ndarray` holding the non-masked data is returned.
Notes
-----
The result is **not** a MaskedArray!
Examples
------... | Return all the non-masked data as a 1-D array.
Returns
-------
data : ndarray
A new `ndarray` holding the non-masked data is returned.
Notes
-----
The result is **not** a MaskedArray!
Examples
--------
>>> import numpy as np
>>> x = np.ma.array(np.arange(5), mask=[0]*2 + [1]*3)
>>> x.compressed()
array([0, 1])
>... | python | numpy/ma/core.py | 3,937 | [
"self"
] | false | 2 | 7.68 | numpy/numpy | 31,054 | unknown | false | |
parseType | function parseType(): TypeNode {
if (contextFlags & NodeFlags.TypeExcludesFlags) {
return doOutsideOfContext(NodeFlags.TypeExcludesFlags, parseType);
}
if (isStartOfFunctionTypeOrConstructorType()) {
return parseFunctionOrConstructorType();
}
const ... | 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 | 4,940 | [] | true | 6 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
isValidAnnotationMemberType | public static boolean isValidAnnotationMemberType(Class<?> type) {
if (type == null) {
return false;
}
if (type.isArray()) {
type = type.getComponentType();
}
return type.isPrimitive() || type.isEnum() || type.isAnnotation()
|| String.class... | Checks if the specified type is permitted as an annotation member.
<p>The Java language specification only permits certain types to be used
in annotations. These include {@link String}, {@link Class}, primitive
types, {@link Annotation}, {@link Enum}, and single-dimensional arrays of
these types.</p>
@param type the ty... | java | src/main/java/org/apache/commons/lang3/AnnotationUtils.java | 286 | [
"type"
] | true | 7 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
of | public static <T> Bindable<T> of(ResolvableType type) {
Assert.notNull(type, "'type' must not be null");
ResolvableType boxedType = box(type);
return new Bindable<>(type, boxedType, null, NO_ANNOTATIONS, NO_BIND_RESTRICTIONS, null);
} | Create a new {@link Bindable} of the specified type.
@param <T> the source type
@param type the type (must not be {@code null})
@return a {@link Bindable} instance
@see #of(Class) | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | 314 | [
"type"
] | true | 1 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
oas | def oas(X, *, assume_centered=False):
"""Estimate covariance with the Oracle Approximating Shrinkage.
Read more in the :ref:`User Guide <shrunk_covariance>`.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data from which to compute the covariance estimate.
assum... | Estimate covariance with the Oracle Approximating Shrinkage.
Read more in the :ref:`User Guide <shrunk_covariance>`.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data from which to compute the covariance estimate.
assume_centered : bool, default=False
If True, data will not be centered... | python | sklearn/covariance/_shrunk_covariance.py | 621 | [
"X",
"assume_centered"
] | false | 1 | 6.24 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
_promote_fields | def _promote_fields(dt1, dt2):
""" Perform type promotion for two structured dtypes.
Parameters
----------
dt1 : structured dtype
First dtype.
dt2 : structured dtype
Second dtype.
Returns
-------
out : dtype
The promoted dtype
Notes
-----
If one of ... | Perform type promotion for two structured dtypes.
Parameters
----------
dt1 : structured dtype
First dtype.
dt2 : structured dtype
Second dtype.
Returns
-------
out : dtype
The promoted dtype
Notes
-----
If one of the inputs is aligned, the result will be. The titles of
both descriptors must match (poin... | python | numpy/_core/_internal.py | 410 | [
"dt1",
"dt2"
] | false | 14 | 6.24 | numpy/numpy | 31,054 | numpy | false | |
drop_airflow_models | def drop_airflow_models(connection):
"""
Drop all airflow models.
:param connection: SQLAlchemy Connection
:return: None
"""
from airflow.models.base import Base
Base.metadata.drop_all(connection)
# alembic adds significant import time, so we import it lazily
from alembic.migration... | Drop all airflow models.
:param connection: SQLAlchemy Connection
:return: None | python | airflow-core/src/airflow/utils/db.py | 1,285 | [
"connection"
] | false | 2 | 7.12 | apache/airflow | 43,597 | sphinx | false | |
runWithTimeout | @Override
public void runWithTimeout(Runnable runnable, long timeoutDuration, TimeUnit timeoutUnit)
throws TimeoutException, InterruptedException {
checkNotNull(runnable);
checkNotNull(timeoutUnit);
checkPositiveTimeout(timeoutDuration);
Future<?> future = executor.submit(runnable);
try {
... | Creates a TimeLimiter instance using the given executor service to execute method calls.
<p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
up, any time callers spend waiting for a thread may count toward their time limit, and in this
case the call may even time out before th... | java | android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java | 181 | [
"runnable",
"timeoutDuration",
"timeoutUnit"
] | void | true | 3 | 6.72 | google/guava | 51,352 | javadoc | false |
reduce | public Fraction reduce() {
if (numerator == 0) {
return equals(ZERO) ? this : ZERO;
}
final int gcd = greatestCommonDivisor(Math.abs(numerator), denominator);
if (gcd == 1) {
return this;
}
return getFraction(numerator / gcd, denominator / gcd);
... | Reduce the fraction to the smallest values for the numerator and denominator, returning the result.
<p>
For example, if this fraction represents 2/4, then the result will be 1/2.
</p>
@return a new reduced fraction instance, or this if no simplification possible | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 848 | [] | Fraction | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
regroupPartitionMapByNode | <T> Map<Node, Map<TopicPartition, T>> regroupPartitionMapByNode(Map<TopicPartition, T> partitionMap) {
return partitionMap.entrySet()
.stream()
.collect(Collectors.groupingBy(entry -> metadata.fetch().leaderFor(entry.getKey()),
Collectors.toMap(Map.Entry::... | Callback for the response of the list offset call.
@param listOffsetsResponse The response from the server.
@return {@link OffsetFetcherUtils.ListOffsetResult} extracted from the response, containing the fetched offsets
and partitions to retry. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetFetcherUtils.java | 168 | [
"partitionMap"
] | true | 1 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
clean_docker_context_files | def clean_docker_context_files():
"""
Cleans up docker context files folder - leaving only .README.md there.
"""
if get_verbose() or get_dry_run():
get_console().print("[info]Cleaning docker-context-files[/]")
if get_dry_run():
return
context_files_to_delete = DOCKER_CONTEXT_PATH... | Cleans up docker context files folder - leaving only .README.md there. | python | dev/breeze/src/airflow_breeze/commands/production_image_commands.py | 808 | [] | false | 6 | 6.24 | apache/airflow | 43,597 | unknown | false | |
_is_dtype | def _is_dtype(arr_or_dtype, condition) -> bool:
"""
Return true if the condition is satisfied for the arr_or_dtype.
Parameters
----------
arr_or_dtype : array-like, str, np.dtype, or ExtensionArrayType
The array-like or dtype object whose dtype we want to extract.
condition : callable[U... | Return true if the condition is satisfied for the arr_or_dtype.
Parameters
----------
arr_or_dtype : array-like, str, np.dtype, or ExtensionArrayType
The array-like or dtype object whose dtype we want to extract.
condition : callable[Union[np.dtype, ExtensionDtype]]
Returns
-------
bool | python | pandas/core/dtypes/common.py | 1,600 | [
"arr_or_dtype",
"condition"
] | bool | true | 2 | 6.24 | pandas-dev/pandas | 47,362 | numpy | false |
visitorWorker | function visitorWorker(node: Node, valueIsDiscarded: boolean): VisitResult<Node> {
// This visitor does not need to descend into the tree if there is no dynamic import, destructuring assignment, or update expression
// as export/import statements are only transformed at the top level of a file.
... | Visit nested elements at the top-level of a module.
@param node The node to visit. | typescript | src/compiler/transformers/module/module.ts | 795 | [
"node",
"valueIsDiscarded"
] | true | 9 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
isNonPowerOf2NorNullLiteral | static bool isNonPowerOf2NorNullLiteral(const EnumConstantDecl *EnumConst) {
const llvm::APSInt &Val = EnumConst->getInitVal();
if (Val.isPowerOf2() || !Val.getBoolValue())
return false;
const Expr *InitExpr = EnumConst->getInitExpr();
if (!InitExpr)
return true;
return isa<IntegerLiteral>(InitExpr->I... | Return the number of EnumConstantDecls in an EnumDecl. | cpp | clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp | 66 | [] | true | 4 | 6.56 | llvm/llvm-project | 36,021 | doxygen | false | |
yield_namespace_device_dtype_combinations | def yield_namespace_device_dtype_combinations(include_numpy_namespaces=True):
"""Yield supported namespace, device, dtype tuples for testing.
Use this to test that an estimator works with all combinations.
Use in conjunction with `ids=_get_namespace_device_dtype_ids` to give
clearer pytest parametrizat... | Yield supported namespace, device, dtype tuples for testing.
Use this to test that an estimator works with all combinations.
Use in conjunction with `ids=_get_namespace_device_dtype_ids` to give
clearer pytest parametrization ID names.
Parameters
----------
include_numpy_namespaces : bool, default=True
If True, a... | python | sklearn/utils/_array_api.py | 59 | [
"include_numpy_namespaces"
] | false | 6 | 6.24 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
bindOptionalChain | function bindOptionalChain(node: OptionalChain, trueTarget: FlowLabel, falseTarget: FlowLabel) {
// For an optional chain, we emulate the behavior of a logical expression:
//
// a?.b -> a && a.b
// a?.b.c -> a && a.b.c
// a?.b?.c -> a && a.b && a.b.c
... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 2,170 | [
"node",
"trueTarget",
"falseTarget"
] | false | 5 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
std | def std(self, ddof: int = 1, numeric_only: bool = False, **kwargs):
"""
Calculate the rolling weighted window standard deviation.
Parameters
----------
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations
is ``N - ddof``, wher... | Calculate the rolling weighted window standard deviation.
Parameters
----------
ddof : int, default 1
Delta Degrees of Freedom. The divisor used in calculations
is ``N - ddof``, where ``N`` represents the number of elements.
numeric_only : bool, default False
Include only float, int, boolean columns.
**k... | python | pandas/core/window/rolling.py | 1,467 | [
"self",
"ddof",
"numeric_only"
] | true | 1 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false | |
difference | public static <K extends @Nullable Object, V extends @Nullable Object>
MapDifference<K, V> difference(
Map<? extends K, ? extends V> left,
Map<? extends K, ? extends V> right,
Equivalence<? super @NonNull V> valueEquivalence) {
Preconditions.checkNotNull(valueEquivalence);
M... | Computes the difference between two maps. This difference is an immutable snapshot of the state
of the maps at the time this method is called. It will never change, even if the maps change at
a later time.
<p>Since this method uses {@code HashMap} instances internally, the keys of the supplied maps
must be well-behaved... | java | android/guava/src/com/google/common/collect/Maps.java | 499 | [
"left",
"right",
"valueEquivalence"
] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
toStringMatches | private boolean toStringMatches(String s1, String s2) {
return s1.hashCode() == s2.hashCode() && s1.equals(s2);
} | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 381 | [
"s1",
"s2"
] | true | 2 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
kneighbors_graph | def kneighbors_graph(self, X=None, n_neighbors=None, mode="connectivity"):
"""Compute the (weighted) graph of k-Neighbors for points in X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features), \
or (n_queries, n_indexed) if metric == 'precom... | Compute the (weighted) graph of k-Neighbors for points in X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_queries, n_features), \
or (n_queries, n_indexed) if metric == 'precomputed', default=None
The query point or points.
If not provided, neighbors of each indexed point are returned.... | python | sklearn/neighbors/_base.py | 960 | [
"self",
"X",
"n_neighbors",
"mode"
] | false | 5 | 7.28 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
baseFill | function baseFill(array, value, start, end) {
var length = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined || end > length) ? length : toInteger(end);
if (end < 0) {
end += length;
... | The base implementation of `_.fill` without an iteratee call guard.
@private
@param {Array} array The array to fill.
@param {*} value The value to fill `array` with.
@param {number} [start=0] The start position.
@param {number} [end=array.length] The end position.
@returns {Array} Returns `array`. | javascript | lodash.js | 2,928 | [
"array",
"value",
"start",
"end"
] | false | 8 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
getEmbeddedIPv4ClientAddress | public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) {
if (isCompatIPv4Address(ip)) {
return getCompatIPv4Address(ip);
}
if (is6to4Address(ip)) {
return get6to4IPv4Address(ip);
}
if (isTeredoAddress(ip)) {
return getTeredoInfo(ip).getClient();
}
throw... | Examines the Inet6Address to extract the embedded IPv4 client address if the InetAddress is an
IPv6 address of one of the specified address types that contain an embedded IPv4 address.
<p>NOTE: ISATAP addresses are explicitly excluded from this method due to their trivial
spoofability. With other transition addresses s... | java | android/guava/src/com/google/common/net/InetAddresses.java | 918 | [
"ip"
] | Inet4Address | true | 4 | 7.52 | google/guava | 51,352 | javadoc | false |
getMessage | @Override
public @Nullable String getMessage() {
if (ObjectUtils.isEmpty(this.messageExceptions)) {
return super.getMessage();
}
else {
StringBuilder sb = new StringBuilder();
String baseMessage = super.getMessage();
if (baseMessage != null) {
sb.append(baseMessage).append(". ");
}
sb.appen... | Return an array with thrown message exceptions.
<p>Note that a general mail server connection failure will not result
in failed messages being returned here: A message will only be
contained here if actually sending it was attempted but failed.
@return the array of thrown message exceptions,
or an empty array if no fai... | java | spring-context-support/src/main/java/org/springframework/mail/MailSendException.java | 126 | [] | String | true | 5 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
transformedBeanName | public static String transformedBeanName(String name) {
Assert.notNull(name, "'name' must not be null");
if (name.isEmpty() || name.charAt(0) != BeanFactory.FACTORY_BEAN_PREFIX_CHAR) {
return name;
}
return transformedBeanNameCache.computeIfAbsent(name, beanName -> {
do {
beanName = beanName.substring... | Return the actual bean name, stripping out the factory dereference
prefix (if any, also stripping repeated factory prefixes if found).
@param name the name of the bean
@return the transformed name
@see BeanFactory#FACTORY_BEAN_PREFIX | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java | 86 | [
"name"
] | String | true | 3 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
sendOffsetFetchRequest | private RequestFuture<Map<TopicPartition, OffsetAndMetadata>> sendOffsetFetchRequest(Set<TopicPartition> partitions) {
Node coordinator = checkAndGetCoordinator();
if (coordinator == null)
return RequestFuture.coordinatorNotAvailable();
log.debug("Fetching committed offsets for part... | Fetch the committed offsets for a set of partitions. This is a non-blocking call. The
returned future can be polled to get the actual offsets returned from the broker.
@param partitions The set of partitions to get offsets for.
@return A request future containing the committed offsets. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java | 1,477 | [
"partitions"
] | true | 2 | 8.4 | apache/kafka | 31,560 | javadoc | false | |
GetEnclosingFunction | static func::FuncOp GetEnclosingFunction(mlir::Operation* op) {
while (op) {
// Check if the current operation is a function.
auto func_op = mlir::dyn_cast<mlir::func::FuncOp>(op);
if (func_op) {
return func_op;
}
op = op->getParentOp();
}
return nullptr; // Operation is not within a fu... | Replaces a quant.quantize composite op with a TFLite quantize op that outputs
a quantized tensor based on the composite op's attributes. | cpp | tensorflow/compiler/mlir/lite/transforms/lower_quant_annotations_pass.cc | 116 | [] | true | 3 | 7.04 | tensorflow/tensorflow | 192,880 | doxygen | false | |
flat | public <T> BiConsumer<T, BiConsumer<String, Object>> flat(String delimiter, Consumer<Pairs<T>> pairs) {
return flat(joinWith(delimiter), pairs);
} | Add pairs using flat naming.
@param <T> the item type
@param delimiter the delimiter used if there is a prefix
@param pairs callback to add all the pairs
@return a {@link BiConsumer} for use with the {@link JsonWriter} | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java | 59 | [
"delimiter",
"pairs"
] | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false | |
producerId | @Override
public long producerId() {
return buffer.getLong(PRODUCER_ID_OFFSET);
} | Gets the base timestamp of the batch which is used to calculate the record timestamps from the deltas.
@return The base timestamp | java | clients/src/main/java/org/apache/kafka/common/record/DefaultRecordBatch.java | 189 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
invokeAnd | public <R> Stream<R> invokeAnd(Function<C, @Nullable R> invoker) {
Function<C, InvocationResult<R>> mapper = (callbackInstance) -> {
Supplier<@Nullable R> supplier = () -> invoker.apply(callbackInstance);
return invoke(callbackInstance, supplier);
};
return this.callbackInstances.stream()
.map(mapp... | Invoke the callback instances where the callback method returns a result.
@param invoker the invoker used to invoke the callback
@param <R> the result type
@return the results of the invocation (may be an empty stream if no callbacks
could be called) | java | core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java | 314 | [
"invoker"
] | true | 1 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false | |
factories | public static Loader factories(SpringFactoriesLoader springFactoriesLoader) {
Assert.notNull(springFactoriesLoader, "'springFactoriesLoader' must not be null");
return new Loader(springFactoriesLoader, null);
} | Create a new {@link Loader} that will obtain AOT services from the given
{@link SpringFactoriesLoader}.
@param springFactoriesLoader the spring factories loader
@return a new {@link Loader} instance | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java | 107 | [
"springFactoriesLoader"
] | Loader | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
_get_secret | def _get_secret(self, path_prefix, secret_id: str, lookup_pattern: str | None) -> str | None:
"""
Get secret value from Secrets Manager.
:param path_prefix: Prefix for the Path to get Secret
:param secret_id: Secret Key
:param lookup_pattern: If provided, `secret_id` must match ... | Get secret value from Secrets Manager.
:param path_prefix: Prefix for the Path to get Secret
:param secret_id: Secret Key
:param lookup_pattern: If provided, `secret_id` must match this pattern to look up the secret in
Secrets Manager | python | providers/amazon/src/airflow/providers/amazon/aws/secrets/secrets_manager.py | 253 | [
"self",
"path_prefix",
"secret_id",
"lookup_pattern"
] | str | None | true | 5 | 6.48 | apache/airflow | 43,597 | sphinx | false |
originalsStrings | public Map<String, String> originalsStrings() {
Map<String, String> copy = new RecordingMap<>();
for (Map.Entry<String, ?> entry : originals.entrySet()) {
if (!(entry.getValue() instanceof String))
throw new ClassCastException("Non-string value found in original settings for ... | Get all the original settings, ensuring that all values are of type String.
@return the original settings
@throws ClassCastException if any of the values are not strings | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 262 | [] | true | 3 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
instantiateBean | protected BeanWrapper instantiateBean(String beanName, RootBeanDefinition mbd) {
try {
Object beanInstance = getInstantiationStrategy().instantiate(mbd, beanName, this);
BeanWrapper bw = new BeanWrapperImpl(beanInstance);
initBeanWrapper(bw);
return bw;
}
catch (Throwable ex) {
throw new BeanCreati... | Instantiate the given bean using its default constructor.
@param beanName the name of the bean
@param mbd the bean definition for the bean
@return a BeanWrapper for the new instance | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,336 | [
"beanName",
"mbd"
] | BeanWrapper | true | 2 | 7.92 | 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.