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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
choice | def choice(self) -> Optional[ChoiceCaller]:
"""
Lazily evaluate and return the ChoiceCaller for this template choice.
On first access, calls template.choice_or_none() with the stored parameters.
If successful, caches and returns the ChoiceCaller. If it fails, caches
and returns ... | Lazily evaluate and return the ChoiceCaller for this template choice.
On first access, calls template.choice_or_none() with the stored parameters.
If successful, caches and returns the ChoiceCaller. If it fails, caches
and returns None. Subsequent accesses return the cached value.
Returns:
ChoiceCaller if the tem... | python | torch/_inductor/kernel_template_choice.py | 42 | [
"self"
] | Optional[ChoiceCaller] | true | 3 | 7.76 | pytorch/pytorch | 96,034 | unknown | false |
_can_fuse_epilogue_impl | def _can_fuse_epilogue_impl(
self,
cuda_template_buffer: CUDATemplateBuffer,
existing_epilogue_nodes: list[BaseSchedulerNode],
node_to_fuse: BaseSchedulerNode,
) -> bool:
"""
Check if the given node can be fused with the epilogue. At the moment, Kernels
suppor... | Check if the given node can be fused with the epilogue. At the moment, Kernels
support fusion with Pointwise operations, wrapped in (named) ComputedBuffer nodes.
Args:
cuda_template_buffer : A CUDATemplateBuffer object representing the CUDA template and it's result buffer
existing_epilogue_nodes : List[Schedul... | python | torch/_inductor/codegen/cuda/cuda_cpp_scheduling.py | 198 | [
"self",
"cuda_template_buffer",
"existing_epilogue_nodes",
"node_to_fuse"
] | bool | true | 14 | 8 | pytorch/pytorch | 96,034 | google | false |
containsWhitespace | public static boolean containsWhitespace(final CharSequence seq) {
if (isEmpty(seq)) {
return false;
}
final int strLen = seq.length();
for (int i = 0; i < strLen; i++) {
if (Character.isWhitespace(seq.charAt(i))) {
return true;
}
... | Tests whether the given CharSequence contains any whitespace characters.
<p>
Whitespace is defined by {@link Character#isWhitespace(char)}.
</p>
<pre>
StringUtils.containsWhitespace(null) = false
StringUtils.containsWhitespace("") = false
StringUtils.containsWhitespace("ab") = false
StringUtils.cont... | java | src/main/java/org/apache/commons/lang3/StringUtils.java | 1,356 | [
"seq"
] | true | 4 | 7.6 | apache/commons-lang | 2,896 | javadoc | false | |
getLogger | private @Nullable LoggerConfig getLogger(@Nullable String name) {
if (!StringUtils.hasLength(name) || ROOT_LOGGER_NAME.equals(name)) {
return findLogger(LogManager.ROOT_LOGGER_NAME);
}
return findLogger(name);
} | Return the configuration location. The result may be:
<ul>
<li>{@code null}: if DefaultConfiguration is used (no explicit config loaded)</li>
<li>A file path: if provided explicitly by the user</li>
<li>A URI: if loaded from the classpath default or a custom location</li>
</ul>
@param configuration the source configura... | java | core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java | 470 | [
"name"
] | LoggerConfig | true | 3 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
tz_convert | def tz_convert(self, tz) -> Self:
"""
Convert tz-aware Datetime Array/Index from one time zone to another.
Parameters
----------
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
Time zone for time. Corresponding timestamps would... | Convert tz-aware Datetime Array/Index from one time zone to another.
Parameters
----------
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
Time zone for time. Corresponding timestamps would be converted
to this time zone of the Datetime Array/Index. A `tz` of None will
... | python | pandas/core/indexes/datetimes.py | 328 | [
"self",
"tz"
] | Self | true | 1 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
create | TokenStream create(TokenStream tokenStream); | Transform the specified input TokenStream.
@param tokenStream a token stream to be transformed
@return transformed token stream | java | libs/plugin-analysis-api/src/main/java/org/elasticsearch/plugin/analysis/TokenFilterFactory.java | 27 | [
"tokenStream"
] | TokenStream | true | 1 | 6 | elastic/elasticsearch | 75,680 | javadoc | false |
resolvePropertyPlaceholders | private void resolvePropertyPlaceholders() {
for (String name : this.properties.stringPropertyNames()) {
String value = this.properties.getProperty(name);
String resolved = SystemPropertyUtils.resolvePlaceholders(this.properties, value);
if (resolved != null) {
this.properties.put(name, resolved);
}
... | Properties key for boolean flag (default false) which, if set, will cause the
external configuration properties to be copied to System properties (assuming that
is allowed by Java security). | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/PropertiesLauncher.java | 277 | [] | void | true | 2 | 6.72 | spring-projects/spring-boot | 79,428 | javadoc | false |
listFiles | private List<File> listFiles(File file) {
File[] files = file.listFiles();
if (files == null) {
return Collections.emptyList();
}
Arrays.sort(files, entryComparator);
return Arrays.asList(files);
} | Create a new {@link ExplodedArchive} instance.
@param rootDirectory the root directory | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/ExplodedArchive.java | 108 | [
"file"
] | true | 2 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false | |
optJSONObject | public JSONObject optJSONObject(String name) {
Object object = opt(name);
return object instanceof JSONObject ? (JSONObject) object : null;
} | Returns the value mapped by {@code name} if it exists and is a {@code
JSONObject}. Returns null otherwise.
@param name the name of the property
@return the value or {@code null} | java | cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONObject.java | 641 | [
"name"
] | JSONObject | true | 2 | 8 | spring-projects/spring-boot | 79,428 | javadoc | false |
allVersions | public List<Short> allVersions() {
List<Short> versions = new ArrayList<>(latestVersion() - oldestVersion() + 1);
for (short version = oldestVersion(); version <= latestVersion(); version++) {
versions.add(version);
}
return versions;
} | indicates whether the API is enabled for forwarding | java | clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java | 232 | [] | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false | |
buildGenericTypeAwarePropertyDescriptor | private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class<?> beanClass, PropertyDescriptor pd) {
try {
return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(),
pd.getWriteMethod(), pd.getPropertyEditorClass());
}
catch (IntrospectionException ex) {
throw... | Create a new CachedIntrospectionResults instance for the given class.
@param beanClass the bean class to analyze
@throws BeansException in case of introspection failure | java | spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java | 394 | [
"beanClass",
"pd"
] | PropertyDescriptor | true | 2 | 6.24 | spring-projects/spring-framework | 59,386 | javadoc | false |
topicPartitionsToLogString | private String topicPartitionsToLogString(Collection<TopicPartition> partitions) {
if (!log.isTraceEnabled()) {
return String.format("%d partition(s)", partitions.size());
}
return "(" + partitions.stream().map(TopicPartition::toString).collect(Collectors.joining(", ")) + ")";
} | A builder that allows for presizing the PartitionData hashmap, and avoiding making a
secondary copy of the sessionPartitions, in cases where this is not necessarily.
This builder is primarily for use by the Replica Fetcher
@param size the initial size of the PartitionData hashmap
@param copySessionPartitions boolean ... | java | clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java | 392 | [
"partitions"
] | String | true | 2 | 6.4 | apache/kafka | 31,560 | javadoc | false |
Row | function Row({
attribute,
attributePlaceholder,
changeAttribute,
changeValue,
validAttributes,
value,
valuePlaceholder,
}: RowProps) {
// TODO (RN style editor) Use @reach/combobox to auto-complete attributes.
// The list of valid attributes would need to be injected by RN backend,
// which would ne... | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
@flow | javascript | packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js | 157 | [] | false | 12 | 6.32 | facebook/react | 241,750 | jsdoc | false | |
get_mssql_table_constraints | def get_mssql_table_constraints(conn, table_name) -> dict[str, dict[str, list[str]]]:
"""
Return the primary and unique constraint along with column name.
Some tables like `task_instance` are missing the primary key constraint
name and the name is auto-generated by the SQL server, so this function
... | Return the primary and unique constraint along with column name.
Some tables like `task_instance` are missing the primary key constraint
name and the name is auto-generated by the SQL server, so this function
helps to retrieve any primary or unique constraint name.
:param conn: sql connection object
:param table_name... | python | airflow-core/src/airflow/migrations/utils.py | 26 | [
"conn",
"table_name"
] | dict[str, dict[str, list[str]]] | true | 2 | 8.08 | apache/airflow | 43,597 | sphinx | false |
issubdtype | def issubdtype(arg1, arg2):
r"""
Returns True if first argument is a typecode lower/equal in type hierarchy.
This is like the builtin :func:`issubclass`, but for `dtype`\ s.
Parameters
----------
arg1, arg2 : dtype_like
`dtype` or object coercible to one
Returns
-------
ou... | r"""
Returns True if first argument is a typecode lower/equal in type hierarchy.
This is like the builtin :func:`issubclass`, but for `dtype`\ s.
Parameters
----------
arg1, arg2 : dtype_like
`dtype` or object coercible to one
Returns
-------
out : bool
See Also
--------
:ref:`arrays.scalars` : Overview of the ... | python | numpy/_core/numerictypes.py | 412 | [
"arg1",
"arg2"
] | false | 3 | 7.04 | numpy/numpy | 31,054 | numpy | false | |
is_masked | def is_masked(x):
"""
Determine whether input has masked values.
Accepts any object as input, but always returns False unless the
input is a MaskedArray containing masked values.
Parameters
----------
x : array_like
Array to check for masked values.
Returns
-------
res... | Determine whether input has masked values.
Accepts any object as input, but always returns False unless the
input is a MaskedArray containing masked values.
Parameters
----------
x : array_like
Array to check for masked values.
Returns
-------
result : bool
True if `x` is a MaskedArray with masked values, Fa... | python | numpy/ma/core.py | 6,862 | [
"x"
] | false | 3 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
definitelyRunningAsRoot | boolean definitelyRunningAsRoot(); | Determine whether this JVM is running as the root user.
@return true if running as root, or false if unsure | java | libs/native/src/main/java/org/elasticsearch/nativeaccess/NativeAccess.java | 33 | [] | true | 1 | 6.8 | elastic/elasticsearch | 75,680 | javadoc | false | |
normalizeReferrerURL | function normalizeReferrerURL(referrerName) {
if (referrerName === null || referrerName === undefined) {
return undefined;
}
if (typeof referrerName === 'string') {
if (path.isAbsolute(referrerName)) {
return pathToFileURL(referrerName).href;
}
if (StringPrototypeStartsWith(referrerName, '... | Normalize the referrer name as a URL.
If it's a string containing an absolute path or a URL it's normalized as
a URL string.
Otherwise it's returned as undefined.
@param {string | null | undefined} referrerName
@returns {string | undefined} | javascript | lib/internal/modules/helpers.js | 276 | [
"referrerName"
] | false | 7 | 6.08 | nodejs/node | 114,839 | jsdoc | false | |
closeHeartbeatThread | private void closeHeartbeatThread() {
BaseHeartbeatThread thread;
synchronized (this) {
if (heartbeatThread == null)
return;
heartbeatThread.close();
thread = heartbeatThread;
heartbeatThread = null;
}
try {
thre... | Ensure the group is active (i.e., joined and synced)
@param timer Timer bounding how long this method can block
@throws KafkaException if the callback throws exception
@return true iff the group is active | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 431 | [] | void | true | 3 | 7.6 | apache/kafka | 31,560 | javadoc | false |
from_object | def from_object(self, obj: object | str) -> None:
"""Updates the values from the given object. An object can be of one
of the following two types:
- a string: in this case the object with that name will be imported
- an actual object reference: that object is used directly
... | Updates the values from the given object. An object can be of one
of the following two types:
- a string: in this case the object with that name will be imported
- an actual object reference: that object is used directly
Objects are usually either modules or classes. :meth:`from_object`
loads only the uppercase ... | python | src/flask/config.py | 218 | [
"self",
"obj"
] | None | true | 4 | 6.56 | pallets/flask | 70,946 | sphinx | false |
_fit_and_predict | def _fit_and_predict(estimator, X, y, train, test, fit_params, method):
"""Fit estimator and predict values for a given dataset split.
Read more in the :ref:`User Guide <cross_validation>`.
Parameters
----------
estimator : estimator object implementing 'fit' and 'predict'
The object to us... | Fit estimator and predict values for a given dataset split.
Read more in the :ref:`User Guide <cross_validation>`.
Parameters
----------
estimator : estimator object implementing 'fit' and 'predict'
The object to use to fit the data.
X : array-like of shape (n_samples, n_features)
The data to fit.
.. ve... | python | sklearn/model_selection/_validation.py | 1,252 | [
"estimator",
"X",
"y",
"train",
"test",
"fit_params",
"method"
] | false | 9 | 6 | scikit-learn/scikit-learn | 64,340 | numpy | false | |
getLocale | public static Locale getLocale(@Nullable LocaleContext localeContext) {
if (localeContext != null) {
Locale locale = localeContext.getLocale();
if (locale != null) {
return locale;
}
}
return (defaultLocale != null ? defaultLocale : Locale.getDefault());
} | Return the Locale associated with the given user context, if any,
or the system default Locale otherwise. This is effectively a
replacement for {@link java.util.Locale#getDefault()},
able to optionally respect a user-level Locale setting.
@param localeContext the user-level locale context to check
@return the current L... | java | spring-context/src/main/java/org/springframework/context/i18n/LocaleContextHolder.java | 220 | [
"localeContext"
] | Locale | true | 4 | 7.44 | spring-projects/spring-framework | 59,386 | javadoc | false |
add | public <V> Member<V> add(String name, @Nullable V value) {
return add(name, (instance) -> value);
} | Add a new member with a static value.
@param <V> the value type
@param name the member name
@param value the member value
@return the added {@link Member} which may be configured further | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonWriter.java | 214 | [
"name",
"value"
] | true | 1 | 6.96 | spring-projects/spring-boot | 79,428 | javadoc | false | |
has_user_subclass | def has_user_subclass(args, allowed_subclasses):
"""Check if any tensor arguments are user subclasses.
This is used to determine if tensor subclasses should get a chance to run
their own implementation first before falling back to the default implementation.
Args:
args: Arguments to check (wil... | Check if any tensor arguments are user subclasses.
This is used to determine if tensor subclasses should get a chance to run
their own implementation first before falling back to the default implementation.
Args:
args: Arguments to check (will be flattened with pytree)
allowed_subclasses: Tuple of allowed sub... | python | torch/_higher_order_ops/utils.py | 1,244 | [
"args",
"allowed_subclasses"
] | false | 3 | 6.96 | pytorch/pytorch | 96,034 | google | false | |
roundUpSafe | private static long roundUpSafe(long value, long divisor) {
if (divisor <= 0) {
throw new IllegalArgumentException("divisor must be positive");
}
return ((value + divisor - 1) / divisor) * divisor;
} | Helper method to round up to the nearest multiple of a given divisor.
<p>Equivalent to C++ {@code raft::round_up_safe<uint32_t>(value, divisor)}
@param value the value to round up
@param divisor the divisor to round to
@return the rounded up value | java | libs/gpu-codec/src/main/java/org/elasticsearch/gpu/codec/CuVSIvfPqParamsFactory.java | 145 | [
"value",
"divisor"
] | true | 2 | 8.08 | elastic/elasticsearch | 75,680 | javadoc | false | |
betweenOrderedExclusive | private boolean betweenOrderedExclusive(final A b, final A c) {
return greaterThan(b) && lessThan(c);
} | Tests if {@code (b < a < c)} or {@code (b > a > c)} where the {@code a} is object passed to {@link #is}.
@param b the object to compare to the base object
@param c the object to compare to the base object
@return true if the base object is between b and c and not equal to those | java | src/main/java/org/apache/commons/lang3/compare/ComparableUtils.java | 73 | [
"b",
"c"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
collect_fw_donated_buffer_idxs | def collect_fw_donated_buffer_idxs(
fw_ins: list[Optional[FakeTensor]],
user_fw_outs: list[Optional[FakeTensor]],
bw_outs: list[Optional[FakeTensor]],
saved_tensors: list[FakeTensor],
) -> list[int]:
"""
Checks if the saved tensors are donated buffers, which means a saved tensor is not
an al... | Checks if the saved tensors are donated buffers, which means a saved tensor is not
an alias of any tensors in fw_ins, user_fw_outs, and bw_outs. | python | torch/_functorch/_aot_autograd/graph_compile.py | 537 | [
"fw_ins",
"user_fw_outs",
"bw_outs",
"saved_tensors"
] | list[int] | true | 9 | 6 | pytorch/pytorch | 96,034 | unknown | false |
processEntries | private static Properties processEntries(Properties properties) {
coercePropertyToEpoch(properties, "commit.time");
coercePropertyToEpoch(properties, "build.time");
Object commitId = properties.get("commit.id");
if (commitId != null) {
// Can get converted into a map, so we copy the entry as a nested key
... | Return the timestamp of the commit or {@code null}.
<p>
If the original value could not be parsed properly, it is still available with the
{@code commit.time} key.
@return the commit time
@see #get(String) | java | core/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java | 95 | [
"properties"
] | Properties | true | 2 | 7.2 | spring-projects/spring-boot | 79,428 | javadoc | false |
read_pickle | def read_pickle(
filepath_or_buffer: FilePath | ReadPickleBuffer,
compression: CompressionOptions = "infer",
storage_options: StorageOptions | None = None,
) -> DataFrame | Series:
"""
Load pickled pandas object (or any object) from file and return unpickled object.
.. warning::
Loading... | Load pickled pandas object (or any object) from file and return unpickled object.
.. warning::
Loading pickled data received from untrusted sources can be
unsafe. See `here <https://docs.python.org/3/library/pickle.html>`__.
Parameters
----------
filepath_or_buffer : str, path object, or file-like object
S... | python | pandas/io/pickle.py | 124 | [
"filepath_or_buffer",
"compression",
"storage_options"
] | DataFrame | Series | true | 1 | 7.2 | pandas-dev/pandas | 47,362 | numpy | false |
attemptBackendHandshake | function attemptBackendHandshake() {
if (!backendInitialized) {
// tslint:disable-next-line:no-console
console.log('Attempting handshake with backend', new Date());
const retry = () => {
if (backendInitialized || backgroundDisconnected) {
return;
}
handshakeWithBackend();
... | @license
Copyright Google LLC All Rights Reserved.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE file at https://angular.dev/license | typescript | devtools/projects/shell-browser/src/app/content-script.ts | 29 | [] | false | 4 | 6.4 | angular/angular | 99,544 | jsdoc | false | |
connect | def connect(self, receiver, sender=None, weak=True, dispatch_uid=None):
"""
Connect receiver to sender for signal.
Arguments:
receiver
A function or an instance method which is to receive signals.
Receivers must be hashable objects. Receivers can be
... | Connect receiver to sender for signal.
Arguments:
receiver
A function or an instance method which is to receive signals.
Receivers must be hashable objects. Receivers can be
asynchronous.
If weak is True, then receiver must be weak referenceable.
Receivers must be able to... | python | django/dispatch/dispatcher.py | 81 | [
"self",
"receiver",
"sender",
"weak",
"dispatch_uid"
] | false | 12 | 6 | django/django | 86,204 | google | false | |
isAutowireCandidate | protected boolean isAutowireCandidate(String beanName, RootBeanDefinition mbd,
DependencyDescriptor descriptor, AutowireCandidateResolver resolver) {
String bdName = transformedBeanName(beanName);
resolveBeanClass(mbd, bdName);
if (mbd.isFactoryMethodUnique && mbd.factoryMethodToIntrospect == null) {
new C... | Determine whether the specified bean definition qualifies as an autowire candidate,
to be injected into other beans which declare a dependency of matching type.
@param beanName the name of the bean definition to check
@param mbd the merged bean definition to check
@param descriptor the descriptor of the dependency to r... | java | spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | 949 | [
"beanName",
"mbd",
"descriptor",
"resolver"
] | true | 4 | 7.6 | spring-projects/spring-framework | 59,386 | javadoc | false | |
getAliases | async function getAliases(options: ExecOptionsWithStringEncoding, existingCommands?: Set<string>): Promise<ICompletionResource[]> {
const output = await execHelper('Get-Command -CommandType Alias | Select-Object Name, CommandType, Definition, DisplayName, ModuleName, @{Name="Version";Expression={$_.Version.ToString()}... | The numeric values associated with CommandType from Get-Command. It appears that this is a
bitfield based on the values but I think it's actually used as an enum where a CommandType can
only be a single one of these.
Source:
```
[enum]::GetValues([System.Management.Automation.CommandTypes]) | ForEach-Object {
[pscu... | typescript | extensions/terminal-suggest/src/shell/pwsh.ts | 57 | [
"options",
"existingCommands?"
] | true | 9 | 7.12 | microsoft/vscode | 179,840 | jsdoc | true | |
matchesActiveProfiles | private boolean matchesActiveProfiles(Predicate<String> activeProfiles) {
Assert.state(this.onProfile != null, "'this.onProfile' must not be null");
return org.springframework.core.env.Profiles.of(this.onProfile).matches(activeProfiles);
} | Return {@code true} if the properties indicate that the config data property
source is active for the given activation context.
@param activationContext the activation context
@return {@code true} if the config data property source is active | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java | 141 | [
"activeProfiles"
] | true | 1 | 6.32 | spring-projects/spring-boot | 79,428 | javadoc | false | |
getVirtualData | private CloseableDataBlock getVirtualData() throws IOException {
CloseableDataBlock virtualData = (this.virtualData != null) ? this.virtualData.get() : null;
if (virtualData != null) {
return virtualData;
}
virtualData = createVirtualData();
this.virtualData = new SoftReference<>(virtualData);
return vir... | Open a {@link DataBlock} containing the raw zip data. For container zip files, this
may be smaller than the original file since additional bytes are permitted at the
front of a zip file. For nested zip files, this will be only the contents of the
nest zip.
<p>
For nested directory zip files, a virtual data block will b... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 146 | [] | CloseableDataBlock | true | 3 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
configure | public <T extends ThreadPoolTaskExecutor> T configure(T taskExecutor) {
PropertyMapper map = PropertyMapper.get();
map.from(this.queueCapacity).to(taskExecutor::setQueueCapacity);
map.from(this.corePoolSize).to(taskExecutor::setCorePoolSize);
map.from(this.maxPoolSize).to(taskExecutor::setMaxPoolSize);
map.fr... | Configure the provided {@link ThreadPoolTaskExecutor} instance using this builder.
@param <T> the type of task executor
@param taskExecutor the {@link ThreadPoolTaskExecutor} to configure
@return the task executor instance
@see #build()
@see #build(Class) | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskExecutorBuilder.java | 326 | [
"taskExecutor"
] | T | true | 2 | 7.28 | spring-projects/spring-boot | 79,428 | javadoc | false |
strings_with_wrong_placed_whitespace | def strings_with_wrong_placed_whitespace(
file_obj: IO[str],
) -> Iterable[tuple[int, str]]:
"""
Test case for leading spaces in concated strings.
For example:
>>> rule = "We want the space at the end of the line, not at the beginning"
Instead of:
>>> rule = "We want the space at the end... | Test case for leading spaces in concated strings.
For example:
>>> rule = "We want the space at the end of the line, not at the beginning"
Instead of:
>>> rule = "We want the space at the end of the line, not at the beginning"
Parameters
----------
file_obj : IO
File-like object containing the Python code to v... | python | scripts/validate_unwanted_patterns.py | 180 | [
"file_obj"
] | Iterable[tuple[int, str]] | true | 12 | 8.56 | pandas-dev/pandas | 47,362 | numpy | false |
round | public static Date round(final Object date, final int field) {
Objects.requireNonNull(date, "date");
if (date instanceof Date) {
return round((Date) date, field);
}
if (date instanceof Calendar) {
return round((Calendar) date, field).getTime();
}
t... | Rounds a date, leaving the field specified as the most
significant field.
<p>For example, if you had the date-time of 28 Mar 2002
13:45:01.231, if this was passed with HOUR, it would return
28 Mar 2002 14:00:00.000. If this was passed with MONTH, it
would return 1 April 2002 0:00:00.000.</p>
<p>For a date in a time zon... | java | src/main/java/org/apache/commons/lang3/time/DateUtils.java | 1,461 | [
"date",
"field"
] | Date | true | 3 | 7.92 | apache/commons-lang | 2,896 | javadoc | false |
inner | def inner(a, b, /):
"""
inner(a, b, /)
Inner product of two arrays.
Ordinary inner product of vectors for 1-D arrays (without complex
conjugation), in higher dimensions a sum product over the last axes.
Parameters
----------
a, b : array_like
If `a` and `b` are nonscalar, thei... | inner(a, b, /)
Inner product of two arrays.
Ordinary inner product of vectors for 1-D arrays (without complex
conjugation), in higher dimensions a sum product over the last axes.
Parameters
----------
a, b : array_like
If `a` and `b` are nonscalar, their last dimensions must match.
Returns
-------
out : ndarray... | python | numpy/_core/multiarray.py | 310 | [
"a",
"b"
] | false | 1 | 6.4 | numpy/numpy | 31,054 | numpy | false | |
check_tuning_config | def check_tuning_config(self, tuning_config: dict) -> None:
"""
Check if a tuning configuration is valid.
:param tuning_config: tuning_config
"""
for channel in tuning_config["TrainingJobDefinition"]["InputDataConfig"]:
if "S3DataSource" in channel["DataSource"]:
... | Check if a tuning configuration is valid.
:param tuning_config: tuning_config | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py | 242 | [
"self",
"tuning_config"
] | None | true | 3 | 6.4 | apache/airflow | 43,597 | sphinx | false |
createIncludeFixerReplacements | llvm::Expected<tooling::Replacements> createIncludeFixerReplacements(
StringRef Code, const IncludeFixerContext &Context,
const clang::format::FormatStyle &Style, bool AddQualifiers) {
if (Context.getHeaderInfos().empty())
return tooling::Replacements();
StringRef FilePath = Context.getFilePath();
std... | Get the include fixer context for the queried symbol. | cpp | clang-tools-extra/clang-include-fixer/IncludeFixer.cpp | 405 | [
"Code",
"AddQualifiers"
] | true | 7 | 6 | llvm/llvm-project | 36,021 | doxygen | false | |
handleAcknowledgeShareSessionNotFound | void handleAcknowledgeShareSessionNotFound() {
Map<TopicIdPartition, Acknowledgements> acknowledgementsMapToClear =
incompleteAcknowledgements.isEmpty() ? acknowledgementsToSend : incompleteAcknowledgements;
acknowledgementsMapToClear.forEach((tip, acks) -> {
if ... | Set the error code for all remaining acknowledgements in the event
of a share session not found error which prevents the remaining acknowledgements from
being sent. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java | 1,350 | [] | void | true | 3 | 7.04 | apache/kafka | 31,560 | javadoc | false |
toString | @Override
public String toString() {
if (this.parentName != null) {
return "Generic bean with parent '" + this.parentName + "': " + super.toString();
}
return "Generic bean: " + super.toString();
} | Create a new GenericBeanDefinition as deep copy of the given
bean definition.
@param original the original bean definition to copy from | java | spring-beans/src/main/java/org/springframework/beans/factory/support/GenericBeanDefinition.java | 94 | [] | String | true | 2 | 6.4 | spring-projects/spring-framework | 59,386 | javadoc | false |
addToMap | void addToMap() {
if (ancestor != null) {
ancestor.addToMap();
} else {
map.put(key, delegate);
}
} | Add the delegate to the map. Other {@code WrappedCollection} methods should call this method
after adding elements to a previously empty collection.
<p>Subcollection add the ancestor's delegate instead. | java | android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java | 388 | [] | void | true | 2 | 6.24 | google/guava | 51,352 | javadoc | false |
toDouble | public Double toDouble() {
return Double.valueOf(doubleValue());
} | Gets this mutable as an instance of Double.
@return a Double instance containing the value from this mutable, never null. | java | src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java | 399 | [] | Double | true | 1 | 6.8 | apache/commons-lang | 2,896 | javadoc | false |
checkOpen | private void checkOpen() throws IOException {
if (seq == null) {
throw new IOException("reader closed");
}
} | Creates a new reader wrapping the given character sequence. | java | android/guava/src/com/google/common/io/CharSequenceReader.java | 50 | [] | void | true | 2 | 6.88 | google/guava | 51,352 | javadoc | false |
extractCause | public static ConcurrentException extractCause(final ExecutionException ex) {
if (ex == null || ex.getCause() == null) {
return null;
}
ExceptionUtils.throwUnchecked(ex.getCause());
return new ConcurrentException(ex.getMessage(), ex.getCause());
} | Inspects the cause of the specified {@link ExecutionException} and
creates a {@link ConcurrentException} with the checked cause if
necessary. This method performs the following checks on the cause of the
passed in exception:
<ul>
<li>If the passed in exception is <strong>null</strong> or the cause is
<strong>null</stro... | java | src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java | 206 | [
"ex"
] | ConcurrentException | true | 3 | 7.6 | apache/commons-lang | 2,896 | javadoc | false |
skew | def skew(self, numeric_only: bool = False):
"""
Calculate the expanding unbiased skewness.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
-------
Series or DataFrame
Retu... | Calculate the expanding unbiased skewness.
Parameters
----------
numeric_only : bool, default False
Include only float, int, boolean columns.
Returns
-------
Series or DataFrame
Return type is the same as the original object with ``np.float64`` dtype.
See Also
--------
scipy.stats.skew : Third moment of a pr... | python | pandas/core/window/expanding.py | 910 | [
"self",
"numeric_only"
] | true | 1 | 7.12 | pandas-dev/pandas | 47,362 | numpy | false | |
stack | def stack(tensors: Any, new_dim: Any, dim: int = 0) -> _Tensor:
"""
Stack tensors along a new dimension.
Args:
tensors: Sequence of tensors to stack
new_dim: The new Dim to create for stacking
dim: The dimension position to insert the new dimension (default: 0)
Returns:
... | Stack tensors along a new dimension.
Args:
tensors: Sequence of tensors to stack
new_dim: The new Dim to create for stacking
dim: The dimension position to insert the new dimension (default: 0)
Returns:
Stacked tensor with the new dimension | python | functorch/dim/__init__.py | 1,136 | [
"tensors",
"new_dim",
"dim"
] | _Tensor | true | 11 | 7.84 | pytorch/pytorch | 96,034 | google | false |
bakeUrlData | function bakeUrlData(type, e = 0, withBase = false, asUrl = false) {
let result = [];
if (type === 'wpt') {
result = getUrlData(withBase);
} else if (urls[type]) {
const input = urls[type];
const item = withBase ? [input, 'about:blank'] : input;
// Roughly the size of WPT URL test data
result ... | Generate an array of data for URL benchmarks to use.
The size of the resulting data set is the original data size * 2 ** `e`.
The 'wpt' type contains about 400 data points when `withBase` is true,
and 200 data points when `withBase` is false.
Other types contain 200 data points with or without base.
@param {string} typ... | javascript | benchmark/common.js | 401 | [
"type"
] | false | 11 | 6.24 | nodejs/node | 114,839 | jsdoc | false | |
get_previous_scheduled_dagrun | def get_previous_scheduled_dagrun(
dag_run_id: int,
session: Session = NEW_SESSION,
) -> DagRun | None:
"""
Return the previous SCHEDULED DagRun, if there is one.
:param dag_run_id: the DAG run ID
:param session: SQLAlchemy ORM Session
"""
dag_run = s... | Return the previous SCHEDULED DagRun, if there is one.
:param dag_run_id: the DAG run ID
:param session: SQLAlchemy ORM Session | python | airflow-core/src/airflow/models/dagrun.py | 967 | [
"dag_run_id",
"session"
] | DagRun | None | true | 3 | 6.72 | apache/airflow | 43,597 | sphinx | false |
callWithTimeout | @CanIgnoreReturnValue
@ParametricNullness
<T extends @Nullable Object> T callWithTimeout(
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit)
throws TimeoutException, InterruptedException, ExecutionException; | Invokes a specified Callable, timing out after the specified time limit. If the target method
call finishes before the limit is reached, the return value or a wrapped exception is
propagated. If, on the other hand, the time limit is reached, we attempt to abort the call to
the target, and throw a {@link TimeoutExceptio... | java | android/guava/src/com/google/common/util/concurrent/TimeLimiter.java | 100 | [
"callable",
"timeoutDuration",
"timeoutUnit"
] | T | true | 1 | 6.56 | google/guava | 51,352 | javadoc | false |
parseListElement | function parseListElement<T extends Node | undefined>(parsingContext: ParsingContext, parseElement: () => T): T {
const node = currentNode(parsingContext);
if (node) {
return consumeNode(node) as T;
}
return parseElement();
} | 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,116 | [
"parsingContext",
"parseElement"
] | true | 2 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
maybeReconcile | private void maybeReconcile() {
if (targetAssignmentReconciled()) {
log.trace("Ignoring reconciliation attempt. Target assignment is equal to the " +
"current assignment.");
return;
}
if (reconciliationInProgress) {
log.trace("Ignoring reconcil... | Reconcile the assignment that has been received from the server. Reconciliation will trigger the
callbacks and update the subscription state.
There are two conditions under which no reconciliation will be triggered:
- We have already reconciled the assignment (the target assignment is the same as the current assignmen... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java | 1,040 | [] | void | true | 9 | 6.96 | apache/kafka | 31,560 | javadoc | false |
createVirtualData | private CloseableDataBlock createVirtualData() throws IOException {
int size = size();
NameOffsetLookups nameOffsetLookups = this.nameOffsetLookups.emptyCopy();
ZipCentralDirectoryFileHeaderRecord[] centralRecords = new ZipCentralDirectoryFileHeaderRecord[size];
long[] centralRecordPositions = new long[size];
... | Open a {@link DataBlock} containing the raw zip data. For container zip files, this
may be smaller than the original file since additional bytes are permitted at the
front of a zip file. For nested zip files, this will be only the contents of the
nest zip.
<p>
For nested directory zip files, a virtual data block will b... | java | loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java | 156 | [] | CloseableDataBlock | true | 2 | 8.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
toPrimitive | public static Object toPrimitive(final Object array) {
if (array == null) {
return null;
}
final Class<?> ct = array.getClass().getComponentType();
final Class<?> pt = ClassUtils.wrapperToPrimitive(ct);
if (Boolean.TYPE.equals(pt)) {
return toPrimitive((Bo... | Create an array of primitive type from an array of wrapper types.
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param array an array of wrapper object.
@return an array of the corresponding primitive type, or the original array.
@since 3.5 | java | src/main/java/org/apache/commons/lang3/ArrayUtils.java | 9,153 | [
"array"
] | Object | true | 10 | 8.24 | apache/commons-lang | 2,896 | javadoc | false |
ofEmptyLocation | static ConfigDataEnvironmentContributor ofEmptyLocation(ConfigDataLocation location, boolean profileSpecific,
ConversionService conversionService) {
return new ConfigDataEnvironmentContributor(Kind.EMPTY_LOCATION, location, null, profileSpecific, null, null,
null, EMPTY_LOCATION_OPTIONS, null, conversionServic... | Factory method to create an {@link Kind#EMPTY_LOCATION empty location} contributor.
@param location the location of this contributor
@param profileSpecific if the contributor is from a profile specific import
@param conversionService the conversion service to use
@return a new {@link ConfigDataEnvironmentContributor} i... | java | core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java | 470 | [
"location",
"profileSpecific",
"conversionService"
] | ConfigDataEnvironmentContributor | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
processBytes | @CanIgnoreReturnValue // some uses know that their processor never returns false
boolean processBytes(byte[] buf, int off, int len) throws IOException; | This method will be called for each chunk of bytes in an input stream. The implementation
should process the bytes from {@code buf[off]} through {@code buf[off + len - 1]} (inclusive).
@param buf the byte array containing the data to process
@param off the initial offset into the array
@param len the length of data to ... | java | android/guava/src/com/google/common/io/ByteProcessor.java | 46 | [
"buf",
"off",
"len"
] | true | 1 | 6.8 | google/guava | 51,352 | javadoc | false | |
functionsIn | function functionsIn(object) {
return object == null ? [] : baseFunctions(object, keysIn(object));
} | Creates an array of function property names from own and inherited
enumerable properties of `object`.
@static
@memberOf _
@since 4.0.0
@category Object
@param {Object} object The object to inspect.
@returns {Array} Returns the function names.
@see _.functions
@example
function Foo() {
this.a = _.constant('a');
this... | javascript | lodash.js | 13,204 | [
"object"
] | false | 2 | 7.12 | lodash/lodash | 61,490 | jsdoc | false | |
toString | @Override
public String toString() {
String remainingMs;
if (timer != null) {
timer.update();
remainingMs = String.valueOf(timer.remainingMs());
} else {
remainingMs = "<not set>";
}
return "UnsentReque... | Return the time when the request was enqueued to {@link NetworkClientDelegate#unsentRequests}. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java | 398 | [] | String | true | 2 | 6.08 | apache/kafka | 31,560 | javadoc | false |
print | public String print(Duration value) {
return longValue(value) + asSuffix();
} | Print the given {@link Duration} as a {@link String}, converting it to a long
value using this unit's precision via {@link #longValue(Duration)}
and appending this unit's simple {@link #asSuffix() suffix}.
@param value the {@code Duration} to convert to a {@code String}
@return the {@code String} representation of the ... | java | spring-context/src/main/java/org/springframework/format/annotation/DurationFormat.java | 185 | [
"value"
] | String | true | 1 | 6.32 | spring-projects/spring-framework | 59,386 | javadoc | false |
betweenOrdered | private boolean betweenOrdered(final A b, final A c) {
return greaterThanOrEqualTo(b) && lessThanOrEqualTo(c);
} | Tests if {@code (b < a < c)} or {@code (b > a > c)} where the {@code a} is object passed to {@link #is}.
@param b the object to compare to the base object
@param c the object to compare to the base object
@return true if the base object is between b and c and not equal to those | java | src/main/java/org/apache/commons/lang3/compare/ComparableUtils.java | 69 | [
"b",
"c"
] | true | 2 | 8.16 | apache/commons-lang | 2,896 | javadoc | false | |
tolist | def tolist(self, fill_value=None):
"""
Return the data portion of the masked array as a hierarchical Python list.
Data items are converted to the nearest compatible Python type.
Masked values are converted to `fill_value`. If `fill_value` is None,
the corresponding entries in th... | Return the data portion of the masked array as a hierarchical Python list.
Data items are converted to the nearest compatible Python type.
Masked values are converted to `fill_value`. If `fill_value` is None,
the corresponding entries in the output list will be ``None``.
Parameters
----------
fill_value : scalar, opt... | python | numpy/ma/core.py | 6,299 | [
"self",
"fill_value"
] | false | 6 | 7.84 | numpy/numpy | 31,054 | numpy | false | |
flushQuietly | @Beta
public static void flushQuietly(Flushable flushable) {
try {
flush(flushable, true);
} catch (IOException e) {
logger.log(Level.SEVERE, "IOException should not have been thrown.", e);
}
} | Equivalent to calling {@code flush(flushable, true)}, but with no {@code IOException} in the
signature.
@param flushable the {@code Flushable} object to be flushed. | java | android/guava/src/com/google/common/io/Flushables.java | 70 | [
"flushable"
] | void | true | 2 | 6.72 | google/guava | 51,352 | javadoc | false |
addNeighbors | public static final <E extends Collection<? super String>> E addNeighbors(String geohash, E neighbors) {
return addNeighborsAtLevel(geohash, geohash.length(), neighbors);
} | Add all geohashes of the cells next to a given geohash to a list.
@param geohash Geohash of a specified cell
@param neighbors list to add the neighbors to
@return the given list | java | libs/geo/src/main/java/org/elasticsearch/geometry/utils/Geohash.java | 160 | [
"geohash",
"neighbors"
] | E | true | 1 | 6.64 | elastic/elasticsearch | 75,680 | javadoc | false |
invokeOnPartitionsLostCallback | private CompletableFuture<Void> invokeOnPartitionsLostCallback(Set<TopicPartition> partitionsLost) {
// This should not trigger the callback if partitionsLost is empty, to keep the current
// behaviour.
Optional<ConsumerRebalanceListener> listener = subscriptions.rebalanceListener();
if ... | @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 | 374 | [
"partitionsLost"
] | true | 3 | 7.04 | apache/kafka | 31,560 | javadoc | false | |
_forward_logs | async def _forward_logs(self, logs_client, next_token: str | None = None) -> str | None:
"""
Read logs from the cloudwatch stream and print them to the task logs.
:return: the token to pass to the next iteration to resume where we started.
"""
while True:
if next_tok... | Read logs from the cloudwatch stream and print them to the task logs.
:return: the token to pass to the next iteration to resume where we started. | python | providers/amazon/src/airflow/providers/amazon/aws/triggers/ecs.py | 200 | [
"self",
"logs_client",
"next_token"
] | str | None | true | 8 | 6.88 | apache/airflow | 43,597 | unknown | false |
channel | public FileChannel channel() {
return channel;
} | Get the underlying file channel.
@return The file channel | java | clients/src/main/java/org/apache/kafka/common/record/FileRecords.java | 124 | [] | FileChannel | true | 1 | 6.96 | apache/kafka | 31,560 | javadoc | false |
_valid_locales | def _valid_locales(locales: list[str] | str, normalize: bool) -> list[str]:
"""
Return a list of normalized locales that do not throw an ``Exception``
when set.
Parameters
----------
locales : str
A string where each locale is separated by a newline.
normalize : bool
Whether... | Return a list of normalized locales that do not throw an ``Exception``
when set.
Parameters
----------
locales : str
A string where each locale is separated by a newline.
normalize : bool
Whether to call ``locale.normalize`` on each locale.
Returns
-------
valid_locales : list
A list of valid locales. | python | pandas/_config/localization.py | 88 | [
"locales",
"normalize"
] | list[str] | true | 2 | 6.88 | pandas-dev/pandas | 47,362 | numpy | false |
assignRackAwareRoundRobin | private void assignRackAwareRoundRobin(List<TopicPartition> unassignedPartitions) {
if (rackInfo.consumerRacks.isEmpty())
return;
int nextUnfilledConsumerIndex = 0;
Iterator<TopicPartition> unassignedIter = unassignedPartitions.iterator();
while (unassigne... | Constructs a constrained assignment builder.
@param partitionsPerTopic The partitions for each subscribed topic
@param rackInfo Rack information for consumers and racks
@param consumerToOwnedPartitions Each consumer's previously owned and still-subscribed partiti... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java | 734 | [
"unassignedPartitions"
] | void | true | 13 | 6.08 | apache/kafka | 31,560 | javadoc | false |
ensureCapacity | public static double[] ensureCapacity(double[] array, int minLength, int padding) {
checkArgument(minLength >= 0, "Invalid minLength: %s", minLength);
checkArgument(padding >= 0, "Invalid padding: %s", padding);
return (array.length < minLength) ? Arrays.copyOf(array, minLength + padding) : array;
} | Returns an array containing the same values as {@code array}, but guaranteed to be of a
specified minimum length. If {@code array} already has a length of at least {@code minLength},
it is returned directly. Otherwise, a new array of size {@code minLength + padding} is
returned, containing the values of {@code array}, ... | java | android/guava/src/com/google/common/primitives/Doubles.java | 346 | [
"array",
"minLength",
"padding"
] | true | 2 | 7.92 | google/guava | 51,352 | javadoc | false | |
getDetailedErrorMessage | protected String getDetailedErrorMessage(Object bean, @Nullable String message) {
StringBuilder sb = (StringUtils.hasLength(message) ? new StringBuilder(message).append('\n') : new StringBuilder());
sb.append("HandlerMethod details: \n");
sb.append("Bean [").append(bean.getClass().getName()).append("]\n");
sb.a... | Add additional details such as the bean type and method signature to
the given error message.
@param message error message to append the HandlerMethod details to | java | spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java | 428 | [
"bean",
"message"
] | String | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
reorder_post_acc_grad_hook_nodes | def reorder_post_acc_grad_hook_nodes(self) -> None:
"""
Usage of AOTAutograd causes all the post_acc_grad_hook nodes to get
pushed to the end of the graph. This differs from eager mode, which
schedules them as soon as possible. This pass attempts to reorder the
graph to mimic eag... | Usage of AOTAutograd causes all the post_acc_grad_hook nodes to get
pushed to the end of the graph. This differs from eager mode, which
schedules them as soon as possible. This pass attempts to reorder the
graph to mimic eager behavior. | python | torch/_dynamo/compiled_autograd.py | 1,293 | [
"self"
] | None | true | 7 | 6 | pytorch/pytorch | 96,034 | unknown | false |
resetCaches | @Override
public void resetCaches() {
this.cacheMap.values().forEach(Cache::clear);
if (this.dynamic) {
this.cacheMap.keySet().retainAll(this.customCacheNames);
}
} | Reset this cache manager's caches, removing them completely for on-demand
re-creation in 'dynamic' mode, or simply clearing their entries otherwise.
@since 6.2.14 | java | spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java | 271 | [] | void | true | 2 | 6.56 | spring-projects/spring-framework | 59,386 | javadoc | false |
defaults | public static ErrorAttributeOptions defaults() {
return of(Include.PATH, Include.STATUS, Include.ERROR);
} | Create an {@code ErrorAttributeOptions} with defaults.
@return an {@code ErrorAttributeOptions} | java | core/spring-boot/src/main/java/org/springframework/boot/web/error/ErrorAttributeOptions.java | 106 | [] | ErrorAttributeOptions | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
is_nested_list_like | def is_nested_list_like(obj: object) -> bool:
"""
Check if the object is list-like, and that all of its elements
are also list-like.
Parameters
----------
obj : The object to check
Returns
-------
is_list_like : bool
Whether `obj` has list-like properties.
Examples
... | Check if the object is list-like, and that all of its elements
are also list-like.
Parameters
----------
obj : The object to check
Returns
-------
is_list_like : bool
Whether `obj` has list-like properties.
Examples
--------
>>> is_nested_list_like([[1, 2, 3]])
True
>>> is_nested_list_like([{1, 2, 3}, {1, 2, 3}]... | python | pandas/core/dtypes/inference.py | 259 | [
"obj"
] | bool | true | 4 | 8.16 | pandas-dev/pandas | 47,362 | numpy | false |
stream | public Stream<T> stream() {
return this.services.stream();
} | Return a {@link Stream} of the AOT services.
@return a stream of the services | java | spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java | 153 | [] | true | 1 | 6.96 | spring-projects/spring-framework | 59,386 | javadoc | false | |
_stripBasePath | function _stripBasePath(basePath: string, url: string): string {
if (!basePath || !url.startsWith(basePath)) {
return url;
}
const strippedUrl = url.substring(basePath.length);
if (strippedUrl === '' || ['/', ';', '?', '#'].includes(strippedUrl[0])) {
return strippedUrl;
}
return url;
} | @description
A service that applications can use to interact with a browser's URL.
Depending on the `LocationStrategy` used, `Location` persists
to the URL's path or the URL's hash segment.
@usageNotes
It's better to use the `Router.navigate()` service to trigger route changes. Use
`Location` only if you need to intera... | typescript | packages/common/src/location/location.ts | 310 | [
"basePath",
"url"
] | true | 5 | 6.64 | angular/angular | 99,544 | jsdoc | false | |
ofContextClass | static ApplicationContextFactory ofContextClass(Class<? extends ConfigurableApplicationContext> contextClass) {
return of(() -> BeanUtils.instantiateClass(contextClass));
} | Creates an {@code ApplicationContextFactory} that will create contexts by
instantiating the given {@code contextClass} through its primary constructor.
@param contextClass the context class
@return the factory that will instantiate the context class
@see BeanUtils#instantiateClass(Class) | java | core/spring-boot/src/main/java/org/springframework/boot/ApplicationContextFactory.java | 88 | [
"contextClass"
] | ApplicationContextFactory | true | 1 | 6 | spring-projects/spring-boot | 79,428 | javadoc | false |
customizers | public ThreadPoolTaskExecutorBuilder customizers(Iterable<? extends ThreadPoolTaskExecutorCustomizer> customizers) {
Assert.notNull(customizers, "'customizers' must not be null");
return new ThreadPoolTaskExecutorBuilder(this.queueCapacity, this.corePoolSize, this.maxPoolSize,
this.allowCoreThreadTimeOut, this.... | Set the {@link ThreadPoolTaskExecutorCustomizer ThreadPoolTaskExecutorCustomizers}
that should be applied to the {@link ThreadPoolTaskExecutor}. 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.
... | java | core/spring-boot/src/main/java/org/springframework/boot/task/ThreadPoolTaskExecutorBuilder.java | 257 | [
"customizers"
] | ThreadPoolTaskExecutorBuilder | true | 1 | 6.08 | spring-projects/spring-boot | 79,428 | javadoc | false |
_needs_i8_conversion | def _needs_i8_conversion(self, key) -> bool:
"""
Check if a given key needs i8 conversion. Conversion is necessary for
Timestamp, Timedelta, DatetimeIndex, and TimedeltaIndex keys. An
Interval-like requires conversion if its endpoints are one of the
aforementioned types.
... | Check if a given key needs i8 conversion. Conversion is necessary for
Timestamp, Timedelta, DatetimeIndex, and TimedeltaIndex keys. An
Interval-like requires conversion if its endpoints are one of the
aforementioned types.
Assumes that any list-like data has already been cast to an Index.
Parameters
----------
key : ... | python | pandas/core/indexes/interval.py | 625 | [
"self",
"key"
] | bool | true | 3 | 6.72 | pandas-dev/pandas | 47,362 | numpy | false |
visitConstructor | function visitConstructor(node: ConstructorDeclaration) {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
}
return factory.updateConstructorDeclaration(
node,
/*modifiers*/ undefined,
visitParameterList(node.parameters, v... | Determines whether to emit a function-like declaration. We should not emit the
declaration if it does not have a body.
@param node The declaration node. | typescript | src/compiler/transformers/ts.ts | 1,332 | [
"node"
] | false | 2 | 6.08 | microsoft/TypeScript | 107,154 | jsdoc | false | |
update_job | def update_job(self, **job_kwargs) -> bool:
"""
Update job configurations.
.. seealso::
- :external+boto3:py:meth:`Glue.Client.update_job`
:param job_kwargs: Keyword args that define the configurations used for the job
:return: True if job was updated and false othe... | Update job configurations.
.. seealso::
- :external+boto3:py:meth:`Glue.Client.update_job`
:param job_kwargs: Keyword args that define the configurations used for the job
:return: True if job was updated and false otherwise | python | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue.py | 463 | [
"self"
] | bool | true | 2 | 7.44 | apache/airflow | 43,597 | sphinx | false |
processBackgroundEvents | <T> T processBackgroundEvents(final Future<T> future,
final Timer timer,
final Predicate<Exception> ignoreErrorEventException) {
log.trace("Will wait up to {} ms for future {} to complete", timer.remainingMs(), future);
do {
... | This method can be used by cases where the caller has an event that needs to both block for completion but
also process background events. For some events, in order to fully process the associated logic, the
{@link ConsumerNetworkThread background thread} needs assistance from the application thread to complete.
If the... | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java | 1,285 | [
"future",
"timer",
"ignoreErrorEventException"
] | T | true | 6 | 7.92 | apache/kafka | 31,560 | javadoc | false |
_tensor_description_to_json | def _tensor_description_to_json(
cls,
tensor_desc: Optional["TensorDescription"], # type: ignore[name-defined] # noqa: F821
) -> Optional[str]:
"""Convert TensorDescription to JSON string.
Args:
tensor_desc: TensorDescription object
Returns:
Option... | Convert TensorDescription to JSON string.
Args:
tensor_desc: TensorDescription object
Returns:
Optional[str]: JSON string representation or None | python | torch/_inductor/codegen/cuda/serialization.py | 399 | [
"cls",
"tensor_desc"
] | Optional[str] | true | 2 | 7.28 | pytorch/pytorch | 96,034 | google | false |
getEnvAsRecord | function getEnvAsRecord(shellIntegrationEnv: ITerminalEnvironment): Record<string, string> {
const env: Record<string, string> = {};
for (const [key, value] of Object.entries(shellIntegrationEnv ?? process.env)) {
if (typeof value === 'string') {
env[key] = value;
}
}
if (!shellIntegrationEnv) {
sanitizePr... | Adjusts the current working directory based on a given current command string if it is a folder.
@param currentCommandString - The current command string, which might contain a folder path prefix.
@param currentCwd - The current working directory.
@returns The new working directory. | typescript | extensions/terminal-suggest/src/terminalSuggestMain.ts | 569 | [
"shellIntegrationEnv"
] | true | 3 | 7.92 | microsoft/vscode | 179,840 | jsdoc | false | |
sort_complex | def sort_complex(a):
"""
Sort a complex array using the real part first, then the imaginary part.
Parameters
----------
a : array_like
Input array
Returns
-------
out : complex ndarray
Always returns a sorted complex array.
Examples
--------
>>> import nump... | Sort a complex array using the real part first, then the imaginary part.
Parameters
----------
a : array_like
Input array
Returns
-------
out : complex ndarray
Always returns a sorted complex array.
Examples
--------
>>> import numpy as np
>>> np.sort_complex([5, 3, 6, 2, 1])
array([1.+0.j, 2.+0.j, 3.+0.j, 5... | python | numpy/lib/_function_base_impl.py | 1,860 | [
"a"
] | false | 6 | 7.68 | numpy/numpy | 31,054 | numpy | false | |
_split | def _split(a, sep=None, maxsplit=None):
"""
For each element in `a`, return a list of the words in the
string, using `sep` as the delimiter string.
Calls :meth:`str.split` element-wise.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
sep : str... | For each element in `a`, return a list of the words in the
string, using `sep` as the delimiter string.
Calls :meth:`str.split` element-wise.
Parameters
----------
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
sep : str or unicode, optional
If `sep` is not specified or None, any whitespace s... | python | numpy/_core/strings.py | 1,400 | [
"a",
"sep",
"maxsplit"
] | false | 1 | 6.64 | numpy/numpy | 31,054 | numpy | false | |
startObject | public XContentBuilder startObject() throws IOException {
generator.writeStartObject();
return this;
} | @return the value of the "human readable" flag. When the value is equal to true,
some types of values are written in a format easier to read for a human. | java | libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentBuilder.java | 337 | [] | XContentBuilder | true | 1 | 6.96 | elastic/elasticsearch | 75,680 | javadoc | false |
requestOffsetResetIfPartitionAssigned | public synchronized void requestOffsetResetIfPartitionAssigned(TopicPartition partition) {
final TopicPartitionState state = assignedStateOrNull(partition);
if (state != null) {
state.reset(defaultResetStrategy);
}
} | Unset the preferred read replica. This causes the fetcher to go back to the leader for fetches.
@param tp The topic partition
@return the removed preferred read replica if set, Empty otherwise. | java | clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java | 800 | [
"partition"
] | void | true | 2 | 8.24 | apache/kafka | 31,560 | javadoc | false |
middleware | def middleware(
self,
middleware_type: Annotated[
str,
Doc(
"""
The type of middleware. Currently only supports `http`.
"""
),
],
) -> Callable[[DecoratedCallable], DecoratedCallable]:
"""
Add... | Add a middleware to the application.
Read more about it in the
[FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/).
## Example
```python
import time
from typing import Awaitable, Callable
from fastapi import FastAPI, Request, Response
app = FastAPI()
@app.middleware("http")
async def... | python | fastapi/applications.py | 4,578 | [
"self",
"middleware_type"
] | Callable[[DecoratedCallable], DecoratedCallable] | true | 1 | 6.8 | tiangolo/fastapi | 93,264 | unknown | false |
hasExpired | private boolean hasExpired() {
if (this.neverExpire) {
return false;
}
Duration timeToLive = this.timeToLive;
Instant lastAccessed = this.lastAccessed;
if (timeToLive == null || lastAccessed == null) {
return true;
}
return !UNLIMITED.equals(timeToLive) && now().isAfter(lastAccessed.plus(timeToLive)... | Get a value from the cache, creating it if necessary.
@param factory a factory used to create the item if there is no reference to it.
@param refreshAction action called to refresh the value if it has expired
@return the value from the cache | java | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SoftReferenceConfigurationPropertyCache.java | 115 | [] | true | 5 | 7.92 | spring-projects/spring-boot | 79,428 | javadoc | false | |
writePair | private <N, V> void writePair(N name, @Nullable V value) {
this.path = this.path.child(name.toString());
if (!isFilteredPath()) {
String processedName = processName(name.toString());
ActiveSeries activeSeries = this.activeSeries.peek();
Assert.state(activeSeries != null, "No series has been started");
a... | Write the specified pairs to an already started {@link Series#OBJECT object
series}.
@param <N> the name type in the pair
@param <V> the value type in the pair
@param pairs a callback that will be used to provide each pair. Typically a
{@code forEach} method reference.
@see #writePairs(Consumer) | java | core/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java | 247 | [
"name",
"value"
] | void | true | 3 | 6.88 | spring-projects/spring-boot | 79,428 | javadoc | false |
processEntry | async function processEntry(
entryPath: string,
entryType: FsEntryType | undefined,
filesResolver: FilesResolver,
): Promise<LoadedFile[]> {
if (!entryType) {
return []
}
if (entryType.kind === 'symlink') {
const realPath = entryType.realPath
const realType = await filesResolver.getEntryType(rea... | Given folder name, returns list of all files composing a single prisma schema
@param folderPath | typescript | packages/schema-files-loader/src/loadSchemaFiles.ts | 19 | [
"entryPath",
"entryType",
"filesResolver"
] | true | 7 | 6.08 | prisma/prisma | 44,834 | jsdoc | true | |
parseTypeOrTypePredicate | function parseTypeOrTypePredicate(): TypeNode {
const pos = getNodePos();
const typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
const type = parseType();
if (typePredicateVariable) {
return finishNode(factory.createTypePredicateNode(/*assert... | 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 | 4,912 | [] | true | 4 | 6.72 | microsoft/TypeScript | 107,154 | jsdoc | false | |
build_submit_sql_data | def build_submit_sql_data(
sql: str | None = None,
conf: dict[Any, Any] | None = None,
driver_resource_spec: str | None = None,
executor_resource_spec: str | None = None,
num_executors: int | str | None = None,
name: str | None = None,
) -> str:
"""
Bu... | Build the submit spark sql request data.
:param sql: The SQL query to execute. (templated)
:param conf: Spark configuration properties.
:param driver_resource_spec: The resource specifications of the Spark driver.
:param executor_resource_spec: The resource specifications of each Spark executor.
:param num_executors: ... | python | providers/alibaba/src/airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py | 260 | [
"sql",
"conf",
"driver_resource_spec",
"executor_resource_spec",
"num_executors",
"name"
] | str | true | 9 | 6.72 | apache/airflow | 43,597 | sphinx | false |
extract_array | def extract_array(
obj: T, extract_numpy: bool = False, extract_range: bool = False
) -> T | ArrayLike:
"""
Extract the ndarray or ExtensionArray from a Series or Index.
For all other types, `obj` is just returned as is.
Parameters
----------
obj : object
For Series / Index, the un... | Extract the ndarray or ExtensionArray from a Series or Index.
For all other types, `obj` is just returned as is.
Parameters
----------
obj : object
For Series / Index, the underlying ExtensionArray is unboxed.
extract_numpy : bool, default False
Whether to extract the ndarray from a NumpyExtensionArray.
ext... | python | pandas/core/construction.py | 430 | [
"obj",
"extract_numpy",
"extract_range"
] | T | ArrayLike | true | 6 | 8.48 | pandas-dev/pandas | 47,362 | numpy | false |
appendNewBatch | private RecordAppendResult appendNewBatch(String topic,
int partition,
Deque<ProducerBatch> dq,
long timestamp,
byte[] key,
... | Append a new batch to the queue
@param topic The topic
@param partition The partition (cannot be RecordMetadata.UNKNOWN_PARTITION)
@param dq The queue
@param timestamp The timestamp of the record
@param key The key for the record
@param value The value for the record
@param headers the Headers for the record
@param cal... | java | clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java | 375 | [
"topic",
"partition",
"dq",
"timestamp",
"key",
"value",
"headers",
"callbacks",
"buffer",
"nowMs"
] | RecordAppendResult | true | 3 | 6.4 | apache/kafka | 31,560 | javadoc | false |
kill_worker | def kill_worker(
self,
worker: CeleryTestWorker,
method: WorkerKill.Method,
) -> None:
"""Kill a Celery worker.
Args:
worker (CeleryTestWorker): Worker to kill.
method (WorkerKill.Method): The method to kill the worker.
"""
if method =... | Kill a Celery worker.
Args:
worker (CeleryTestWorker): Worker to kill.
method (WorkerKill.Method): The method to kill the worker. | python | t/smoke/operations/worker_kill.py | 19 | [
"self",
"worker",
"method"
] | None | true | 5 | 6.4 | celery/celery | 27,741 | google | false |
remove_unused_levels | def remove_unused_levels(self) -> MultiIndex:
"""
Create new MultiIndex from current that removes unused levels.
Unused level(s) means levels that are not expressed in the
labels. The resulting MultiIndex will have the same outward
appearance, meaning the same .values and orderi... | Create new MultiIndex from current that removes unused levels.
Unused level(s) means levels that are not expressed in the
labels. The resulting MultiIndex will have the same outward
appearance, meaning the same .values and ordering. It will
also be .equals() to the original.
The `remove_unused_levels` method is usefu... | python | pandas/core/indexes/multi.py | 2,123 | [
"self"
] | MultiIndex | true | 8 | 7.2 | pandas-dev/pandas | 47,362 | unknown | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.