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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parseNumberFormat | function parseNumberFormat(format: string, minusSign = '-'): ParsedNumberFormat {
const p = {
minInt: 1,
minFrac: 0,
maxFrac: 0,
posPre: '',
posSuf: '',
negPre: '',
negSuf: '',
gSize: 0,
lgSize: 0,
};
const patternParts = format.split(PATTERN_SEP);
const positive = patternPa... | @ngModule CommonModule
@description
Formats a number as text, with group sizing, separator, and other
parameters based on the locale.
@param value The number to format.
@param locale A locale code for the locale format rules to use.
@param digitsInfo Decimal representation options, specified by a string in the followin... | typescript | packages/common/src/i18n/format_number.ts | 289 | [
"format",
"minusSign"
] | true | 14 | 7.44 | angular/angular | 99,544 | jsdoc | false | |
uniqBy | function uniqBy(array, iteratee) {
return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
} | This method is like `_.uniq` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the criterion by which
uniqueness is computed. The order of result values is determined by the
order they occur in the array. The iteratee is invoked with one argument:
(value).
@static
@memberOf _
@s... | javascript | lodash.js | 8,520 | [
"array",
"iteratee"
] | false | 3 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
readLines | public ImmutableList<String> readLines() throws IOException {
Closer closer = Closer.create();
try {
BufferedReader reader = closer.register(openBufferedStream());
List<String> result = new ArrayList<>();
String line;
while ((line = reader.readLine()) != null) {
result.add(line);... | Reads all the lines of this source as a list of strings. The returned list will be empty if
this source is empty.
<p>Like {@link BufferedReader#readLine()}, this method considers a line to be a sequence of
text that is terminated by (but does not include) one of {@code \r\n}, {@code \r} or {@code
\n}. If the source's c... | java | android/guava/src/com/google/common/io/CharSource.java | 337 | [] | true | 3 | 6.88 | google/guava | 51,352 | javadoc | false | |
substituteTypeVariables | private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
final Type replacementType = typeVarAssigns.get(type);
if (replacementType == null) {
throw new... | Finds the mapping for {@code type} in {@code typeVarAssigns}.
@param type the type to be replaced.
@param typeVarAssigns the map with type variables.
@return the replaced type.
@throws IllegalArgumentException if the type cannot be substituted. | java | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 1,488 | [
"type",
"typeVarAssigns"
] | Type | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
unreflectUnchecked | private static MethodHandle unreflectUnchecked(final Method method) {
try {
return unreflect(method);
} catch (final IllegalAccessException e) {
throw new UncheckedIllegalAccessException(e);
}
} | Throws NullPointerException if {@code method} is {@code null}.
@param method The method to test.
@return The given method.
@throws NullPointerException if {@code method} is {@code null}. | java | src/main/java/org/apache/commons/lang3/function/MethodInvokers.java | 244 | [
"method"
] | MethodHandle | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
laplacian_kernel | def laplacian_kernel(X, Y=None, gamma=None):
"""Compute the laplacian kernel between X and Y.
The laplacian kernel is defined as:
.. code-block:: text
K(x, y) = exp(-gamma ||x-y||_1)
for each pair of rows x in X and y in Y.
Read more in the :ref:`User Guide <laplacian_kernel>`.
.. v... | Compute the laplacian kernel between X and Y.
The laplacian kernel is defined as:
.. code-block:: text
K(x, y) = exp(-gamma ||x-y||_1)
for each pair of rows x in X and y in Y.
Read more in the :ref:`User Guide <laplacian_kernel>`.
.. versionadded:: 0.17
Parameters
----------
X : {array-like, sparse matrix} of... | python | sklearn/metrics/pairwise.py | 1,631 | [
"X",
"Y",
"gamma"
] | false | 4 | 7.68 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
toOffsetDateTime | public static OffsetDateTime toOffsetDateTime(final Date date, final TimeZone timeZone) {
return OffsetDateTime.ofInstant(date.toInstant(), toZoneId(timeZone));
} | Converts a {@link Date} to a {@link OffsetDateTime}.
@param date the Date to convert to a OffsetDateTime, not null.
@param timeZone the time zone, null maps to to the default time zone.
@return a new OffsetDateTime.
@since 3.19.0 | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,674 | [
"date",
"timeZone"
] | OffsetDateTime | true | 1 | 6.64 | apache/commons-lang | 2,896 | javadoc | false |
intToHexDigit | public static char intToHexDigit(final int nibble) {
final char c = Character.forDigit(nibble, 16);
if (c == Character.MIN_VALUE) {
throw new IllegalArgumentException("nibble value not between 0 and 15: " + nibble);
}
return c;
} | Converts the 4 LSB of an int to a hexadecimal digit.
<p>
0 returns '0'
</p>
<p>
1 returns '1'
</p>
<p>
10 returns 'A' and so on...
</p>
@param nibble the 4 bits to convert.
@return a hexadecimal digit representing the 4 LSB of {@code nibble}.
@throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}... | java | src/main/java/org/apache/commons/lang3/Conversion.java | 980 | [
"nibble"
] | true | 2 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
exposeTargetClass | static void exposeTargetClass(
ConfigurableListableBeanFactory beanFactory, @Nullable String beanName, Class<?> targetClass) {
if (beanName != null && beanFactory.containsBeanDefinition(beanName)) {
beanFactory.getMergedBeanDefinition(beanName).setAttribute(ORIGINAL_TARGET_CLASS_ATTRIBUTE, targetClass);
}
} | Expose the given target class for the specified bean, if possible.
@param beanFactory the containing ConfigurableListableBeanFactory
@param beanName the name of the bean
@param targetClass the corresponding target class
@since 4.2.3 | java | spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AutoProxyUtils.java | 183 | [
"beanFactory",
"beanName",
"targetClass"
] | void | true | 3 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
toStringOnOff | public static String toStringOnOff(final Boolean bool) {
return toString(bool, ON, OFF, null);
} | Converts a Boolean to a String returning {@code 'on'},
{@code 'off'}, or {@code null}.
<pre>
BooleanUtils.toStringOnOff(Boolean.TRUE) = "on"
BooleanUtils.toStringOnOff(Boolean.FALSE) = "off"
BooleanUtils.toStringOnOff(null) = null;
</pre>
@param bool the Boolean to check
@return {@code 'on'}, {@code 'o... | java | src/main/java/org/apache/commons/lang3/BooleanUtils.java | 1,073 | [
"bool"
] | String | true | 1 | 6.48 | apache/commons-lang | 2,896 | javadoc | false |
issctype | def issctype(rep):
"""
Determines whether the given object represents a scalar data-type.
Parameters
----------
rep : any
If `rep` is an instance of a scalar dtype, True is returned. If not,
False is returned.
Returns
-------
out : bool
Boolean result of check w... | Determines whether the given object represents a scalar data-type.
Parameters
----------
rep : any
If `rep` is an instance of a scalar dtype, True is returned. If not,
False is returned.
Returns
-------
out : bool
Boolean result of check whether `rep` is a scalar dtype.
See Also
--------
issubsctype, iss... | python | numpy/_core/numerictypes.py | 128 | [
"rep"
] | false | 5 | 7.04 | numpy/numpy | 31,054 | numpy | false | |
get_group | def get_group(self, name) -> DataFrame | Series:
"""
Construct DataFrame from group with provided name.
Parameters
----------
name : object
The name of the group to get as a DataFrame.
Returns
-------
Series or DataFrame
Get the r... | Construct DataFrame from group with provided name.
Parameters
----------
name : object
The name of the group to get as a DataFrame.
Returns
-------
Series or DataFrame
Get the respective Series or DataFrame corresponding to the group provided.
See Also
--------
DataFrameGroupBy.groups: Dictionary representat... | python | pandas/core/groupby/groupby.py | 818 | [
"self",
"name"
] | DataFrame | Series | true | 9 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
start | @Override
public void start() throws SchedulingException {
if (this.scheduler != null) {
if (this.jobStore != null) {
this.jobStore.initializeConnectionProvider();
}
try {
startScheduler(this.scheduler, this.startupDelay);
}
catch (SchedulerException ex) {
throw new SchedulingException("Co... | Start the Quartz Scheduler, respecting the "startupDelay" setting.
@param scheduler the Scheduler to start
@param startupDelay the number of seconds to wait before starting
the Scheduler asynchronously | java | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java | 783 | [] | void | true | 4 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
_dispatch_frame_op | def _dispatch_frame_op(
self, right, func: Callable, axis: AxisInt | None = None
) -> DataFrame:
"""
Evaluate the frame operation func(left, right) by evaluating
column-by-column, dispatching to the Series implementation.
Parameters
----------
right : scalar,... | Evaluate the frame operation func(left, right) by evaluating
column-by-column, dispatching to the Series implementation.
Parameters
----------
right : scalar, Series, or DataFrame
func : arithmetic or comparison operator
axis : {None, 0, 1}
Returns
-------
DataFrame
Notes
-----
Caller is responsible for setting np.e... | python | pandas/core/frame.py | 8,687 | [
"self",
"right",
"func",
"axis"
] | DataFrame | true | 7 | 6.32 | pandas-dev/pandas | 47,362 | numpy | false |
equals | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ConstantInitializer<?>)) {
return false;
}
final ConstantInitializer<?> c = (ConstantInitializer<?>) obj;
return Objects.equals(getObjec... | Compares this object with another one. This implementation returns
<strong>true</strong> if and only if the passed in object is an instance of
{@link ConstantInitializer} which refers to an object equals to the
object managed by this instance.
@param obj the object to compare to
@return a flag whether the objects are e... | java | src/main/java/org/apache/commons/lang3/concurrent/ConstantInitializer.java | 69 | [
"obj"
] | true | 3 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
reconstruct_from_patches_2d | def reconstruct_from_patches_2d(patches, image_size):
"""Reconstruct the image from all of its patches.
Patches are assumed to overlap and the image is constructed by filling in
the patches from left to right, top to bottom, averaging the overlapping
regions.
Read more in the :ref:`User Guide <ima... | Reconstruct the image from all of its patches.
Patches are assumed to overlap and the image is constructed by filling in
the patches from left to right, top to bottom, averaging the overlapping
regions.
Read more in the :ref:`User Guide <image_feature_extraction>`.
Parameters
----------
patches : ndarray of shape (n... | python | sklearn/feature_extraction/image.py | 470 | [
"patches",
"image_size"
] | false | 4 | 7.12 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
maxBucketIndex | OptionalLong maxBucketIndex(); | @return the highest populated bucket index, or an empty optional if no buckets are populated | java | libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogram.java | 140 | [] | OptionalLong | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
throwIfPropertyFound | static void throwIfPropertyFound(ConfigDataEnvironmentContributor contributor, ConfigurationPropertyName name) {
ConfigurationPropertySource source = contributor.getConfigurationPropertySource();
ConfigurationProperty property = (source != null) ? source.getConfigurationProperty(name) : null;
if (property != null... | Throw an {@link InactiveConfigDataAccessException} if the given
{@link ConfigDataEnvironmentContributor} contains the property.
@param contributor the contributor to check
@param name the name to check | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/InactiveConfigDataAccessException.java | 122 | [
"contributor",
"name"
] | void | true | 3 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
nextAlphanumeric | public String nextAlphanumeric(final int count) {
return next(count, true, true);
} | Creates a random string whose length is the number of characters specified.
<p>
Characters will be chosen from the set of Latin alphabetic characters (a-z, A-Z) and the digits 0-9.
</p>
@param count the length of random string to create.
@return the random string.
@throws IllegalArgumentException if {@code count} < ... | java | src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 840 | [
"count"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
handleTimeouts | int handleTimeouts(Collection<Call> calls, String msg) {
int numTimedOut = 0;
for (Iterator<Call> iter = calls.iterator(); iter.hasNext(); ) {
Call call = iter.next();
int remainingMs = calcTimeoutMsRemainingAsInt(now, call.deadlineMs);
if (remaini... | Check for calls which have timed out.
Timed out calls will be removed and failed.
The remaining milliseconds until the next timeout will be updated.
@param calls The collection of calls.
@return The number of calls which were timed out. | java | clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java | 1,045 | [
"calls",
"msg"
] | true | 3 | 8.24 | apache/kafka | 31,560 | javadoc | false | |
nextCleanInternal | private int nextCleanInternal() throws JSONException {
while (this.pos < this.in.length()) {
int c = this.in.charAt(this.pos++);
switch (c) {
case '\t', ' ', '\n', '\r':
continue;
case '/':
if (this.pos == this.in.length()) {
return c;
}
char peek = this.in.charAt(this.pos);
... | Returns the next value from the input.
@return a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long,
Double or {@link JSONObject#NULL}.
@throws JSONException if the input is malformed. | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java | 112 | [] | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false | |
get_named_param_nodes | def get_named_param_nodes(graph: fx.Graph) -> dict[str, fx.Node]:
"""Get parameter nodes mapped by their fully qualified names.
This function traverses the graph to find all parameter input nodes and
returns them in a dictionary where keys are the parameter names (FQNs)
and values are the corresponding... | Get parameter nodes mapped by their fully qualified names.
This function traverses the graph to find all parameter input nodes and
returns them in a dictionary where keys are the parameter names (FQNs)
and values are the corresponding FX nodes.
Args:
graph: The FX joint graph with descriptors
Returns:
A dict... | python | torch/_functorch/_aot_autograd/fx_utils.py | 223 | [
"graph"
] | dict[str, fx.Node] | true | 5 | 7.92 | pytorch/pytorch | 96,034 | google | false |
size | def size(self) -> DataFrame | Series:
"""
Compute group sizes.
Returns
-------
DataFrame or Series
Number of rows in each group as a Series if as_index is True
or a DataFrame if as_index is False.
%(see_also)s
Examples
--------
... | Compute group sizes.
Returns
-------
DataFrame or Series
Number of rows in each group as a Series if as_index is True
or a DataFrame if as_index is False.
%(see_also)s
Examples
--------
For SeriesGroupBy:
>>> lst = ["a", "a", "b"]
>>> ser = pd.Series([1, 2, 3], index=lst)
>>> ser
a 1
a 2
b 3
dtyp... | python | pandas/core/groupby/groupby.py | 2,861 | [
"self"
] | DataFrame | Series | true | 12 | 8.4 | pandas-dev/pandas | 47,362 | unknown | false |
correctedDoForward | @Nullable B correctedDoForward(@Nullable A a) {
if (handleNullAutomatically) {
// TODO(kevinb): we shouldn't be checking for a null result at runtime. Assert?
return a == null ? null : checkNotNull(doForward(a));
} else {
return unsafeDoForward(a);
}
} | Returns a representation of {@code a} as an instance of type {@code B}.
@return the converted value; is null <i>if and only if</i> {@code a} is null | java | android/guava/src/com/google/common/base/Converter.java | 200 | [
"a"
] | B | true | 3 | 7.2 | google/guava | 51,352 | javadoc | false |
toString | @Override
public String toString() {
final String msgStr = Objects.toString(message, StringUtils.EMPTY);
final String formattedTime = formatTime();
return msgStr.isEmpty() ? formattedTime : msgStr + StringUtils.SPACE + formattedTime;
} | Gets a summary of the time that this StopWatch recorded as a string.
<p>
The format used is ISO 8601-like, [<em>message</em> ]<em>hours</em>:<em>minutes</em>:<em>seconds</em>.<em>milliseconds</em>.
</p>
@return the time as a String.
@since 3.10 Returns the prefix {@code "message "} if the message is set. | java | src/main/java/org/apache/commons/lang3/time/StopWatch.java | 815 | [] | String | true | 2 | 7.76 | apache/commons-lang | 2,896 | javadoc | false |
getTotalTransformationCost | private static float getTotalTransformationCost(final Class<?>[] srcArgs, final Executable executable) {
final Class<?>[] destArgs = executable.getParameterTypes();
final boolean isVarArgs = executable.isVarArgs();
// "source" and "destination" are the actual and declared args respectively.
... | Gets the sum of the object transformation cost for each class in the source argument list.
@param srcArgs The source arguments.
@param executable The executable to calculate transformation costs for.
@return The total transformation cost. | java | src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java | 199 | [
"srcArgs",
"executable"
] | true | 10 | 8.08 | apache/commons-lang | 2,896 | javadoc | false | |
isSorted | public static <T> boolean isSorted(final T[] array, final Comparator<T> comparator) {
Objects.requireNonNull(comparator, "comparator");
if (getLength(array) < 2) {
return true;
}
T previous = array[0];
final int n = array.length;
for (int i = 1; i < n; i++) {
... | Tests whether the provided array is sorted according to the provided {@link Comparator}.
@param array the array to check.
@param comparator the {@link Comparator} to compare over.
@param <T> the datatype of the array.
@return whether the array is sorted.
@throws NullPointerException if {@code comparator} is {@code null... | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 3,745 | [
"array",
"comparator"
] | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false | |
hex2dToGeo | static LatLng hex2dToGeo(double x, double y, int face, int res, boolean substrate) {
// calculate (r, theta) in hex2d
double r = Math.sqrt(x * x + y * y);
if (r < Constants.EPSILON) {
return faceCenterGeo[face];
}
double theta = FastMath.atan2(y, x);
// sca... | Determines the center point in spherical coordinates of a cell given by the provided 2D
hex coordinates on a particular icosahedral face.
@param x The x component of the 2D hex coordinates.
@param y The y component of the 2D hex coordinates.
@param face The icosahedral face upon which the 2D hex co... | java | libs/h3/src/main/java/org/elasticsearch/h3/Vec2d.java | 122 | [
"x",
"y",
"face",
"res",
"substrate"
] | LatLng | true | 7 | 6.88 | elastic/elasticsearch | 75,680 | javadoc | false |
get | def get(self, i):
"""
Extract element from each component at specified position or with specified key.
Extract element from lists, tuples, dict, or strings in each element in the
Series/Index.
Parameters
----------
i : int or hashable dict label
Posi... | Extract element from each component at specified position or with specified key.
Extract element from lists, tuples, dict, or strings in each element in the
Series/Index.
Parameters
----------
i : int or hashable dict label
Position or key of element to extract.
Returns
-------
Series or Index
Series or Inde... | python | pandas/core/strings/accessor.py | 1,073 | [
"self",
"i"
] | false | 1 | 6.4 | pandas-dev/pandas | 47,362 | numpy | false | |
template_filter | def template_filter(
self, name: T_template_filter | str | None = None
) -> T_template_filter | t.Callable[[T_template_filter], T_template_filter]:
"""Decorate a function to register it as a custom Jinja filter. The name
is optional. The decorator may be used without parentheses.
..... | Decorate a function to register it as a custom Jinja filter. The name
is optional. The decorator may be used without parentheses.
.. code-block:: python
@app.template_filter("reverse")
def reverse_filter(s):
return reversed(s)
The :meth:`add_template_filter` method may be used to register a
function ... | python | src/flask/sansio/app.py | 667 | [
"self",
"name"
] | T_template_filter | t.Callable[[T_template_filter], T_template_filter] | true | 2 | 6.4 | pallets/flask | 70,946 | sphinx | false |
equals | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return Objects.equals(this.cause, ((Error) obj).cause);
} | Return the original cause of the error.
@return the error cause | java | core/spring-boot/src/main/java/org/springframework/boot/web/error/Error.java | 77 | [
"obj"
] | true | 4 | 7.04 | spring-projects/spring-boot | 79,428 | javadoc | false | |
delete | def delete(self, loc) -> list[Block]:
"""Deletes the locs from the block.
We split the block to avoid copying the underlying data. We create new
blocks for every connected segment of the initial block that is not deleted.
The new blocks point to the initial array.
"""
if... | Deletes the locs from the block.
We split the block to avoid copying the underlying data. We create new
blocks for every connected segment of the initial block that is not deleted.
The new blocks point to the initial array. | python | pandas/core/internals/blocks.py | 1,541 | [
"self",
"loc"
] | list[Block] | true | 8 | 6 | pandas-dev/pandas | 47,362 | unknown | false |
lreshape | def lreshape(data: DataFrame, groups: dict, dropna: bool = True) -> DataFrame:
"""
Reshape wide-format data to long. Generalized inverse of DataFrame.pivot.
Accepts a dictionary, ``groups``, in which each key is a new column name
and each value is a list of old column names that will be "melted" under
... | Reshape wide-format data to long. Generalized inverse of DataFrame.pivot.
Accepts a dictionary, ``groups``, in which each key is a new column name
and each value is a list of old column names that will be "melted" under
the new column name as part of the reshape.
Parameters
----------
data : DataFrame
The wide-fo... | python | pandas/core/reshape/melt.py | 282 | [
"data",
"groups",
"dropna"
] | DataFrame | true | 7 | 8.4 | pandas-dev/pandas | 47,362 | numpy | false |
newInstance | public static @Nullable ColorConverter newInstance(@Nullable Configuration config, @Nullable String[] options) {
if (options.length < 1) {
LOGGER.error("Incorrect number of options on style. Expected at least 1, received {}", options.length);
return null;
}
if (options[0] == null) {
LOGGER.error("No patt... | Creates a new instance of the class. Required by Log4J2.
@param config the configuration
@param options the options
@return a new instance, or {@code null} if the options are invalid | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java | 123 | [
"config",
"options"
] | ColorConverter | true | 4 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
isParsable | public static boolean isParsable(final String str) {
if (StringUtils.isEmpty(str)) {
return false;
}
if (str.charAt(0) == '-') {
if (str.length() == 1) {
return false;
}
return isParsableDecimal(str, 1);
}
return isP... | Checks whether the given String is a parsable number.
<p>
Parsable numbers include those Strings understood by {@link Integer#parseInt(String)}, {@link Long#parseLong(String)}, {@link Float#parseFloat(String)}
or {@link Double#parseDouble(String)}. This method can be used instead of catching {@link java.text.ParseExcep... | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 726 | [
"str"
] | true | 4 | 7.76 | apache/commons-lang | 2,896 | javadoc | false | |
simplifyDurationFactoryArg | std::string simplifyDurationFactoryArg(const MatchFinder::MatchResult &Result,
const Expr &Node) {
// Check for an explicit cast to `float` or `double`.
if (std::optional<std::string> MaybeArg = stripFloatCast(Result, Node))
return *MaybeArg;
// Check for floats without... | Returns `true` if `Node` is a value which evaluates to a literal `0`. | cpp | clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp | 169 | [] | true | 3 | 7.2 | llvm/llvm-project | 36,021 | doxygen | false | |
get_error_info | def get_error_info(self, aws_account_id: str | None, data_set_id: str, ingestion_id: str) -> dict | None:
"""
Get info about the error if any.
:param aws_account_id: An AWS Account ID, if set to ``None`` then use associated AWS Account ID.
:param data_set_id: QuickSight Data Set ID
... | Get info about the error if any.
:param aws_account_id: An AWS Account ID, if set to ``None`` then use associated AWS Account ID.
:param data_set_id: QuickSight Data Set ID
:param ingestion_id: QuickSight Ingestion ID
:return: Error info dict containing the error type (key 'Type') and message (key 'Message')
if av... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/quicksight.py | 118 | [
"self",
"aws_account_id",
"data_set_id",
"ingestion_id"
] | dict | None | true | 2 | 8.08 | apache/airflow | 43,597 | sphinx | false |
describe_nodegroup | def describe_nodegroup(self, clusterName: str, nodegroupName: str, verbose: bool = False) -> dict:
"""
Return descriptive information about an Amazon EKS managed node group.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.describe_nodegroup`
:param clusterName: The name ... | Return descriptive information about an Amazon EKS managed node group.
.. seealso::
- :external+boto3:py:meth:`EKS.Client.describe_nodegroup`
:param clusterName: The name of the Amazon EKS Cluster associated with the nodegroup.
:param nodegroupName: The name of the nodegroup to describe.
:param verbose: Provides ... | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py | 334 | [
"self",
"clusterName",
"nodegroupName",
"verbose"
] | dict | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false |
moveProfileSpecific | private void moveProfileSpecific(Map<ImportPhase, List<ConfigDataEnvironmentContributor>> children) {
List<ConfigDataEnvironmentContributor> before = children.get(ImportPhase.BEFORE_PROFILE_ACTIVATION);
if (!hasAnyProfileSpecificChildren(before)) {
return;
}
List<ConfigDataEnvironmentContributor> updatedBefo... | Create a new {@link ConfigDataEnvironmentContributor} instance with a new set of
children for the given phase.
@param importPhase the import phase
@param children the new children
@return a new contributor instance | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java | 283 | [
"children"
] | void | true | 2 | 7.76 | spring-projects/spring-boot | 79,428 | javadoc | false |
estimator_html_repr | def estimator_html_repr(estimator):
"""Build a HTML representation of an estimator.
Read more in the :ref:`User Guide <visualizing_composite_estimators>`.
Parameters
----------
estimator : estimator object
The estimator to visualize.
Returns
-------
html: str
HTML repr... | Build a HTML representation of an estimator.
Read more in the :ref:`User Guide <visualizing_composite_estimators>`.
Parameters
----------
estimator : estimator object
The estimator to visualize.
Returns
-------
html: str
HTML representation of estimator.
Examples
--------
>>> from sklearn.utils._repr_html.e... | python | sklearn/utils/_repr_html/estimator.py | 407 | [
"estimator"
] | false | 3 | 6.96 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
doStart | private void doStart(Map<String, ? extends Lifecycle> lifecycleBeans, String beanName,
boolean autoStartupOnly, @Nullable List<CompletableFuture<?>> futures) {
Lifecycle bean = lifecycleBeans.remove(beanName);
if (bean != null && bean != this) {
String[] dependenciesForBean = getBeanFactory().getDependencies... | Start the specified bean as part of the given set of Lifecycle beans,
making sure that any beans that it depends on are started first.
@param lifecycleBeans a Map with bean name as key and Lifecycle instance as value
@param beanName the name of the bean to start | java | spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java | 395 | [
"lifecycleBeans",
"beanName",
"autoStartupOnly",
"futures"
] | void | true | 7 | 6.72 | spring-projects/spring-framework | 59,386 | javadoc | false |
reverse | public static void reverse(final float[] array) {
if (array != null) {
reverse(array, 0, array.length);
}
} | Reverses the order of the given array.
<p>
This method does nothing for a {@code null} input array.
</p>
@param array the array to reverse, may be {@code null}. | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 6,514 | [
"array"
] | void | true | 2 | 7.04 | apache/commons-lang | 2,896 | javadoc | false |
end | def end(self, heartbeat_interval=10):
"""
End execution. Poll until all outstanding tasks are marked as completed.
This is a blocking call and async Lambda tasks can not be cancelled, so this will wait until
all tasks are either completed or the timeout is reached.
:param heart... | End execution. Poll until all outstanding tasks are marked as completed.
This is a blocking call and async Lambda tasks can not be cancelled, so this will wait until
all tasks are either completed or the timeout is reached.
:param heartbeat_interval: The interval in seconds to wait between checks for task completion. | python | providers/amazon/src/airflow/providers/amazon/aws/executors/aws_lambda/lambda_executor.py | 492 | [
"self",
"heartbeat_interval"
] | false | 5 | 6.24 | apache/airflow | 43,597 | sphinx | false | |
currentNode | function currentNode(parsingContext: ParsingContext, pos?: number): Node | undefined {
// If we don't have a cursor or the parsing context isn't reusable, there's nothing to reuse.
//
// If there is an outstanding parse error that we've encountered, but not attached to
// some node, ... | 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,125 | [
"parsingContext",
"pos?"
] | true | 11 | 6.88 | microsoft/TypeScript | 107,154 | jsdoc | false | |
getRunListeners | private SpringApplicationRunListeners getRunListeners(String[] args) {
ArgumentResolver argumentResolver = ArgumentResolver.of(SpringApplication.class, this);
argumentResolver = argumentResolver.and(String[].class, args);
List<SpringApplicationRunListener> listeners = getSpringFactoriesInstances(SpringApplication... | Run the Spring application, creating and refreshing a new
{@link ApplicationContext}.
@param args the application arguments (usually passed from a Java main method)
@return a running {@link ApplicationContext} | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 453 | [
"args"
] | SpringApplicationRunListeners | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
detectAndParse | public static Period detectAndParse(String value, @Nullable ChronoUnit unit) {
return detect(value).parse(value, unit);
} | Detect the style then parse the value to return a period.
@param value the value to parse
@param unit the period unit to use if the value doesn't specify one ({@code null}
will default to ms)
@return the parsed period
@throws IllegalArgumentException if the value is not a known style or cannot be
parsed | java | core/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java | 198 | [
"value",
"unit"
] | Period | true | 1 | 6.48 | spring-projects/spring-boot | 79,428 | javadoc | false |
getNextRequestId | function getNextRequestId() {
if (requestId === NumberMAX_SAFE_INTEGER) {
requestId = 0;
}
return `node-network-event-${++requestId}`;
} | Return a monotonically increasing time in seconds since an arbitrary point in the past.
@returns {number} | javascript | lib/internal/inspector/network.js | 47 | [] | false | 2 | 7.12 | nodejs/node | 114,839 | jsdoc | false | |
bindJSDocTypeAlias | function bindJSDocTypeAlias(node: JSDocTypedefTag | JSDocCallbackTag | JSDocEnumTag) {
bind(node.tagName);
if (node.kind !== SyntaxKind.JSDocEnumTag && node.fullName) {
// don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag
setParent(node.fullName, n... | Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
@param symbolTable - The symbol table which node will be added to.
@param parent - node's parent declaration.
@param node - The declaration to be added to the symbol table
@param includes - The SymbolFlags that n... | typescript | src/compiler/binder.ts | 2,113 | [
"node"
] | false | 4 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
unmute | private void unmute(KafkaChannel channel) {
// Remove the channel from explicitlyMutedChannels only if the channel has been actually unmuted.
if (channel.maybeUnmute()) {
explicitlyMutedChannels.remove(channel);
if (channel.hasBytesBuffered()) {
keysWithBufferedRe... | handle any ready I/O on a set of selection keys
@param selectionKeys set of keys to handle
@param isImmediatelyConnected true if running over a set of keys for just-connected sockets
@param currentTimeNanos time at which set of keys was determined | java | clients/src/main/java/org/apache/kafka/common/network/Selector.java | 760 | [
"channel"
] | void | true | 3 | 6.08 | apache/kafka | 31,560 | javadoc | false |
write | <N, V> void write(@Nullable N name, @Nullable V value) {
if (name != null) {
writePair(name, value);
}
else {
write(value);
}
} | Write a name value pair, or just a value if {@code name} is {@code null}.
@param <N> the name type in the pair
@param <V> the value type in the pair
@param name the name of the pair or {@code null} if only the value should be
written
@param value the value | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java | 99 | [
"name",
"value"
] | void | true | 2 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
dotAll | public static Pattern dotAll(final String regex) {
return Pattern.compile(regex, Pattern.DOTALL);
} | Compiles the given regular expression into a pattern with the {@link Pattern#DOTALL} flag.
@param regex The expression to be compiled.
@return the given regular expression compiled into a pattern with the {@link Pattern#DOTALL} flag.
@since 3.13.0 | java | src/main/java/org/apache/commons/lang3/RegExUtils.java | 43 | [
"regex"
] | Pattern | true | 1 | 6.96 | apache/commons-lang | 2,896 | javadoc | false |
min | public static long min(long a, final long b, final long c) {
if (b < a) {
a = b;
}
if (c < a) {
a = c;
}
return a;
} | Gets the minimum of three {@code long} values.
@param a value 1.
@param b value 2.
@param c value 3.
@return the smallest of the values. | java | src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 1,291 | [
"a",
"b",
"c"
] | true | 3 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
isMaskedArray | def isMaskedArray(x):
"""
Test whether input is an instance of MaskedArray.
This function returns True if `x` is an instance of MaskedArray
and returns False otherwise. Any object is accepted as input.
Parameters
----------
x : object
Object to test.
Returns
-------
r... | Test whether input is an instance of MaskedArray.
This function returns True if `x` is an instance of MaskedArray
and returns False otherwise. Any object is accepted as input.
Parameters
----------
x : object
Object to test.
Returns
-------
result : bool
True if `x` is a MaskedArray.
See Also
--------
isMA... | python | numpy/ma/core.py | 6,669 | [
"x"
] | false | 1 | 6.48 | numpy/numpy | 31,054 | numpy | false | |
whenInstanceOf | default ValueProcessor<T> whenInstanceOf(Class<?> type) {
Predicate<@Nullable T> isInstance = type::isInstance;
return when(isInstance);
} | Return a new processor from this one that only applies to member with values of
the given type.
@param type the type that must match
@return a new {@link ValueProcessor} that only applies when value is the given
type. | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 1,022 | [
"type"
] | true | 1 | 6.64 | spring-projects/spring-boot | 79,428 | javadoc | false | |
slice | FileDataBlock slice(long offset, long size) {
if (offset == 0 && size == this.size) {
return this;
}
if (offset < 0) {
throw new IllegalArgumentException("Offset must not be negative");
}
if (size < 0 || offset + size > this.size) {
throw new IllegalArgumentException("Size must not be negative and mu... | Return a new {@link FileDataBlock} slice providing access to a subset of the data.
The caller is responsible for calling {@link #open()} and {@link #close()} on the
returned block.
@param offset the start offset for the slice relative to this block
@param size the size of the new slice
@return a new {@link FileDataBloc... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/FileDataBlock.java | 140 | [
"offset",
"size"
] | FileDataBlock | true | 6 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
hasReadyNodes | public boolean hasReadyNodes(long now) {
lock.lock();
try {
return client.hasReadyNodes(now);
} finally {
lock.unlock();
}
} | Send a new request. Note that the request is not actually transmitted on the
network until one of the {@link #poll(Timer)} variants is invoked. At this
point the request will either be transmitted successfully or will fail.
Use the returned future to obtain the result of the send. Note that there is no
need to check fo... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java | 149 | [
"now"
] | true | 1 | 6.72 | apache/kafka | 31,560 | javadoc | false | |
load | @SuppressWarnings("resource")
private static SecurityInfo load(ZipContent content) throws IOException {
int size = content.size();
boolean hasSecurityInfo = false;
Certificate[][] entryCertificates = new Certificate[size][];
CodeSigner[][] entryCodeSigners = new CodeSigner[size][];
try (JarEntriesStream entr... | Load security info from the jar file. We need to use {@link JarInputStream} to
obtain the security info since we don't have an actual real file to read. This
isn't that fast, but hopefully doesn't happen too often and the result is cached.
@param content the zip content
@return the security info
@throws IOException on ... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/SecurityInfo.java | 84 | [
"content"
] | SecurityInfo | true | 7 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
get | @SuppressWarnings("unchecked")
@Override
public T get(RegisteredBean registeredBean) {
Assert.notNull(registeredBean, "'registeredBean' must not be null");
if (this.generatorWithoutArguments != null) {
Executable executable = getFactoryMethodForGenerator();
return invokeBeanSupplier(executable, () -> this.g... | Return a new {@link BeanInstanceSupplier} instance that uses
direct bean name injection shortcuts for specific parameters.
@param beanNames the bean names to use as shortcut (aligned with the
constructor or factory method parameters)
@return a new {@link BeanInstanceSupplier} instance that uses the
given shortcut bean ... | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java | 188 | [
"registeredBean"
] | T | true | 4 | 7.28 | spring-projects/spring-framework | 59,386 | javadoc | false |
rolloverDataStream | private void rolloverDataStream(
ProjectId projectId,
String writeIndexName,
RolloverRequest rolloverRequest,
ActionListener<Void> listener
) {
// "saving" the rollover target name here so we don't capture the entire request
ResolvedExpression resolvedRolloverTarget =... | This method sends requests to delete any indices in the datastream that exceed its retention policy. It returns the set of indices
it has sent delete requests for.
@param project The project metadata from which to get index metadata
@param dataStream The data stream
@param i... | java | modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleService.java | 1,081 | [
"projectId",
"writeIndexName",
"rolloverRequest",
"listener"
] | void | true | 5 | 7.84 | elastic/elasticsearch | 75,680 | javadoc | false |
constrainToRange | public static char constrainToRange(char value, char min, char max) {
checkArgument(min <= max, "min (%s) must be less than or equal to max (%s)", min, max);
return value < min ? min : value < max ? value : max;
} | Returns the value nearest to {@code value} which is within the closed range {@code [min..max]}.
<p>If {@code value} is within the range {@code [min..max]}, {@code value} is returned
unchanged. If {@code value} is less than {@code min}, {@code min} is returned, and if {@code
value} is greater than {@code max}, {@code ma... | java | android/guava/src/com/google/common/primitives/Chars.java | 266 | [
"value",
"min",
"max"
] | true | 3 | 6.8 | google/guava | 51,352 | javadoc | false | |
wait_for_job | def wait_for_job(
self,
job_id: str,
delay: int | float | None = None,
get_batch_log_fetcher: Callable[[str], AwsTaskLogFetcher | None] | None = None,
) -> None:
"""
Wait for Batch job to complete.
:param job_id: a Batch job ID
:param delay: a delay ... | Wait for Batch job to complete.
:param job_id: a Batch job ID
:param delay: a delay before polling for job status
:param get_batch_log_fetcher : a method that returns batch_log_fetcher
:raises: AirflowException | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/batch_client.py | 281 | [
"self",
"job_id",
"delay",
"get_batch_log_fetcher"
] | None | true | 4 | 6.72 | apache/airflow | 43,597 | sphinx | false |
vecdot | def vecdot(x1, x2, /, *, axis=-1):
"""
Computes the vector dot product.
This function is restricted to arguments compatible with the Array API,
contrary to :func:`numpy.vecdot`.
Let :math:`\\mathbf{a}` be a vector in ``x1`` and :math:`\\mathbf{b}` be
a corresponding vector in ``x2``. The dot p... | Computes the vector dot product.
This function is restricted to arguments compatible with the Array API,
contrary to :func:`numpy.vecdot`.
Let :math:`\\mathbf{a}` be a vector in ``x1`` and :math:`\\mathbf{b}` be
a corresponding vector in ``x2``. The dot product is defined as:
.. math::
\\mathbf{a} \\cdot \\mathbf... | python | numpy/linalg/_linalg.py | 3,605 | [
"x1",
"x2",
"axis"
] | false | 1 | 6.32 | numpy/numpy | 31,054 | numpy | false | |
evaluate | protected @Nullable Object evaluate(@Nullable Object value) {
if (value instanceof String str) {
return doEvaluate(str);
}
else if (value instanceof String[] values) {
boolean actuallyResolved = false;
@Nullable Object[] resolvedValues = new Object[values.length];
for (int i = 0; i < values.length; i+... | Evaluate the given value as an expression, if necessary.
@param value the original value (may be an expression)
@return the resolved value if necessary, or the original value | java | spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java | 284 | [
"value"
] | Object | true | 6 | 7.92 | spring-projects/spring-framework | 59,386 | javadoc | false |
textLength | @Override
public int textLength() throws IOException {
try {
return parser.getTextLength();
} catch (IOException e) {
throw handleParserException(e);
}
} | Handle parser exception depending on type.
This converts known exceptions to XContentParseException and rethrows them. | java | libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentParser.java | 227 | [] | true | 2 | 6.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
castArrayLikeObject | function castArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
} | Casts `value` to an empty array if it's not an array like object.
@private
@param {*} value The value to inspect.
@returns {Array|Object} Returns the cast array-like object. | javascript | lodash.js | 4,533 | [
"value"
] | false | 2 | 6.16 | lodash/lodash | 61,490 | jsdoc | false | |
listClientMetricsResources | @Deprecated(since = "4.1", forRemoval = true)
ListClientMetricsResourcesResult listClientMetricsResources(ListClientMetricsResourcesOptions options); | List the client metrics configuration resources available in the cluster.
@param options The options to use when listing the client metrics resources.
@return The ListClientMetricsResourcesResult.
@deprecated Since 4.1. Use {@link #listConfigResources(Set, ListConfigResourcesOptions)} instead. | java | clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 1,808 | [
"options"
] | ListClientMetricsResourcesResult | true | 1 | 6 | apache/kafka | 31,560 | javadoc | false |
indexOf | static int indexOf(final CharSequence cs, final int searchChar, int start) {
if (cs instanceof String) {
return ((String) cs).indexOf(searchChar, start);
}
final int sz = cs.length();
if (start < 0) {
start = 0;
}
if (searchChar < Character.MIN_SUP... | Returns the index within {@code cs} of the first occurrence of the specified character, starting the search at the specified index.
<p>
If a character with value {@code searchChar} occurs in the character sequence represented by the {@code cs} object at an index no smaller than
{@code start}, then the index of the firs... | java | src/main/java/org/apache/commons/lang3/CharSequenceUtils.java | 110 | [
"cs",
"searchChar",
"start"
] | true | 10 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
sort | public static float[] sort(final float[] array) {
if (array != null) {
Arrays.sort(array);
}
return array;
} | Sorts the given array into ascending order and returns it.
@param array the array to sort (may be null).
@return the given array.
@see Arrays#sort(float[]) | java | src/main/java/org/apache/commons/lang3/ArraySorter.java | 79 | [
"array"
] | true | 2 | 8.24 | apache/commons-lang | 2,896 | javadoc | false | |
of | public static <L, R> ImmutablePair<L, R> of(final Map.Entry<L, R> pair) {
return pair != null ? new ImmutablePair<>(pair.getKey(), pair.getValue()) : nullPair();
} | Creates an immutable pair from a map entry.
@param <L> the left element type.
@param <R> the right element type.
@param pair the existing map entry.
@return an immutable formed from the map entry.
@since 3.10 | java | src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java | 118 | [
"pair"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
version_prefix | def version_prefix(self: Self) -> bytes:
"""
Get the version prefix for the cache.
Returns:
bytes: The version prefix as bytes, derived from the cache version string.
"""
return sha256(str(OnDiskCache.version).encode()).digest()[:4] | Get the version prefix for the cache.
Returns:
bytes: The version prefix as bytes, derived from the cache version string. | python | torch/_inductor/cache.py | 314 | [
"self"
] | bytes | true | 1 | 6.56 | pytorch/pytorch | 96,034 | unknown | false |
toUtf16Escape | protected String toUtf16Escape(final int codePoint) {
return "\\u" + hex(codePoint);
} | Converts the given code point to a hexadecimal string of the form {@code "\\uXXXX"}
@param codePoint
a Unicode code point.
@return the hexadecimal string for the given code point.
@since 3.2 | java | src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java | 110 | [
"codePoint"
] | String | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
append_fields | def append_fields(base, names, data, dtypes=None,
fill_value=-1, usemask=True, asrecarray=False):
"""
Add new fields to an existing array.
The names of the fields are given with the `names` arguments,
the corresponding values with the `data` arguments.
If a single field is appende... | Add new fields to an existing array.
The names of the fields are given with the `names` arguments,
the corresponding values with the `data` arguments.
If a single field is appended, `names`, `data` and `dtypes` do not have
to be lists but just values.
Parameters
----------
base : array
Input array to extend.
name... | python | numpy/lib/recfunctions.py | 655 | [
"base",
"names",
"data",
"dtypes",
"fill_value",
"usemask",
"asrecarray"
] | false | 12 | 6.16 | numpy/numpy | 31,054 | numpy | false | |
bulk_write_to_db | def bulk_write_to_db(
cls,
bundle_name: str,
bundle_version: str | None,
dags: Collection[DAG | LazyDeserializedDAG],
parse_duration: float | None = None,
session: Session = NEW_SESSION,
) -> None:
"""
Ensure the DagModel rows for the given dags are up... | Ensure the DagModel rows for the given dags are up-to-date in the dag table in the DB.
:param dags: the DAG objects to save to the DB
:return: None | python | airflow-core/src/airflow/serialization/serialized_objects.py | 2,767 | [
"cls",
"bundle_name",
"bundle_version",
"dags",
"parse_duration",
"session"
] | None | true | 2 | 7.76 | apache/airflow | 43,597 | sphinx | false |
getPropertySourceProperty | protected final @Nullable Object getPropertySourceProperty(String name) {
// Save calls to SystemEnvironmentPropertySource.resolvePropertyName(...)
// since we've already done the mapping
PropertySource<?> propertySource = getPropertySource();
return (!this.systemEnvironmentSource) ? propertySource.getProperty(... | Create a new {@link SpringConfigurationPropertySource} implementation.
@param propertySource the source property source
@param systemEnvironmentSource if the source is from the system environment
@param mappers the property mappers | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java | 106 | [
"name"
] | Object | true | 2 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
clearTask | public void clearTask() {
pendingTask.getAndUpdate(task -> {
if (task == null) {
return null;
} else if (task instanceof ActiveFuture || task instanceof FetchAction || task instanceof ShareFetchAction) {
return null;
}
return task;
... | If there is no pending task, set the pending task active.
If wakeup was called before setting an active task, the current task will complete exceptionally with
WakeupException right away.
If there is an active task, throw exception.
@param currentTask
@param <T>
@return | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/WakeupTrigger.java | 134 | [] | void | true | 5 | 8.08 | apache/kafka | 31,560 | javadoc | false |
download_patch | def download_patch(pr_number: int, repo_url: str, download_dir: str) -> str:
"""
Downloads the patch file for a given PR from the specified GitHub repository.
Args:
pr_number (int): The pull request number.
repo_url (str): The URL of the repository where the PR is hosted.
download_d... | Downloads the patch file for a given PR from the specified GitHub repository.
Args:
pr_number (int): The pull request number.
repo_url (str): The URL of the repository where the PR is hosted.
download_dir (str): The directory to store the downloaded patch.
Returns:
str: The path to the downloaded patc... | python | tools/nightly_hotpatch.py | 98 | [
"pr_number",
"repo_url",
"download_dir"
] | str | true | 2 | 8.24 | pytorch/pytorch | 96,034 | google | false |
getApplicationLog | protected Log getApplicationLog() {
if (this.mainApplicationClass == null) {
return logger;
}
return LogFactory.getLog(this.mainApplicationClass);
} | Returns the {@link Log} for the application. By default will be deduced.
@return the application log | java | core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | 671 | [] | Log | true | 2 | 8.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
resolveId | protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext)
throws BeanDefinitionStoreException {
if (shouldGenerateId()) {
return parserContext.getReaderContext().generateBeanName(definition);
}
else {
String id = element.getAttribute(ID_ATTRIBUTE);
if... | Resolve the ID for the supplied {@link BeanDefinition}.
<p>When using {@link #shouldGenerateId generation}, a name is generated automatically.
Otherwise, the ID is extracted from the "id" attribute, potentially with a
{@link #shouldGenerateIdAsFallback() fallback} to a generated id.
@param element the element that the ... | java | spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java | 109 | [
"element",
"definition",
"parserContext"
] | String | true | 4 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
executeUserEntryPoint | function executeUserEntryPoint(main = process.argv[1]) {
let useESMLoader;
let resolvedMain;
if (getOptionValue('--entry-url')) {
useESMLoader = true;
} else {
resolvedMain = resolveMainPath(main);
useESMLoader = shouldUseESMLoader(resolvedMain);
}
// Unless we know we should use the ESM loader ... | Parse the CLI main entry point string and run it.
For backwards compatibility, we have to run a bunch of monkey-patchable code that belongs to the CJS loader (exposed
by `require('module')`) even when the entry point is ESM.
Because of backwards compatibility, this function is exposed publicly via `import { runMain } f... | javascript | lib/internal/modules/run_main.js | 140 | [] | false | 7 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
get_versions_from_toml | def get_versions_from_toml() -> dict[str, str]:
"""Min versions in pyproject.toml for pip install pandas[extra]."""
install_map = _optional.INSTALL_MAPPING
optional_dependencies = {}
with open(SETUP_PATH, "rb") as pyproject_f:
pyproject_toml = tomllib.load(pyproject_f)
opt_deps = pyproje... | Min versions in pyproject.toml for pip install pandas[extra]. | python | scripts/validate_min_versions_in_sync.py | 230 | [] | dict[str, str] | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | unknown | false |
setSubject | public void setSubject(String subject) throws MessagingException {
Assert.notNull(subject, "Subject must not be null");
if (getEncoding() != null) {
this.mimeMessage.setSubject(subject, getEncoding());
}
else {
this.mimeMessage.setSubject(subject);
}
} | Set the subject of the message, using the correct encoding.
@param subject the subject text
@throws MessagingException in case of errors | java | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | 771 | [
"subject"
] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
evaluate | private @Nullable Object evaluate(@Nullable Object cacheHit, CacheOperationInvoker invoker, Method method,
CacheOperationContexts contexts) {
// Re-invocation in reactive pipeline after late cache hit determination?
if (contexts.processed) {
return cacheHit;
}
Object cacheValue;
Object returnValue;
... | Find a cached value only for {@link CacheableOperation} that passes the condition.
@param contexts the cacheable operations
@return a {@link Cache.ValueWrapper} holding the cached value,
or {@code null} if none is found | java | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | 571 | [
"cacheHit",
"invoker",
"method",
"contexts"
] | Object | true | 7 | 8.08 | spring-projects/spring-framework | 59,386 | javadoc | false |
appendFixedWidthPadRight | public StrBuilder appendFixedWidthPadRight(final Object obj, final int width, final char padChar) {
if (width > 0) {
ensureCapacity(size + width);
String str = ObjectUtils.toString(obj, this::getNullText);
if (str == null) {
str = StringUtils.EMPTY;
... | Appends an object to the builder padding on the right to a fixed length.
The {@code toString} of the object is used.
If the object is larger than the length, the right-hand side side is lost.
If the object is null, null text value is used.
@param obj the object to append, null uses null text
@param width the fixed fi... | java | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 907 | [
"obj",
"width",
"padChar"
] | StrBuilder | true | 4 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
uniqWith | function uniqWith(array, comparator) {
comparator = typeof comparator == 'function' ? comparator : undefined;
return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
} | This method is like `_.uniq` except that it accepts `comparator` which
is invoked to compare elements of `array`. The order of result values is
determined by the order they occur in the array.The comparator is invoked
with two arguments: (arrVal, othVal).
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} ... | javascript | lodash.js | 8,544 | [
"array",
"comparator"
] | false | 4 | 7.44 | lodash/lodash | 61,490 | jsdoc | false | |
generateHash | private byte[] generateHash(@Nullable Class<?> sourceClass) {
ApplicationHome home = new ApplicationHome(sourceClass);
MessageDigest digest;
try {
digest = MessageDigest.getInstance("SHA-1");
update(digest, home.getSource());
update(digest, home.getDir());
update(digest, System.getProperty("user.dir")... | Return a subdirectory of the application temp.
@param subDir the subdirectory name
@return a subdirectory | java | core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java | 145 | [
"sourceClass"
] | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false | |
rootLayer | function rootLayer(client: Client): CompositeProxyLayer {
const prototype = Object.getPrototypeOf(client._originalClient)
const allKeys = [...new Set(Object.getOwnPropertyNames(prototype))]
return {
getKeys() {
return allKeys
},
getPropertyValue(prop) {
return client[prop]
},
}
} | Dynamically creates a model proxy interface for a give name. For each prop
accessed on this proxy, it will lookup the dmmf to find if that model exists.
If it is the case, it will create a proxy for that model via {@link applyModel}.
@param client to create the proxy around
@returns a proxy to access models | typescript | packages/client/src/runtime/core/model/applyModelsAndClientExtensions.ts | 39 | [
"client"
] | true | 1 | 6.88 | prisma/prisma | 44,834 | jsdoc | false | |
doInvoke | protected @Nullable Object doInvoke(@Nullable Object... args) {
Object bean = getTargetBean();
// Detect package-protected NullBean instance through equals(null) check
if (bean.equals(null)) {
return null;
}
try {
ReflectionUtils.makeAccessible(this.method);
if (KotlinDetector.isSuspendingFunction(t... | Invoke the event listener method with the given argument values. | java | spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java | 363 | [] | Object | true | 7 | 6.88 | spring-projects/spring-framework | 59,386 | javadoc | false |
parse | @Override
public Date parse(String text, Locale locale) throws ParseException {
try {
return getDateFormat(locale).parse(text);
}
catch (ParseException ex) {
Set<String> fallbackPatterns = new LinkedHashSet<>();
String isoPattern = ISO_FALLBACK_PATTERNS.get(this.iso);
if (isoPattern != null) {
fa... | Specify whether parsing is to be lenient. Default is {@code false}.
<p>With lenient parsing, the parser may allow inputs that do not precisely match the format.
With strict parsing, inputs must match the format exactly. | java | spring-context/src/main/java/org/springframework/format/datetime/DateFormatter.java | 208 | [
"text",
"locale"
] | Date | true | 9 | 6 | spring-projects/spring-framework | 59,386 | javadoc | false |
translate | def translate(a, table, deletechars=None):
"""
For each element in `a`, return a copy of the string where all
characters occurring in the optional argument `deletechars` are
removed, and the remaining characters have been mapped through the
given translation table.
Calls :meth:`str.translate` e... | For each element in `a`, return a copy of the string where all
characters occurring in the optional argument `deletechars` are
removed, and the remaining characters have been mapped through the
given translation table.
Calls :meth:`str.translate` element-wise.
Parameters
----------
a : array-like, with `np.bytes_` or... | python | numpy/_core/strings.py | 1,681 | [
"a",
"table",
"deletechars"
] | false | 3 | 7.52 | numpy/numpy | 31,054 | numpy | false | |
customizers | public SimpleAsyncTaskExecutorBuilder customizers(
Iterable<? extends SimpleAsyncTaskExecutorCustomizer> customizers) {
Assert.notNull(customizers, "'customizers' must not be null");
return new SimpleAsyncTaskExecutorBuilder(this.virtualThreads, this.threadNamePrefix,
this.cancelRemainingTasksOnClose, this.r... | Set the {@link SimpleAsyncTaskExecutorCustomizer customizers} that should be
applied to the {@link SimpleAsyncTaskExecutor}. Customizers are applied in the
order that they were added after builder configuration has been applied. Setting
this value will replace any previously configured customizers.
@param customizers t... | java | core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskExecutorBuilder.java | 197 | [
"customizers"
] | SimpleAsyncTaskExecutorBuilder | true | 1 | 6.24 | spring-projects/spring-boot | 79,428 | javadoc | false |
_standardize_out_kwarg | def _standardize_out_kwarg(**kwargs) -> dict:
"""
If kwargs contain "out1" and "out2", replace that with a tuple "out"
np.divmod, np.modf, np.frexp can have either `out=(out1, out2)` or
`out1=out1, out2=out2)`
"""
if "out" not in kwargs and "out1" in kwargs and "out2" in kwargs:
out1 = ... | If kwargs contain "out1" and "out2", replace that with a tuple "out"
np.divmod, np.modf, np.frexp can have either `out=(out1, out2)` or
`out1=out1, out2=out2)` | python | pandas/core/arraylike.py | 421 | [] | dict | true | 4 | 6.88 | pandas-dev/pandas | 47,362 | unknown | false |
maybeExecuteRetention | Set<Index> maybeExecuteRetention(
ProjectMetadata project,
DataStream dataStream,
TimeValue dataRetention,
TimeValue failureRetention,
Set<Index> indicesToExcludeForRemainingRun
) {
if (dataRetention == null && failureRetention == null) {
return Set.of();
... | This method sends requests to delete any indices in the datastream that exceed its retention policy. It returns the set of indices
it has sent delete requests for.
@param project The project metadata from which to get index metadata
@param dataStream The data stream
@param i... | java | modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleService.java | 933 | [
"project",
"dataStream",
"dataRetention",
"failureRetention",
"indicesToExcludeForRemainingRun"
] | true | 10 | 7.84 | elastic/elasticsearch | 75,680 | javadoc | false | |
aggregate | def aggregate(self, func=None, *args, **kwargs):
"""
Aggregate using one or more operations over the specified axis.
Parameters
----------
func : function, str, list or dict
Function to use for aggregating the data. If a function, must either
work when pa... | Aggregate using one or more operations over the specified axis.
Parameters
----------
func : function, str, list or dict
Function to use for aggregating the data. If a function, must either
work when passed a Series/DataFrame or
when passed to Series/DataFrame.apply.
Accepted combinations are:
- ... | python | pandas/core/window/rolling.py | 1,218 | [
"self",
"func"
] | false | 2 | 7.76 | pandas-dev/pandas | 47,362 | numpy | false | |
_should_retry_on_error | def _should_retry_on_error(self, exception: BaseException) -> bool:
"""
Determine if an exception should trigger a retry.
:param exception: The exception that occurred
:return: True if the exception should trigger a retry, False otherwise
"""
if isinstance(exception, Cli... | Determine if an exception should trigger a retry.
:param exception: The exception that occurred
:return: True if the exception should trigger a retry, False otherwise | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue.py | 140 | [
"self",
"exception"
] | bool | true | 2 | 8.08 | apache/airflow | 43,597 | sphinx | false |
write | @Override
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException {
return socketChannel.write(srcs, offset, length);
} | Writes a sequence of bytes to this channel from the subsequence of the given buffers.
@param srcs The buffers from which bytes are to be retrieved
@param offset The offset within the buffer array of the first buffer from which bytes are to be retrieved; must be non-negative and no larger than srcs.length.
@param length... | java | clients/src/main/java/org/apache/kafka/common/network/PlaintextTransportLayer.java | 163 | [
"srcs",
"offset",
"length"
] | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false | |
toDashedCase | public static String toDashedCase(String value) {
StringBuilder dashed = new StringBuilder();
Character previous = null;
for (int i = 0; i < value.length(); i++) {
char current = value.charAt(i);
if (SEPARATORS.contains(current)) {
dashed.append("-");
}
else if (Character.isUpperCase(current) && p... | Return the idiomatic metadata format for the given {@code value}.
@param value a value
@return the idiomatic format for the value, or the value itself if it already
complies with the idiomatic metadata format. | java | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/support/ConventionUtils.java | 47 | [
"value"
] | String | true | 6 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false |
charsStartIndex | function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
} | Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
that is not found in the character symbols.
@private
@param {Array} strSymbols The string symbols to inspect.
@param {Array} chrSymbols The character symbols to find.
@returns {number} Returns the index of the first unmatched string symbol. | javascript | lodash.js | 1,073 | [
"strSymbols",
"chrSymbols"
] | false | 3 | 6.08 | lodash/lodash | 61,490 | jsdoc | false | |
transformAccessorsToExpression | function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, container: Node, startsOnNewLine: boolean): Expression {
// To align with source maps in the old emitter, the receiver and property name
// arguments are both... | Transforms a set of related get/set accessors into an expression for either a class
body function or an ObjectLiteralExpression with computed properties.
@param receiver The receiver for the member. | typescript | src/compiler/transformers/es2015.ts | 2,354 | [
"receiver",
"{ firstAccessor, getAccessor, setAccessor }",
"container",
"startsOnNewLine"
] | true | 7 | 6.56 | microsoft/TypeScript | 107,154 | jsdoc | false | |
exponential_backoff_retry | def exponential_backoff_retry(
last_attempt_time: datetime,
attempts_since_last_successful: int,
callable_function: Callable,
max_delay: int = 60 * 2,
max_attempts: int = -1,
exponent_base: int = 4,
) -> None:
"""
Retry a callable function with exponential backoff between attempts if it ... | Retry a callable function with exponential backoff between attempts if it raises an exception.
:param last_attempt_time: Timestamp of last attempt call.
:param attempts_since_last_successful: Number of attempts since last success.
:param callable_function: Callable function that will be called if enough time has passe... | python | providers/amazon/src/airflow/providers/amazon/aws/executors/utils/exponential_backoff_retry.py | 46 | [
"last_attempt_time",
"attempts_since_last_successful",
"callable_function",
"max_delay",
"max_attempts",
"exponent_base"
] | None | true | 4 | 6.72 | apache/airflow | 43,597 | sphinx | false |
createCollection | abstract Collection<V> createCollection(); | Creates the collection of values for a single key.
<p>Collections with weak, soft, or phantom references are not supported. Each call to {@code
createCollection} should create a new instance.
<p>The returned collection class determines whether duplicate key-value pairs are allowed.
@return an empty collection of values | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 155 | [] | true | 1 | 6.48 | google/guava | 51,352 | javadoc | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.