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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
performRequest | private Response performRequest(final NodeTuple<Iterator<Node>> tuple, final InternalRequest request, Exception previousException)
throws IOException {
RequestContext context = request.createContextForNextAttempt(tuple.nodes.next(), tuple.authCache);
HttpResponse httpResponse;
try {
... | Sends a request to the Elasticsearch cluster that the client points to.
Blocks until the request is completed and returns its response or fails
by throwing an exception. Selects a host out of the provided ones in a
round-robin fashion. Failing hosts are marked dead and retried after a
certain amount of time (minimum 1 ... | java | client/rest/src/main/java/org/elasticsearch/client/RestClient.java | 295 | [
"tuple",
"request",
"previousException"
] | Response | true | 8 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
provide_api_client | def provide_api_client(
kind: Literal[ClientKind.CLI, ClientKind.AUTH] = ClientKind.CLI,
) -> Callable[[Callable[PS, RT]], Callable[PS, RT]]:
"""
Provide a CLI API Client to the decorated function.
CLI API Client shouldn't be passed to the function when this wrapper is used
if the purpose is not mo... | Provide a CLI API Client to the decorated function.
CLI API Client shouldn't be passed to the function when this wrapper is used
if the purpose is not mocking or testing.
If you want to reuse a CLI API Client or run the function as part of
API call, you pass it to the function, if not this wrapper
will create one and ... | python | airflow-ctl/src/airflowctl/api/client.py | 331 | [
"kind"
] | Callable[[Callable[PS, RT]], Callable[PS, RT]] | true | 2 | 6 | apache/airflow | 43,597 | unknown | false |
scoreMode | @Override
public ScoreMode scoreMode() {
return (valuesSources != null && valuesSources.needsScores()) ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
} | array of descriptive stats, per shard, needed to compute the correlation | java | modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/MatrixStatsAggregator.java | 55 | [] | ScoreMode | true | 3 | 6.32 | elastic/elasticsearch | 75,680 | javadoc | false |
nativeExtracter | public <T> T nativeExtracter(NativeExtracterMap<T> map) {
return type.nativeExtracter(backRefs, map);
} | Build an extract that has access to the "native" type of the extracter
match. This means that patterns like {@code %{NUMBER:bytes:float}} has
access to an actual {@link float}. Extracters returned from this method
should be stateless and can be reused. Pathological implementations
of the {@code map} parameter could vio... | java | libs/grok/src/main/java/org/elasticsearch/grok/GrokCaptureConfig.java | 109 | [
"map"
] | T | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false |
toPrimitive | public static short[] toPrimitive(final Short[] array) {
if (array == null) {
return null;
}
if (array.length == 0) {
return EMPTY_SHORT_ARRAY;
}
final short[] result = new short[array.length];
for (int i = 0; i < array.length; i++) {
r... | Converts an array of object Shorts to primitives.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array a {@link Short} array, may be {@code null}.
@return a {@code byte} array, {@code null} if null array input.
@throws NullPointerException if an array element is {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 9,196 | [
"array"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
get_seq_lens | def get_seq_lens(self, input_length):
"""
Given a 1D Tensor or Variable containing integer sequence lengths, return a 1D tensor or variable
containing the size sequences that will be output by the network.
:param input_length: 1D Tensor
:return: 1D Tensor scaled by model
... | Given a 1D Tensor or Variable containing integer sequence lengths, return a 1D tensor or variable
containing the size sequences that will be output by the network.
:param input_length: 1D Tensor
:return: 1D Tensor scaled by model | python | benchmarks/functional_autograd_benchmark/torchaudio_models.py | 361 | [
"self",
"input_length"
] | false | 3 | 7.28 | pytorch/pytorch | 96,034 | sphinx | false | |
tolerateRaceConditionDueToBeingParallelCapable | private void tolerateRaceConditionDueToBeingParallelCapable(IllegalArgumentException ex, String packageName)
throws AssertionError {
if (getDefinedPackage(packageName) == null) {
// This should never happen as the IllegalArgumentException indicates that the
// package has already been defined and, therefore,... | Define a package before a {@code findClass} call is made. This is necessary to
ensure that the appropriate manifest for nested JARs is associated with the
package.
@param className the class name being found | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlClassLoader.java | 162 | [
"ex",
"packageName"
] | void | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
match | public static ConditionOutcome match(ConditionMessage message) {
return new ConditionOutcome(true, message);
} | Create a new {@link ConditionOutcome} instance for 'match'.
@param message the message
@return the {@link ConditionOutcome} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java | 81 | [
"message"
] | ConditionOutcome | true | 1 | 6.16 | spring-projects/spring-boot | 79,428 | javadoc | false |
createExportStatement | function createExportStatement(name: ModuleExportName, value: Expression, location?: TextRange, allowComments?: boolean, liveBinding?: boolean) {
const statement = setTextRange(factory.createExpressionStatement(createExportExpression(name, value, /*location*/ undefined, liveBinding)), location);
start... | Creates a call to the current file's export function to export a value.
@param name The bound name of the export.
@param value The exported value.
@param location The location to use for source maps and comments for the export.
@param allowComments An optional value indicating whether to emit comments for the stat... | typescript | src/compiler/transformers/module/module.ts | 2,168 | [
"name",
"value",
"location?",
"allowComments?",
"liveBinding?"
] | false | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
createTrustManager | @Override
public X509ExtendedTrustManager createTrustManager() {
final List<Path> paths = resolveFiles();
try {
final List<Certificate> certificates = readCertificates(paths);
final KeyStore store = KeyStoreUtil.buildTrustStore(certificates);
return KeyStoreUtil.c... | Construct a new trust config for the provided paths (which will be resolved relative to the basePath).
The paths are stored as-is, and are not read until {@link #createTrustManager()} is called.
This means that
<ol>
<li>validation of the file (contents and accessibility) is deferred, and this constructor will <em>not f... | java | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemTrustConfig.java | 76 | [] | X509ExtendedTrustManager | true | 2 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
load_executor | def load_executor(cls, executor_name: ExecutorName | str | None) -> BaseExecutor:
"""
Load the executor.
This supports the following formats:
* by executor name for core executor
* by import path
* by class name of the Executor
* by ExecutorName object specificat... | Load the executor.
This supports the following formats:
* by executor name for core executor
* by import path
* by class name of the Executor
* by ExecutorName object specification
:return: an instance of executor class via executor_name | python | airflow-core/src/airflow/executors/executor_loader.py | 325 | [
"cls",
"executor_name"
] | BaseExecutor | true | 6 | 6.56 | apache/airflow | 43,597 | unknown | false |
preferredReadReplica | public synchronized Optional<Integer> preferredReadReplica(TopicPartition tp, long timeMs) {
final TopicPartitionState topicPartitionState = assignedStateOrNull(tp);
if (topicPartitionState == null) {
return Optional.empty();
} else {
return topicPartitionState.preferredR... | Get the preferred read replica
@param tp The topic partition
@param timeMs The current time
@return Returns the current preferred read replica, if it has been set and if it has not expired. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 751 | [
"tp",
"timeMs"
] | true | 2 | 7.76 | apache/kafka | 31,560 | javadoc | false | |
pattern | public String pattern() {
return this.pattern;
} | @return Regular expression pattern compatible with RE2/J. | java | clients/src/main/java/org/apache/kafka/clients/consumer/SubscriptionPattern.java | 40 | [] | String | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
isPrototype | function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
} | Checks if `value` is likely a prototype object.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is a prototype, else `false`. | javascript | lodash.js | 6,481 | [
"value"
] | false | 4 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
from_prefixed_env | def from_prefixed_env(
self, prefix: str = "FLASK", *, loads: t.Callable[[str], t.Any] = json.loads
) -> bool:
"""Load any environment variables that start with ``FLASK_``,
dropping the prefix from the env key for the config key. Values
are passed through a loading function to attemp... | Load any environment variables that start with ``FLASK_``,
dropping the prefix from the env key for the config key. Values
are passed through a loading function to attempt to convert them
to more specific types than strings.
Keys are loaded in :func:`sorted` order.
The default loading function attempts to parse value... | python | src/flask/config.py | 126 | [
"self",
"prefix",
"loads"
] | bool | true | 6 | 7.04 | pallets/flask | 70,946 | sphinx | false |
forOwnRight | function forOwnRight(object, iteratee) {
return object && baseForOwnRight(object, getIteratee(iteratee, 3));
} | This method is like `_.forOwn` except that it iterates over properties of
`object` in the opposite order.
@static
@memberOf _
@since 2.0.0
@category Object
@param {Object} object The object to iterate over.
@param {Function} [iteratee=_.identity] The function invoked per iteration.
@returns {Object} Returns `object`.
@... | javascript | lodash.js | 13,150 | [
"object",
"iteratee"
] | false | 2 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
value_counts | def value_counts(self, dropna: bool = True) -> Series:
"""
Returns a Series containing counts of each unique value.
Parameters
----------
dropna : bool, default True
Don't include counts of missing values.
Returns
-------
counts : Series
... | Returns a Series containing counts of each unique value.
Parameters
----------
dropna : bool, default True
Don't include counts of missing values.
Returns
-------
counts : Series
See Also
--------
Series.value_counts | python | pandas/core/arrays/masked.py | 1,388 | [
"self",
"dropna"
] | Series | true | 2 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false |
substringAfterLast | public static String substringAfterLast(final String str, final int find) {
if (isEmpty(str)) {
return str;
}
final int pos = str.lastIndexOf(find);
if (pos == INDEX_NOT_FOUND || pos == str.length() - 1) {
return EMPTY;
}
return str.substring(pos +... | Gets the substring after the last occurrence of a separator. The separator is not returned.
<p>
A {@code null} string input will return {@code null}. An empty ("") string input will return the empty string.
</p>
<p>
If nothing is found, the empty string is returned.
</p>
<pre>
StringUtils.substringAfterLast(null, *) ... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,284 | [
"str",
"find"
] | String | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
value | public JSONStringer value(boolean value) throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
beforeValue();
this.out.append(value);
return this;
} | Encodes {@code value} to this stringer.
@param value the value to encode
@return this stringer.
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONStringer.java | 273 | [
"value"
] | JSONStringer | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
freshTargetSource | private TargetSource freshTargetSource() {
if (this.targetName == null) {
// Not refreshing target: bean name not specified in 'interceptorNames'
return this.targetSource;
}
else {
if (this.beanFactory == null) {
throw new IllegalStateException("No BeanFactory available anymore (probably due to seria... | Return a TargetSource to use when creating a proxy. If the target was not
specified at the end of the interceptorNames list, the TargetSource will be
this class's TargetSource member. Otherwise, we get the target bean and wrap
it in a TargetSource if necessary. | java | spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java | 529 | [] | TargetSource | true | 5 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
getAllInterfaces | public static List<Class<?>> getAllInterfaces(final Class<?> cls) {
if (cls == null) {
return null;
}
final LinkedHashSet<Class<?>> interfacesFound = new LinkedHashSet<>();
getAllInterfaces(cls, interfacesFound);
return new ArrayList<>(interfacesFound);
} | Gets a {@link List} of all interfaces implemented by the given class and its superclasses.
<p>
The order is determined by looking through each interface in turn as declared in the source file and following its
hierarchy up. Then each superclass is considered in the same way. Later duplicates are ignored, so the order i... | java | src/main/java/org/apache/commons/lang3/ClassUtils.java | 371 | [
"cls"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
removeIfFromRandomAccessList | private static <T extends @Nullable Object> boolean removeIfFromRandomAccessList(
List<T> list, Predicate<? super T> predicate) {
// Note: Not all random access lists support set(). Additionally, it's possible
// for a list to reject setting an element, such as when the list does not permit
// duplica... | Removes, from an iterable, every element that satisfies the provided predicate.
<p>Removals may or may not happen immediately as each element is tested against the predicate.
The behavior of this method is not specified if {@code predicate} is dependent on {@code
removeFrom}.
<p><b>Java 8+ users:</b> if {@code removeFr... | java | android/guava/src/com/google/common/collect/Iterables.java | 196 | [
"list",
"predicate"
] | true | 6 | 7.6 | google/guava | 51,352 | javadoc | false | |
escapeXml10 | public static String escapeXml10(final String input) {
return ESCAPE_XML10.translate(input);
} | Escapes the characters in a {@link String} using XML entities.
<p>
For example:
</p>
<pre>{@code
"bread" & "butter"
}</pre>
<p>
converts to:
</p>
<pre>
{@code
"bread" & "butter"
}
</pre>
<p>
Note that XML 1.0 is a text-only format: it cannot represent control characters or unpaired Unicode surro... | java | src/main/java/org/apache/commons/lang3/StringEscapeUtils.java | 625 | [
"input"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
to_period | def to_period(
self,
freq: str | None = None,
copy: bool | lib.NoDefault = lib.no_default,
) -> Series:
"""
Convert Series from DatetimeIndex to PeriodIndex.
Parameters
----------
freq : str, default None
Frequency associated with the Peri... | Convert Series from DatetimeIndex to PeriodIndex.
Parameters
----------
freq : str, default None
Frequency associated with the PeriodIndex.
copy : bool, default False
This keyword is now ignored; changing its value will have no
impact on the method.
.. deprecated:: 3.0.0
This keyword is ignor... | python | pandas/core/series.py | 6,524 | [
"self",
"freq",
"copy"
] | Series | true | 2 | 8 | pandas-dev/pandas | 47,362 | numpy | false |
parameterDocComments | function parameterDocComments(parameters: readonly ParameterDeclaration[], isJavaScriptFile: boolean, indentationStr: string, newLine: string): string {
return parameters.map(({ name, dotDotDotToken }, i) => {
const paramName = name.kind === SyntaxKind.Identifier ? name.text : "param" + i;
const ... | Checks if position points to a valid position to add JSDoc comments, and if so,
returns the appropriate template. Otherwise returns an empty string.
Valid positions are
- outside of comments, statements, and expressions, and
- preceding a:
- function/constructor/method declaration
- cl... | typescript | src/services/jsDoc.ts | 541 | [
"parameters",
"isJavaScriptFile",
"indentationStr",
"newLine"
] | true | 4 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
fnv64_BROKEN | constexpr uint64_t fnv64_BROKEN(
const char* buf, uint64_t hash = fnv64_hash_start) noexcept {
for (; *buf; ++buf) {
hash = fnv64_append_byte_BROKEN(hash, static_cast<uint8_t>(*buf));
}
return hash;
} | FNV hash of a c-str.
Continues hashing until a null byte is reached.
@param hash The initial hash seed.
@see fnv32
@methodset fnv | cpp | folly/hash/FnvHash.h | 376 | [] | true | 2 | 7.04 | facebook/folly | 30,157 | doxygen | false | |
shouldReturn | function shouldReturn(expression: Expression, transformer: Transformer): boolean {
return !!expression.original && transformer.setOfExpressionsToReturn.has(getNodeId(expression.original));
} | @param hasContinuation Whether another `then`, `catch`, or `finally` continuation follows the continuation to which this statement belongs.
@param continuationArgName The argument name for the continuation that follows this call. | typescript | src/services/codefixes/convertToAsyncFunction.ts | 936 | [
"expression",
"transformer"
] | true | 2 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toString | @Override
public String toString() {
return "LevelConfiguration [name=" + this.name + ", logLevel=" + this.logLevel + "]";
} | Return if this is a custom level and cannot be represented by {@link LogLevel}.
@return if this is a custom level | java | core/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java | 226 | [] | String | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
remove | public String remove(final String str, final String remove) {
return replace(str, remove, StringUtils.EMPTY, -1);
} | Removes all occurrences of a substring from within the source string.
<p>
A {@code null} source string will return {@code null}. An empty ("") source string will return the empty string. A {@code null} remove string will return
the source string. An empty ("") remove string will return the source string.
</p>
<p>
Case-... | java | src/main/java/org/apache/commons/lang3/Strings.java | 1,093 | [
"str",
"remove"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
beansOfTypeIncludingAncestors | public static <T> Map<String, T> beansOfTypeIncludingAncestors(
ListableBeanFactory lbf, Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
throws BeansException {
Assert.notNull(lbf, "ListableBeanFactory must not be null");
Map<String, T> result = new LinkedHashMap<>(4);
result.putAll(lb... | Return all beans of the given type or subtypes, also picking up beans defined in
ancestor bean factories if the current bean factory is a HierarchicalBeanFactory.
The returned Map will only contain beans of this type.
<p>Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set,
which means that... | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java | 367 | [
"lbf",
"type",
"includeNonSingletons",
"allowEagerInit"
] | true | 5 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
recursivelyUncacheFiberNode | function recursivelyUncacheFiberNode(node: Instance | TextInstance) {
if (typeof node === 'number') {
// Leaf node (eg text)
uncacheFiberNode(node);
} else {
uncacheFiberNode((node: any)._nativeTag);
(node: any)._children.forEach(recursivelyUncacheFiberNode);
}
} | 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 | javascript | packages/react-native-renderer/src/ReactFiberConfigNative.js | 104 | [] | false | 3 | 6.4 | facebook/react | 241,750 | jsdoc | false | |
Mutex | Mutex(Mutex&&) = delete; | Construct a new async mutex that is initially unlocked. | cpp | folly/coro/Mutex.h | 102 | [] | true | 2 | 6.64 | facebook/folly | 30,157 | doxygen | false | |
loadBeanDefinitions | public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException {
// Check for XML files and redirect them to the "standard" XmlBeanDefinitionReader
String filename = encodedResource.getResource().getFilename();
if (StringUtils.endsWithIgnoreCase(filename, ".xml")) {
return ... | Load bean definitions from the specified Groovy script or XML file.
<p>Note that {@code ".xml"} files will be parsed as XML content; all other kinds
of resources will be parsed as Groovy scripts.
@param encodedResource the resource descriptor for the Groovy script or XML file,
allowing specification of an encoding to u... | java | spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java | 237 | [
"encodedResource"
] | true | 6 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false | |
create_cluster | def create_cluster(
self,
name: str,
roleArn: str,
resourcesVpcConfig: dict,
**kwargs,
) -> dict:
"""
Create an Amazon EKS control plane.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.create_cluster`
:param name: The unique n... | Create an Amazon EKS control plane.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.create_cluster`
:param name: The unique name to give to your Amazon EKS Cluster.
:param roleArn: The Amazon Resource Name (ARN) of the IAM role that provides permissions
for the Kubernetes control plane to make calls to AWS A... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 133 | [
"self",
"name",
"roleArn",
"resourcesVpcConfig"
] | dict | true | 1 | 6.4 | apache/airflow | 43,597 | sphinx | false |
visitImportDeclaration | function visitImportDeclaration(node: ImportDeclaration): VisitResult<Statement | undefined> {
if (!node.importClause) {
// Do not elide a side-effect only import declaration.
// import "foo";
return node;
}
if (node.importClause.isTypeOnly) {
... | Visits an import declaration, eliding it if it is type-only or if it has an import clause that may be elided.
@param node The import declaration node. | typescript | src/compiler/transformers/ts.ts | 2,255 | [
"node"
] | true | 4 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
noMatch | public static ConditionOutcome noMatch(String message) {
return new ConditionOutcome(false, message);
} | Create a new {@link ConditionOutcome} instance for 'no match'. For more consistent
messages consider using {@link #noMatch(ConditionMessage)}.
@param message the message
@return the {@link ConditionOutcome} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java | 91 | [
"message"
] | ConditionOutcome | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
shouldSendLeaveGroupRequest | private boolean shouldSendLeaveGroupRequest(CloseOptions.GroupMembershipOperation membershipOperation) {
if (!coordinatorUnknown() && state != MemberState.UNJOINED && generation.hasMemberId()) {
return membershipOperation == LEAVE_GROUP || (isDynamicMember() && membershipOperation == DEFAULT);
... | Sends LeaveGroupRequest and logs the {@code leaveReason}, unless this member is using static membership
with the default consumer group membership operation, or is already not part of the group (i.e., does not have a
valid member ID, is in the UNJOINED state, or the coordinator is unknown).
@param membershipOperation t... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 1,190 | [
"membershipOperation"
] | true | 6 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
_validate_numeric_only | def _validate_numeric_only(self, name: str, numeric_only: bool) -> None:
"""
Validate numeric_only argument, raising if invalid for the input.
Parameters
----------
name : str
Name of the operator (kernel).
numeric_only : bool
Value passed by user... | Validate numeric_only argument, raising if invalid for the input.
Parameters
----------
name : str
Name of the operator (kernel).
numeric_only : bool
Value passed by user. | python | pandas/core/window/rolling.py | 230 | [
"self",
"name",
"numeric_only"
] | None | true | 4 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
_generate_inputs_for_submodules | def _generate_inputs_for_submodules(
model: torch.nn.Module,
target_submodules: Iterable[str],
args: tuple[Any, ...],
kwargs: Optional[dict[str, Any]] = None,
) -> dict[str, tuple[Any, Any]]:
"""
Generate inputs for targeting submdoules in the given model. Note that if two submodules refer to th... | Generate inputs for targeting submdoules in the given model. Note that if two submodules refer to the same obj, this
function doesn't work.
Args:
model: root model.
inputs: inputs to the root model.
target_submodules: submodules that we want to generate inputs for.
Returns:
A dict that maps from submo... | python | torch/_export/tools.py | 18 | [
"model",
"target_submodules",
"args",
"kwargs"
] | dict[str, tuple[Any, Any]] | true | 5 | 8.08 | pytorch/pytorch | 96,034 | google | false |
decorateBeanDefinitionIfRequired | public BeanDefinitionHolder decorateBeanDefinitionIfRequired(
Element ele, BeanDefinitionHolder originalDef, @Nullable BeanDefinition containingBd) {
BeanDefinitionHolder finalDefinition = originalDef;
// Decorate based on custom attributes first.
NamedNodeMap attributes = ele.getAttributes();
for (int i =... | Decorate the given bean definition through a namespace handler, if applicable.
@param ele the current element
@param originalDef the current bean definition
@param containingBd the containing bean definition (if any)
@return the decorated bean definition | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java | 1,399 | [
"ele",
"originalDef",
"containingBd"
] | BeanDefinitionHolder | true | 4 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
withShortcut | public AutowiredMethodArgumentsResolver withShortcut(String... beanNames) {
return new AutowiredMethodArgumentsResolver(this.methodName, this.parameterTypes, this.required, beanNames);
} | Return a new {@link AutowiredMethodArgumentsResolver} instance
that uses direct bean name injection shortcuts for specific parameters.
@param beanNames the bean names to use as shortcuts (aligned with the
method parameters)
@return a new {@link AutowiredMethodArgumentsResolver} instance that uses
the given shortcut bea... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AutowiredMethodArgumentsResolver.java | 110 | [] | AutowiredMethodArgumentsResolver | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
conn | def conn(self) -> BaseAwsConnection:
"""
Get the underlying boto3 client/resource (cached).
:return: boto3.client or boto3.resource
"""
if self.client_type:
return self.get_client_type(region_name=self.region_name)
return self.get_resource_type(region_name=se... | Get the underlying boto3 client/resource (cached).
:return: boto3.client or boto3.resource | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/base_aws.py | 759 | [
"self"
] | BaseAwsConnection | true | 2 | 6.72 | apache/airflow | 43,597 | unknown | false |
transformFunctionLikeToExpression | function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange | undefined, name: Identifier | undefined, container: Node | undefined): FunctionExpression {
const savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
const ancestorFacts =... | Transforms a function-like node into a FunctionExpression.
@param node The function-like node to transform.
@param location The source-map location for the new FunctionExpression.
@param name The name of the new FunctionExpression. | typescript | src/compiler/transformers/es2015.ts | 2,512 | [
"node",
"location",
"name",
"container"
] | true | 8 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toString | public static String toString(byte x, int radix) {
checkArgument(
radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX,
"radix (%s) must be between Character.MIN_RADIX and Character.MAX_RADIX",
radix);
// Benchmarks indicate this is probably not worth optimizing.
return Integ... | Returns a string representation of {@code x} for the given radix, where {@code x} is treated as
unsigned.
@param x the value to convert to a string.
@param radix the radix to use while working with {@code x}
@throws IllegalArgumentException if {@code radix} is not between {@link Character#MIN_RADIX}
and {@link Char... | java | android/guava/src/com/google/common/primitives/UnsignedBytes.java | 193 | [
"x",
"radix"
] | String | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false |
checkStrictModeFunctionDeclaration | function checkStrictModeFunctionDeclaration(node: FunctionDeclaration) {
if (languageVersion < ScriptTarget.ES2015) {
// Report error if function is not top level function declaration
if (
blockScopeContainer.kind !== SyntaxKind.SourceFile &&
blockSco... | 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,694 | [
"node"
] | false | 5 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
resolveExports | function resolveExports(nmPath, request, conditions) {
// The implementation's behavior is meant to mirror resolution in ESM.
const { 1: name, 2: expansion = '' } =
RegExpPrototypeExec(EXPORTS_PATTERN, request) || kEmptyObject;
if (!name) { return; }
const pkgPath = path.resolve(nmPath, name);
const pkg =... | Resolves the exports for a given module path and request.
@param {string} nmPath The path to the module.
@param {string} request The request for the module.
@param {Set<string>} conditions The conditions to use for resolution.
@returns {undefined|string} | javascript | lib/internal/modules/cjs/loader.js | 668 | [
"nmPath",
"request",
"conditions"
] | false | 7 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
toString | @Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("active", getActive().toString());
creator.append("default", getDefault().toString());
creator.append("accepted", getAccepted().toString());
return creator.toString();
} | Return if the given profile is active.
@param profile the profile to test
@return if the profile is active | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java | 215 | [] | String | true | 1 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
node_inline_ | def node_inline_(call_mod_node: torch.fx.Node) -> Optional[torch.fx.GraphModule]:
"""
Inline the submodule of the given node into the parent module.
Note: we only support the case where submodule takes tensors inputs.
"""
assert call_mod_node.op == "call_module"
gm = call_mod_node.graph.owning_m... | Inline the submodule of the given node into the parent module.
Note: we only support the case where submodule takes tensors inputs. | python | torch/_export/utils.py | 797 | [
"call_mod_node"
] | Optional[torch.fx.GraphModule] | true | 14 | 7.12 | pytorch/pytorch | 96,034 | unknown | false |
createCtor | function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
var args = arguments;
switch ... | Creates a function that produces an instance of `Ctor` regardless of
whether it was invoked as part of a `new` expression or by `call` or `apply`.
@private
@param {Function} Ctor The constructor to wrap.
@returns {Function} Returns the new wrapped function. | javascript | lodash.js | 5,083 | [
"Ctor"
] | false | 2 | 6.4 | lodash/lodash | 61,490 | jsdoc | false | |
peekingIterator | public static <T extends @Nullable Object> PeekingIterator<T> peekingIterator(
Iterator<? extends T> iterator) {
if (iterator instanceof PeekingImpl) {
// Safe to cast <? extends T> to <T> because PeekingImpl only uses T
// covariantly (and cannot be subclassed to add non-covariant uses).
@S... | Returns a {@code PeekingIterator} backed by the given iterator.
<p>Calls to the {@code peek} method with no intervening calls to {@code next} do not affect the
iteration, and hence return the same object each time. A subsequent call to {@code next} is
guaranteed to return the same object again. For example:
{@snippet :... | java | android/guava/src/com/google/common/collect/Iterators.java | 1,263 | [
"iterator"
] | true | 2 | 7.6 | google/guava | 51,352 | javadoc | false | |
safe_sparse_dot | def safe_sparse_dot(a, b, *, dense_output=False):
"""Dot product that handle the sparse matrix case correctly.
Parameters
----------
a : {ndarray, sparse matrix}
b : {ndarray, sparse matrix}
dense_output : bool, default=False
When False, ``a`` and ``b`` both being sparse will yield spar... | Dot product that handle the sparse matrix case correctly.
Parameters
----------
a : {ndarray, sparse matrix}
b : {ndarray, sparse matrix}
dense_output : bool, default=False
When False, ``a`` and ``b`` both being sparse will yield sparse output.
When True, output will always be a dense array.
Returns
-------
d... | python | sklearn/utils/extmath.py | 166 | [
"a",
"b",
"dense_output"
] | false | 21 | 6.56 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
opj_int64_clamp | static INLINE OPJ_INT64 opj_int64_clamp(OPJ_INT64 a, OPJ_INT64 min,
OPJ_INT64 max)
{
if (a < min) {
return min;
}
if (a > max) {
return max;
}
return a;
} | Clamp an integer inside an interval
@return
<ul>
<li>Returns a if (min < a < max)
<li>Returns max if (a > max)
<li>Returns min if (a < min)
</ul> | cpp | 3rdparty/openjpeg/openjp2/opj_intmath.h | 137 | [
"a",
"min",
"max"
] | true | 3 | 6.56 | opencv/opencv | 85,374 | doxygen | false | |
abortableErrorIfPossible | void abortableErrorIfPossible(RuntimeException e) {
if (canHandleAbortableError()) {
if (needToTriggerEpochBumpFromClient())
clientSideEpochBumpRequired = true;
abortableError(e);
} else {
fatalError(e);
}
} | Determines if an error should be treated as abortable or fatal, based on transaction state and configuration.
<ol><l> NOTE: Only use this method for transactional producers </l></ol>
- <b>Abortable Error</b>:
An abortable error can be handled effectively, if epoch bumping is supported.
1) If transactionV2 is en... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 1,382 | [
"e"
] | void | true | 3 | 6.72 | apache/kafka | 31,560 | javadoc | false |
cloneArray | function cloneArray(array) {
var length = array ? array.length : 0,
result = Array(length);
while (length--) {
result[length] = array[length];
}
return result;
} | Creates a clone of `array`.
@private
@param {Array} array The array to clone.
@returns {Array} Returns the cloned array. | javascript | fp/_baseConvert.js | 44 | [
"array"
] | false | 3 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
unmodifiableRowSortedTable | public static <R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object>
RowSortedTable<R, C, V> unmodifiableRowSortedTable(
RowSortedTable<R, ? extends C, ? extends V> table) {
/*
* It's not ? extends R, because it's technically not covariant in R. Specifically,
... | Returns an unmodifiable view of the specified row-sorted table. This method allows modules to
provide users with "read-only" access to internal tables. Query operations on the returned
table "read through" to the specified table, and attempts to modify the returned table, whether
direct or via its collection views, res... | java | android/guava/src/com/google/common/collect/Tables.java | 623 | [
"table"
] | true | 1 | 6.72 | google/guava | 51,352 | javadoc | false | |
get_reference_class | def get_reference_class(cls, reference_name: str) -> type[BaseDeadlineReference]:
"""
Get a reference class by its name.
:param reference_name: The name of the reference class to find
"""
try:
return next(
ref_class
for name, ref_class... | Get a reference class by its name.
:param reference_name: The name of the reference class to find | python | airflow-core/src/airflow/models/deadline.py | 229 | [
"cls",
"reference_name"
] | type[BaseDeadlineReference] | true | 3 | 7.04 | apache/airflow | 43,597 | sphinx | false |
getLowPC | static bool getLowPC(const DIE &Die, const DWARFUnit &DU, uint64_t &LowPC,
uint64_t &SectionIndex) {
DIEValue DvalLowPc = Die.findAttribute(dwarf::DW_AT_low_pc);
if (!DvalLowPc)
return false;
dwarf::Form Form = DvalLowPc.getForm();
bool AddrOffset = Form == dwarf::DW_FORM_LLVM_addrx_of... | If DW_AT_low_pc exists sets LowPC and returns true. | cpp | bolt/lib/Rewrite/DWARFRewriter.cpp | 373 | [] | true | 9 | 6.56 | llvm/llvm-project | 36,021 | doxygen | false | |
unique_with_mask | def unique_with_mask(values, mask: npt.NDArray[np.bool_] | None = None):
"""See algorithms.unique for docs. Takes a mask for masked arrays."""
values = _ensure_arraylike(values, func_name="unique")
if isinstance(values.dtype, ExtensionDtype):
# Dispatch to extension dtype's unique.
return v... | See algorithms.unique for docs. Takes a mask for masked arrays. | python | pandas/core/algorithms.py | 463 | [
"values",
"mask"
] | true | 5 | 6 | pandas-dev/pandas | 47,362 | unknown | false | |
iscomplexobj | def iscomplexobj(x):
"""
Check for a complex type or an array of complex numbers.
The type of the input is checked, not the value. Even if the input
has an imaginary part equal to zero, `iscomplexobj` evaluates to True.
Parameters
----------
x : any
The input can be of any type and... | Check for a complex type or an array of complex numbers.
The type of the input is checked, not the value. Even if the input
has an imaginary part equal to zero, `iscomplexobj` evaluates to True.
Parameters
----------
x : any
The input can be of any type and shape.
Returns
-------
iscomplexobj : bool
The retu... | python | numpy/lib/_type_check_impl.py | 271 | [
"x"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
mask_indices | def mask_indices(n, mask_func, k=0):
"""
Return the indices to access (n, n) arrays, given a masking function.
Assume `mask_func` is a function that, for a square array a of size
``(n, n)`` with a possible offset argument `k`, when called as
``mask_func(a, k)`` returns a new array with zeros in cer... | Return the indices to access (n, n) arrays, given a masking function.
Assume `mask_func` is a function that, for a square array a of size
``(n, n)`` with a possible offset argument `k`, when called as
``mask_func(a, k)`` returns a new array with zeros in certain locations
(functions like `triu` or `tril` do precisely ... | python | numpy/lib/_twodim_base_impl.py | 839 | [
"n",
"mask_func",
"k"
] | false | 1 | 6.4 | numpy/numpy | 31,054 | numpy | false | |
maybeScheduleJob | private void maybeScheduleJob() {
if (this.isMaster == false) {
return;
}
// don't schedule the job if the node is shutting down
if (isClusterServiceStoppedOrClosed()) {
logger.trace(
"Skipping scheduling a data stream lifecycle job due to the clu... | Records the provided error for the index in the error store and logs the error message at `ERROR` level if the error for the index
is different to what's already in the error store or if the same error was in the error store for a number of retries divible by
the provided signallingErrorRetryThreshold (i.e. we log to l... | java | modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleService.java | 1,568 | [] | void | true | 4 | 6.72 | elastic/elasticsearch | 75,680 | javadoc | false |
preventSubstitution | function preventSubstitution<T extends Node>(node: T): T {
if (noSubstitution === undefined) noSubstitution = [];
noSubstitution[getNodeId(node)] = true;
return node;
} | Prevent substitution of a node for this transformer.
@param node The node which should not be substituted. | typescript | src/compiler/transformers/module/system.ts | 2,036 | [
"node"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
nanmean | def nanmean(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
mask: npt.NDArray[np.bool_] | None = None,
) -> float:
"""
Compute the mean of the element along an axis ignoring NaNs
Parameters
----------
values : ndarray
axis : int, optional
skipna... | Compute the mean of the element along an axis ignoring NaNs
Parameters
----------
values : ndarray
axis : int, optional
skipna : bool, default True
mask : ndarray[bool], optional
nan-mask if known
Returns
-------
float
Unless input is a float array, in which case use the same
precision as the input array.... | python | pandas/core/nanops.py | 663 | [
"values",
"axis",
"skipna",
"mask"
] | float | true | 12 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
rejoinNeededOrPending | protected synchronized boolean rejoinNeededOrPending() {
// if there's a pending joinFuture, we should try to complete handling it.
return rejoinNeeded || joinFuture != null;
} | Check whether the group should be rejoined (e.g. if metadata changes) or whether a
rejoin request is already in flight and needs to be completed.
@return true if it should, false otherwise | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 353 | [] | true | 2 | 8.32 | apache/kafka | 31,560 | javadoc | false | |
minimum_fill_value | def minimum_fill_value(obj):
"""
Return the maximum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the minimum of an array with a given dtype.
Parameters
----------
obj : ndarray, dtype or scalar
An ... | Return the maximum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the minimum of an array with a given dtype.
Parameters
----------
obj : ndarray, dtype or scalar
An object that can be queried for it's numeric type.
Returns
------... | python | numpy/ma/core.py | 319 | [
"obj"
] | false | 1 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
when | default ValueProcessor<T> when(Predicate<@Nullable T> predicate) {
return (name, value) -> (predicate.test(value)) ? processValue(name, value) : value;
} | Return a new processor from this one that only applies to member with values
that match the given predicate.
@param predicate the predicate that must match
@return a new {@link ValueProcessor} that only applies when the predicate
matches | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 1,034 | [
"predicate"
] | true | 2 | 7.68 | spring-projects/spring-boot | 79,428 | javadoc | false | |
chooseOverlappingNodes | function chooseOverlappingNodes(span: TextSpan, node: Node, result: Node[]): boolean {
if (!nodeOverlapsWithSpan(node, span)) {
return false;
}
if (textSpanContainsTextRange(span, node)) {
addSourceElement(node, result);
return true;
}
... | @returns whether the argument node was included in the result | typescript | src/services/services.ts | 2,162 | [
"span",
"node",
"result"
] | true | 5 | 6.4 | microsoft/TypeScript | 107,154 | jsdoc | false | |
removeSingletonIfCreatedForTypeCheckOnly | protected boolean removeSingletonIfCreatedForTypeCheckOnly(String beanName) {
if (!this.alreadyCreated.contains(beanName)) {
removeSingleton(beanName);
return true;
}
else {
return false;
}
} | Remove the singleton instance (if any) for the given bean name,
but only if it hasn't been used for other purposes than type checking.
@param beanName the name of the bean
@return {@code true} if actually removed, {@code false} otherwise | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,812 | [
"beanName"
] | true | 2 | 7.76 | spring-projects/spring-framework | 59,386 | javadoc | false | |
takeAcknowledgedRecords | public Map<TopicIdPartition, NodeAcknowledgements> takeAcknowledgedRecords() {
Map<TopicIdPartition, NodeAcknowledgements> acknowledgementMap = new LinkedHashMap<>();
batches.forEach((tip, batch) -> {
int nodeId = batch.nodeId();
Acknowledgements acknowledgements = batch.takeAckn... | Removes all acknowledged records from the in-flight records and returns the map of acknowledgements
to send. If some records were not acknowledged, the in-flight records will not be empty after this
method.
@return The map of acknowledgements to send, along with node information | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareFetch.java | 229 | [] | true | 2 | 8.08 | apache/kafka | 31,560 | javadoc | false | |
_convert_git_changes_to_table | def _convert_git_changes_to_table(
version: str, changes: str, base_url: str, markdown: bool = True
) -> tuple[str, list[Change]]:
"""
Converts list of changes from its string form to markdown/RST table and array of change information
The changes are in the form of multiple lines where each line consis... | Converts list of changes from its string form to markdown/RST table and array of change information
The changes are in the form of multiple lines where each line consists of:
FULL_COMMIT_HASH SHORT_COMMIT_HASH COMMIT_DATE COMMIT_SUBJECT
The subject can contain spaces but one of the preceding values can, so we can mak... | python | dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py | 301 | [
"version",
"changes",
"base_url",
"markdown"
] | tuple[str, list[Change]] | true | 8 | 7.92 | apache/airflow | 43,597 | sphinx | false |
_safe_parse_datetime_optional | def _safe_parse_datetime_optional(date_to_check: str | None) -> datetime | None:
"""
Parse datetime and raise error for invalid dates.
Allow None values.
:param date_to_check: the string value to be parsed
"""
if date_to_check is None:
return None
try:
return timezone.parse... | Parse datetime and raise error for invalid dates.
Allow None values.
:param date_to_check: the string value to be parsed | python | airflow-core/src/airflow/api_fastapi/common/parameters.py | 540 | [
"date_to_check"
] | datetime | None | true | 2 | 6.88 | apache/airflow | 43,597 | sphinx | false |
try_adopt_task_instances | def try_adopt_task_instances(self, tis: Sequence[TaskInstance]) -> Sequence[TaskInstance]:
"""
Adopt task instances which have an external_executor_id (the serialized task key).
Anything that is not adopted will be cleared by the scheduler and becomes eligible for re-scheduling.
:param... | Adopt task instances which have an external_executor_id (the serialized task key).
Anything that is not adopted will be cleared by the scheduler and becomes eligible for re-scheduling.
:param tis: The task instances to adopt. | python | providers/amazon/src/airflow/providers/amazon/aws/executors/aws_lambda/lambda_executor.py | 454 | [
"self",
"tis"
] | Sequence[TaskInstance] | true | 4 | 7.2 | apache/airflow | 43,597 | sphinx | false |
toString | @Override
public String toString() {
return new ToStringCreator(this).append("name", this.name)
.append("value", this.value)
.append("origin", this.origin)
.toString();
} | Return the value of the configuration property.
@return the configuration property value | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java | 115 | [] | String | true | 1 | 6.4 | spring-projects/spring-boot | 79,428 | javadoc | false |
min_x_blocks_sub_kernel | def min_x_blocks_sub_kernel(self, sub_kernel: TritonKernel, num: int) -> None:
"""
Kernels with no_x_dim being true has no tunable XBLOCK. They have a fixed number of X blocks.
Grid calculation needs to make sure that they are assigned with enough number of blocks.
"""
min_x_bloc... | Kernels with no_x_dim being true has no tunable XBLOCK. They have a fixed number of X blocks.
Grid calculation needs to make sure that they are assigned with enough number of blocks. | python | torch/_inductor/codegen/triton_combo_kernel.py | 465 | [
"self",
"sub_kernel",
"num"
] | None | true | 10 | 6 | pytorch/pytorch | 96,034 | unknown | false |
indexOf | public int indexOf(final String str, final int startIndex) {
return Strings.CS.indexOf(this, str, startIndex);
} | Searches the string builder to find the first reference to the specified
string starting searching from the given index.
<p>
Note that a null input string will return -1, whereas the JDK throws an exception.
</p>
@param str the string to find, null returns -1
@param startIndex the index to start at, invalid index rou... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2,038 | [
"str",
"startIndex"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
to_sql | def to_sql(
self,
frame,
name: str,
if_exists: str = "fail",
index: bool = True,
index_label=None,
schema=None,
chunksize: int | None = None,
dtype: DtypeArg | None = None,
method: Literal["multi"] | Callable | None = None,
engine: ... | Write records stored in a DataFrame to a SQL database.
Parameters
----------
frame: DataFrame
name: string
Name of SQL table.
if_exists: {'fail', 'replace', 'append', 'delete_rows'}, default 'fail'
fail: If table exists, do nothing.
replace: If table exists, drop it, recreate it, and insert data.
appen... | python | pandas/io/sql.py | 2,801 | [
"self",
"frame",
"name",
"if_exists",
"index",
"index_label",
"schema",
"chunksize",
"dtype",
"method",
"engine"
] | int | None | true | 6 | 6.96 | pandas-dev/pandas | 47,362 | numpy | false |
allocateTag | function allocateTag() {
let tag = nextReactTag;
if (tag % 10 === 1) {
tag += 2;
}
nextReactTag = tag + 2;
return tag;
} | 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 | javascript | packages/react-native-renderer/src/ReactFiberConfigNative.js | 95 | [] | false | 2 | 6.24 | facebook/react | 241,750 | jsdoc | false | |
beginCatchBlock | function beginCatchBlock(variable: VariableDeclaration): void {
Debug.assert(peekBlockKind() === CodeBlockKind.Exception);
// generated identifiers should already be unique within a file
let name: Identifier;
if (isGeneratedIdentifier(variable.name)) {
name = variable.... | Enters the `catch` clause of a generated `try` statement.
@param variable The catch variable. | typescript | src/compiler/transformers/generators.ts | 2,227 | [
"variable"
] | true | 4 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
format | @Override
public String format(final Date date) {
return printer.format(date);
} | Formats a {@link Date} object using a {@link GregorianCalendar}.
@param date the date to format.
@return the formatted string. | java | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | 444 | [
"date"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
substituteCallExpression | function substituteCallExpression(node: CallExpression): Expression {
const expression = node.expression;
if (isSuperProperty(expression)) {
const argumentExpression = isPropertyAccessExpression(expression)
? substitutePropertyAccessExpression(expression)
... | Hooks node substitutions.
@param hint A hint as to the intended usage of the node.
@param node The node to substitute. | typescript | src/compiler/transformers/es2017.ts | 1,000 | [
"node"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
items | public ConditionMessage items(Style style, Object @Nullable ... items) {
return items(style, (items != null) ? Arrays.asList(items) : null);
} | Indicate the items. For example
{@code didNotFind("bean", "beans").items("x", "y")} results in the message "did
not find beans x, y".
@param style the render style
@param items the items (may be {@code null})
@return a built {@link ConditionMessage} | java | core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | 360 | [
"style"
] | ConditionMessage | true | 2 | 8 | spring-projects/spring-boot | 79,428 | javadoc | false |
__init__ | def __init__(
self,
input_nodes: list[Any],
scalars: Optional[dict[str, Union[float, int]]] = None,
out_dtype: Optional[torch.dtype] = None,
mat1_idx: int = -2,
mat2_idx: int = -1,
):
"""
Initialize with a tuple of input nodes.
By default, we ... | Initialize with a tuple of input nodes.
By default, we assume the last 2 input nodes are mat1 and mat2, but
the caller can adjust when necessary | python | torch/_inductor/kernel_inputs.py | 216 | [
"self",
"input_nodes",
"scalars",
"out_dtype",
"mat1_idx",
"mat2_idx"
] | true | 3 | 6 | pytorch/pytorch | 96,034 | unknown | false | |
write_view_information_to_args | def write_view_information_to_args(
mutable_arg_names: list[str],
mutable_arg_types: list[torch.Type],
kwargs: dict[str, Any],
arg_to_base_index: dict[str, Any],
):
"""
This function writes the view information into kwargs. It reads mutable_args from kwargs.
and uses arg_to_base_index and te... | This function writes the view information into kwargs. It reads mutable_args from kwargs.
and uses arg_to_base_index and tensor information to write ViewInfo into kwargs.
mutable_arg_names: mutable custom operator arg names.
mutable_arg_types: mutable custom operator arg types.
kwargs: the original custom operator args... | python | torch/_higher_order_ops/auto_functionalize.py | 171 | [
"mutable_arg_names",
"mutable_arg_types",
"kwargs",
"arg_to_base_index"
] | true | 14 | 6.48 | pytorch/pytorch | 96,034 | unknown | false | |
maxTimestamp | long maxTimestamp(); | Get the max timestamp or log append time of this record batch.
If the timestamp type is create time, this is the max timestamp among all records contained in this batch and
the value is updated during compaction.
@return The max timestamp | java | clients/src/main/java/org/apache/kafka/common/record/RecordBatch.java | 93 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
sub_node_can_fuse | def sub_node_can_fuse(
self,
node1: BaseSchedulerNode,
node2: BaseSchedulerNode,
other_nodes: tuple[BaseSchedulerNode, ...],
):
"""
node1 is from the current mix order reduction; node2 is another node we want to fuse in.
other_nodes are passed in to check if ... | node1 is from the current mix order reduction; node2 is another node we want to fuse in.
other_nodes are passed in to check if fusion will introduce producer/consumer relationship
between the inner and outer reduction. If yes, we don't fuse. | python | torch/_inductor/scheduler.py | 2,093 | [
"self",
"node1",
"node2",
"other_nodes"
] | true | 6 | 6 | pytorch/pytorch | 96,034 | unknown | false | |
castCurry | function castCurry(name, func, n) {
return (forceCurry || (config.curry && n > 1))
? curry(func, n)
: func;
} | Casts `func` to a curried function if needed.
@private
@param {string} name The name of the function to inspect.
@param {Function} func The function to inspect.
@param {number} n The arity of `func`.
@returns {Function} Returns the cast function. | javascript | fp/_baseConvert.js | 300 | [
"name",
"func",
"n"
] | false | 4 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
moveaxis | def moveaxis(a, source, destination):
"""
Move axes of an array to new positions.
Other axes remain in their original order.
Parameters
----------
a : np.ndarray
The array whose axes should be reordered.
source : int or sequence of int
Original positions of the axes to move... | Move axes of an array to new positions.
Other axes remain in their original order.
Parameters
----------
a : np.ndarray
The array whose axes should be reordered.
source : int or sequence of int
Original positions of the axes to move. These must be unique.
destination : int or sequence of int
Destination p... | python | numpy/_core/numeric.py | 1,481 | [
"a",
"source",
"destination"
] | false | 3 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
cloneIfPossible | public static <T> T cloneIfPossible(final T obj) {
final T clone = clone(obj);
return clone == null ? obj : clone;
} | Clones an object if possible.
<p>
This method is similar to {@link #clone(Object)}, but will return the provided instance as the return value instead of {@code null} if the instance is
not cloneable. This is more convenient if the caller uses different implementations (e.g. of a service) and some of the implementations... | java | src/main/java/org/apache/commons/lang3/ObjectUtils.java | 275 | [
"obj"
] | T | true | 2 | 8 | apache/commons-lang | 2,896 | javadoc | false |
getAsText | @Override
public String getAsText() {
Object value = getValue();
return (value != null ? value.toString() : "");
} | Create a new CharacterEditor instance.
<p>The "allowEmpty" parameter controls whether an empty String is to be
allowed in parsing, i.e. be interpreted as the {@code null} value when
{@link #setAsText(String) text is being converted}. If {@code false},
an {@link IllegalArgumentException} will be thrown at that time.
@pa... | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/CharacterEditor.java | 95 | [] | String | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
value | public JSONStringer value(long value) throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
beforeValue();
this.out.append(value);
return this;
} | Encodes {@code value} to this stringer.
@param value the value to encode
@return this stringer.
@throws JSONException if processing of json failed | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONStringer.java | 304 | [
"value"
] | JSONStringer | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
verify_integrity | def verify_integrity(self, *, session: Session = NEW_SESSION, dag_version_id: UUIDType) -> None:
"""
Verify the DagRun by checking for removed tasks or tasks that are not in the database yet.
It will set state to removed or add the task if required.
:param dag_version_id: The DAG versi... | Verify the DagRun by checking for removed tasks or tasks that are not in the database yet.
It will set state to removed or add the task if required.
:param dag_version_id: The DAG version ID
:param session: Sqlalchemy ORM Session | python | airflow-core/src/airflow/models/dagrun.py | 1,693 | [
"self",
"session",
"dag_version_id"
] | None | true | 8 | 6.88 | apache/airflow | 43,597 | sphinx | false |
_get_unique_name | def _get_unique_name(
self,
proposed_name: str,
fail_if_exists: bool,
describe_func: Callable[[str], Any],
check_exists_func: Callable[[str, Callable[[str], Any]], bool],
resource_type: str,
) -> str:
"""
Return the proposed name if it doesn't already ... | Return the proposed name if it doesn't already exist, otherwise returns it with a timestamp suffix.
:param proposed_name: Base name.
:param fail_if_exists: Will throw an error if a resource with that name already exists
instead of finding a new name.
:param check_exists_func: The function to check if the resource ... | python | providers/amazon/src/airflow/providers/amazon/aws/operators/sagemaker.py | 153 | [
"self",
"proposed_name",
"fail_if_exists",
"describe_func",
"check_exists_func",
"resource_type"
] | str | true | 3 | 7.04 | apache/airflow | 43,597 | sphinx | false |
closeForRecordAppends | public void closeForRecordAppends() {
if (appendStream != CLOSED_STREAM) {
try {
appendStream.close();
} catch (IOException e) {
throw new KafkaException(e);
} finally {
appendStream = CLOSED_STREAM;
}
}
... | Release resources required for record appends (e.g. compression buffers). Once this method is called, it's only
possible to update the RecordBatch header. | java | clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java | 332 | [] | void | true | 3 | 6.4 | apache/kafka | 31,560 | javadoc | false |
readFileAfterStat | function readFileAfterStat(err, stats) {
const context = this.context;
if (err)
return context.close(err);
// TODO(BridgeAR): Check if allocating a smaller chunk is better performance
// wise, similar to the promise based version (less peak memory and chunked
// stringify operations vs multiple C++/JS b... | Synchronously tests whether or not the given path exists.
@param {string | Buffer | URL} path
@returns {boolean} | javascript | lib/fs.js | 305 | [
"err",
"stats"
] | false | 7 | 6.4 | nodejs/node | 114,839 | jsdoc | false | |
isStartupShutdownThreadStuck | private boolean isStartupShutdownThreadStuck() {
Thread activeThread = this.startupShutdownThread;
if (activeThread != null && activeThread.getState() == Thread.State.WAITING) {
// Indefinitely waiting: might be Thread.join or the like, or System.exit
activeThread.interrupt();
try {
// Leave just a lit... | Determine whether an active startup/shutdown thread is currently stuck,
for example, through a {@code System.exit} call in a user component. | java | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | 1,094 | [] | true | 5 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false | |
setValue | @Override
public void setValue(@Nullable Object value) {
if (value == null && this.nullAsEmptyCollection) {
super.setValue(createCollection(this.collectionType, 0));
}
else if (value == null || (this.collectionType.isInstance(value) && !alwaysCreateNewCollection())) {
// Use the source value as-is, as it m... | Convert the given value to a Collection of the target type. | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java | 112 | [
"value"
] | void | true | 9 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
deburr | function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
} | Deburrs `string` by converting
[Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
letters to basic Latin letters and removing
[combining diacritical marks](https://en.wikipedia.org/wiki/Combining_D... | javascript | lodash.js | 14,288 | [
"string"
] | false | 2 | 6.8 | lodash/lodash | 61,490 | jsdoc | false | |
newReferenceArray | public static <E extends @Nullable Object> AtomicReferenceArray<E> newReferenceArray(E[] array) {
return new AtomicReferenceArray<>(array);
} | Creates an {@code AtomicReferenceArray} instance with the same length as, and all elements
copied from, the given array.
@param array the array to copy elements from
@return a new {@code AtomicReferenceArray} copied from the given array | java | android/guava/src/com/google/common/util/concurrent/Atomics.java | 69 | [
"array"
] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false | |
adapt | public <T> Supplier<@Nullable T> adapt(Function<CachingConfigurer, @Nullable T> provider) {
return () -> {
CachingConfigurer cachingConfigurer = this.supplier.get();
return (cachingConfigurer != null ? provider.apply(cachingConfigurer) : null);
};
} | Adapt the {@link CachingConfigurer} supplier to another supplier
provided by the specified mapping function. If the underlying
{@link CachingConfigurer} is {@code null}, {@code null} is returned
and the mapping function is not invoked.
@param provider the provider to use to adapt the supplier
@param <T> the type of the... | java | spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java | 123 | [
"provider"
] | true | 2 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
getIpinfoDatabase | @Nullable
static Database getIpinfoDatabase(final String databaseType) {
// for ipinfo the database selection is more along the lines of user-agent sniffing than
// string-based dispatch. the specific database_type strings could change in the future,
// hence the somewhat loose nature of thi... | Cleans up the database_type String from an ipinfo database by splitting on punctuation, removing stop words, and then joining
with an underscore.
<p>
e.g. "ipinfo free_foo_sample.mmdb" -> "foo"
@param type the database_type from an ipinfo database
@return a cleaned up database_type string | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IpinfoIpDataLookups.java | 77 | [
"databaseType"
] | Database | true | 7 | 8.4 | elastic/elasticsearch | 75,680 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.