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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
write | @Override
public int write(ByteBuffer src) throws IOException {
if (state == State.CLOSING)
throw closingException();
if (!ready())
return 0;
int written = 0;
while (flush(netWriteBuffer) && src.hasRemaining()) {
netWriteBuffer.clear();
... | Writes a sequence of bytes to this channel from the given buffer.
@param src The buffer from which bytes are to be retrieved
@return The number of bytes read from src, possibly zero, or -1 if the channel has reached end-of-stream
@throws IOException If some other I/O error occurs | java | clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java | 709 | [
"src"
] | true | 12 | 8.4 | apache/kafka | 31,560 | javadoc | false | |
_correctness_check | def _correctness_check(provider_package: str, class_name: str, provider_info: ProviderInfo) -> Any:
"""
Perform coherence check on provider classes.
For apache-airflow providers - it checks if it starts with appropriate package. For all providers
it tries to import the provider - checking that there ar... | Perform coherence check on provider classes.
For apache-airflow providers - it checks if it starts with appropriate package. For all providers
it tries to import the provider - checking that there are no exceptions during importing.
It logs appropriate warning in case it detects any problems.
:param provider_package:... | python | airflow-core/src/airflow/providers_manager.py | 287 | [
"provider_package",
"class_name",
"provider_info"
] | Any | true | 6 | 7.2 | apache/airflow | 43,597 | sphinx | false |
getAnnotation | @SuppressWarnings("unchecked")
public <A extends Annotation> @Nullable A getAnnotation(Class<A> type) {
for (Annotation annotation : this.annotations) {
if (type.isInstance(annotation)) {
return (A) annotation;
}
}
return null;
} | Return a single associated annotations that could affect binding.
@param <A> the annotation type
@param type annotation type
@return the associated annotation or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | 112 | [
"type"
] | A | true | 2 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
cancelJob | private void cancelJob() {
if (scheduler.get() != null) {
scheduler.get().remove(LIFECYCLE_JOB_NAME);
scheduledJob = null;
}
} | Records the provided error for the index in the error store and logs the error message at `ERROR` level if the error for the index
is different to what's already in the error store or if the same error was in the error store for a number of retries divible by
the provided signallingErrorRetryThreshold (i.e. we log to l... | java | modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleService.java | 1,556 | [] | void | true | 2 | 6.56 | elastic/elasticsearch | 75,680 | javadoc | false |
_set_order | def _set_order(X, y, order="C"):
"""Change the order of X and y if necessary.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : ndarray of shape (n_samples,)
Target values.
order : {None, 'C', 'F'}
If 'C', dense a... | Change the order of X and y if necessary.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : ndarray of shape (n_samples,)
Target values.
order : {None, 'C', 'F'}
If 'C', dense arrays are returned as C-ordered, sparse matrices in csr
format. If '... | python | sklearn/linear_model/_coordinate_descent.py | 49 | [
"X",
"y",
"order"
] | false | 8 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
newConnections | private GraphConnections<N, V> newConnections() {
return isDirected()
? DirectedGraphConnections.<N, V>of(incidentEdgeOrder)
: UndirectedGraphConnections.<N, V>of(incidentEdgeOrder);
} | Adds {@code node} to the graph and returns the associated {@link GraphConnections}.
@throws IllegalStateException if {@code node} is already present | java | android/guava/src/com/google/common/graph/StandardMutableValueGraph.java | 187 | [] | true | 2 | 6.08 | google/guava | 51,352 | javadoc | false | |
validateDurationByUnits | function validateDurationByUnits(durationString: string, timeUnits: string[]): boolean {
for (const value of durationString.trim().split(' ')) {
const match = value.match(/([0-9]*[.]?[0-9]+)(.+)/);
if (match === null || match.length !== 3) {
return false;
}
const isValidUnit = timeUnits.include... | isValidGrafanaDuration returns `true` if the given string can be parsed into a valid Duration object based on
the Grafana SDK's gtime.parseDuration, `false` otherwise.
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "M", "y".
@see https://pkg.go.dev/github.com/grafana/grafana-plugin-sdk-go/bac... | typescript | packages/grafana-data/src/datetime/durationutil.ts | 163 | [
"durationString",
"timeUnits"
] | true | 4 | 6.24 | grafana/grafana | 71,362 | jsdoc | false | |
beanOfType | public static <T> T beanOfType(ListableBeanFactory lbf, Class<T> type) throws BeansException {
Assert.notNull(lbf, "ListableBeanFactory must not be null");
Map<String, T> beansOfType = lbf.getBeansOfType(type);
return uniqueBean(type, beansOfType);
} | Return a single bean of the given type or subtypes, not looking in ancestor
factories. Useful convenience method when we expect a single bean and
don't care about the bean name.
<p>Does consider objects created by FactoryBeans, which means that FactoryBeans
will get initialized. If the object created by the FactoryBean... | java | spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java | 472 | [
"lbf",
"type"
] | T | true | 1 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
leastOf | @SuppressWarnings("EmptyList") // ImmutableList doesn't support nullable element types
public <E extends T> List<E> leastOf(Iterator<E> iterator, int k) {
checkNotNull(iterator);
checkNonnegative(k, "k");
if (k == 0 || !iterator.hasNext()) {
return emptyList();
} else if (k >= Integer.MAX_VALUE... | Returns the {@code k} least elements from the given iterator according to this ordering, in
order from least to greatest. If there are fewer than {@code k} elements present, all will be
included.
<p>The implementation does not necessarily use a <i>stable</i> sorting algorithm; when multiple
elements are equivalent, it ... | java | android/guava/src/com/google/common/collect/Ordering.java | 781 | [
"iterator",
"k"
] | true | 5 | 6.4 | google/guava | 51,352 | javadoc | false | |
fromType | public static ScramMechanism fromType(byte type) {
for (ScramMechanism scramMechanism : VALUES) {
if (scramMechanism.type == type) {
return scramMechanism;
}
}
return UNKNOWN;
} | @param type the type indicator
@return the instance corresponding to the given type indicator, otherwise {@link #UNKNOWN} | java | clients/src/main/java/org/apache/kafka/clients/admin/ScramMechanism.java | 44 | [
"type"
] | ScramMechanism | true | 2 | 7.12 | apache/kafka | 31,560 | javadoc | false |
memberId | public String memberId() {
return memberId;
} | @return Member ID that is generated at startup and remains unchanged for the entire lifetime of the process. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 269 | [] | String | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false |
rot90 | def rot90(m, k=1, axes=(0, 1)):
"""
Rotate an array by 90 degrees in the plane specified by axes.
Rotation direction is from the first towards the second axis.
This means for a 2D array with the default `k` and `axes`, the
rotation will be counterclockwise.
Parameters
----------
m : ar... | Rotate an array by 90 degrees in the plane specified by axes.
Rotation direction is from the first towards the second axis.
This means for a 2D array with the default `k` and `axes`, the
rotation will be counterclockwise.
Parameters
----------
m : array_like
Array of two or more dimensions.
k : integer
Number... | python | numpy/lib/_function_base_impl.py | 179 | [
"m",
"k",
"axes"
] | false | 12 | 7.76 | numpy/numpy | 31,054 | numpy | false | |
emptyTopicList | public boolean emptyTopicList() {
return data.topics().isEmpty();
} | @return Builder for metadata request using topic IDs. | java | clients/src/main/java/org/apache/kafka/common/requests/MetadataRequest.java | 103 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
longValue | @Override
public long longValue() {
return value;
} | Returns the value of this MutableByte as a long.
@return the numeric value represented by this object after conversion to type long. | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 322 | [] | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false | |
logical_op | def logical_op(left: ArrayLike, right: Any, op) -> ArrayLike:
"""
Evaluate a logical operation `|`, `&`, or `^`.
Parameters
----------
left : np.ndarray or ExtensionArray
right : object
Cannot be a DataFrame, Series, or Index.
op : {operator.and_, operator.or_, operator.xor}
... | Evaluate a logical operation `|`, `&`, or `^`.
Parameters
----------
left : np.ndarray or ExtensionArray
right : object
Cannot be a DataFrame, Series, or Index.
op : {operator.and_, operator.or_, operator.xor}
Or one of the reversed variants from roperator.
Returns
-------
ndarray or ExtensionArray | python | pandas/core/ops/array_ops.py | 400 | [
"left",
"right",
"op"
] | ArrayLike | true | 14 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false |
read | @Override
@CanIgnoreReturnValue
public int read() throws IOException {
int b = in.read();
if (b != -1) {
hasher.putByte((byte) b);
}
return b;
} | Reads the next byte of data from the underlying input stream and updates the hasher with the
byte read. | java | android/guava/src/com/google/common/hash/HashingInputStream.java | 50 | [] | true | 2 | 7.04 | google/guava | 51,352 | javadoc | false | |
validate_integer | def validate_integer(
name: str, val: int | float | None, min_val: int = 0
) -> int | None:
"""
Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case.
Parameter... | Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case.
Parameters
----------
name : str
Parameter name (used for error reporting)
val : int or float
The value to check
min_val : in... | python | pandas/io/parsers/readers.py | 202 | [
"name",
"val",
"min_val"
] | int | None | true | 6 | 6.56 | pandas-dev/pandas | 47,362 | numpy | false |
addCopies | @CanIgnoreReturnValue
public Builder<E> addCopies(E element, int occurrences) {
requireNonNull(contents); // see the comment on the field
if (occurrences == 0) {
return this;
}
if (buildInvoked) {
contents = new ObjectCountHashMap<E>(contents);
isLinkedHash = false;
... | Adds a number of occurrences of an element to this {@code ImmutableMultiset}.
@param element the element to add
@param occurrences the number of occurrences of the element to add. May be zero, in which
case no change will be made.
@return this {@code Builder} object
@throws NullPointerException if {@code element} i... | java | android/guava/src/com/google/common/collect/ImmutableMultiset.java | 543 | [
"element",
"occurrences"
] | true | 3 | 7.76 | google/guava | 51,352 | javadoc | false | |
_groupby_op | def _groupby_op(
self,
*,
how: str,
has_dropped_na: bool,
min_count: int,
ngroups: int,
ids: npt.NDArray[np.intp],
**kwargs,
) -> ArrayLike:
"""
Dispatch GroupBy reduction or transformation operation.
This is an *experimental* ... | Dispatch GroupBy reduction or transformation operation.
This is an *experimental* API to allow ExtensionArray authors to implement
reductions and transformations. The API is subject to change.
Parameters
----------
how : {'any', 'all', 'sum', 'prod', 'min', 'max', 'mean', 'median',
'median', 'var', 'std', 'sem... | python | pandas/core/arrays/base.py | 2,678 | [
"self",
"how",
"has_dropped_na",
"min_count",
"ngroups",
"ids"
] | ArrayLike | true | 11 | 6.48 | pandas-dev/pandas | 47,362 | numpy | false |
release | private void release() {
if (refCount.decrementAndGet() == 0)
currentThread.set(NO_CURRENT_THREAD);
} | Release the light lock protecting the consumer from multithreaded access. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java | 2,102 | [] | void | true | 2 | 6.32 | apache/kafka | 31,560 | javadoc | false |
toString | @Override
public String toString() {
return (this.origin != null) ? this.origin.toString()
: "\"" + this.propertyName + "\" from property source \"" + this.propertySource.getName() + "\"";
} | Return the actual origin for the source if known.
@return the actual source origin
@since 3.2.8 | java | core/spring-boot/src/main/java/org/springframework/boot/origin/PropertySourceOrigin.java | 94 | [] | String | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
zeroIfNull | public static Duration zeroIfNull(final Duration duration) {
return ObjectUtils.getIfNull(duration, Duration.ZERO);
} | Returns the given non-null value or {@link Duration#ZERO} if null.
@param duration The duration to test.
@return The given duration or {@link Duration#ZERO}. | java | src/main/java/org/apache/commons/lang3/time/DurationUtils.java | 264 | [
"duration"
] | Duration | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
shouldAppearInPrimaryNavBarMenu | function shouldAppearInPrimaryNavBarMenu(item: NavigationBarNode): boolean {
// Items with children should always appear in the primary navbar menu.
if (item.children) {
return true;
}
// Some nodes are otherwise important enough to always include in the primary naviga... | Determines if a node should appear in the primary navbar menu. | typescript | src/services/navigationBar.ts | 897 | [
"item"
] | true | 3 | 6 | microsoft/TypeScript | 107,154 | jsdoc | false | |
visitSourceFile | function visitSourceFile(node: SourceFile): SourceFile {
const ancestorFacts = enterSubtree(
HierarchyFacts.SourceFileExcludes,
isEffectiveStrictModeSourceFile(node, compilerOptions) ?
HierarchyFacts.StrictModeSourceFileIncludes :
HierarchyFacts.Sourc... | @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the
expression of an `ExpressionStatement`). | typescript | src/compiler/transformers/es2018.ts | 563 | [
"node"
] | true | 3 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
clientChannelBuilder | public static ChannelBuilder clientChannelBuilder(
SecurityProtocol securityProtocol,
JaasContext.Type contextType,
AbstractConfig config,
ListenerName listenerName,
String clientSaslMechanism,
Time time,
LogContext logContext) {
... | @param securityProtocol the securityProtocol
@param contextType the contextType, it must be non-null if `securityProtocol` is SASL_*; it is ignored otherwise
@param config client config
@param listenerName the listenerName if contextType is SERVER or null otherwise
@param clientSaslMechanism SASL mechanism if mode is C... | java | clients/src/main/java/org/apache/kafka/common/network/ChannelBuilders.java | 64 | [
"securityProtocol",
"contextType",
"config",
"listenerName",
"clientSaslMechanism",
"time",
"logContext"
] | ChannelBuilder | true | 5 | 6.64 | apache/kafka | 31,560 | javadoc | false |
create | private static NestedLocation create(String location) {
int index = location.lastIndexOf("/!");
String locationPath = (index != -1) ? location.substring(0, index) : location;
String nestedEntryName = (index != -1) ? location.substring(index + 2) : null;
return new NestedLocation((!locationPath.isEmpty()) ? asPa... | Create a new {@link NestedLocation} from the given URI.
@param uri the nested URI
@return a new {@link NestedLocation} instance
@throws IllegalArgumentException if the URI is not valid | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java | 101 | [
"location"
] | NestedLocation | true | 4 | 7.6 | spring-projects/spring-boot | 79,428 | javadoc | false |
builder | public static XContentBuilder builder(XContent xContent) throws IOException {
return new XContentBuilder(xContent, new ByteArrayOutputStream());
} | Create a new {@link XContentBuilder} using the given {@link XContent} content.
<p>
The builder uses an internal {@link ByteArrayOutputStream} output stream to build the content.
</p>
@param xContent the {@link XContent}
@return a new {@link XContentBuilder}
@throws IOException if an {@link IOException} occurs while bui... | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 60 | [
"xContent"
] | XContentBuilder | true | 1 | 6.16 | elastic/elasticsearch | 75,680 | javadoc | false |
predict | def predict(self, X):
"""
Predict class for X.
The predicted class of an input sample is a vote by the trees in
the forest, weighted by their probability estimates. That is,
the predicted class is the one with highest mean probability
estimate across the trees.
... | Predict class for X.
The predicted class of an input sample is a vote by the trees in
the forest, weighted by their probability estimates. That is,
the predicted class is the one with highest mean probability
estimate across the trees.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_featu... | python | sklearn/ensemble/_forest.py | 882 | [
"self",
"X"
] | false | 4 | 6.08 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
toCodePoints | public static int[] toCodePoints(final CharSequence cs) {
if (cs == null) {
return null;
}
if (cs.length() == 0) {
return ArrayUtils.EMPTY_INT_ARRAY;
}
return cs.toString().codePoints().toArray();
} | Converts a {@link CharSequence} into an array of code points.
<p>
Valid pairs of surrogate code units will be converted into a single supplementary code point. Isolated surrogate code units (i.e. a high surrogate not
followed by a low surrogate or a low surrogate not preceded by a high surrogate) will be returned as-is... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,641 | [
"cs"
] | true | 3 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
key_exist | def key_exist(self, bucket_name: str | None, key: str) -> bool:
"""
Find out whether the specified key exists in the oss remote storage.
:param bucket_name: the name of the bucket
:param key: oss bucket key
"""
# full_path = None
self.log.info("Looking up oss buc... | Find out whether the specified key exists in the oss remote storage.
:param bucket_name: the name of the bucket
:param key: oss bucket key | python | providers/alibaba/src/airflow/providers/alibaba/cloud/hooks/oss.py | 322 | [
"self",
"bucket_name",
"key"
] | bool | true | 1 | 6 | apache/airflow | 43,597 | sphinx | false |
get | @ParametricNullness
public static <T extends @Nullable Object> T get(
Iterable<? extends T> iterable, int position, @ParametricNullness T defaultValue) {
checkNotNull(iterable);
Iterators.checkNonnegative(position);
if (iterable instanceof List) {
List<? extends T> list = (List<? extends T>) i... | Returns the element at the specified position in an iterable or a default value otherwise.
<p><b>{@code Stream} equivalent:</b> {@code
stream.skip(position).findFirst().orElse(defaultValue)} (returns the default value if the index
is out of bounds)
@param position position of the element to return
@param defaultValue t... | java | android/guava/src/com/google/common/collect/Iterables.java | 799 | [
"iterable",
"position",
"defaultValue"
] | T | true | 3 | 7.44 | google/guava | 51,352 | javadoc | false |
copyReaderToBuilder | @CanIgnoreReturnValue
static long copyReaderToBuilder(Reader from, StringBuilder to) throws IOException {
checkNotNull(from);
checkNotNull(to);
char[] buf = new char[DEFAULT_BUF_SIZE];
int nRead;
long total = 0;
while ((nRead = from.read(buf)) != -1) {
to.append(buf, 0, nRead);
tot... | Copies all characters between the {@link Reader} and {@link StringBuilder} objects. Does not
close or flush the reader.
<p>This is identical to {@link #copy(Readable, Appendable)} but optimized for these specific
types. CharBuffer has poor performance when being written into or read out of so round tripping
all the byt... | java | android/guava/src/com/google/common/io/CharStreams.java | 109 | [
"from",
"to"
] | true | 2 | 8.08 | google/guava | 51,352 | javadoc | false | |
getCoercedIPv4Address | public static Inet4Address getCoercedIPv4Address(InetAddress ip) {
if (ip instanceof Inet4Address) {
return (Inet4Address) ip;
}
// Special cases:
byte[] bytes = ip.getAddress();
boolean leadingBytesOfZero = true;
for (int i = 0; i < 15; ++i) {
if (bytes[i] != 0) {
leadingBy... | Coerces an IPv6 address into an IPv4 address.
<p>HACK: As long as applications continue to use IPv4 addresses for indexing into tables,
accounting, et cetera, it may be necessary to <b>coerce</b> IPv6 addresses into IPv4 addresses.
This method does so by hashing 64 bits of the IPv6 address into {@code 224.0.0.0/3} (64 ... | java | android/guava/src/com/google/common/net/InetAddresses.java | 997 | [
"ip"
] | Inet4Address | true | 10 | 8.08 | google/guava | 51,352 | javadoc | false |
stripToEmpty | public static String stripToEmpty(final String str) {
return str == null ? EMPTY : strip(str, null);
} | Strips whitespace from the start and end of a String returning an empty String if {@code null} input.
<p>
This is similar to {@link #trimToEmpty(String)} but removes whitespace. Whitespace is defined by {@link Character#isWhitespace(char)}.
</p>
<pre>
StringUtils.stripToEmpty(null) = ""
StringUtils.stripToEmpty("")... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 8,040 | [
"str"
] | String | true | 2 | 7.68 | apache/commons-lang | 2,896 | javadoc | false |
process | private void process(final ResumePartitionsEvent event) {
try {
Collection<TopicPartition> partitions = event.partitions();
log.debug("Resuming partitions {}", partitions);
for (TopicPartition partition : partitions) {
subscriptions.resume(partition);
... | Process event indicating whether the AcknowledgeCommitCallbackHandler is configured by the user.
@param event Event containing a boolean to indicate if the callback handler is configured or not. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java | 636 | [
"event"
] | void | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
removeAdvice | boolean removeAdvice(Advice advice); | Remove the Advisor containing the given advice.
@param advice the advice to remove
@return {@code true} of the advice was found and removed;
{@code false} if there was no such advice | java | spring-aop/src/main/java/org/springframework/aop/framework/Advised.java | 216 | [
"advice"
] | true | 1 | 6.8 | spring-projects/spring-framework | 59,386 | javadoc | false | |
registerStateListener | public void registerStateListener(MemberStateListener listener) {
if (listener == null) {
throw new IllegalArgumentException("State updates listener cannot be null");
}
this.stateUpdatesListeners.add(listener);
} | Register a new listener that will be invoked whenever the member state changes, or a new
member ID or epoch is received.
@param listener Listener to invoke. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java | 1,385 | [
"listener"
] | void | true | 2 | 6.88 | apache/kafka | 31,560 | javadoc | false |
removeBrackets | function removeBrackets(key) {
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
} | It removes the brackets from the end of a string
@param {string} key - The key of the parameter.
@returns {string} the key without the brackets. | javascript | lib/helpers/toFormData.js | 26 | [
"key"
] | false | 2 | 6 | axios/axios | 108,381 | jsdoc | false | |
asFailableFunction | @SuppressWarnings("unchecked")
public static <T, R> FailableFunction<T, R, Throwable> asFailableFunction(final Method method) {
return asInterfaceInstance(FailableFunction.class, method);
} | Produces a {@link FailableFunction} for a given a <em>supplier</em> Method. You call the Function with one argument:
the object receiving the method call. The FailableFunction return type must match the method's return type.
@param <T> the type of the first argument to the function: The type containing the method.
@par... | java | src/main/java/org/apache/commons/lang3/function/MethodInvokers.java | 153 | [
"method"
] | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false | |
read_key | def read_key(self, key: str, bucket_name: str | None = None) -> str:
"""
Read a key from S3.
.. seealso::
- :external+boto3:py:meth:`S3.Object.get`
:param key: S3 key that will point to the file
:param bucket_name: Name of the bucket in which the file is stored
... | Read a key from S3.
.. seealso::
- :external+boto3:py:meth:`S3.Object.get`
:param key: S3 key that will point to the file
:param bucket_name: Name of the bucket in which the file is stored
:return: the content of the key | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 1,068 | [
"self",
"key",
"bucket_name"
] | str | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
root_mean_squared_log_error | def root_mean_squared_log_error(
y_true, y_pred, *, sample_weight=None, multioutput="uniform_average"
):
"""Root mean squared logarithmic error regression loss.
Read more in the :ref:`User Guide <mean_squared_log_error>`.
.. versionadded:: 1.4
Parameters
----------
y_true : array-like of ... | Root mean squared logarithmic error regression loss.
Read more in the :ref:`User Guide <mean_squared_log_error>`.
.. versionadded:: 1.4
Parameters
----------
y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)
Ground truth (correct) target values.
y_pred : array-like of shape (n_samples,) or (n_... | python | sklearn/metrics/_regression.py | 785 | [
"y_true",
"y_pred",
"sample_weight",
"multioutput"
] | false | 3 | 7.12 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
serverAssignor | public Optional<String> serverAssignor() {
return this.serverAssignor;
} | @return Server-side assignor implementation configured for the member, that will be sent
out to the server to be used. If empty, then the server will select the assignor. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMembershipManager.java | 348 | [] | true | 1 | 6.8 | apache/kafka | 31,560 | javadoc | false | |
directFieldAsBase64 | public XContentBuilder directFieldAsBase64(String name, CheckedConsumer<OutputStream, IOException> writer) throws IOException {
if (contentType() != XContentType.JSON) {
assert false : "directFieldAsBase64 supports only JSON format";
throw new UnsupportedOperationException("directFieldAs... | Write the content that is written to the output stream by the {@code writer} as a string encoded in Base64 format.
This API can be used to generate XContent directly without the intermediate results to reduce memory usage.
Note that this method supports only JSON. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 1,255 | [
"name",
"writer"
] | XContentBuilder | true | 2 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
skipNulls | public Joiner skipNulls() {
return new Joiner(this) {
@Override
@SuppressWarnings("JoinIterableIterator") // suggests infinite recursion
public String join(Iterable<?> parts) {
return join(parts.iterator());
}
@Override
public <A extends Appendable> A appendTo(A appendab... | Returns a joiner with the same behavior as this joiner, except automatically skipping over any
provided null elements. | java | android/guava/src/com/google/common/base/Joiner.java | 264 | [] | Joiner | true | 5 | 6.72 | google/guava | 51,352 | javadoc | false |
toString | @Override
public String toString() {
return "ConfigEntry(" +
"name=" + name +
", value=" + (isSensitive ? "Redacted" : value) +
", source=" + source +
", isSensitive=" + isSensitive +
", isReadOnly=" + isReadOnly +
... | Override toString to redact sensitive value.
WARNING, user should be responsible to set the correct "isSensitive" field for each config entry. | java | clients/src/main/java/org/apache/kafka/clients/admin/ConfigEntry.java | 182 | [] | String | true | 2 | 6.56 | apache/kafka | 31,560 | javadoc | false |
initializeConfigFileSupport | function initializeConfigFileSupport() {
if (getOptionValue('--experimental-default-config-file') ||
getOptionValue('--experimental-config-file')) {
emitExperimentalWarning('--experimental-config-file');
}
} | 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 | 383 | [] | false | 3 | 6.8 | nodejs/node | 114,839 | jsdoc | false | |
tryConsumeDeclare | function tryConsumeDeclare(): boolean {
let token = scanner.getToken();
if (token === SyntaxKind.DeclareKeyword) {
// declare module "mod"
token = nextToken();
if (token === SyntaxKind.ModuleKeyword) {
token = nextToken();
if (to... | Returns true if at least one token was consumed from the stream | typescript | src/services/preProcess.ts | 76 | [] | true | 4 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
toInstance | public <R> R toInstance(Function<? super T, R> factory) {
Assert.notNull(factory, "'factory' must not be null");
T value = getValue();
if (value != null && test(value)) {
return factory.apply(value);
}
throw new NoSuchElementException("No value present");
} | Complete the mapping by creating a new instance from the non-filtered value.
@param <R> the resulting type
@param factory the factory used to create the instance
@return the instance
@throws NoSuchElementException if the value has been filtered | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | 324 | [
"factory"
] | R | true | 3 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
createDateTimeFormatter | public DateTimeFormatter createDateTimeFormatter() {
return createDateTimeFormatter(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM));
} | Create a new {@code DateTimeFormatter} using this factory.
<p>If no specific pattern or style has been defined,
{@link FormatStyle#MEDIUM medium date time format} will be used.
@return a new date time formatter
@see #createDateTimeFormatter(DateTimeFormatter) | java | spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterFactory.java | 163 | [] | DateTimeFormatter | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
equals | @Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof Features)) {
return false;
}
final Features<?> that = (Features<?>) other;
return Objects.equals(this.features, that.features);
} | Converts from a map to Features<SupportedVersionRange>.
@param featuresMap the map representation of a Features<SupportedVersionRange> object,
generated using the toMap() API.
@return the Features<SupportedVersionRange> object | java | clients/src/main/java/org/apache/kafka/common/feature/Features.java | 139 | [
"other"
] | true | 3 | 7.12 | apache/kafka | 31,560 | javadoc | false | |
paired_manhattan_distances | def paired_manhattan_distances(X, Y):
"""Compute the paired L1 distances between X and Y.
Distances are calculated between (X[0], Y[0]), (X[1], Y[1]), ...,
(X[n_samples], Y[n_samples]).
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of ... | Compute the paired L1 distances between X and Y.
Distances are calculated between (X[0], Y[0]), (X[1], Y[1]), ...,
(X[n_samples], Y[n_samples]).
Read more in the :ref:`User Guide <metrics>`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
An array-like where each row is a s... | python | sklearn/metrics/pairwise.py | 1,222 | [
"X",
"Y"
] | false | 3 | 7.68 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
hasNameStartingWith | public boolean hasNameStartingWith(CharSequence prefix) {
String name = this.name;
if (name != null) {
return name.startsWith(prefix.toString());
}
long pos = getCentralDirectoryFileHeaderRecordPos(this.lookupIndex)
+ ZipCentralDirectoryFileHeaderRecord.FILE_NAME_OFFSET;
return ZipString.startsW... | Returns {@code true} if this entry has a name starting with the given prefix.
@param prefix the required prefix
@return if the entry name starts with the prefix | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 738 | [
"prefix"
] | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
setQuoteMatcher | public StrTokenizer setQuoteMatcher(final StrMatcher quote) {
if (quote != null) {
this.quoteMatcher = quote;
}
return this;
} | Sets the quote matcher to use.
<p>
The quote character is used to wrap data between the tokens.
This enables delimiters to be entered as data.
</p>
@param quote the quote matcher to use, null ignored.
@return {@code this} instance. | java | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | 1,021 | [
"quote"
] | StrTokenizer | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
generate_numba_table_func | def generate_numba_table_func(
func: Callable[..., np.ndarray],
nopython: bool,
nogil: bool,
parallel: bool,
):
"""
Generate a numba jitted function to apply window calculations table-wise.
Func will be passed an M window size x N number of columns array, and
must return a 1 x N number ... | Generate a numba jitted function to apply window calculations table-wise.
Func will be passed an M window size x N number of columns array, and
must return a 1 x N number of columns array.
1. jit the user's function
2. Return a rolling apply function with the jitted function inline
Parameters
----------
func : funct... | python | pandas/core/window/numba_.py | 183 | [
"func",
"nopython",
"nogil",
"parallel"
] | true | 5 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false | |
head_object | def head_object(self, key: str, bucket_name: str | None = None) -> dict | None:
"""
Retrieve metadata of an object.
.. seealso::
- :external+boto3:py:meth:`S3.Client.head_object`
:param key: S3 key that will point to the file
:param bucket_name: Name of the bucket i... | Retrieve metadata of an object.
.. seealso::
- :external+boto3:py:meth:`S3.Client.head_object`
:param key: S3 key that will point to the file
:param bucket_name: Name of the bucket in which the file is stored
:return: metadata of an object | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py | 997 | [
"self",
"key",
"bucket_name"
] | dict | None | true | 3 | 7.92 | apache/airflow | 43,597 | sphinx | false |
commitAsync | public void commitAsync(
final Map<TopicIdPartition, NodeAcknowledgements> acknowledgementsMap,
final long deadlineMs) {
final Cluster cluster = metadata.fetch();
final ResultHandler resultHandler = new ResultHandler(Optional.empty());
sessionHandlers.forEach((nodeId, se... | Enqueue an AcknowledgeRequestState to be picked up on the next poll.
@param acknowledgementsMap The acknowledgements to commit
@param deadlineMs Time until which the request will be retried if it fails with
an expected retriable error. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 599 | [
"acknowledgementsMap",
"deadlineMs"
] | void | true | 7 | 6.56 | apache/kafka | 31,560 | javadoc | false |
ensureTransactional | private void ensureTransactional() {
if (!isTransactional())
throw new IllegalStateException("Transactional method invoked on a non-transactional producer.");
} | Check if the transaction is in the prepared state.
@return true if the current state is PREPARED_TRANSACTION | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java | 1,149 | [] | void | true | 2 | 8.16 | apache/kafka | 31,560 | javadoc | false |
failure_message_from_response | def failure_message_from_response(response: dict[str, Any]) -> str | None:
"""
Get failure message from response dictionary.
:param response: response from AWS API
:return: failure message
"""
return response["jobRun"]["stateDetails"] | Get failure message from response dictionary.
:param response: response from AWS API
:return: failure message | python | providers/amazon/src/airflow/providers/amazon/aws/sensors/emr.py | 170 | [
"response"
] | str | None | true | 1 | 6.56 | apache/airflow | 43,597 | sphinx | false |
_from_arrays | def _from_arrays(
cls,
arrays,
columns,
index,
dtype: Dtype | None = None,
verify_integrity: bool = True,
) -> Self:
"""
Create DataFrame from a list of arrays corresponding to the columns.
Parameters
----------
arrays : list-l... | Create DataFrame from a list of arrays corresponding to the columns.
Parameters
----------
arrays : list-like of arrays
Each array in the list corresponds to one column, in order.
columns : list-like, Index
The column names for the resulting DataFrame.
index : list-like, Index
The rows labels for the resul... | python | pandas/core/frame.py | 2,611 | [
"cls",
"arrays",
"columns",
"index",
"dtype",
"verify_integrity"
] | Self | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
fireSuccess | private void fireSuccess() {
T value = value();
while (true) {
RequestFutureListener<T> listener = listeners.poll();
if (listener == null)
break;
listener.onSuccess(value);
}
} | Raise an error. The request will be marked as failed.
@param error corresponding error to be passed to caller | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestFuture.java | 163 | [] | void | true | 3 | 6.88 | apache/kafka | 31,560 | javadoc | false |
forward | def forward(self, outputs, targets):
"""This performs the loss computation.
Parameters:
outputs: dict of tensors, see the output specification of the model for the format
targets: list of dicts, such that len(targets) == batch_size.
The expected keys in ea... | This performs the loss computation.
Parameters:
outputs: dict of tensors, see the output specification of the model for the format
targets: list of dicts, such that len(targets) == batch_size.
The expected keys in each dict depends on the losses applied, see each loss' doc | python | benchmarks/functional_autograd_benchmark/torchvision_models.py | 820 | [
"self",
"outputs",
"targets"
] | false | 8 | 6.08 | pytorch/pytorch | 96,034 | google | false | |
asList | public ImmutableList<E> asList() {
return isEmpty() ? ImmutableList.of() : ImmutableList.asImmutableList(toArray());
} | Returns an {@code ImmutableList} containing the same elements, in the same order, as this
collection.
<p><b>Performance note:</b> in most cases this method can return quickly without actually
copying anything. The exact circumstances under which the copy is performed are undefined and
subject to change.
@since 2.0 | java | android/guava/src/com/google/common/collect/ImmutableCollection.java | 354 | [] | true | 2 | 6.64 | google/guava | 51,352 | javadoc | false | |
nextInt | @Deprecated
public static int nextInt(final int startInclusive, final int endExclusive) {
return secure().randomInt(startInclusive, endExclusive);
} | Generates a random integer within the specified range.
@param startInclusive the smallest value that can be returned, must be non-negative.
@param endExclusive the upper bound (not included).
@throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is negative.
@return th... | java | src/main/java/org/apache/commons/lang3/RandomUtils.java | 207 | [
"startInclusive",
"endExclusive"
] | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false | |
getAndAdd | public byte getAndAdd(final byte operand) {
final byte last = value;
this.value += operand;
return last;
} | Increments this instance's value by {@code operand}; this method returns the value associated with the instance
immediately prior to the addition operation. This method is not thread safe.
@param operand the quantity to add, not null.
@return the value associated with this instance immediately before the operand was ad... | java | src/main/java/org/apache/commons/lang3/mutable/MutableByte.java | 217 | [
"operand"
] | true | 1 | 6.88 | apache/commons-lang | 2,896 | javadoc | false | |
copyConfigurationFrom | protected void copyConfigurationFrom(AdvisedSupport other, TargetSource targetSource, List<Advisor> advisors) {
copyFrom(other);
this.targetSource = targetSource;
this.advisorChainFactory = other.advisorChainFactory;
this.interfaces = new ArrayList<>(other.interfaces);
for (Advisor advisor : advisors) {
if... | Copy the AOP configuration from the given {@link AdvisedSupport} object,
but allow substitution of a fresh {@link TargetSource} and a given interceptor chain.
@param other the {@code AdvisedSupport} object to take proxy configuration from
@param targetSource the new TargetSource
@param advisors the Advisors for the cha... | java | spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java | 574 | [
"other",
"targetSource",
"advisors"
] | void | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
generate_numba_apply_func | def generate_numba_apply_func(
func: Callable[..., Scalar],
nopython: bool,
nogil: bool,
parallel: bool,
):
"""
Generate a numba jitted apply function specified by values from engine_kwargs.
1. jit the user's function
2. Return a rolling apply function with the jitted function inline
... | Generate a numba jitted apply function specified by values from engine_kwargs.
1. jit the user's function
2. Return a rolling apply function with the jitted function inline
Configurations specified in engine_kwargs apply to both the user's
function _AND_ the rolling apply function.
Parameters
----------
func : funct... | python | pandas/core/window/numba_.py | 22 | [
"func",
"nopython",
"nogil",
"parallel"
] | true | 6 | 6.64 | pandas-dev/pandas | 47,362 | numpy | false | |
toString | @Override
public String toString() {
StringBuilder sb = new StringBuilder(64);
int i = 0;
for (ParseState.Entry entry : this.state) {
if (i > 0) {
sb.append('\n');
sb.append("\t".repeat(i));
sb.append("-> ");
}
sb.append(entry);
i++;
}
return sb.toString();
} | Returns a tree-style representation of the current {@code ParseState}. | java | spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java | 93 | [] | String | true | 2 | 6.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
getPropertiesFromServices | private Properties getPropertiesFromServices(Environment environment, JsonParser parser) {
Properties properties = new Properties();
try {
String property = environment.getProperty("VCAP_SERVICES", "{}");
Map<String, Object> map = parser.parseMap(property);
extractPropertiesFromServices(properties, map);
... | Create a new {@link CloudFoundryVcapEnvironmentPostProcessor} instance.
@param logFactory the log factory to use
@since 3.0.0 | java | core/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java | 156 | [
"environment",
"parser"
] | Properties | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
getAsText | @Override
public String getAsText() {
Object value = getValue();
if (value == null) {
return "";
}
if (this.numberFormat != null) {
// Use NumberFormat for rendering value.
return this.numberFormat.format(value);
}
else {
// Use toString method for rendering value.
return value.toString();
... | Format the Number as String, using the specified NumberFormat. | java | spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomNumberEditor.java | 135 | [] | String | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
parse | public static JoinGroupRequest parse(Readable readable, short version) {
return new JoinGroupRequest(new JoinGroupRequestData(readable, version), version);
} | Get the client's join reason.
@param request The JoinGroupRequest.
@return The join reason. | java | clients/src/main/java/org/apache/kafka/common/requests/JoinGroupRequest.java | 210 | [
"readable",
"version"
] | JoinGroupRequest | true | 1 | 6.48 | apache/kafka | 31,560 | javadoc | false |
subAndCheck | private static int subAndCheck(final int x, final int y) {
final long s = (long) x - (long) y;
if (s < Integer.MIN_VALUE || s > Integer.MAX_VALUE) {
throw new ArithmeticException("overflow: add");
}
return (int) s;
} | Subtracts two integers, checking for overflow.
@param x the minuend
@param y the subtrahend
@return the difference {@code x-y}
@throws ArithmeticException if the result cannot be represented as
an int | java | src/main/java/org/apache/commons/lang3/math/Fraction.java | 449 | [
"x",
"y"
] | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
logCacheError | protected void logCacheError(Supplier<String> messageSupplier, RuntimeException exception) {
if (getLogger().isWarnEnabled()) {
if (isLogStackTraces()) {
getLogger().warn(messageSupplier.get(), exception);
}
else {
getLogger().warn(messageSupplier.get());
}
}
} | Log the cache error message in the given supplier.
<p>If {@link #isLogStackTraces()} is {@code true}, the given
{@code exception} will be logged as well.
<p>The default implementation logs the message as a warning.
@param messageSupplier the message supplier
@param exception the exception thrown by the cache provider
@... | java | spring-context/src/main/java/org/springframework/cache/interceptor/LoggingCacheErrorHandler.java | 156 | [
"messageSupplier",
"exception"
] | void | true | 3 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
open_memmap | def open_memmap(filename, mode='r+', dtype=None, shape=None,
fortran_order=False, version=None, *,
max_header_size=_MAX_HEADER_SIZE):
"""
Open a .npy file as a memory-mapped array.
This may be used to read an existing file or create a new one.
Parameters
----------
... | Open a .npy file as a memory-mapped array.
This may be used to read an existing file or create a new one.
Parameters
----------
filename : str or path-like
The name of the file on disk. This may *not* be a file-like
object.
mode : str, optional
The mode in which to open the file; the default is 'r+'. In... | python | numpy/lib/_format_impl.py | 891 | [
"filename",
"mode",
"dtype",
"shape",
"fortran_order",
"version",
"max_header_size"
] | false | 9 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
_is_jax_zero_gradient_array | def _is_jax_zero_gradient_array(x: object) -> TypeGuard[_ZeroGradientArray]:
"""Return True if `x` is a zero-gradient array.
These arrays are a design quirk of Jax that may one day be removed.
See https://github.com/google/jax/issues/20620.
"""
# Fast exit
try:
dtype = x.dtype # type: ... | Return True if `x` is a zero-gradient array.
These arrays are a design quirk of Jax that may one day be removed.
See https://github.com/google/jax/issues/20620. | python | sklearn/externals/array_api_compat/common/_helpers.py | 75 | [
"x"
] | TypeGuard[_ZeroGradientArray] | true | 3 | 6 | scikit-learn/scikit-learn | 64,340 | unknown | false |
read | @CanIgnoreReturnValue
// Sometimes you don't care how many bytes you actually read, I guess.
// (You know that it's either going to read len bytes or stop at EOF.)
public static int read(InputStream in, byte[] b, int off, int len) throws IOException {
checkNotNull(in);
checkNotNull(b);
if (len < 0) {
... | Reads some bytes from an input stream and stores them into the buffer array {@code b}. This
method blocks until {@code len} bytes of input data have been read into the array, or end of
file is detected. The number of bytes read is returned, possibly zero. Does not close the
stream.
<p>A caller can detect EOF if the num... | java | android/guava/src/com/google/common/io/ByteStreams.java | 935 | [
"in",
"b",
"off",
"len"
] | true | 4 | 8.24 | google/guava | 51,352 | javadoc | false | |
resourceOutput | public Builder resourceOutput(Path resourceOutput) {
this.resourceOutput = resourceOutput;
return this;
} | Set the output directory for generated resources.
@param resourceOutput the location of generated resources
@return this builder for method chaining | java | spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java | 231 | [
"resourceOutput"
] | Builder | true | 1 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
herm2poly | def herm2poly(c):
"""
Convert a Hermite series to a polynomial.
Convert an array representing the coefficients of a Hermite series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to highe... | Convert a Hermite series to a polynomial.
Convert an array representing the coefficients of a Hermite series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to highest degree.
Parameters
----------
c : array_li... | python | numpy/polynomial/hermite.py | 140 | [
"c"
] | false | 5 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
subscribeFromPattern | public synchronized boolean subscribeFromPattern(Set<String> topics) {
if (subscriptionType != SubscriptionType.AUTO_PATTERN)
throw new IllegalArgumentException("Attempt to subscribe from pattern while subscription type set to " +
subscriptionType);
return changeSubscrip... | This method sets the subscription type if it is not already set (i.e. when it is NONE),
or verifies that the subscription type is equal to the give type when it is set (i.e.
when it is not NONE)
@param type The given subscription type | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 210 | [
"topics"
] | true | 2 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
_get_vars | def _get_vars(self, stack, scopes: list[str]) -> None:
"""
Get specifically scoped variables from a list of stack frames.
Parameters
----------
stack : list
A list of stack frames as returned by ``inspect.stack()``
scopes : sequence of strings
A s... | Get specifically scoped variables from a list of stack frames.
Parameters
----------
stack : list
A list of stack frames as returned by ``inspect.stack()``
scopes : sequence of strings
A sequence containing valid stack frame attribute names that
evaluate to a dictionary. For example, ('locals', 'globals') | python | pandas/core/computation/scope.py | 272 | [
"self",
"stack",
"scopes"
] | None | true | 2 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
pendingToString | @Override
protected @Nullable String pendingToString() {
@RetainedLocalRef ListenableFuture<? extends V> localInputFuture = inputFuture;
@RetainedLocalRef Class<X> localExceptionType = exceptionType;
@RetainedLocalRef F localFallback = fallback;
String superString = super.pendingToString();
String... | Template method for subtypes to actually set the result. | java | android/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java | 167 | [] | String | true | 5 | 6.88 | google/guava | 51,352 | javadoc | false |
span | @Override
public Range<C> span() {
Entry<Cut<C>, Range<C>> firstEntry = rangesByLowerBound.firstEntry();
Entry<Cut<C>, Range<C>> lastEntry = rangesByLowerBound.lastEntry();
if (firstEntry == null || lastEntry == null) {
/*
* Either both are null or neither is: Either the set is empty, or it's... | Returns a {@code TreeRangeSet} representing the union of the specified ranges.
<p>This is the smallest {@code RangeSet} which encloses each of the specified ranges. An
element will be contained in this {@code RangeSet} if and only if it is contained in at least
one {@code Range} in {@code ranges}.
@since 21.0 | java | android/guava/src/com/google/common/collect/TreeRangeSet.java | 164 | [] | true | 3 | 7.04 | google/guava | 51,352 | javadoc | false | |
indexOf | public static int indexOf(final byte[] array, final byte valueToFind, final int startIndex) {
if (array == null) {
return INDEX_NOT_FOUND;
}
for (int i = max0(startIndex); i < array.length; i++) {
if (valueToFind == array[i]) {
return i;
}
... | Finds the index of the given value in the array starting at the given index.
<p>
This method returns {@link #INDEX_NOT_FOUND} ({@code -1}) for a {@code null} input array.
</p>
<p>
A negative startIndex is treated as zero. A startIndex larger than the array length will return {@link #INDEX_NOT_FOUND} ({@code -1}).
</p>
... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2,427 | [
"array",
"valueToFind",
"startIndex"
] | true | 4 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
empty | static ReleasableExponentialHistogram empty() {
return EmptyExponentialHistogram.INSTANCE;
} | @return an empty singleton, which does not allocate any memory and therefore {@link #close()} is a no-op. | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ReleasableExponentialHistogram.java | 34 | [] | ReleasableExponentialHistogram | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false |
isExpandoDeclaration | function isExpandoDeclaration(node: Declaration): boolean {
if (!isAssignmentDeclaration(node)) return false;
const containingAssignment = findAncestor(node, p => {
if (isAssignmentExpression(p)) return true;
if (!isAssignmentDeclaration(p as Declaration)) return "quit";
return fals... | ```ts
function f() {}
f.foo = 0;
```
Here, `f` has two declarations: the function declaration, and the identifier in the next line.
The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
it can contain `foo`. However, that declaration is pretty uninteresting and not intui... | typescript | src/services/goToDefinition.ts | 617 | [
"node"
] | true | 5 | 7.12 | microsoft/TypeScript | 107,154 | jsdoc | false | |
reconstruct_func | def reconstruct_func(
func: AggFuncType | None, **kwargs
) -> tuple[bool, AggFuncType, tuple[str, ...] | None, npt.NDArray[np.intp] | None]:
"""
This is the internal function to reconstruct func given if there is relabeling
or not and also normalize the keyword to get new order of columns.
If named... | This is the internal function to reconstruct func given if there is relabeling
or not and also normalize the keyword to get new order of columns.
If named aggregation is applied, `func` will be None, and kwargs contains the
column and aggregation function information to be parsed;
If named aggregation is not applied, ... | python | pandas/core/apply.py | 1,712 | [
"func"
] | tuple[bool, AggFuncType, tuple[str, ...] | None, npt.NDArray[np.intp] | None] | true | 13 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
serializeEntityNameAsExpressionFallback | function serializeEntityNameAsExpressionFallback(node: EntityName): BinaryExpression {
if (node.kind === SyntaxKind.Identifier) {
// A -> typeof A !== "undefined" && A
const copied = serializeEntityNameAsExpression(node);
return createCheckedValue(copied, copied);
... | Serializes an entity name which may not exist at runtime, but whose access shouldn't throw
@param node The entity name to serialize. | typescript | src/compiler/transformers/typeSerializer.ts | 569 | [
"node"
] | true | 3 | 7.04 | microsoft/TypeScript | 107,154 | jsdoc | false | |
get_pip_package_name | def get_pip_package_name(provider_id: str) -> str:
"""
Returns PIP package name for the package id.
:param provider_id: id of the package
:return: the name of pip package
"""
return "apache-airflow-providers-" + provider_id.replace(".", "-") | Returns PIP package name for the package id.
:param provider_id: id of the package
:return: the name of pip package | python | dev/breeze/src/airflow_breeze/utils/packages.py | 457 | [
"provider_id"
] | str | true | 1 | 6.88 | apache/airflow | 43,597 | sphinx | false |
sheet_names | def sheet_names(self):
"""
Names of the sheets in the document.
This is particularly useful for loading a specific sheet into a DataFrame when
you do not know the sheet names beforehand.
Returns
-------
list of str
List of sheet names in the document... | Names of the sheets in the document.
This is particularly useful for loading a specific sheet into a DataFrame when
you do not know the sheet names beforehand.
Returns
-------
list of str
List of sheet names in the document.
See Also
--------
ExcelFile.parse : Parse a sheet into a DataFrame.
read_excel : Read an... | python | pandas/io/excel/_base.py | 1,832 | [
"self"
] | false | 1 | 6.48 | pandas-dev/pandas | 47,362 | unknown | false | |
isBindingIdentifier | function isBindingIdentifier(): boolean {
if (token() === SyntaxKind.Identifier) {
return true;
}
// `let await`/`let yield` in [Yield] or [Await] are allowed here and disallowed in the binder.
return token() > SyntaxKind.LastReservedWord;
} | Invokes the provided callback. If the callback returns something falsy, then it restores
the parser to the state it was in immediately prior to invoking the callback. If the
callback returns something truthy, then the parser state is not rolled back. The result
of invoking the callback is returned from this funct... | typescript | src/compiler/parser.ts | 2,308 | [] | true | 2 | 7.2 | microsoft/TypeScript | 107,154 | jsdoc | false | |
iterator | @Override
public Iterator<Entry> iterator() {
return new PropertiesIterator(this.entries);
} | Return the value of the specified property as an {@link Instant} or {@code null} if
the value is not a valid {@link Long} representation of an epoch time.
@param key the key of the property
@return the property value | java | core/spring-boot/src/main/java/org/springframework/boot/info/InfoProperties.java | 78 | [] | true | 1 | 6.8 | spring-projects/spring-boot | 79,428 | javadoc | false | |
baseProperty | function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
} | The base implementation of `_.property` without support for deep paths.
@private
@param {string} key The key of the property to get.
@returns {Function} Returns the new accessor function. | javascript | lodash.js | 892 | [
"key"
] | false | 2 | 6.24 | lodash/lodash | 61,490 | jsdoc | false | |
wsgi_errors_stream | def wsgi_errors_stream() -> t.TextIO:
"""Find the most appropriate error stream for the application. If a request
is active, log to ``wsgi.errors``, otherwise use ``sys.stderr``.
If you configure your own :class:`logging.StreamHandler`, you may want to
use this for the stream. If you are using file or ... | Find the most appropriate error stream for the application. If a request
is active, log to ``wsgi.errors``, otherwise use ``sys.stderr``.
If you configure your own :class:`logging.StreamHandler`, you may want to
use this for the stream. If you are using file or dict configuration and
can't import this directly, you ca... | python | src/flask/logging.py | 16 | [] | t.TextIO | true | 2 | 6.88 | pallets/flask | 70,946 | unknown | false |
join | @Nullable String join(String prefix, String name); | Joins the given prefix and name.
@param prefix the prefix
@param name the name
@return the joined result or {@code null} | java | core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java | 113 | [
"prefix",
"name"
] | String | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false |
matchesMethod | private boolean matchesMethod(Method method) {
return (this.checkInherited ? AnnotatedElementUtils.hasAnnotation(method, this.annotationType) :
method.isAnnotationPresent(this.annotationType));
} | Create a new AnnotationClassFilter for the given annotation type.
@param annotationType the annotation type to look for
@param checkInherited whether to also check the superclasses and
interfaces as well as meta-annotations for the annotation type
(i.e. whether to use {@link AnnotatedElementUtils#hasAnnotation}
semanti... | java | spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java | 86 | [
"method"
] | true | 2 | 6.16 | spring-projects/spring-framework | 59,386 | javadoc | false | |
ping | def ping(self, destination=None):
"""Ping all (or specific) workers.
>>> app.control.inspect().ping()
{'celery@node1': {'ok': 'pong'}, 'celery@node2': {'ok': 'pong'}}
>>> app.control.inspect().ping(destination=['celery@node1'])
{'celery@node1': {'ok': 'pong'}}
Arguments... | Ping all (or specific) workers.
>>> app.control.inspect().ping()
{'celery@node1': {'ok': 'pong'}, 'celery@node2': {'ok': 'pong'}}
>>> app.control.inspect().ping(destination=['celery@node1'])
{'celery@node1': {'ok': 'pong'}}
Arguments:
destination (List): If set, a list of the hosts to send the
command to,... | python | celery/app/control.py | 274 | [
"self",
"destination"
] | false | 2 | 8.24 | celery/celery | 27,741 | google | false | |
_has_method | def _has_method(
class_path: str,
method_names: Iterable[str],
class_registry: dict[str, dict[str, Any]],
ignored_classes: list[str] | None = None,
) -> bool:
"""
Determines if a class or its bases in the registry have any of the specified methods.
:param class_path: The path of the class t... | Determines if a class or its bases in the registry have any of the specified methods.
:param class_path: The path of the class to check.
:param method_names: A list of names of methods to search for.
:param class_registry: A dictionary representing the class registry, where each key is a class name
and the value i... | python | devel-common/src/sphinx_exts/providers_extensions.py | 188 | [
"class_path",
"method_names",
"class_registry",
"ignored_classes"
] | bool | true | 8 | 9.2 | apache/airflow | 43,597 | sphinx | false |
count_masked | def count_masked(arr, axis=None):
"""
Count the number of masked elements along the given axis.
Parameters
----------
arr : array_like
An array with (possibly) masked elements.
axis : int, optional
Axis along which to count. If None (default), a flattened
version of the ... | Count the number of masked elements along the given axis.
Parameters
----------
arr : array_like
An array with (possibly) masked elements.
axis : int, optional
Axis along which to count. If None (default), a flattened
version of the array is used.
Returns
-------
count : int, ndarray
The total number ... | python | numpy/ma/extras.py | 66 | [
"arr",
"axis"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
format | @Deprecated
StringBuffer format(Date date, StringBuffer buf); | Formats a {@link Date} object into the
supplied {@link StringBuffer} using a {@link GregorianCalendar}.
@param date the date to format.
@param buf the buffer to format into.
@return the specified string buffer.
@deprecated Use {{@link #format(Date, Appendable)}. | java | src/main/java/org/apache/commons/lang3/time/DatePrinter.java | 106 | [
"date",
"buf"
] | StringBuffer | true | 1 | 6.16 | apache/commons-lang | 2,896 | javadoc | false |
isAppEngineWithApiClasses | @J2ktIncompatible
@GwtIncompatible // TODO
private static boolean isAppEngineWithApiClasses() {
if (System.getProperty("com.google.appengine.runtime.environment") == null) {
return false;
}
try {
Class.forName("com.google.appengine.api.utils.SystemProperty");
} catch (ClassNotFoundExcept... | Returns a default thread factory used to create new threads.
<p>When running on AppEngine with access to <a
href="https://cloud.google.com/appengine/docs/standard/java/javadoc/">AppEngine legacy
APIs</a>, this method returns {@code ThreadManager.currentRequestThreadFactory()}. Otherwise,
it returns {@link Executors#def... | java | android/guava/src/com/google/common/util/concurrent/MoreExecutors.java | 834 | [] | true | 7 | 6.24 | google/guava | 51,352 | javadoc | false | |
toLocalDateTime | public LocalDateTime toLocalDateTime() {
return toLocalDateTime(calendar);
} | Converts this instance to a {@link LocalDateTime}.
@return a LocalDateTime.
@since 3.17.0 | java | src/main/java/org/apache/commons/lang3/time/CalendarUtils.java | 213 | [] | LocalDateTime | true | 1 | 6.32 | apache/commons-lang | 2,896 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.