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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
get | protected Object get(String key) {
if (!values.containsKey(key))
throw new ConfigException(String.format("Unknown configuration '%s'", key));
used.add(key);
return values.get(key);
} | Called directly after user configs got parsed (and thus default values got set).
This allows to change default values for "secondary defaults" if required.
@param parsedValues unmodifiable map of current configuration
@return a map of updates that should be applied to the configuration (will be validated to prevent bad... | java | clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java | 174 | [
"key"
] | Object | true | 2 | 7.6 | apache/kafka | 31,560 | javadoc | false |
matchesExclusion | protected abstract boolean matchesExclusion(String pattern, int patternIndex); | Does the exclusion pattern at the given index match the given String?
@param pattern the {@code String} pattern to match
@param patternIndex index of pattern (starting from 0)
@return {@code true} if there is a match, {@code false} otherwise | java | spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java | 195 | [
"pattern",
"patternIndex"
] | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false | |
packageToPath | public static String packageToPath(final String path) {
return Objects.requireNonNull(path, "path").replace('.', '/');
} | Converts a package name to a Java path ('/').
@param path the source path.
@return a package name.
@throws NullPointerException if {@code path} is null.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/ClassPathUtils.java | 41 | [
"path"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
sort | public static void sort(Object[] source, SortDefinition sortDefinition) throws BeansException {
if (StringUtils.hasText(sortDefinition.getProperty())) {
Arrays.sort(source, new PropertyComparator<>(sortDefinition));
}
} | Sort the given source according to the given sort definition.
<p>Note: Contained objects have to provide the given property
in the form of a bean property, i.e. a getXXX method.
@param source input source
@param sortDefinition the parameters to sort by
@throws java.lang.IllegalArgumentException in case of a missing pro... | java | spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java | 149 | [
"source",
"sortDefinition"
] | void | true | 2 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
fill | public static int[] fill(final int[] a, final int val) {
if (a != null) {
Arrays.fill(a, val);
}
return a;
} | Fills and returns the given array, assigning the given {@code int} value to each element of the array.
@param a the array to be filled (may be null).
@param val the value to be stored in all elements of the array.
@return the given array.
@see Arrays#fill(int[],int) | java | src/main/java/org/apache/commons/lang3/ArrayFill.java | 116 | [
"a",
"val"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
objects_to_datetime64 | def objects_to_datetime64(
data: np.ndarray,
dayfirst,
yearfirst,
utc: bool = False,
errors: DateTimeErrorChoices = "raise",
allow_object: bool = False,
out_unit: str | None = None,
) -> tuple[np.ndarray, tzinfo | None]:
"""
Convert data to array of timestamps.
Parameters
--... | Convert data to array of timestamps.
Parameters
----------
data : np.ndarray[object]
dayfirst : bool
yearfirst : bool
utc : bool, default False
Whether to convert/localize timestamps to UTC.
errors : {'raise', 'coerce'}
allow_object : bool
Whether to return an object-dtype ndarray instead of raising if the
... | python | pandas/core/arrays/datetimes.py | 2,578 | [
"data",
"dayfirst",
"yearfirst",
"utc",
"errors",
"allow_object",
"out_unit"
] | tuple[np.ndarray, tzinfo | None] | true | 6 | 6.8 | pandas-dev/pandas | 47,362 | numpy | false |
deleteTopics | default DeleteTopicsResult deleteTopics(TopicCollection topics) {
return deleteTopics(topics, new DeleteTopicsOptions());
} | This is a convenience method for {@link #deleteTopics(TopicCollection, DeleteTopicsOptions)}
with default options. See the overload for more details.
<p>
When using topic IDs, this operation is supported by brokers with inter-broker protocol 2.8 or higher.
When using topic names, this operation is supported by brokers ... | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 240 | [
"topics"
] | DeleteTopicsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
parseTemplateMiddleOrTemplateTail | function parseTemplateMiddleOrTemplateTail(): TemplateMiddle | TemplateTail {
const fragment = parseLiteralLikeNode(token());
Debug.assert(fragment.kind === SyntaxKind.TemplateMiddle || fragment.kind === SyntaxKind.TemplateTail, "Template fragment has wrong token kind");
return fragment as Te... | 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,748 | [] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
metricsRegistry | @Override
public Metrics metricsRegistry() {
return metrics;
} | This method can be used by cases where the caller has an event that needs to both block for completion but
also process background events. For some events, in order to fully process the associated logic, the
{@link ConsumerNetworkThread background thread} needs assistance from the application thread to complete.
If the... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java | 1,346 | [] | Metrics | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
wrapCanBeObjectOrArrayOfObjects | private static XContentParseException wrapCanBeObjectOrArrayOfObjects(ParseField field, XContentParser p) {
return new XContentParseException(
p.getTokenLocation(),
"["
+ field
+ "] can be a single object with any number of "
+ "fields or a... | Parses a Value from the given {@link XContentParser}
@param parser the parser to build a value from
@param value the value to fill from the parser
@param context a context that is passed along to all declared field parsers
@return the parsed value
@throws IOException if an IOException occurs. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java | 543 | [
"field",
"p"
] | XContentParseException | true | 1 | 6.4 | elastic/elasticsearch | 75,680 | javadoc | false |
nextClean | public char nextClean() throws JSONException {
int nextCleanInt = nextCleanInternal();
return nextCleanInt == -1 ? '\0' : (char) nextCleanInt;
} | Returns the current position and the entire input string.
@return the current position and the entire input string. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 493 | [] | true | 2 | 8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
collectPartitions | private Set<TopicPartition> collectPartitions(Predicate<TopicPartitionState> filter) {
Set<TopicPartition> result = new HashSet<>();
assignment.forEach((topicPartition, topicPartitionState) -> {
if (filter.test(topicPartitionState)) {
result.add(topicPartition);
}... | Unset the preferred read replica. This causes the fetcher to go back to the leader for fetches.
@param tp The topic partition
@return the removed preferred read replica if set, Empty otherwise. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 841 | [
"filter"
] | true | 2 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
setAttribute | @Override
public void setAttribute(Traceable traceable, String key, long value) {
final var span = Span.fromContextOrNull(spans.get(traceable.getSpanId()));
if (span != null) {
span.setAttribute(key, value);
}
} | Most of the examples of how to use the OTel API look something like this, where the span context
is automatically propagated:
<pre>{@code
Span span = tracer.spanBuilder("parent").startSpan();
try (Scope scope = parentSpan.makeCurrent()) {
// ...do some stuff, possibly creating further spans
} finally {
span.end... | java | modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracer.java | 372 | [
"traceable",
"key",
"value"
] | void | true | 2 | 7.92 | elastic/elasticsearch | 75,680 | javadoc | false |
getRequiredScaleReductionToReduceBucketCountBy | int getRequiredScaleReductionToReduceBucketCountBy(int desiredCollapsedBucketCount) {
assert desiredCollapsedBucketCount >= 0;
if (desiredCollapsedBucketCount == 0) {
return 0;
}
int totalCollapsed = 0;
for (int i = 0; i < collapsedBucketCount.length; i++) {
... | Returns the required scale reduction to reduce the number of buckets by at least the given amount.
@param desiredCollapsedBucketCount the target number of buckets to collapse
@return the required scale reduction | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/DownscaleStats.java | 102 | [
"desiredCollapsedBucketCount"
] | true | 4 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false | |
nextInChain | boolean nextInChain() {
if (nextEntry != null) {
for (nextEntry = nextEntry.getNext(); nextEntry != null; nextEntry = nextEntry.getNext()) {
if (advanceTo(nextEntry)) {
return true;
}
}
}
return false;
} | Finds the next entry in the current chain. Returns true if an entry was found. | java | android/guava/src/com/google/common/cache/LocalCache.java | 4,249 | [] | true | 4 | 6.72 | google/guava | 51,352 | javadoc | false | |
originalBeanName | protected String originalBeanName(String name) {
String beanName = transformedBeanName(name);
if (!name.isEmpty() && name.charAt(0) == BeanFactory.FACTORY_BEAN_PREFIX_CHAR) {
beanName = FACTORY_BEAN_PREFIX + beanName;
}
return beanName;
} | Determine the original bean name, resolving locally defined aliases to canonical names.
@param name the user-specified name
@return the original bean name | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,280 | [
"name"
] | String | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false |
getName | public String getName() {
String name = this.name;
if (name == null) {
int offset = ZipContent.this.nameOffsetLookups.get(this.lookupIndex);
long pos = getCentralDirectoryFileHeaderRecordPos(this.lookupIndex)
+ ZipCentralDirectoryFileHeaderRecord.FILE_NAME_OFFSET + offset;
name = ZipString.readS... | Return the name of this entry.
@return the entry name | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 753 | [] | String | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
format | public static String format(final long millis, final String pattern, final TimeZone timeZone, final Locale locale) {
return format(new Date(millis), pattern, timeZone, locale);
} | Formats a date/time into a specific pattern in a time zone and locale.
@param millis the date to format expressed in milliseconds.
@param pattern the pattern to use to format the date, not null.
@param timeZone the time zone to use, may be {@code null}.
@param locale the locale to use, may be {@code null}.
@return... | java | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | 352 | [
"millis",
"pattern",
"timeZone",
"locale"
] | String | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
writeEndRaw | public void writeEndRaw() {
assert base != null : "JsonGenerator should be of instance GeneratorBase but was: " + generator.getClass();
if (base != null) {
JsonStreamContext context = base.getOutputContext();
assert (context instanceof JsonWriteContext) : "Expected an instance of... | Reference to filtering generator because
writing an empty object '{}' when everything is filtered
out needs a specific treatment | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentGenerator.java | 447 | [] | void | true | 2 | 6.24 | elastic/elasticsearch | 75,680 | javadoc | false |
createLong | public static Long createLong(final String str) {
if (str == null) {
return null;
}
return Long.decode(str);
} | Creates a {@link Long} from a {@link String}.
Handles hexadecimal (0Xhhhh) and octal (0ddd) notations. A leading zero means octal; spaces are not trimmed.
<p>
Returns {@code null} if the string is {@code null}.
</p>
@param str a {@link String} to convert, may be null.
@return converted {@link Long} (or null if the inpu... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 283 | [
"str"
] | Long | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false |
convertToClassName | private static String convertToClassName(String name, @Nullable String prefix) {
name = name.replace('/', '.');
name = name.replace('\\', '.');
name = name.substring(0, name.length() - DOT_CLASS.length());
if (prefix != null) {
name = name.substring(prefix.length());
}
return name;
} | Perform the given callback operation on all main classes from the given jar.
@param <T> the result type
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@param callback the callback
@return the first callback result or {@code null}
@throws IOException in case o... | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | 238 | [
"name",
"prefix"
] | String | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
getStringFieldValueInDottedNotation | private String getStringFieldValueInDottedNotation(IngestDocument ingestDocument) {
String value = null;
Object valueObject = ingestDocument.getCtxMap().get(fieldReference);
if (valueObject instanceof String) {
value = (String) valueObject;
} else if (valu... | Resolves the field reference from the provided ingest document or returns the static value if this value source doesn't represent
a field reference.
@param ingestDocument
@return the resolved field reference or static value | java | modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/RerouteProcessor.java | 289 | [
"ingestDocument"
] | String | true | 3 | 7.6 | elastic/elasticsearch | 75,680 | javadoc | false |
keySet | @Override
public Set<K> keySet() {
return new KeySet();
} | Returns {@code true} if this BiMap contains an entry whose value is equal to {@code value} (or,
equivalently, if this inverse view contains a key that is equal to {@code value}).
<p>Due to the property that values in a BiMap are unique, this will tend to execute in
faster-than-linear time.
@param value the object to se... | java | guava/src/com/google/common/collect/HashBiMap.java | 499 | [] | true | 1 | 6.64 | google/guava | 51,352 | javadoc | false | |
download_file | def download_file(
self,
key: str,
bucket_name: str | None = None,
local_path: str | None = None,
preserve_file_name: bool = False,
use_autogenerated_subdir: bool = True,
) -> str:
"""
Download a file from the S3 location to the local file system.
... | Download a file from the S3 location to the local file system.
Note:
This function shadows the 'download_file' method of S3 API, but it is not the same.
If you want to use the original method from S3 API, please use 'S3Hook.get_conn().download_file()'
.. seealso::
- :external+boto3:py:meth:`S3.Object.down... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 1,528 | [
"self",
"key",
"bucket_name",
"local_path",
"preserve_file_name",
"use_autogenerated_subdir"
] | str | true | 9 | 7.84 | apache/airflow | 43,597 | sphinx | false |
equals | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClientQuotaFilterComponent that = (ClientQuotaFilterComponent) o;
return Objects.equals(that.entityType, entityType) && Objects.equals(that.match, match)... | @return the optional match string, where:
if present, the name that's matched exactly
if empty, matches the default name
if null, matches any specified name | java | clients/src/main/java/org/apache/kafka/common/quota/ClientQuotaFilterComponent.java | 92 | [
"o"
] | true | 5 | 6.08 | apache/kafka | 31,560 | javadoc | false | |
setAsText | @Override
public void setAsText(String text) throws IllegalArgumentException {
if (StringUtils.hasText(text)) {
String uri = text.trim();
if (this.classLoader != null && uri.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
ClassPathResource resource = new ClassPathResource(
uri.substring(ResourceUti... | Create a new URIEditor, using the given ClassLoader to resolve
"classpath:" locations into physical resource URLs.
@param classLoader the ClassLoader to use for resolving "classpath:" locations
(may be {@code null} to indicate the default ClassLoader)
@param encode indicates whether Strings will be encoded or not
@sinc... | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/URIEditor.java | 103 | [
"text"
] | void | true | 6 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
nullToEmpty | public static Character[] nullToEmpty(final Character[] array) {
return nullTo(array, EMPTY_CHARACTER_OBJECT_ARRAY);
} | Defensive programming technique to change a {@code null}
reference to an empty one.
<p>
This method returns an empty array for a {@code null} input array.
</p>
<p>
As a memory optimizing technique an empty array passed in will be overridden with
the empty {@code public static} references in this class.
</p>
@param arra... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 4,375 | [
"array"
] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
maybeCompleteSend | public NetworkSend maybeCompleteSend() {
if (send != null && send.completed()) {
midWrite = false;
transportLayer.removeInterestOps(SelectionKey.OP_WRITE);
NetworkSend result = send;
send = null;
return result;
}
return null;
} | Returns the port to which this channel's socket is connected or 0 if the socket has never been connected.
If the socket was connected prior to being closed, then this method will continue to return the
connected port number after the socket is closed. | java | clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java | 396 | [] | NetworkSend | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false |
clearMetadataCache | public void clearMetadataCache() {
this.mergedBeanDefinitions.forEach((beanName, bd) -> {
if (!isBeanEligibleForMetadataCaching(beanName)) {
bd.stale = true;
}
});
} | Clear the merged bean definition cache, removing entries for beans
which are not considered eligible for full metadata caching yet.
<p>Typically triggered after changes to the original bean definitions,
for example, after applying a {@code BeanFactoryPostProcessor}. Note that metadata
for beans which have already been ... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | 1,538 | [] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
registerDefaultFilters | @SuppressWarnings("unchecked")
protected void registerDefaultFilters() {
this.includeFilters.add(new AnnotationTypeFilter(Component.class));
ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader();
try {
this.includeFilters.add(new AnnotationTypeFilter(
((Class<? extends Annot... | Register the default filter for {@link Component @Component}.
<p>This will implicitly register all annotations that have the
{@link Component @Component} meta-annotation including the
{@link Repository @Repository}, {@link Service @Service}, and
{@link Controller @Controller} stereotype annotations.
<p>Also supports JS... | java | spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java | 215 | [] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
set_default_tensor_type | def set_default_tensor_type(t: type["torch.Tensor"] | str, /) -> None:
r"""
.. warning::
This function is deprecated as of PyTorch 2.1, please use :func:`torch.set_default_dtype()` and
:func:`torch.set_default_device()` as alternatives.
Sets the default ``torch.Tensor`` type to floating po... | r"""
.. warning::
This function is deprecated as of PyTorch 2.1, please use :func:`torch.set_default_dtype()` and
:func:`torch.set_default_device()` as alternatives.
Sets the default ``torch.Tensor`` type to floating point tensor type
``t``. This type will also be used as default floating point type for
type ... | python | torch/__init__.py | 1,286 | [
"t"
] | None | true | 2 | 8 | pytorch/pytorch | 96,034 | google | false |
_maybe_cast_slice_bound | def _maybe_cast_slice_bound(self, label, side: str):
"""
If label is a string, cast it to scalar type according to resolution.
Parameters
----------
label : object
side : {'left', 'right'}
Returns
-------
label : object
Notes
---... | If label is a string, cast it to scalar type according to resolution.
Parameters
----------
label : object
side : {'left', 'right'}
Returns
-------
label : object
Notes
-----
Value of `side` parameter should be validated in caller. | python | pandas/core/indexes/datetimelike.py | 457 | [
"self",
"label",
"side"
] | true | 4 | 7.04 | pandas-dev/pandas | 47,362 | numpy | false | |
endOrCacheInflater | private void endOrCacheInflater(Inflater inflater) {
Deque<Inflater> inflaterCache = this.inflaterCache;
if (inflaterCache != null) {
synchronized (inflaterCache) {
if (this.inflaterCache == inflaterCache && inflaterCache.size() < INFLATER_CACHE_LIMIT) {
inflater.reset();
this.inflaterCache.add(inf... | Either release the given {@link Inflater} by calling {@link Inflater#end()} or add
it to the cache for later reuse.
@param inflater the inflater to end or cache | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFileResources.java | 133 | [
"inflater"
] | void | true | 4 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
drop_unused_symbols | def drop_unused_symbols(
index: Union[int, sympy.Expr],
var_names: list[sympy.Expr],
sizes: list[sympy.Expr],
) -> None:
"""
Reduction has last (reduced) dim in its sizes, but
downstream users won't. Normalize this away.
"""
if not isinstance(index, s... | Reduction has last (reduced) dim in its sizes, but
downstream users won't. Normalize this away. | python | torch/_inductor/dependencies.py | 519 | [
"index",
"var_names",
"sizes"
] | None | true | 4 | 6 | pytorch/pytorch | 96,034 | unknown | false |
negate | default FailablePredicate<T, E> negate() {
return t -> !test(t);
} | Returns a predicate that negates this predicate.
@return a predicate that negates this predicate. | java | src/main/java/org/apache/commons/lang3/function/FailablePredicate.java | 82 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
format | def format(self, name: str, roffset=True) -> str:
"""
Codegen a call to tl.make_block_ptr()
Args:
name: variable name for pointer
roffset: should rn_offset be included in offsets=..., for use with tl.advance()
Returns:
"tl.make_block_ptr(...)"
... | Codegen a call to tl.make_block_ptr()
Args:
name: variable name for pointer
roffset: should rn_offset be included in offsets=..., for use with tl.advance()
Returns:
"tl.make_block_ptr(...)" | python | torch/_inductor/codegen/triton.py | 693 | [
"self",
"name",
"roffset"
] | str | true | 3 | 7.28 | pytorch/pytorch | 96,034 | google | false |
succeeded | public boolean succeeded() {
return isDone() && !failed();
} | Check if the request succeeded;
@return true if the request completed and was successful | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestFuture.java | 82 | [] | true | 2 | 7.52 | apache/kafka | 31,560 | javadoc | false | |
value | public XContentBuilder value(Byte value) throws IOException {
return (value == null) ? nullValue() : value(value.byteValue());
} | @return the value of the "human readable" flag. When the value is equal to true,
some types of values are written in a format easier to read for a human. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 439 | [
"value"
] | XContentBuilder | true | 2 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
matchPackage | private static boolean matchPackage(String basePackage, String packageName) {
if (pathMatcher.isPattern(basePackage)) {
return pathMatcher.match(basePackage, packageName);
}
else {
return packageName.equals(basePackage) || packageName.startsWith(basePackage + ".");
}
} | Return the candidate types that are associated with the specified stereotype.
@param basePackage the package to check for candidates
@param stereotype the stereotype to use
@return the candidate types associated with the specified {@code stereotype}
or an empty set if none has been found for the specified {@code basePa... | java | spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndex.java | 160 | [
"basePackage",
"packageName"
] | true | 3 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
isZip | private boolean isZip(InputStream inputStream) throws IOException {
for (byte magicByte : ZIP_FILE_HEADER) {
if (inputStream.read() != magicByte) {
return false;
}
}
return true;
} | Writes a signature file if necessary for the given {@code writtenLibraries}.
@param writtenLibraries the libraries
@param writer the writer to use to write the signature file if necessary
@throws IOException if a failure occurs when writing the signature file | java | loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java | 293 | [
"inputStream"
] | true | 2 | 6.56 | spring-projects/spring-boot | 79,428 | javadoc | false | |
bean | <T> T bean(String name, Class<T> beanClass) throws BeansException; | Return an instance, which may be shared or independent, of the
specified bean.
@param name the name of the bean to retrieve
@param beanClass the type the bean must match; can be an interface or superclass
@return an instance of the bean.
@see BeanFactory#getBean(String, Class) | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanRegistry.java | 248 | [
"name",
"beanClass"
] | T | true | 1 | 6.48 | spring-projects/spring-framework | 59,386 | javadoc | false |
getNodeDIResolutionPath | function getNodeDIResolutionPath(node: ComponentTreeNode): SerializedInjector[] | undefined {
// Some nodes are not linked to HTMLElements, for example @defer blocks
if (!node.nativeElement) {
return undefined;
}
const nodeInjector = getInjectorFromElementNode(node.nativeElement);
if (!nodeInjector) {
... | Opens the source code of a component or a directive in the editor.
@param constructName - The name of the class/function that represents a component, provider, guard
or other callable to view source for.
@param type - The type of the element to view source for component, provider, or directive.
@returns - The element ... | typescript | devtools/projects/ng-devtools-backend/src/lib/client-event-subscribers.ts | 455 | [
"node"
] | true | 5 | 8.08 | angular/angular | 99,544 | jsdoc | false | |
indexOfAny | public static int indexOfAny(final CharSequence str, final CharSequence... searchStrs) {
if (str == null || searchStrs == null) {
return INDEX_NOT_FOUND;
}
// String's can't have a MAX_VALUEth index.
int ret = Integer.MAX_VALUE;
int tmp;
for (final CharSequenc... | Find the first index of any of a set of potential substrings.
<p>
A {@code null} CharSequence will return {@code -1}. A {@code null} or zero length search array will return {@code -1}. A {@code null} search array entry
will be ignored, but a search array containing "" will return {@code 0} if {@code str} is not null. T... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 2,741 | [
"str"
] | true | 7 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
concat | public static <T extends @Nullable Object> T[] concat(T[] array, @ParametricNullness T element) {
T[] result = Arrays.copyOf(array, array.length + 1);
result[array.length] = element;
return result;
} | Returns a new array that appends {@code element} to {@code array}.
@param array the array of elements to prepend
@param element the element to append to the end
@return an array whose size is one larger than {@code array}, with the same contents as {@code
array}, plus {@code element} occupying the last position. | java | android/guava/src/com/google/common/collect/ObjectArrays.java | 104 | [
"array",
"element"
] | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false | |
_default_formatter | def _default_formatter(x: Any, precision: int, thousands: bool = False) -> Any:
"""
Format the display of a value
Parameters
----------
x : Any
Input variable to be formatted
precision : Int
Floating point precision used if ``x`` is float or complex.
thousands : bool, defaul... | Format the display of a value
Parameters
----------
x : Any
Input variable to be formatted
precision : Int
Floating point precision used if ``x`` is float or complex.
thousands : bool, default False
Whether to group digits with thousands separated with ",".
Returns
-------
value : Any
Matches input ty... | python | pandas/io/formats/style_render.py | 1,885 | [
"x",
"precision",
"thousands"
] | Any | true | 6 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
reportTags | private void reportTags(StringBuilder report, ProjectType type) {
Map<String, String> tags = type.getTags();
Iterator<Map.Entry<String, String>> iterator = tags.entrySet().iterator();
report.append(" [");
while (iterator.hasNext()) {
Map.Entry<String, String> entry = iterator.next();
report.append(entry.g... | Generate a report for the specified service. The report contains the available
capabilities as advertised by the root endpoint.
@param url the url of the service
@return the report that describes the service
@throws IOException if the report cannot be generated | java | cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java | 117 | [
"report",
"type"
] | void | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
parseObject | Object parseObject(String source) throws ParseException; | Parses text from a string to produce a Date.
@param source A {@link String} whose beginning should be parsed.
@return a {@link java.util.Date} object.
@throws ParseException if the beginning of the specified string cannot be parsed.
@see java.text.DateFormat#parseObject(String) | java | src/main/java/org/apache/commons/lang3/time/DateParser.java | 113 | [
"source"
] | Object | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
bindEachFunctionsFirst | function bindEachFunctionsFirst(nodes: NodeArray<Node> | undefined): void {
bindEach(nodes, n => n.kind === SyntaxKind.FunctionDeclaration ? bind(n) : undefined);
bindEach(nodes, n => n.kind !== SyntaxKind.FunctionDeclaration ? bind(n) : undefined);
} | 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,078 | [
"nodes"
] | true | 3 | 6.64 | microsoft/TypeScript | 107,154 | jsdoc | false | |
slice | def slice(self, start=None, stop=None, step=None):
"""
Slice substrings from each element in the Series or Index.
Slicing substrings from strings in a Series or Index helps extract
specific portions of data, making it easier to analyze or manipulate
text. This is useful for task... | Slice substrings from each element in the Series or Index.
Slicing substrings from strings in a Series or Index helps extract
specific portions of data, making it easier to analyze or manipulate
text. This is useful for tasks like parsing structured text fields or
isolating parts of strings with a consistent format.
... | python | pandas/core/strings/accessor.py | 1,959 | [
"self",
"start",
"stop",
"step"
] | false | 1 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false | |
configs | public NewTopic configs(Map<String, String> configs) {
this.configs = configs;
return this;
} | Set the configuration to use on the new topic.
@param configs The configuration map.
@return This NewTopic object. | java | clients/src/main/java/org/apache/kafka/clients/admin/NewTopic.java | 113 | [
"configs"
] | NewTopic | true | 1 | 6.64 | apache/kafka | 31,560 | javadoc | false |
mapLookup | public static <V> StrLookup<V> mapLookup(final Map<String, V> map) {
return new MapStrLookup<>(map);
} | Returns a lookup which looks up values using a map.
<p>
If the map is null, then null will be returned from every lookup.
The map result object is converted to a string using toString().
</p>
@param <V> the type of the values supported by the lookup.
@param map the map of keys to values, may be null.
@return a lookup ... | java | src/main/java/org/apache/commons/lang3/text/StrLookup.java | 121 | [
"map"
] | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false | |
hermval2d | def hermval2d(x, y, c):
"""
Evaluate a 2-D Hermite series at points (x, y).
This function returns the values:
.. math:: p(x,y) = \\sum_{i,j} c_{i,j} * H_i(x) * H_j(y)
The parameters `x` and `y` are converted to arrays only if they are
tuples or a lists, otherwise they are treated as a scalars... | Evaluate a 2-D Hermite series at points (x, y).
This function returns the values:
.. math:: p(x,y) = \\sum_{i,j} c_{i,j} * H_i(x) * H_j(y)
The parameters `x` and `y` are converted to arrays only if they are
tuples or a lists, otherwise they are treated as a scalars and they
must have the same shape after conversion.... | python | numpy/polynomial/hermite.py | 891 | [
"x",
"y",
"c"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
newConfinedBuffer | CloseableByteBuffer newConfinedBuffer(int len); | Creates a new {@link CloseableByteBuffer} using a confined arena. The buffer must be
used within the same thread that it is created.
@param len the number of bytes the buffer should allocate
@return the buffer | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/NativeAccess.java | 104 | [
"len"
] | CloseableByteBuffer | true | 1 | 6.48 | elastic/elasticsearch | 75,680 | javadoc | false |
loadValue | private OriginTrackedValue loadValue(StringBuilder buffer, CharacterReader reader, boolean splitLists)
throws IOException {
buffer.setLength(0);
while (reader.isWhiteSpace() && !reader.isEndOfLine()) {
reader.read();
}
Location location = reader.getLocation();
while (!reader.isEndOfLine() && !(splitList... | Load {@code .properties} data and return a map of {@code String} ->
{@link OriginTrackedValue}.
@param expandLists if list {@code name[]=a,b,c} shortcuts should be expanded
@return the loaded properties
@throws IOException on read error | java | core/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java | 150 | [
"buffer",
"reader",
"splitLists"
] | OriginTrackedValue | true | 6 | 7.44 | spring-projects/spring-boot | 79,428 | javadoc | false |
orElse | String orElse(String extension) {
return (this.matcher != null) ? toString() : extension;
} | Return the extension from the hint or return the parameter if the hint is not
{@link #isPresent() present}.
@param extension the fallback extension
@return the extension either from the hint or fallback | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/FileExtensionHint.java | 55 | [
"extension"
] | String | true | 2 | 7.68 | spring-projects/spring-boot | 79,428 | javadoc | false |
createImgixUrl | function createImgixUrl(path: string, config: ImageLoaderConfig) {
const url = new URL(`${path}/${config.src}`);
// This setting ensures the smallest allowable format is set.
url.searchParams.set('auto', 'format');
if (config.width) {
url.searchParams.set('w', config.width.toString());
}
// When reques... | Function that generates an ImageLoader for Imgix and turns it into an Angular provider.
@param path path to the desired Imgix origin,
e.g. https://somepath.imgix.net or https://images.mysite.com
@returns Set of providers to configure the Imgix loader.
@publicApi | typescript | packages/common/src/directives/ng_optimized_image/image_loaders/imgix_loader.ts | 43 | [
"path",
"config"
] | false | 3 | 6.96 | angular/angular | 99,544 | jsdoc | false | |
parseConditionalExpressionRest | function parseConditionalExpressionRest(leftOperand: Expression, pos: number, allowReturnTypeInArrowFunction: boolean): Expression {
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
const questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
... | 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 | 5,574 | [
"leftOperand",
"pos",
"allowReturnTypeInArrowFunction"
] | true | 3 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
apply_index | def apply_index(
self,
func: Callable,
axis: AxisInt | str = 0,
level: Level | list[Level] | None = None,
**kwargs,
) -> Styler:
"""
Apply a CSS-styling function to the index or column headers, {wise}.
Updates the HTML representation with the result.
... | Apply a CSS-styling function to the index or column headers, {wise}.
Updates the HTML representation with the result.
.. versionadded:: 2.1.0
Styler.applymap_index was deprecated and renamed to Styler.map_index.
Parameters
----------
func : function
``func`` should {func}.
axis : {{0, 1, "index", "columns"}}
... | python | pandas/io/formats/style.py | 2,025 | [
"self",
"func",
"axis",
"level"
] | Styler | true | 1 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
bytes | public static long bytes(String value) {
return BytesProcessor.apply(value);
} | Uses {@link BytesProcessor} to return the number of bytes in a
human-readable byte string such as <code>1kb</code>.
@param value human-readable byte string
@return number of bytes | java | modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/Processors.java | 29 | [
"value"
] | true | 1 | 6.48 | elastic/elasticsearch | 75,680 | javadoc | false | |
falsePredicate | @SuppressWarnings("unchecked")
static <E extends Throwable> FailableLongPredicate<E> falsePredicate() {
return FALSE;
} | Gets the FALSE singleton.
@param <E> The kind of thrown exception or error.
@return The NOP singleton. | java | src/main/java/org/apache/commons/lang3/function/FailableLongPredicate.java | 46 | [] | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false | |
open | def open(self, path, mode='r', encoding=None, newline=None):
"""
Open and return file-like object.
If `path` is an URL, it will be downloaded, stored in the
`DataSource` directory and opened from there.
Parameters
----------
path : str or pathlib.Path
... | Open and return file-like object.
If `path` is an URL, it will be downloaded, stored in the
`DataSource` directory and opened from there.
Parameters
----------
path : str or pathlib.Path
Local file path or URL to open.
mode : {'r', 'w', 'a'}, optional
Mode to open `path`. Mode 'r' for reading, 'w' for writin... | python | numpy/lib/_datasource.py | 483 | [
"self",
"path",
"mode",
"encoding",
"newline"
] | false | 6 | 6.24 | numpy/numpy | 31,054 | numpy | false | |
appendln | public StrBuilder appendln(final char[] chars, final int startIndex, final int length) {
return append(chars, startIndex, length).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
@param startIndex the start index, inclusive, must be valid
@param length the length to append, must be valid
@return {@code this} instance.
@since 2.3 | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 971 | [
"chars",
"startIndex",
"length"
] | StrBuilder | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
calculate | def calculate(cls, finished_upstreams: Iterator[TaskInstance]) -> _UpstreamTIStates:
"""
Calculate states for a task instance.
``counter`` is inclusive of ``setup_counter`` -- e.g. if there are 2 skipped upstreams, one
of which is a setup, then counter will show 2 skipped and setup coun... | Calculate states for a task instance.
``counter`` is inclusive of ``setup_counter`` -- e.g. if there are 2 skipped upstreams, one
of which is a setup, then counter will show 2 skipped and setup counter will show 1.
:param finished_upstreams: all the finished upstreams of the dag_run | python | airflow-core/src/airflow/ti_deps/deps/trigger_rule_dep.py | 63 | [
"cls",
"finished_upstreams"
] | _UpstreamTIStates | true | 4 | 7.04 | apache/airflow | 43,597 | sphinx | false |
configureDeliveryTimeout | private static int configureDeliveryTimeout(ProducerConfig config, Logger log) {
int deliveryTimeoutMs = config.getInt(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG);
int lingerMs = lingerMs(config);
int requestTimeoutMs = config.getInt(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG);
int lingerAn... | A producer is instantiated by providing a set of key-value pairs as configuration, a key and a value {@link Serializer}.
Valid configuration strings are documented <a href="http://kafka.apache.org/documentation.html#producerconfigs">here</a>.
<p>
Note: after creating a {@code KafkaProducer} you must always {@link #clos... | java | clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java | 584 | [
"config",
"log"
] | true | 3 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
center | public static String center(String str, final int size, String padStr) {
if (str == null || size <= 0) {
return str;
}
if (isEmpty(padStr)) {
padStr = SPACE;
}
final int strLen = str.length();
final int pads = size - strLen;
if (pads <= 0) ... | Centers a String in a larger String of size {@code size}. Uses a supplied String as the value to pad the String with.
<p>
If the size is less than the String length, the String is returned. A {@code null} String returns {@code null}. A negative size is treated as zero.
</p>
<pre>
StringUtils.center(null, *, *) = nu... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 633 | [
"str",
"size",
"padStr"
] | String | true | 5 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
_can_use_libjoin | def _can_use_libjoin(self) -> bool:
"""
Whether we can use the fastpaths implemented in _libs.join.
This is driven by whether (in monotonic increasing cases that are
guaranteed not to have NAs) we can convert to an np.ndarray without
making a copy. If we cannot, this negates the... | Whether we can use the fastpaths implemented in _libs.join.
This is driven by whether (in monotonic increasing cases that are
guaranteed not to have NAs) we can convert to an np.ndarray without
making a copy. If we cannot, this negates the performance benefit
of using libjoin. | python | pandas/core/indexes/base.py | 4,943 | [
"self"
] | bool | true | 6 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
registerLoggedException | protected void registerLoggedException(Throwable exception) {
SpringBootExceptionHandler handler = getSpringBootExceptionHandler();
if (handler != null) {
handler.registerLoggedException(exception);
}
} | Register that the given exception has been logged. By default, if the running in
the main thread, this method will suppress additional printing of the stacktrace.
@param exception the exception that was logged | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 874 | [
"exception"
] | void | true | 2 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false |
elementDiffers | private boolean elementDiffers(Elements e1, Elements e2, int i) {
ElementType type1 = e1.getType(i);
ElementType type2 = e2.getType(i);
if (type1.allowsFastEqualityCheck() && type2.allowsFastEqualityCheck()) {
return !fastElementEquals(e1, e2, i);
}
if (type1.allowsDashIgnoringEqualityCheck() && type2.allo... | Returns {@code true} if this element is an ancestor (immediate or nested parent) of
the specified name.
@param name the name to check
@return {@code true} if this name is an ancestor | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | 394 | [
"e1",
"e2",
"i"
] | true | 5 | 8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
drainPendingOffsetCommitRequests | public NetworkClientDelegate.PollResult drainPendingOffsetCommitRequests() {
if (pendingRequests.unsentOffsetCommits.isEmpty())
return EMPTY;
List<NetworkClientDelegate.UnsentRequest> requests = pendingRequests.drainPendingCommits();
return new NetworkClientDelegate.PollResult(Long.M... | Drains the inflight offsetCommits during shutdown because we want to make sure all pending commits are sent
before closing. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java | 636 | [] | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
handleDescribeTopicsByNamesWithDescribeTopicPartitionsApi | private Map<String, KafkaFuture<TopicDescription>> handleDescribeTopicsByNamesWithDescribeTopicPartitionsApi(
final Collection<String> topicNames,
DescribeTopicsOptions options
) {
final Map<String, KafkaFutureImpl<TopicDescription>> topicFutures = new HashMap<>(topicNames.size());
f... | Fail futures in the given Map which were retried due to exceeding quota. We propagate
the initial error back to the caller if the request timed out. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 2,314 | [
"topicNames",
"options"
] | true | 5 | 6 | apache/kafka | 31,560 | javadoc | false | |
tryStatSync | function tryStatSync(fd, isUserFd) {
const stats = binding.fstat(fd, false, undefined, true /* shouldNotThrow */);
if (stats === undefined && !isUserFd) {
fs.closeSync(fd);
}
return stats;
} | Asynchronously reads the entire contents of a file.
@param {string | Buffer | URL | number} path
@param {{
encoding?: string | null;
flag?: string;
signal?: AbortSignal;
} | string} [options]
@param {(
err?: Error,
data?: string | Buffer
) => any} callback
@returns {void} | javascript | lib/fs.js | 385 | [
"fd",
"isUserFd"
] | false | 3 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
unravel_index | def unravel_index(indices, shape, order="C"):
"""
unravel_index(indices, shape, order='C')
Converts a flat index or array of flat indices into a tuple
of coordinate arrays.
Parameters
----------
indices : array_like
An integer array whose elements are indices into the flattened
... | unravel_index(indices, shape, order='C')
Converts a flat index or array of flat indices into a tuple
of coordinate arrays.
Parameters
----------
indices : array_like
An integer array whose elements are indices into the flattened
version of an array of dimensions ``shape``. Before version 1.6.0,
this funct... | python | numpy/_core/multiarray.py | 1,041 | [
"indices",
"shape",
"order"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
lazyTypes | function lazyTypes() {
if (_TYPES !== null) { return _TYPES; }
return _TYPES = require('internal/util/types');
} | Lazily loads and returns the internal/util/types module.
@returns {object} | javascript | lib/internal/modules/helpers.js | 358 | [] | false | 2 | 6.72 | nodejs/node | 114,839 | jsdoc | false | |
vdot | def vdot(a, b, /):
r"""
vdot(a, b, /)
Return the dot product of two vectors.
The `vdot` function handles complex numbers differently than `dot`:
if the first argument is complex, it is replaced by its complex conjugate
in the dot product calculation. `vdot` also handles multidimensional
ar... | r"""
vdot(a, b, /)
Return the dot product of two vectors.
The `vdot` function handles complex numbers differently than `dot`:
if the first argument is complex, it is replaced by its complex conjugate
in the dot product calculation. `vdot` also handles multidimensional
arrays differently than `dot`: it does not perfor... | python | numpy/_core/multiarray.py | 844 | [
"a",
"b"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
createBeanInstance | protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd, @Nullable Object @Nullable [] args) {
// Make sure bean class is actually resolved at this point.
Class<?> beanClass = resolveBeanClass(mbd, beanName);
if (beanClass != null && !Modifier.isPublic(beanClass.getModifiers()) && !mbd.i... | Create a new instance for the specified bean, using an appropriate instantiation strategy:
factory method, constructor autowiring, or simple instantiation.
@param beanName the name of the bean
@param mbd the bean definition for the bean
@param args explicit arguments to use for constructor or factory method invocation
... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | 1,177 | [
"beanName",
"mbd",
"args"
] | BeanWrapper | true | 16 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
find_class | def find_class(self, module: str, name: str) -> Any:
"""Resolve import for pickle.
When the main runner uses a symbol `foo` from this file, it sees it as
`worker.main.foo`. However the worker (called as a standalone file)
sees the same symbol as `__main__.foo`. We have to help pickle
... | Resolve import for pickle.
When the main runner uses a symbol `foo` from this file, it sees it as
`worker.main.foo`. However the worker (called as a standalone file)
sees the same symbol as `__main__.foo`. We have to help pickle
understand that they refer to the same symbols. | python | benchmarks/instruction_counts/worker/main.py | 98 | [
"self",
"module",
"name"
] | Any | true | 2 | 6 | pytorch/pytorch | 96,034 | unknown | false |
isPipelineProcessorWithGeoIpProcessor | @SuppressWarnings("unchecked")
private static boolean isPipelineProcessorWithGeoIpProcessor(
Map<String, Object> processor,
boolean downloadDatabaseOnPipelineCreation,
Map<String, PipelineConfiguration> pipelineConfigById,
Map<String, Boolean> pipelineHasGeoProcessorById
) {
... | Check if a processor is a pipeline processor containing at least a geoip processor. This method also updates
pipelineHasGeoProcessorById with a result for any pipelines it looks at.
@param processor Processor config.
@param downloadDatabaseOnPipelineCreation Should the download_database_on_pipeline_creation of the geoi... | java | modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java | 487 | [
"processor",
"downloadDatabaseOnPipelineCreation",
"pipelineConfigById",
"pipelineHasGeoProcessorById"
] | true | 6 | 7.76 | elastic/elasticsearch | 75,680 | javadoc | false | |
validate_rearrange_expressions | def validate_rearrange_expressions(
left: ParsedExpression, right: ParsedExpression, axes_lengths: Mapping[str, int]
) -> None:
"""Perform expression validations that are specific to the `rearrange` operation.
Args:
left (ParsedExpression): left-hand side expression
right (ParsedExpression)... | Perform expression validations that are specific to the `rearrange` operation.
Args:
left (ParsedExpression): left-hand side expression
right (ParsedExpression): right-hand side expression
axes_lengths (Mapping[str, int]): any additional length specifications for dimensions | python | functorch/einops/_parsing.py | 249 | [
"left",
"right",
"axes_lengths"
] | None | true | 7 | 6.08 | pytorch/pytorch | 96,034 | google | false |
hasUndrained | public boolean hasUndrained() {
for (TopicInfo topicInfo : topicInfoMap.values()) {
for (Deque<ProducerBatch> deque : topicInfo.batches.values()) {
synchronized (deque) {
if (!deque.isEmpty())
return true;
}
}
... | Check whether there are any batches which haven't been drained | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java | 784 | [] | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false | |
translate | def translate(self, table):
"""
Map all characters in the string through the given mapping table.
This method is equivalent to the standard :meth:`str.translate`
method for strings. It maps each character in the string to a new
character according to the translation table provid... | Map all characters in the string through the given mapping table.
This method is equivalent to the standard :meth:`str.translate`
method for strings. It maps each character in the string to a new
character according to the translation table provided. Unmapped
characters are left unchanged, while characters mapped to N... | python | pandas/core/strings/accessor.py | 2,577 | [
"self",
"table"
] | false | 2 | 7.52 | pandas-dev/pandas | 47,362 | numpy | false | |
getStartInstant | public Instant getStartInstant() {
if (runningState == State.UNSTARTED) {
throw new IllegalStateException("Stopwatch has not been started");
}
return startInstant;
} | Gets the Instant this StopWatch was started, between the current time and midnight, January 1, 1970 UTC.
@return the Instant this StopWatch was started, between the current time and midnight, January 1, 1970 UTC.
@throws IllegalStateException if this StopWatch has not been started.
@since 3.16.0 | java | src/main/java/org/apache/commons/lang3/time/StopWatch.java | 477 | [] | Instant | true | 2 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
paramJavadocPattern | private Pattern paramJavadocPattern(String paramName) {
String pattern = String.format("(?<=@param +%s).*?(?=([\r\n]+ *@)|$)", paramName);
return Pattern.compile(pattern, Pattern.DOTALL);
} | Return the {@link PrimitiveType} of the specified type or {@code null} if the type
does not represent a valid wrapper type.
@param typeMirror a type
@return the primitive type or {@code null} if the type is not a wrapper type | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | 265 | [
"paramName"
] | Pattern | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
setBeanFactory | @Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (!(beanFactory instanceof ListableBeanFactory lbf)) {
throw new FatalBeanException(
"ServiceLocatorFactoryBean needs to run in a BeanFactory that is a ListableBeanFactory");
}
this.beanFactory = lbf;
} | Set mappings between service ids (passed into the service locator)
and bean names (in the bean factory). Service ids that are not defined
here will be treated as bean names as-is.
<p>The empty string as service id key defines the mapping for {@code null} and
empty string, and for factory methods without parameter. If n... | java | spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java | 247 | [
"beanFactory"
] | void | true | 2 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
getMantissa | private static String getMantissa(final String str, final int stopPos) {
final char firstChar = str.charAt(0);
final boolean hasSign = isSign(firstChar);
final int length = str.length();
if (length <= (hasSign ? 1 : 0) || length < stopPos) {
throw new NumberFormatException(st... | Utility method for {@link #createNumber(String)}.
<p>
Returns mantissa of the given number.
</p>
@param str the string representation of the number.
@param stopPos the position of the exponent or decimal point.
@return mantissa of the given number.
@throws NumberFormatException if no mantissa can be retrieved. | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 498 | [
"str",
"stopPos"
] | String | true | 5 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
doesnt_use_pandas_warnings | def doesnt_use_pandas_warnings(file_obj: IO[str]) -> Iterable[tuple[int, str]]:
"""
Checking that pandas-specific warnings are used for deprecations.
Parameters
----------
file_obj : IO
File-like object containing the Python code to validate.
Yields
------
line_number : int
... | Checking that pandas-specific warnings are used for deprecations.
Parameters
----------
file_obj : IO
File-like object containing the Python code to validate.
Yields
------
line_number : int
Line number of the warning.
msg : str
Explanation of the error. | python | scripts/validate_unwanted_patterns.py | 347 | [
"file_obj"
] | Iterable[tuple[int, str]] | true | 12 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
invoke | @Nullable Object invoke() throws ThrowableWrapper; | Invoke the cache operation defined by this instance. Wraps any exception
that is thrown during the invocation in a {@link ThrowableWrapper}.
@return the result of the operation
@throws ThrowableWrapper if an error occurred while invoking the operation | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationInvoker.java | 41 | [] | Object | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
configureDefaultApiTimeoutMs | private int configureDefaultApiTimeoutMs(AdminClientConfig config) {
int requestTimeoutMs = config.getInt(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG);
int defaultApiTimeoutMs = config.getInt(AdminClientConfig.DEFAULT_API_TIMEOUT_MS_CONFIG);
if (defaultApiTimeoutMs < requestTimeoutMs) {
... | If a default.api.timeout.ms has been explicitly specified, raise an error if it conflicts with request.timeout.ms.
If no default.api.timeout.ms has been configured, then set its value as the max of the default and request.timeout.ms. Also we should probably log a warning.
Otherwise, use the provided values for both con... | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 649 | [
"config"
] | true | 3 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
getProviderName | function getProviderName(child: any): string[] {
const providers = child?.providers || [];
const names = providers.map((p: any) => p.name);
return names || [];
} | Gets the set of currently active Route configuration objects from the router state.
This function synchronously reads the current router state without waiting for navigation events.
@param router - The Angular Router instance
@returns A Set containing all Route configuration objects that are currently active
@example
`... | typescript | devtools/projects/ng-devtools-backend/src/lib/router-tree.ts | 100 | [
"child"
] | true | 3 | 8.88 | angular/angular | 99,544 | jsdoc | false | |
getReferencesForConfigName | private Deque<StandardConfigDataReference> getReferencesForConfigName(String name,
ConfigDataLocation configDataLocation, String directory, @Nullable String profile) {
Deque<StandardConfigDataReference> references = new ArrayDeque<>();
for (PropertySourceLoader propertySourceLoader : this.propertySourceLoaders) ... | Create a new {@link StandardConfigDataLocationResolver} instance.
@param logFactory the factory for loggers to use
@param binder a binder backed by the initial {@link Environment}
@param resourceLoader a {@link ResourceLoader} used to load resources | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java | 200 | [
"name",
"configDataLocation",
"directory",
"profile"
] | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
make_friedman2 | def make_friedman2(n_samples=100, *, noise=0.0, random_state=None):
"""Generate the "Friedman #2" regression problem.
This dataset is described in Friedman [1] and Breiman [2].
Inputs `X` are 4 independent features uniformly distributed on the
intervals::
0 <= X[:, 0] <= 100,
40 * pi ... | Generate the "Friedman #2" regression problem.
This dataset is described in Friedman [1] and Breiman [2].
Inputs `X` are 4 independent features uniformly distributed on the
intervals::
0 <= X[:, 0] <= 100,
40 * pi <= X[:, 1] <= 560 * pi,
0 <= X[:, 2] <= 1,
1 <= X[:, 3] <= 11.
... | python | sklearn/datasets/_samples_generator.py | 1,253 | [
"n_samples",
"noise",
"random_state"
] | false | 1 | 6.4 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
of | public static <E> Stream<E> of(final Iterator<E> iterator) {
return iterator == null ? Stream.empty() : StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED), false);
} | Creates a sequential stream on the given Iterator.
@param <E> the type of elements in the Iterator.
@param iterator the Iterator to stream or null.
@return a new Stream or {@link Stream#empty()} if the Iterator is null.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/stream/Streams.java | 711 | [
"iterator"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
preserve_node_ordering | def preserve_node_ordering(
graph: fx.Graph,
additional_deps_map: dict[fx.Node, OrderedSet[fx.Node]],
verbose: bool = False,
) -> None:
"""
Preserve node ordering using control_deps HOP with subgraph.
This function wraps operations with control_deps that:
1. Makes additional dependencies ex... | Preserve node ordering using control_deps HOP with subgraph.
This function wraps operations with control_deps that:
1. Makes additional dependencies explicit (first argument)
2. Creates a subgraph internally to preserve the exact original operation
3. Preserves the original node names
Args:
graph: The FX graph to... | python | torch/_inductor/fx_passes/control_dependencies.py | 79 | [
"graph",
"additional_deps_map",
"verbose"
] | None | true | 5 | 6.32 | pytorch/pytorch | 96,034 | google | false |
reset | final void reset() {
numBuckets = 0;
cachedCountsSum = null;
} | @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 | 270 | [] | void | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
responseDataToLogString | private String responseDataToLogString(Set<TopicPartition> topicPartitions) {
if (!log.isTraceEnabled()) {
int implied = sessionPartitions.size() - topicPartitions.size();
if (implied > 0) {
return String.format(" with %d response partition(s), %d implied partition(s)",
... | Create a string describing the partitions in a FetchResponse.
@param topicPartitions The topicPartitions from the FetchResponse.
@return The string to log. | java | clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java | 490 | [
"topicPartitions"
] | String | true | 4 | 7.6 | apache/kafka | 31,560 | javadoc | false |
visitCatchClause | function visitCatchClause(node: CatchClause): CatchClause {
const ancestorFacts = enterSubtree(HierarchyFacts.BlockScopeExcludes, HierarchyFacts.BlockScopeIncludes);
let updated: CatchClause;
Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downlev... | Transforms a MethodDeclaration of an ObjectLiteralExpression into an expression.
@param node The ObjectLiteralExpression that contains the MethodDeclaration.
@param method The MethodDeclaration node.
@param receiver The receiver for the assignment. | typescript | src/compiler/transformers/es2015.ts | 4,195 | [
"node"
] | true | 3 | 6.24 | microsoft/TypeScript | 107,154 | jsdoc | false | |
initialize | @Override
public void initialize(LoggingInitializationContext initializationContext, @Nullable String configLocation,
@Nullable LogFile logFile) {
LoggerContext loggerContext = getLoggerContext();
if (isAlreadyInitialized(loggerContext)) {
return;
}
StatusConsoleListener listener = new StatusConsoleListe... | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 237 | [
"initializationContext",
"configLocation",
"logFile"
] | void | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
_gotitem | def _gotitem(self, key, ndim: int, subset=None):
"""
Sub-classes to define. Return a sliced object.
Parameters
----------
key : string / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset to act ... | Sub-classes to define. Return a sliced object.
Parameters
----------
key : string / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset to act on | python | pandas/core/resample.py | 502 | [
"self",
"key",
"ndim",
"subset"
] | true | 5 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false | |
destinationBrokerId | default OptionalInt destinationBrokerId() {
return OptionalInt.empty();
} | Get the target broker ID that a request is intended for or
empty if the request can be sent to any broker.
Note that if the destination broker ID is present in the
{@link ApiRequestScope} returned by {@link AdminApiLookupStrategy#lookupScope(Object)},
then no lookup will be attempted.
@return optional broker ID | java | clients/src/main/java/org/apache/kafka/clients/admin/internals/ApiRequestScope.java | 42 | [] | OptionalInt | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
describeLogDirs | DescribeLogDirsResult describeLogDirs(Collection<Integer> brokers, DescribeLogDirsOptions options); | Query the information of all log directories on the given set of brokers
<p>
This operation is supported by brokers with version 1.0.0 or higher.
@param brokers A list of brokers
@param options The options to use when querying log dir info
@return The DescribeLogDirsResult | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 594 | [
"brokers",
"options"
] | DescribeLogDirsResult | true | 1 | 6.32 | apache/kafka | 31,560 | javadoc | false |
is_terminal_support_colors | def is_terminal_support_colors() -> bool:
"""Try to determine if the current terminal supports colors."""
if sys.platform == "win32":
return False
if not is_tty():
return False
if "COLORTERM" in os.environ:
return True
term = os.environ.get("TERM", "dumb").lower()
if term... | Try to determine if the current terminal supports colors. | python | airflow-core/src/airflow/utils/platform.py | 41 | [] | bool | true | 6 | 6.88 | apache/airflow | 43,597 | unknown | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.