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
defaultResourceNameForMethod
private static String defaultResourceNameForMethod(String methodName) { if (methodName.startsWith("set") && methodName.length() > 3) { return StringUtils.uncapitalizeAsProperty(methodName.substring(3)); } return methodName; }
Create a new {@link ResourceMethodResolver} for the specified method and resource name. @param methodName the method name @param parameterType the parameter type @param resourceName the resource name @return a new {@link ResourceMethodResolver} instance
java
spring-context/src/main/java/org/springframework/context/annotation/ResourceElementResolver.java
106
[ "methodName" ]
String
true
3
7.28
spring-projects/spring-framework
59,386
javadoc
false
parenthesizeConditionOfConditionalExpression
function parenthesizeConditionOfConditionalExpression(condition: Expression): Expression { const conditionalPrecedence = getOperatorPrecedence(SyntaxKind.ConditionalExpression, SyntaxKind.QuestionToken); const emittedCondition = skipPartiallyEmittedExpressions(condition); const conditionPrece...
Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended order of operations. @param binaryOperator The operator for the BinaryExpression. @param operand The operand for the BinaryExpression. @param isLeftSideOfBinary A value indicating whether the operand is the left side...
typescript
src/compiler/factory/parenthesizerRules.ts
324
[ "condition" ]
true
2
6.24
microsoft/TypeScript
107,154
jsdoc
false
getAdditionalModulePaths
function getAdditionalModulePaths(options = {}) { const baseUrl = options.baseUrl; if (!baseUrl) { return ''; } const baseUrlResolved = path.resolve(paths.appPath, baseUrl); // We don't need to do anything if `baseUrl` is set to `node_modules`. This is // the default behavior. if (path.relative(pat...
Get additional module paths based on the baseUrl of a compilerOptions object. @param {Object} options
javascript
fixtures/flight/config/modules.js
14
[]
false
5
6.08
facebook/react
241,750
jsdoc
false
maybe_prepare_scalar_for_op
def maybe_prepare_scalar_for_op(obj, shape: Shape): """ Cast non-pandas objects to pandas types to unify behavior of arithmetic and comparison operations. Parameters ---------- obj: object shape : tuple[int] Returns ------- out : object Notes ----- Be careful to ca...
Cast non-pandas objects to pandas types to unify behavior of arithmetic and comparison operations. Parameters ---------- obj: object shape : tuple[int] Returns ------- out : object Notes ----- Be careful to call this *after* determining the `name` attribute to be attached to the result of the arithmetic operation.
python
pandas/core/ops/array_ops.py
512
[ "obj", "shape" ]
true
13
6.8
pandas-dev/pandas
47,362
numpy
false
_block_info_recursion
def _block_info_recursion(arrays, max_depth, result_ndim, depth=0): """ Returns the shape of the final array, along with a list of slices and a list of arrays that can be used for assignment inside the new array Parameters ---------- arrays : nested list of arrays The arrays to chec...
Returns the shape of the final array, along with a list of slices and a list of arrays that can be used for assignment inside the new array Parameters ---------- arrays : nested list of arrays The arrays to check max_depth : list of int The number of nested lists result_ndim : int The number of dimensions ...
python
numpy/_core/shape_base.py
695
[ "arrays", "max_depth", "result_ndim", "depth" ]
false
3
6.08
numpy/numpy
31,054
numpy
false
addIfHasValue
private void addIfHasValue(Properties properties, String name, @Nullable String value) { if (StringUtils.hasText(value)) { properties.put(name, value); } }
Creates a new {@code BuildPropertiesWriter} that will write to the given {@code outputFile}. @param outputFile the output file
java
loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/BuildPropertiesWriter.java
91
[ "properties", "name", "value" ]
void
true
2
6.4
spring-projects/spring-boot
79,428
javadoc
false
_check_skiprows_func
def _check_skiprows_func( self, skiprows: Callable, rows_to_use: int, ) -> int: """ Determine how many file rows are required to obtain `nrows` data rows when `skiprows` is a function. Parameters ---------- skiprows : function The ...
Determine how many file rows are required to obtain `nrows` data rows when `skiprows` is a function. Parameters ---------- skiprows : function The function passed to read_excel by the user. rows_to_use : int The number of rows that will be needed for the header and the data. Returns ------- int
python
pandas/io/excel/_base.py
607
[ "self", "skiprows", "rows_to_use" ]
int
true
3
6.88
pandas-dev/pandas
47,362
numpy
false
get_exchange
def get_exchange(conn, name=EVENT_EXCHANGE_NAME): """Get exchange used for sending events. Arguments: conn (kombu.Connection): Connection used for sending/receiving events. name (str): Name of the exchange. Default is ``celeryev``. Note: The event type changes if Redis is used as t...
Get exchange used for sending events. Arguments: conn (kombu.Connection): Connection used for sending/receiving events. name (str): Name of the exchange. Default is ``celeryev``. Note: The event type changes if Redis is used as the transport (from topic -> fanout).
python
celery/events/event.py
46
[ "conn", "name" ]
false
3
6.24
celery/celery
27,741
google
false
shouldEmitAliasDeclaration
function shouldEmitAliasDeclaration(node: Node): boolean { return compilerOptions.verbatimModuleSyntax || isInJSFile(node) || resolver.isReferencedAliasDeclaration(node); }
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/ts.ts
2,743
[ "node" ]
true
3
6.64
microsoft/TypeScript
107,154
jsdoc
false
fuzz_spec_custom
def fuzz_spec_custom(self): """ Generate a random Spec based on this template's distribution preferences. Returns: Spec: Either a TensorSpec or ScalarSpec according to template's distribution """ import random from torchfuzz.tensor_fuzzer import fuzz_torch_t...
Generate a random Spec based on this template's distribution preferences. Returns: Spec: Either a TensorSpec or ScalarSpec according to template's distribution
python
tools/experimental/torchfuzz/codegen.py
49
[ "self" ]
false
8
6.64
pytorch/pytorch
96,034
unknown
false
resolveConstructorArguments
protected List<Object> resolveConstructorArguments(Object[] args, int start, int end) { Object[] constructorArgs = Arrays.copyOfRange(args, start, end); for (int i = 0; i < constructorArgs.length; i++) { if (constructorArgs[i] instanceof GString) { constructorArgs[i] = constructorArgs[i].toString(); } ...
This method is called when a bean definition node is called. @param beanName the name of the bean to define @param args the arguments to the bean. The first argument is the class name, the last argument is sometimes a closure. All the arguments in between are constructor arguments. @return the bean definition wrapper
java
spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java
545
[ "args", "start", "end" ]
true
5
8.08
spring-projects/spring-framework
59,386
javadoc
false
cancel_task_execution
def cancel_task_execution(self, task_execution_arn: str) -> None: """ Cancel a TaskExecution for the specified ``task_execution_arn``. .. seealso:: - :external+boto3:py:meth:`DataSync.Client.cancel_task_execution` :param task_execution_arn: TaskExecutionArn. :raises...
Cancel a TaskExecution for the specified ``task_execution_arn``. .. seealso:: - :external+boto3:py:meth:`DataSync.Client.cancel_task_execution` :param task_execution_arn: TaskExecutionArn. :raises AirflowBadRequest: If ``task_execution_arn`` is empty.
python
providers/amazon/src/airflow/providers/amazon/aws/hooks/datasync.py
238
[ "self", "task_execution_arn" ]
None
true
2
6.08
apache/airflow
43,597
sphinx
false
asSupplier
@SuppressWarnings("unchecked") public static <R> Supplier<R> asSupplier(final Method method) { return asInterfaceInstance(Supplier.class, method); }
Produces a {@link Supplier} for a given a <em>supplier</em> Method. The Supplier return type must match the method's return type. <p> Only works with static methods. </p> @param <R> The Method return type. @param method the method to invoke. @return a correctly-typed wrapper for the given target.
java
src/main/java/org/apache/commons/lang3/function/MethodInvokers.java
224
[ "method" ]
true
1
6.96
apache/commons-lang
2,896
javadoc
false
iterator
public static Iterator<Calendar> iterator(final Calendar calendar, final int rangeStyle) { Objects.requireNonNull(calendar, "calendar"); final Calendar start; final Calendar end; int startCutoff = Calendar.SUNDAY; int endCutoff = Calendar.SATURDAY; switch (rangeStyle) { ...
Constructs an {@link Iterator} over each day in a date range defined by a focus date and range style. <p>For instance, passing Thursday, July 4, 2002 and a {@code RANGE_MONTH_SUNDAY} will return an {@link Iterator} that starts with Sunday, June 30, 2002 and ends with Saturday, August 3, 2002, returning a Calendar insta...
java
src/main/java/org/apache/commons/lang3/time/DateUtils.java
971
[ "calendar", "rangeStyle" ]
true
8
7.52
apache/commons-lang
2,896
javadoc
false
value
public String value() { return value; }
Returns real password string @return real password string
java
clients/src/main/java/org/apache/kafka/common/config/types/Password.java
64
[]
String
true
1
6.16
apache/kafka
31,560
javadoc
false
leave
public void leave() { ReentrantLock lock = this.lock; try { // No need to signal if we will still be holding the lock when we return if (lock.getHoldCount() == 1) { signalNextWaiter(); } } finally { lock.unlock(); // Will throw IllegalMonitorStateException if not held } ...
Leaves this monitor. May be called only by a thread currently occupying this monitor.
java
android/guava/src/com/google/common/util/concurrent/Monitor.java
939
[]
void
true
2
7.04
google/guava
51,352
javadoc
false
getSystemThreadGroup
public static ThreadGroup getSystemThreadGroup() { ThreadGroup threadGroup = Thread.currentThread().getThreadGroup(); while (threadGroup != null && threadGroup.getParent() != null) { threadGroup = threadGroup.getParent(); } return threadGroup; }
Gets the system thread group (sometimes also referred as "root thread group"). <p> This method returns null if this thread has died (been stopped). </p> @return the system thread group. @throws SecurityException if the current thread cannot modify thread groups from this thread's thread group up to the system thread gr...
java
src/main/java/org/apache/commons/lang3/ThreadUtils.java
462
[]
ThreadGroup
true
3
8.08
apache/commons-lang
2,896
javadoc
false
setupQuic
function setupQuic() { if (!getOptionValue('--experimental-quic')) { return; } const { BuiltinModule } = require('internal/bootstrap/realm'); BuiltinModule.allowRequireByUsers('quic'); }
Patch the process object with legacy properties and normalizations. Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`. Replace `process.argv[1]` with the resolved absolute file path of the entry point, if found. @param {boolean} expandArgv1 - Whether to replac...
javascript
lib/internal/process/pre_execution.js
390
[]
false
2
6.8
nodejs/node
114,839
jsdoc
false
putIfHasLength
private void putIfHasLength(Attributes attributes, String name, @Nullable String value) { if (StringUtils.hasLength(value)) { attributes.putValue(name, value); } }
Return the {@link File} to use to back up the original source. @return the file to use to back up the original source
java
loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java
431
[ "attributes", "name", "value" ]
void
true
2
6.88
spring-projects/spring-boot
79,428
javadoc
false
getIdentifierToken
function getIdentifierToken(): SyntaxKind.Identifier | KeywordSyntaxKind { // Reserved words are between 2 and 12 characters long and start with a lowercase letter const len = tokenValue.length; if (len >= 2 && len <= 12) { const ch = tokenValue.charCodeAt(0); if (ch...
Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or a literal component of a TemplateExpression.
typescript
src/compiler/scanner.ts
1,815
[]
true
6
6.08
microsoft/TypeScript
107,154
jsdoc
false
title
def title(a): """ Return element-wise title cased version of string or unicode. Title case words start with uppercase characters, all remaining cased characters are lowercase. Calls :meth:`str.title` element-wise. For 8-bit strings, this method is locale-dependent. Parameters -------...
Return element-wise title cased version of string or unicode. Title case words start with uppercase characters, all remaining cased characters are lowercase. Calls :meth:`str.title` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array-like, with ``StringDType``, ``bytes_...
python
numpy/_core/strings.py
1,244
[ "a" ]
false
1
6
numpy/numpy
31,054
numpy
false
match
public boolean match(byte[] utf8Bytes, int offset, int length, GrokCaptureExtracter extracter) { Matcher matcher = compiledExpression.matcher(utf8Bytes, offset, offset + length); int result; try { matcherWatchdog.register(matcher); result = matcher.search(offset, offset +...
Matches and collects any named captures. @param utf8Bytes array containing the text to match against encoded in utf-8 @param offset offset {@code utf8Bytes} of the start of the text @param length length of the text to match @param extracter collector for captures. {@link GrokCaptureConfig#nativeExtracter} can build the...
java
libs/grok/src/main/java/org/elasticsearch/grok/Grok.java
233
[ "utf8Bytes", "offset", "length", "extracter" ]
true
3
8.08
elastic/elasticsearch
75,680
javadoc
false
repeat
public static String repeat(final char repeat, final int count) { if (count <= 0) { return EMPTY; } return new String(ArrayFill.fill(new char[count], repeat)); }
Returns padding using the specified delimiter repeated to a given length. <pre> StringUtils.repeat('e', 0) = "" StringUtils.repeat('e', 3) = "eee" StringUtils.repeat('e', -2) = "" </pre> <p> Note: this method does not support padding with <a href="https://www.unicode.org/glossary/#supplementary_character">Unicode Sup...
java
src/main/java/org/apache/commons/lang3/StringUtils.java
6,041
[ "repeat", "count" ]
String
true
2
7.6
apache/commons-lang
2,896
javadoc
false
getImplicitLowerBounds
public static Type[] getImplicitLowerBounds(final WildcardType wildcardType) { Objects.requireNonNull(wildcardType, "wildcardType"); final Type[] bounds = wildcardType.getLowerBounds(); return bounds.length == 0 ? new Type[] { null } : bounds; }
Gets an array containing a single value of {@code null} if {@link WildcardType#getLowerBounds()} returns an empty array. Otherwise, it returns the result of {@link WildcardType#getLowerBounds()}. @param wildcardType the subject wildcard type, not {@code null}. @return a non-empty array containing the lower bounds of th...
java
src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
664
[ "wildcardType" ]
true
2
7.6
apache/commons-lang
2,896
javadoc
false
CONST
public static long CONST(final long v) { return v; }
Returns the provided value unchanged. This can prevent javac from inlining a constant field, e.g., <pre> public final static long MAGIC_LONG = ObjectUtils.CONST(123L); </pre> This way any jars that refer to this field do not have to recompile themselves if the field's value changes at some future date. @param v the lon...
java
src/main/java/org/apache/commons/lang3/ObjectUtils.java
437
[ "v" ]
true
1
6.8
apache/commons-lang
2,896
javadoc
false
toPromLikeExpr
function toPromLikeExpr(labelBasedQuery: AbstractQuery): string { const expr = labelBasedQuery.labelMatchers .map((selector: AbstractLabelMatcher) => { const operator = ToPromLikeMap[selector.operator]; if (operator) { return `${selector.name}${operator}"${selector.value}"`; } else { ...
Adds metadata for synthetic metrics for which the API does not provide metadata. See https://github.com/grafana/grafana/issues/22337 for details. @param metadata HELP and TYPE metadata from /api/v1/metadata
typescript
packages/grafana-prometheus/src/language_utils.ts
259
[ "labelBasedQuery" ]
true
4
6.72
grafana/grafana
71,362
jsdoc
false
_padding_can_be_fused
def _padding_can_be_fused(): """ Conservatively check if padding can be fused with downstream op. 1. if the downstream op is a sum, then there is little benefit to do inplace padding 2. if the downstream op is a matmul, doing inplace padding can save membw. ...
Conservatively check if padding can be fused with downstream op. 1. if the downstream op is a sum, then there is little benefit to do inplace padding 2. if the downstream op is a matmul, doing inplace padding can save membw.
python
torch/_inductor/lowering.py
4,467
[]
false
4
6.08
pytorch/pytorch
96,034
unknown
false
didNotFind
public ItemsBuilder didNotFind(String article) { return didNotFind(article, article); }
Indicate that one or more results were not found. For example {@code didNotFind("bean").items("x")} results in the message "did not find bean x". @param article the article found @return an {@link ItemsBuilder}
java
core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java
249
[ "article" ]
ItemsBuilder
true
1
6.8
spring-projects/spring-boot
79,428
javadoc
false
offer
public void offer(@ParametricNullness T elem) { if (k == 0) { return; } else if (bufferSize == 0) { buffer[0] = elem; threshold = elem; bufferSize = 1; } else if (bufferSize < k) { buffer[bufferSize++] = elem; // uncheckedCastNullableTToT is safe because bufferSize > 0. ...
Adds {@code elem} as a candidate for the top {@code k} elements. This operation takes amortized O(1) time.
java
android/guava/src/com/google/common/collect/TopKSelector.java
137
[ "elem" ]
void
true
7
6
google/guava
51,352
javadoc
false
compute_dict_like
def compute_dict_like( self, op_name: Literal["agg", "apply"], selected_obj: Series | DataFrame, selection: Hashable | Sequence[Hashable], kwargs: dict[str, Any], ) -> tuple[list[Hashable], list[Any]]: """ Compute agg/apply results for dict-like input. ...
Compute agg/apply results for dict-like input. Parameters ---------- op_name : {"agg", "apply"} Operation being performed. selected_obj : Series or DataFrame Data to perform operation on. selection : hashable or sequence of hashables Used by GroupBy, Window, and Resample if selection is applied to the obje...
python
pandas/core/apply.py
513
[ "self", "op_name", "selected_obj", "selection", "kwargs" ]
tuple[list[Hashable], list[Any]]
true
13
6.8
pandas-dev/pandas
47,362
numpy
false
createBindTarget
private static @Nullable Bindable<Object> createBindTarget(@Nullable Object bean, Class<?> beanType, @Nullable Method factoryMethod) { ResolvableType type = (factoryMethod != null) ? ResolvableType.forMethodReturnType(factoryMethod) : ResolvableType.forClass(beanType); Annotation[] annotations = findAnnotati...
Return a {@link ConfigurationPropertiesBean @ConfigurationPropertiesBean} instance for the given bean details or {@code null} if the bean is not a {@link ConfigurationProperties @ConfigurationProperties} object. Annotations are considered both on the bean itself, as well as any factory method (for example a {@link Bean...
java
core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBean.java
249
[ "bean", "beanType", "factoryMethod" ]
true
3
7.28
spring-projects/spring-boot
79,428
javadoc
false
flipNode
function flipNode(node: Node, size: number, orthogonalSize: number): Node { if (node instanceof BranchNode) { const result = new BranchNode(orthogonal(node.orientation), node.layoutController, node.styles, node.splitviewProportionalLayout, size, orthogonalSize, node.edgeSnapping); let totalSize = 0; for (let i...
Creates a latched event that avoids being fired when the view constraints do not change at all.
typescript
src/vs/base/browser/ui/grid/gridview.ts
950
[ "node", "size", "orthogonalSize" ]
true
7
6
microsoft/vscode
179,840
jsdoc
false
_fpath_from_key
def _fpath_from_key(self, key: str) -> Path: """Generate a file path from a cache key. Args: key: The cache key to convert to a file path (must be str). Returns: A Path object representing the file location for this key. """ return self._cache_dir / key
Generate a file path from a cache key. Args: key: The cache key to convert to a file path (must be str). Returns: A Path object representing the file location for this key.
python
torch/_inductor/runtime/caching/implementations.py
211
[ "self", "key" ]
Path
true
1
6.72
pytorch/pytorch
96,034
google
false
forTopicPartition
public static Optional<FetchSnapshotRequestData.PartitionSnapshot> forTopicPartition( FetchSnapshotRequestData data, TopicPartition topicPartition ) { return data .topics() .stream() .filter(topic -> topic.name().equals(topicPartition.topic())) ...
Finds the PartitionSnapshot for a given topic partition. @param data the fetch snapshot request data @param topicPartition the topic partition to find @return the request partition snapshot if found, otherwise an empty Optional
java
clients/src/main/java/org/apache/kafka/common/requests/FetchSnapshotRequest.java
57
[ "data", "topicPartition" ]
true
1
6.4
apache/kafka
31,560
javadoc
false
equals
public boolean equals(final StrBuilder other) { if (this == other) { return true; } if (other == null) { return false; } if (this.size != other.size) { return false; } final char[] thisBuf = this.buffer; final char[] oth...
Checks the contents of this builder against another to see if they contain the same character content. @param other the object to check, null returns false @return true if the builders contain the same characters in the same order
java
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
1,867
[ "other" ]
true
6
8.24
apache/commons-lang
2,896
javadoc
false
entrySet
@Override public Set<Entry<K, V>> entrySet() { return (entrySetView == null) ? entrySetView = createEntrySet() : entrySetView; }
Updates the index an iterator is pointing to after a call to remove: returns the index of the entry that should be looked at after a removal on indexRemoved, with indexBeforeRemove as the index that *was* the next entry that would be looked at.
java
android/guava/src/com/google/common/collect/CompactHashMap.java
726
[]
true
2
6.32
google/guava
51,352
javadoc
false
create
static Archive create(ProtectionDomain protectionDomain) throws Exception { CodeSource codeSource = protectionDomain.getCodeSource(); URI location = (codeSource != null) ? codeSource.getLocation().toURI() : null; if (location == null) { throw new IllegalStateException("Unable to determine code source archive")...
Factory method to create an appropriate {@link Archive} from the given {@link Class} target. @param target a target class that will be used to find the archive code source @return an new {@link Archive} instance @throws Exception if the archive cannot be created
java
loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/Archive.java
108
[ "protectionDomain" ]
Archive
true
3
8.08
spring-projects/spring-boot
79,428
javadoc
false
format
@Deprecated StringBuffer format(Calendar calendar, StringBuffer buf);
Formats a {@link Calendar} object into the supplied {@link StringBuffer}. The TimeZone set on the Calendar is only used to adjust the time offset. The TimeZone specified during the construction of the Parser will determine the TimeZone used in the formatted string. @param calendar the calendar to format. @param buf t...
java
src/main/java/org/apache/commons/lang3/time/DatePrinter.java
74
[ "calendar", "buf" ]
StringBuffer
true
1
6.48
apache/commons-lang
2,896
javadoc
false
info
public RecordsInfo info() { if (timestampType == TimestampType.LOG_APPEND_TIME) { if (compression.type() != CompressionType.NONE || magic >= RecordBatch.MAGIC_VALUE_V2) // maxTimestamp => case 2 // shallowOffsetOfMaxTimestamp => case 2 return new Recor...
There are three cases of finding max timestamp to return: 1) version 0: The max timestamp is NO_TIMESTAMP (-1) 2) LogAppendTime: All records have same timestamp, and so the max timestamp is equal to logAppendTime 3) CreateTime: The max timestamp of record <p> Let's talk about OffsetOfMaxTimestamp. There are some paths ...
java
clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java
271
[]
RecordsInfo
true
7
7.92
apache/kafka
31,560
javadoc
false
getByteArrayBaseOffset
private static int getByteArrayBaseOffset() { if (theUnsafe == null) { return OFFSET_UNSAFE_APPROACH_IS_UNAVAILABLE; } try { int offset = theUnsafe.arrayBaseOffset(byte[].class); int scale = theUnsafe.arrayIndexScale(byte[].class); // Use Unsafe only if ...
The offset to the first element in a byte array, or {@link #OFFSET_UNSAFE_APPROACH_IS_UNAVAILABLE}.
java
android/guava/src/com/google/common/primitives/UnsignedBytes.java
349
[]
true
6
6.72
google/guava
51,352
javadoc
false
build_mime_message
def build_mime_message( mail_from: str | None, to: str | Iterable[str], subject: str, html_content: str, files: list[str] | None = None, cc: str | Iterable[str] | None = None, bcc: str | Iterable[str] | None = None, mime_subtype: str = "mixed", mime_charset: str = "utf-8", custom...
Build a MIME message that can be used to send an email and returns a full list of recipients. :param mail_from: Email address to set as the email's "From" field. :param to: A string or iterable of strings containing email addresses to set as the email's "To" field. :param subject: The subject of the email. :param html...
python
airflow-core/src/airflow/utils/email.py
157
[ "mail_from", "to", "subject", "html_content", "files", "cc", "bcc", "mime_subtype", "mime_charset", "custom_headers" ]
tuple[MIMEMultipart, list[str]]
true
8
8.16
apache/airflow
43,597
sphinx
false
handleListOffsetResponse
private void handleListOffsetResponse(ListOffsetsResponse listOffsetsResponse, RequestFuture<ListOffsetResult> future) { try { ListOffsetResult result = offsetFetcherUtils.handleListOffsetResponse(listOffsetsResponse); future.complete(result); ...
Callback for the response of the list offset call above. @param listOffsetsResponse The response from the server. @param future The future to be completed when the response returns. Note that any partition-level errors will generally fail the entire future result. The one excepti...
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetFetcher.java
424
[ "listOffsetsResponse", "future" ]
void
true
2
6.72
apache/kafka
31,560
javadoc
false
create
def create(value: Any, **kwargs: Any) -> VariableTracker: """ Create a `ConstantVariable` based on the given value, and supports automatic routing for collection types like `tuple` (in which case we'd create `ConstantVariable` for the leaf items). NOTE: the caller must install t...
Create a `ConstantVariable` based on the given value, and supports automatic routing for collection types like `tuple` (in which case we'd create `ConstantVariable` for the leaf items). NOTE: the caller must install the proper guards if needed; most often the guard will be `CONSTANT_MATCH`.
python
torch/_dynamo/variables/constant.py
56
[ "value" ]
VariableTracker
true
7
6.72
pytorch/pytorch
96,034
unknown
false
update_min_airflow_version_and_build_files
def update_min_airflow_version_and_build_files( provider_id: str, with_breaking_changes: bool, maybe_with_new_features: bool, skip_readme: bool ): """Updates min airflow version in provider yaml and __init__.py :param provider_id: provider package id :param with_breaking_changes: whether there are any ...
Updates min airflow version in provider yaml and __init__.py :param provider_id: provider package id :param with_breaking_changes: whether there are any breaking changes :param maybe_with_new_features: whether there are any new features :param skip_readme: skip updating readme: skip_readme :return:
python
dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
1,303
[ "provider_id", "with_breaking_changes", "maybe_with_new_features", "skip_readme" ]
true
2
7.44
apache/airflow
43,597
sphinx
false
getResolvableType
public ResolvableType getResolvableType() { ResolvableType resolvableType = this.resolvableType; if (resolvableType == null) { resolvableType = (this.field != null ? ResolvableType.forField(this.field, this.nestingLevel, this.containingClass) : ResolvableType.forMethodParameter(obtainMethodParameter())...
Build a {@link ResolvableType} object for the wrapped parameter/field. @since 4.0
java
spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
267
[]
ResolvableType
true
3
6.24
spring-projects/spring-framework
59,386
javadoc
false
skipToListStart
private static void skipToListStart(XContentParser parser) throws IOException { Token token = parser.currentToken(); if (token == null) { token = parser.nextToken(); } if (token == XContentParser.Token.FIELD_NAME) { token = parser.nextToken(); } if...
Checks if the next current token in the supplied parser is a map start for a non-empty map. Skips to the next token if the parser does not yet have a current token (i.e. {@link #currentToken()} returns {@code null}) and then checks it. @return the first key in the map if a non-empty map start is found
java
libs/x-content/src/main/java/org/elasticsearch/xcontent/support/AbstractXContentParser.java
382
[ "parser" ]
void
true
4
6.72
elastic/elasticsearch
75,680
javadoc
false
afterPropertiesSet
@Override public void afterPropertiesSet() { if (isSingleton()) { this.properties = createProperties(); } }
Set if a singleton should be created, or a new object on each request otherwise. Default is {@code true} (a singleton).
java
spring-beans/src/main/java/org/springframework/beans/factory/config/YamlPropertiesFactoryBean.java
105
[]
void
true
2
7.04
spring-projects/spring-framework
59,386
javadoc
false
afterPropertiesSet
@Override @SuppressWarnings("NullAway") // Dataflow analysis limitation public void afterPropertiesSet() throws ClassNotFoundException, NoSuchFieldException { if (this.targetClass != null && this.targetObject != null) { throw new IllegalArgumentException("Specify either targetClass or targetObject, not both"); ...
The bean name of this FieldRetrievingFactoryBean will be interpreted as "staticField" pattern, if neither "targetClass" nor "targetObject" nor "targetField" have been specified. This allows for concise bean definitions with just an id/name.
java
spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java
160
[]
void
true
11
6.24
spring-projects/spring-framework
59,386
javadoc
false
fromHost
public static HostAndPort fromHost(String host) { HostAndPort parsedHost = fromString(host); checkArgument(!parsedHost.hasPort(), "Host has a port: %s", host); return parsedHost; }
Build a HostAndPort instance from a host only. <p>Note: Non-bracketed IPv6 literals are allowed. Use {@link #requireBracketsForIPv6()} to prohibit these. @param host the host-only string to parse. Must not contain a port number. @return if parsing was successful, a populated HostAndPort object. @throws IllegalArgumentE...
java
android/guava/src/com/google/common/net/HostAndPort.java
151
[ "host" ]
HostAndPort
true
1
6.4
google/guava
51,352
javadoc
false
normalize
def normalize(X, norm="l2", *, axis=1, copy=True, return_norm=False): """Scale input vectors individually to unit norm (vector length). Read more in the :ref:`User Guide <preprocessing_normalization>`. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) T...
Scale input vectors individually to unit norm (vector length). Read more in the :ref:`User Guide <preprocessing_normalization>`. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) The data to normalize, element by element. scipy.sparse matrices should be in CSR format to av...
python
sklearn/preprocessing/_data.py
1,961
[ "X", "norm", "axis", "copy", "return_norm" ]
false
17
6.24
scikit-learn/scikit-learn
64,340
numpy
false
random
private static ThreadLocalRandom random() { return ThreadLocalRandom.current(); }
Gets the {@link ThreadLocalRandom} for {@code shuffle} methods that don't take a {@link Random} argument. @return the current ThreadLocalRandom.
java
src/main/java/org/apache/commons/lang3/ArrayUtils.java
4,655
[]
ThreadLocalRandom
true
1
6.16
apache/commons-lang
2,896
javadoc
false
getObjectForBeanInstance
protected Object getObjectForBeanInstance(Object beanInstance, @Nullable Class<?> requiredType, String name, String beanName, @Nullable RootBeanDefinition mbd) { // Don't let calling code try to dereference the factory if the bean isn't a factory. if (BeanFactoryUtils.isFactoryDereference(name)) { if (beanIn...
Get the object for the given bean instance, either the bean instance itself or its created object in case of a FactoryBean. @param beanInstance the shared bean instance @param name the name that may include factory dereference prefix @param beanName the canonical bean name @param mbd the merged bean definition @return ...
java
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
1,841
[ "beanInstance", "requiredType", "name", "beanName", "mbd" ]
Object
true
11
7.92
spring-projects/spring-framework
59,386
javadoc
false
repeat
function repeat(string, n, guard) { if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { n = 1; } else { n = toInteger(n); } return baseRepeat(toString(string), n); }
Repeats the given string `n` times. @static @memberOf _ @since 3.0.0 @category String @param {string} [string=''] The string to repeat. @param {number} [n=1] The number of times to repeat the string. @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. @returns {string} Returns the repeated str...
javascript
lodash.js
14,615
[ "string", "n", "guard" ]
false
4
7.68
lodash/lodash
61,490
jsdoc
false
toString
@Override public String toString() { StringBuilder b = new StringBuilder(); b.append("Request{"); b.append("method='").append(method).append('\''); b.append(", endpoint='").append(endpoint).append('\''); if (false == parameters.isEmpty()) { b.append(", params=").a...
Get the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.
java
client/rest/src/main/java/org/elasticsearch/client/Request.java
150
[]
String
true
3
6.4
elastic/elasticsearch
75,680
javadoc
false
getFunctionDeclarationAtPosition
function getFunctionDeclarationAtPosition(file: SourceFile, startPosition: number, checker: TypeChecker): ValidFunctionDeclaration | undefined { const node = getTouchingToken(file, startPosition); const functionDeclaration = getContainingFunctionDeclaration(node); // don't offer refactor on top-level J...
Gets the symbol for the contextual type of the node if it is not a union or intersection.
typescript
src/services/refactors/convertParamsToDestructuredObject.ts
435
[ "file", "startPosition", "checker" ]
true
7
6
microsoft/TypeScript
107,154
jsdoc
false
with
public Options with(Option option) { return copy((options) -> options.add(option)); }
Create a new {@link Options} instance that contains the options in this set including the given option. @param option the option to include @return a new {@link Options} instance
java
core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java
239
[ "option" ]
Options
true
1
6.96
spring-projects/spring-boot
79,428
javadoc
false
clusterResource
ClusterResource clusterResource() { return new ClusterResource(clusterId); }
Get leader-epoch for partition. @param tp partition @return leader-epoch if known, else return OptionalInt.empty()
java
clients/src/main/java/org/apache/kafka/clients/MetadataSnapshot.java
143
[]
ClusterResource
true
1
6
apache/kafka
31,560
javadoc
false
_mini_batch_step
def _mini_batch_step( X, sample_weight, centers, centers_new, weight_sums, random_state, random_reassign=False, reassignment_ratio=0.01, verbose=False, n_threads=1, ): """Incremental update of the centers for the Minibatch K-Means algorithm. Parameters ---------- ...
Incremental update of the centers for the Minibatch K-Means algorithm. Parameters ---------- X : {ndarray, sparse matrix} of shape (n_samples, n_features) The original data array. If sparse, must be in CSR format. x_squared_norms : ndarray of shape (n_samples,) Squared euclidean norm of each data point. sam...
python
sklearn/cluster/_kmeans.py
1,563
[ "X", "sample_weight", "centers", "centers_new", "weight_sums", "random_state", "random_reassign", "reassignment_ratio", "verbose", "n_threads" ]
false
10
6
scikit-learn/scikit-learn
64,340
numpy
false
from_arrays
def from_arrays( cls, left, right, closed: IntervalClosedType | None = "right", copy: bool = False, dtype: Dtype | None = None, ) -> Self: """ Construct from two arrays defining the left and right bounds. Parameters ---------- ...
Construct from two arrays defining the left and right bounds. Parameters ---------- left : array-like (1-dimensional) Left bounds for each interval. right : array-like (1-dimensional) Right bounds for each interval. closed : {'left', 'right', 'both', 'neither'}, default 'right' Whether the intervals are cl...
python
pandas/core/arrays/interval.py
581
[ "cls", "left", "right", "closed", "copy", "dtype" ]
Self
true
1
7.04
pandas-dev/pandas
47,362
numpy
false
writeBuckets
private static void writeBuckets(XContentBuilder b, String fieldName, ExponentialHistogram.Buckets buckets) throws IOException { if (buckets.iterator().hasNext() == false) { return; } b.startObject(fieldName); BucketIterator it = buckets.iterator(); b.startArray(BUCKE...
Serializes an {@link ExponentialHistogram} to the provided {@link XContentBuilder}. @param builder the XContentBuilder to write to @param histogram the ExponentialHistogram to serialize @throws IOException if the XContentBuilder throws an IOException
java
libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramXContent.java
96
[ "b", "fieldName", "buckets" ]
void
true
4
6.08
elastic/elasticsearch
75,680
javadoc
false
equals
@Override public boolean equals(final Object obj) { if (obj instanceof MutableInt) { return value == ((MutableInt) obj).intValue(); } return false; }
Compares this object to the specified object. The result is {@code true} if and only if the argument is not {@code null} and is a {@link MutableInt} object that contains the same {@code int} value as this object. @param obj the object to compare with, null returns false. @return {@code true} if the objects are the sam...
java
src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
180
[ "obj" ]
true
2
8.08
apache/commons-lang
2,896
javadoc
false
of
static PemSslStore of(@Nullable String type, List<X509Certificate> certificates, @Nullable PrivateKey privateKey) { return of(type, null, null, certificates, privateKey); }
Factory method that can be used to create a new {@link PemSslStore} with the given values. @param type the key store type @param certificates the certificates for this store @param privateKey the private key @return a new {@link PemSslStore} instance
java
core/spring-boot/src/main/java/org/springframework/boot/ssl/pem/PemSslStore.java
130
[ "type", "certificates", "privateKey" ]
PemSslStore
true
1
6.64
spring-projects/spring-boot
79,428
javadoc
false
isDotOfNumericLiteral
function isDotOfNumericLiteral(contextToken: Node): boolean { if (contextToken.kind === SyntaxKind.NumericLiteral) { const text = contextToken.getFullText(); return text.charAt(text.length - 1) === "."; } return false; }
@returns true if we are certain that the currently edited location must define a new location; false otherwise.
typescript
src/services/completions.ts
5,105
[ "contextToken" ]
true
2
6.88
microsoft/TypeScript
107,154
jsdoc
false
fit
def fit(self, X, y=None): """Fit the model from data in X. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Training vector, where `n_samples` is the number of samples and `n_features` is the number of features. y : ...
Fit the model from data in X. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Training vector, where `n_samples` is the number of samples and `n_features` is the number of features. y : Ignored Not used, present for API consistency by convention. Returns ------- sel...
python
sklearn/decomposition/_kernel_pca.py
419
[ "self", "X", "y" ]
false
5
6.08
scikit-learn/scikit-learn
64,340
numpy
false
validate_ordered
def validate_ordered(ordered: Ordered) -> None: """ Validates that we have a valid ordered parameter. If it is not a boolean, a TypeError will be raised. Parameters ---------- ordered : object The parameter to be verified. Raises ------ ...
Validates that we have a valid ordered parameter. If it is not a boolean, a TypeError will be raised. Parameters ---------- ordered : object The parameter to be verified. Raises ------ TypeError If 'ordered' is not a boolean.
python
pandas/core/dtypes/dtypes.py
544
[ "ordered" ]
None
true
2
6.72
pandas-dev/pandas
47,362
numpy
false
get_variable
def get_variable(self, key: str, team_name: str | None = None) -> str | None: """ Get Airflow Variable from Environment Variable. :param key: Variable Key :param team_name: Team name associated to the task trying to access the variable (if any) :return: Variable Value ""...
Get Airflow Variable from Environment Variable. :param key: Variable Key :param team_name: Team name associated to the task trying to access the variable (if any) :return: Variable Value
python
airflow-core/src/airflow/secrets/environment_variables.py
36
[ "self", "key", "team_name" ]
str | None
true
3
8.08
apache/airflow
43,597
sphinx
false
falsePredicate
@SuppressWarnings("unchecked") static <T, U, E extends Throwable> FailableBiPredicate<T, U, E> falsePredicate() { return FALSE; }
Gets the FALSE singleton. @param <T> Consumed type 1. @param <U> Consumed type 2. @param <E> The kind of thrown exception or error. @return The NOP singleton.
java
src/main/java/org/apache/commons/lang3/function/FailableBiPredicate.java
50
[]
true
1
6.96
apache/commons-lang
2,896
javadoc
false
instance
public Struct instance(String field) { return instance(schema.get(field)); }
Create a struct instance for the given field which must be a container type (struct or array) @param field The name of the field to create (field must be a schema type) @return The struct @throws SchemaException If the given field is not a container type
java
clients/src/main/java/org/apache/kafka/common/protocol/types/Struct.java
182
[ "field" ]
Struct
true
1
6
apache/kafka
31,560
javadoc
false
maybeBindExpressionFlowIfCall
function maybeBindExpressionFlowIfCall(node: Expression) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. if (node.kind === SyntaxKind.CallExpression) { ...
Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names. @param symbolTable - The symbol table which node will be added to. @param parent - node's parent declaration. @param node - The declaration to be added to the symbol table @param includes - The SymbolFlags that n...
typescript
src/compiler/binder.ts
1,778
[ "node" ]
false
4
6.08
microsoft/TypeScript
107,154
jsdoc
false
visitFunctionExpression
function visitFunctionExpression(node: FunctionExpression): Expression { let parameters: NodeArray<ParameterDeclaration>; const savedLexicalArgumentsBinding = lexicalArgumentsBinding; lexicalArgumentsBinding = undefined; const functionFlags = getFunctionFlags(node); const up...
Visits a FunctionExpression node. This function will be called when one of the following conditions are met: - The node is marked async @param node The node to visit.
typescript
src/compiler/transformers/es2017.ts
524
[ "node" ]
true
3
6.88
microsoft/TypeScript
107,154
jsdoc
false
describeFeatures
DescribeFeaturesResult describeFeatures(DescribeFeaturesOptions options);
Describes finalized as well as supported features. The request is issued to any random broker. <p> The following exceptions can be anticipated when calling {@code get()} on the future from the returned {@link DescribeFeaturesResult}: <ul> <li>{@link org.apache.kafka.common.errors.TimeoutException} If the request ti...
java
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java
1,542
[ "options" ]
DescribeFeaturesResult
true
1
6
apache/kafka
31,560
javadoc
false
setNullText
public StrBuilder setNullText(String nullText) { if (StringUtils.isEmpty(nullText)) { nullText = null; } this.nullText = nullText; return this; }
Sets the text to be appended when null is added. @param nullText the null text, null means no append @return {@code this} instance.
java
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
2,834
[ "nullText" ]
StrBuilder
true
2
7.76
apache/commons-lang
2,896
javadoc
false
falsePredicate
@SuppressWarnings("unchecked") static <T, E extends Throwable> FailablePredicate<T, E> falsePredicate() { return FALSE; }
Gets the FALSE singleton. @param <T> Predicate type. @param <E> The kind of thrown exception or error. @return The NOP singleton.
java
src/main/java/org/apache/commons/lang3/function/FailablePredicate.java
48
[]
true
1
6.96
apache/commons-lang
2,896
javadoc
false
hash
@Deprecated @InlineMe( replacement = "Files.asByteSource(file).hash(hashFunction)", imports = "com.google.common.io.Files") public static HashCode hash(File file, HashFunction hashFunction) throws IOException { return asByteSource(file).hash(hashFunction); }
Computes the hash code of the {@code file} using {@code hashFunction}. @param file the file to read @param hashFunction the hash function to use to hash the data @return the {@link HashCode} of all of the bytes in the file @throws IOException if an I/O error occurs @since 12.0 @deprecated Prefer {@code asByteSource(fil...
java
android/guava/src/com/google/common/io/Files.java
621
[ "file", "hashFunction" ]
HashCode
true
1
6.88
google/guava
51,352
javadoc
false
write
def write(self, message): """ Do whatever it takes to actually log the specified logging record. :param message: message to log """ if message.endswith("\n"): message = message.rstrip() self._buffer += message self.flush() else: ...
Do whatever it takes to actually log the specified logging record. :param message: message to log
python
airflow-core/src/airflow/utils/log/logging_mixin.py
213
[ "self", "message" ]
false
3
6.08
apache/airflow
43,597
sphinx
false
createErrorMessage
private static String createErrorMessage(RegisteredBean registeredBean, String msg) { StringBuilder sb = new StringBuilder("Error processing bean with name '"); sb.append(registeredBean.getBeanName()).append("'"); String resourceDescription = registeredBean.getMergedBeanDefinition().getResourceDescription(); if...
Shortcut to create an instance with the {@link RegisteredBean} that fails to be processed with only a detail message. @param registeredBean the registered bean that fails to be processed @param msg the detail message
java
spring-beans/src/main/java/org/springframework/beans/factory/aot/AotBeanProcessingException.java
57
[ "registeredBean", "msg" ]
String
true
2
6.72
spring-projects/spring-framework
59,386
javadoc
false
union
def union(self, other) -> FrozenList: """ Returns a FrozenList with other concatenated to the end of self. Parameters ---------- other : array-like The array-like whose elements we are concatenating. Returns ------- FrozenList The...
Returns a FrozenList with other concatenated to the end of self. Parameters ---------- other : array-like The array-like whose elements we are concatenating. Returns ------- FrozenList The collection difference between self and other.
python
pandas/core/indexes/frozen.py
35
[ "self", "other" ]
FrozenList
true
2
6.24
pandas-dev/pandas
47,362
numpy
false
leaveGroup
protected CompletableFuture<Void> leaveGroup(boolean runCallbacks) { if (isNotInGroup()) { if (state == MemberState.FENCED) { clearAssignment(); transitionTo(MemberState.UNSUBSCRIBED); } subscriptions.unsubscribe(); notifyAssignment...
Transition to {@link MemberState#PREPARE_LEAVING} to release the assignment. Once completed, transition to {@link MemberState#LEAVING} to send the heartbeat request and leave the group. This is expected to be invoked when the user calls the unsubscribe API or is closing the consumer. @param runCallbacks {@code true} to...
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java
580
[ "runCallbacks" ]
true
7
8.08
apache/kafka
31,560
javadoc
false
isClientAbortException
private boolean isClientAbortException(@Nullable Throwable ex) { if (ex == null) { return false; } for (Class<?> candidate : CLIENT_ABORT_EXCEPTIONS) { if (candidate.isInstance(ex)) { return true; } } return isClientAbortException(ex.getCause()); }
Return the description for the given request. By default this method will return a description based on the request {@code servletPath} and {@code pathInfo}. @param request the source request @return the description
java
core/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java
226
[ "ex" ]
true
3
7.92
spring-projects/spring-boot
79,428
javadoc
false
is_dict_like
def is_dict_like(obj: object) -> bool: """ Check if the object is dict-like. Parameters ---------- obj : object The object to check. This can be any Python object, and the function will determine whether it behaves like a dictionary. Returns ------- bool ...
Check if the object is dict-like. Parameters ---------- obj : object The object to check. This can be any Python object, and the function will determine whether it behaves like a dictionary. Returns ------- bool Whether `obj` has dict-like properties. See Also -------- api.types.is_list_like : Check ...
python
pandas/core/dtypes/inference.py
307
[ "obj" ]
bool
true
2
8.48
pandas-dev/pandas
47,362
numpy
false
tryAddBucket
boolean tryAddBucket(long index, long count) { int slot = startSlot() + numBuckets; assert numBuckets == 0 || bucketIndices[slot - 1] < index : "Histogram buckets must be added with their indices in ascending order"; if (slot >= bucketCounts.length) { ...
@return the position of the first bucket of this set of buckets within {@link #bucketCounts} and {@link #bucketIndices}.
java
libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/FixedCapacityExponentialHistogram.java
275
[ "index", "count" ]
true
3
6.72
elastic/elasticsearch
75,680
javadoc
false
copyFile
function copyFile(src, dest, mode, callback) { if (typeof mode === 'function') { callback = mode; mode = 0; } src = getValidatedPath(src, 'src'); dest = getValidatedPath(dest, 'dest'); callback = makeCallback(callback); const req = new FSReqCallback(); req.oncomplete = callback; binding.copyFi...
Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. @param {string | Buffer | URL} src @param {string | Buffer | URL} dest @param {number} [mode] @param {(err?: Error) => any} callback @returns {void}
javascript
lib/fs.js
3,058
[ "src", "dest", "mode", "callback" ]
false
2
6.24
nodejs/node
114,839
jsdoc
false
getInet4Address
private static Inet4Address getInet4Address(byte[] bytes) { checkArgument( bytes.length == 4, "Byte array has invalid length for an IPv4 address: %s != 4.", bytes.length); // Given a 4-byte array, this cast should always succeed. return (Inet4Address) bytesToInetAddress(bytes, null)...
Returns an {@link Inet4Address}, given a byte array representation of the IPv4 address. @param bytes byte array representing an IPv4 address (should be of length 4) @return {@link Inet4Address} corresponding to the supplied byte array @throws IllegalArgumentException if a valid {@link Inet4Address} can not be created
java
android/guava/src/com/google/common/net/InetAddresses.java
124
[ "bytes" ]
Inet4Address
true
1
6.56
google/guava
51,352
javadoc
false
toBooleanObject
public static Boolean toBooleanObject(final int value) { return value == 0 ? Boolean.FALSE : Boolean.TRUE; }
Converts an int to a Boolean using the convention that {@code zero} is {@code false}, everything else is {@code true}. <pre> BooleanUtils.toBoolean(0) = Boolean.FALSE BooleanUtils.toBoolean(1) = Boolean.TRUE BooleanUtils.toBoolean(2) = Boolean.TRUE </pre> @param value the int to convert @return Boolean.TRUE if n...
java
src/main/java/org/apache/commons/lang3/BooleanUtils.java
583
[ "value" ]
Boolean
true
2
7.68
apache/commons-lang
2,896
javadoc
false
fromrecords
def fromrecords(reclist, dtype=None, shape=None, formats=None, names=None, titles=None, aligned=False, byteorder=None, fill_value=None, mask=ma.nomask): """ Creates a MaskedRecords from a list of records. Parameters ---------- reclist : sequence A list of rec...
Creates a MaskedRecords from a list of records. Parameters ---------- reclist : sequence A list of records. Each element of the sequence is first converted to a masked array if needed. If a 2D array is passed as argument, it is processed line by line dtype : {None, dtype}, optional Data type descriptor...
python
numpy/ma/mrecords.py
537
[ "reclist", "dtype", "shape", "formats", "names", "titles", "aligned", "byteorder", "fill_value", "mask" ]
false
10
6.16
numpy/numpy
31,054
numpy
false
_set_node_metadata_hook
def _set_node_metadata_hook(gm: torch.fx.GraphModule, f): """ Takes a callable which will be called after we create a new node. The callable takes the newly created node as input and returns None. """ assert callable(f), "node_metadata_hook must be a callable." # Add the hook to all submodules ...
Takes a callable which will be called after we create a new node. The callable takes the newly created node as input and returns None.
python
torch/_export/passes/_node_metadata_hook.py
94
[ "gm", "f" ]
true
5
6
pytorch/pytorch
96,034
unknown
false
forward
def forward(self, x): r"""Inputs of forward function Args: x: the sequence fed to the positional encoder model (required). Shape: x: [sequence length, batch size, embed dim] output: [sequence length, batch size, embed dim] Examples: >>> out...
r"""Inputs of forward function Args: x: the sequence fed to the positional encoder model (required). Shape: x: [sequence length, batch size, embed dim] output: [sequence length, batch size, embed dim] Examples: >>> output = pos_encoder(x)
python
benchmarks/functional_autograd_benchmark/torchaudio_models.py
413
[ "self", "x" ]
false
1
6.16
pytorch/pytorch
96,034
google
false
sensor
public synchronized Sensor sensor(String name, MetricConfig config, Sensor.RecordingLevel recordingLevel, Sensor... parents) { return sensor(name, config, Long.MAX_VALUE, recordingLevel, parents); }
Get or create a sensor with the given unique name and zero or more parent sensors. All parent sensors will receive every value recorded with this sensor. @param name The name of the sensor @param config A default configuration to use for this sensor for metrics that don't have their own config @param recordingLevel The...
java
clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java
386
[ "name", "config", "recordingLevel" ]
Sensor
true
1
6.64
apache/kafka
31,560
javadoc
false
toString
@SuppressWarnings("GuardedBy") @Override public String toString() { Runnable currentlyRunning = task; if (currentlyRunning != null) { return "SequentialExecutorWorker{running=" + currentlyRunning + "}"; } return "SequentialExecutorWorker{state=" + workerRunningState + "}"; }
Continues executing tasks from {@link #queue} until it is empty. <p>The thread's interrupt bit is cleared before execution of each task. <p>If the Thread in use is interrupted before or during execution of the tasks in {@link #queue}, the Executor will complete its tasks, and then restore the interruption. This means t...
java
android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
256
[]
String
true
2
6.72
google/guava
51,352
javadoc
false
appendln
public StrBuilder appendln(final char[] chars) { return append(chars).appendNewLine(); }
Appends a char array followed by a new line to the string builder. Appending null will call {@link #appendNull()}. @param chars the char array to append @return {@code this} instance. @since 2.3
java
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
957
[ "chars" ]
StrBuilder
true
1
6.8
apache/commons-lang
2,896
javadoc
false
isFull
public boolean isFull() { // note that the write limit is respected only after the first record is added which ensures we can always // create non-empty batches (this is used to disable batching when the producer's batch size is set to 0). return appendStream == CLOSED_STREAM || (this.numRecords...
Check if we have room for a given number of bytes.
java
clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java
889
[]
true
3
6.88
apache/kafka
31,560
javadoc
false
bean
public GenericBeanDefinition bean(Class<?> type) { GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(type); return beanDefinition; }
Define an inner bean definition. @param type the bean type @return the bean definition
java
spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java
303
[ "type" ]
GenericBeanDefinition
true
1
7.04
spring-projects/spring-framework
59,386
javadoc
false
chomp
public static String chomp(final String str) { if (isEmpty(str)) { return str; } if (str.length() == 1) { final char ch = str.charAt(0); if (ch == CharUtils.CR || ch == CharUtils.LF) { return EMPTY; } return str; ...
Removes one newline from end of a String if it's there, otherwise leave it alone. A newline is &quot;{@code \n}&quot;, &quot;{@code \r}&quot;, or &quot;{@code \r\n}&quot;. <p> NOTE: This method changed in 2.0. It now more closely matches Perl chomp. </p> <pre> StringUtils.chomp(null) = null StringUtils.chomp("...
java
src/main/java/org/apache/commons/lang3/StringUtils.java
674
[ "str" ]
String
true
8
7.6
apache/commons-lang
2,896
javadoc
false
missingFieldNames
public Set<String> missingFieldNames(final RunningStats other) { if (other == null || this.docCount == 0 || other.docCount == 0) { return Collections.emptySet(); } return symmetricDifference(this.getAllFieldNames(), other.getAllFieldNames()); }
Get the set of fields required by the aggregation which are missing in at least one document. @param other the other {@link RunningStats} to check @return a set of field names
java
modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/RunningStats.java
208
[ "other" ]
true
4
7.92
elastic/elasticsearch
75,680
javadoc
false
isEventSupported
function isEventSupported(eventNameSuffix: string): boolean { if (!canUseDOM) { return false; } const eventName = 'on' + eventNameSuffix; let isSupported = eventName in document; if (!isSupported) { const element = document.createElement('div'); element.setAttribute(eventName, 'return;'); is...
Checks if an event is supported in the current execution environment. NOTE: This will not work correctly for non-generic events such as `change`, `reset`, `load`, `error`, and `select`. Borrows from Modernizr. @param {string} eventNameSuffix Event name, e.g. "click". @return {boolean} True if the event is supported. @i...
javascript
packages/react-dom-bindings/src/events/isEventSupported.js
25
[ "eventNameSuffix" ]
false
3
7.12
facebook/react
241,750
jsdoc
false
parseBracketedList
function parseBracketedList<T extends Node>(kind: ParsingContext, parseElement: () => T, open: PunctuationSyntaxKind, close: PunctuationSyntaxKind): NodeArray<T> { if (parseExpected(open)) { const result = parseDelimitedList(kind, parseElement); parseExpected(close); retu...
Reports a diagnostic error for the current token being an invalid name. @param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName). @param nameDiagnostic Diagnostic to report for all other cases. @param tokenIfBlankName Current token if the name was invalid for being...
typescript
src/compiler/parser.ts
3,579
[ "kind", "parseElement", "open", "close" ]
true
2
6.72
microsoft/TypeScript
107,154
jsdoc
false
isBraceWrappedContext
function isBraceWrappedContext(context: FormattingContext): boolean { return context.contextNode.kind === SyntaxKind.ObjectBindingPattern || context.contextNode.kind === SyntaxKind.MappedType || isSingleLineBlockContext(context); }
A rule takes a two tokens (left/right) and a particular context for which you're meant to look at them. You then declare what should the whitespace annotation be between these tokens via the action param. @param debugName Name to print @param left The left side of the comparison @param right The right side of the...
typescript
src/services/formatting/rules.ts
584
[ "context" ]
true
3
6.24
microsoft/TypeScript
107,154
jsdoc
false
replaceChars
public static String replaceChars(final String str, final char searchChar, final char replaceChar) { if (str == null) { return null; } return str.replace(searchChar, replaceChar); }
Replaces all occurrences of a character in a String with another. This is a null-safe version of {@link String#replace(char, char)}. <p> A {@code null} string input returns {@code null}. An empty ("") string input returns an empty string. </p> <pre> StringUtils.replaceChars(null, *, *) = null StringUtils.replace...
java
src/main/java/org/apache/commons/lang3/StringUtils.java
6,263
[ "str", "searchChar", "replaceChar" ]
String
true
2
8.08
apache/commons-lang
2,896
javadoc
false
createModuleLoader
function createModuleLoader(asyncLoaderHooks) { // Don't spawn a new loader hook worker if we are already in a loader hook worker to avoid infinite recursion. if (shouldSpawnLoaderHookWorker()) { assert(asyncLoaderHooks === undefined, 'asyncLoaderHooks should only be provided on the loader hook thread itself');...
A loader instance is used as the main entry point for loading ES modules. Currently, this is a singleton; there is only one used for loading the main module and everything in its dependency graph, though separate instances of this class might be instantiated as part of bootstrap for other purposes. @param {AsyncLoaderH...
javascript
lib/internal/modules/esm/loader.js
838
[ "asyncLoaderHooks" ]
false
4
6.08
nodejs/node
114,839
jsdoc
false
inverse
@Override public ImmutableSetMultimap<V, K> inverse() { ImmutableSetMultimap<V, K> result = inverse; return (result == null) ? (inverse = invert()) : result; }
{@inheritDoc} <p>Because an inverse of a set multimap cannot contain multiple pairs with the same key and value, this method returns an {@code ImmutableSetMultimap} rather than the {@code ImmutableMultimap} specified in the {@code ImmutableMultimap} class.
java
android/guava/src/com/google/common/collect/ImmutableSetMultimap.java
554
[]
true
2
6.08
google/guava
51,352
javadoc
false