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
img_to_graph
def img_to_graph(img, *, mask=None, return_as=sparse.coo_matrix, dtype=None): """Graph of the pixel-to-pixel gradient connections. Edges are weighted with the gradient values. Read more in the :ref:`User Guide <image_feature_extraction>`. Parameters ---------- img : array-like of shape (heigh...
Graph of the pixel-to-pixel gradient connections. Edges are weighted with the gradient values. Read more in the :ref:`User Guide <image_feature_extraction>`. Parameters ---------- img : array-like of shape (height, width) or (height, width, channel) 2D or 3D image. mask : ndarray of shape (height, width) or \ ...
python
sklearn/feature_extraction/image.py
152
[ "img", "mask", "return_as", "dtype" ]
false
1
6.32
scikit-learn/scikit-learn
64,340
numpy
false
firstBatchSize
public Integer firstBatchSize() { if (buffer.remaining() < HEADER_SIZE_UP_TO_MAGIC) return null; return new ByteBufferLogInputStream(buffer, Integer.MAX_VALUE).nextBatchSize(); }
Validates the header of the first batch and returns batch size. @return first batch size including LOG_OVERHEAD if buffer contains header up to magic byte, null otherwise @throws CorruptRecordException if record size or magic is invalid
java
clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
120
[]
Integer
true
2
7.76
apache/kafka
31,560
javadoc
false
parseObject
@Override public Object parseObject(final String source) throws ParseException { return parse(source); }
Parses a formatted date string according to the format. Updates the Calendar with parsed fields. Upon success, the ParsePosition index is updated to indicate how much of the source text was consumed. Not all source text needs to be consumed. Upon parse failure, ParsePosition error index is updated to the offset of the ...
java
src/main/java/org/apache/commons/lang3/time/FastDateParser.java
1,080
[ "source" ]
Object
true
1
6.8
apache/commons-lang
2,896
javadoc
false
getBean
protected <T> T getBean(String name, Class<T> serviceType) { if (this.beanFactory == null) { throw new IllegalStateException( "BeanFactory must be set on cache aspect for " + serviceType.getSimpleName() + " retrieval"); } return BeanFactoryAnnotationUtils.qualifiedBeanOfType(this.beanFactory, serviceType,...
Retrieve a bean with the specified name and type. Used to resolve services that are referenced by name in a {@link CacheOperation}. @param name the name of the bean, as defined by the cache operation @param serviceType the type expected by the operation's service reference @return the bean matching the expected type, q...
java
spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java
380
[ "name", "serviceType" ]
T
true
2
7.44
spring-projects/spring-framework
59,386
javadoc
false
visitThisKeyword
function visitThisKeyword(node: Node): Node { hierarchyFacts |= HierarchyFacts.LexicalThis; if (hierarchyFacts & HierarchyFacts.ArrowFunction && !(hierarchyFacts & HierarchyFacts.StaticInitializer)) { hierarchyFacts |= HierarchyFacts.CapturedLexicalThis; } if (convertedL...
Restores the `HierarchyFacts` for this node's ancestor after visiting this node's subtree, propagating specific facts from the subtree. @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree. @param excludeFacts The existing `HierarchyFacts` of the subtree that should not be ...
typescript
src/compiler/transformers/es2015.ts
854
[ "node" ]
true
6
6.4
microsoft/TypeScript
107,154
jsdoc
false
_entry_is_valid
def _entry_is_valid( cfg: dict[str, Any], template_id: str, template_hash_map: Optional[dict[str, Optional[str]]], ) -> bool: """ Check if a config entry is valid based on template hash validation. Args: cfg: Configuration dictionary that may contain a te...
Check if a config entry is valid based on template hash validation. Args: cfg: Configuration dictionary that may contain a template_hash field template_id: The template identifier template_hash_map: Optional mapping from template_uid to src_hash for validation Returns: True if the config is valid and ...
python
torch/_inductor/lookup_table/choices.py
147
[ "cfg", "template_id", "template_hash_map" ]
bool
true
9
7.68
pytorch/pytorch
96,034
google
false
indexOf
public static int indexOf(char[] array, char target) { return indexOf(array, target, 0, array.length); }
Returns the index of the first appearance of the value {@code target} in {@code array}. @param array an array of {@code char} values, possibly empty @param target a primitive {@code char} value @return the least index {@code i} for which {@code array[i] == target}, or {@code -1} if no such index exists.
java
android/guava/src/com/google/common/primitives/Chars.java
150
[ "array", "target" ]
true
1
6.48
google/guava
51,352
javadoc
false
getComputedFieldsFromModel
function getComputedFieldsFromModel( name: string | undefined, previousComputedFields: ComputedFieldsMap | undefined, modelResult: ResultArg | undefined, ): ComputedFieldsMap { if (!modelResult) { return {} } return mapObjectValues(modelResult, ({ needs, compute }, fieldName) => ({ name: fieldName,...
Given the list of previously resolved computed fields, new extension and dmmf model name, produces a map of all computed fields that may be applied to this model, accounting for all previous and past extensions. All naming conflicts which could be produced by the plain list of extensions are resolved as follows: - exte...
typescript
packages/client/src/runtime/core/extensions/resultUtils.ts
75
[ "name", "previousComputedFields", "modelResult" ]
true
3
7.76
prisma/prisma
44,834
jsdoc
false
addToken
private void addToken(final List<String> list, String tok) { if (StringUtils.isEmpty(tok)) { if (isIgnoreEmptyTokens()) { return; } if (isEmptyTokenAsNull()) { tok = null; } } list.add(tok); }
Adds a token to a list, paying attention to the parameters we've set. @param list the list to add to. @param tok the token to add.
java
src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
415
[ "list", "tok" ]
void
true
4
7.04
apache/commons-lang
2,896
javadoc
false
get_bucket
def get_bucket(self, bucket_name: str | None = None) -> S3Bucket: """ Return a :py:class:`S3.Bucket` object. .. seealso:: - :external+boto3:py:meth:`S3.ServiceResource.Bucket` :param bucket_name: the name of the bucket :return: the bucket object to the bucket name. ...
Return a :py:class:`S3.Bucket` object. .. seealso:: - :external+boto3:py:meth:`S3.ServiceResource.Bucket` :param bucket_name: the name of the bucket :return: the bucket object to the bucket name.
python
providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py
327
[ "self", "bucket_name" ]
S3Bucket
true
1
6.24
apache/airflow
43,597
sphinx
false
createBean
<T> T createBean(Class<T> beanClass) throws BeansException;
Fully create a new bean instance of the given class. <p>Performs full initialization of the bean, including all applicable {@link BeanPostProcessor BeanPostProcessors}. <p>Note: This is intended for creating a fresh instance, populating annotated fields and methods as well as applying all standard bean initialization c...
java
spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java
137
[ "beanClass" ]
T
true
1
6
spring-projects/spring-framework
59,386
javadoc
false
fit
def fit(self, X, y=None): """Fit the imputer on `X`. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Input data, where `n_samples` is the number of samples and `n_features` is the number of features. y : Ignored ...
Fit the imputer on `X`. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Input data, where `n_samples` is the number of samples and `n_features` is the number of features. y : Ignored Not used, present here for API consistency by convention. Returns ------- self : obje...
python
sklearn/impute/_base.py
430
[ "self", "X", "y" ]
false
7
6.08
scikit-learn/scikit-learn
64,340
numpy
false
pathJoin
function pathJoin(paths: string[]): string { return paths .flatMap((p) => p.split('/')) .filter(Boolean) .join('/'); }
Combines path parts together, without duplicating separators (slashes). Used instead of `path.join` because this code runs in the browser. @param paths Array of paths to join together. @returns Joined path string, with single '/' between parts
typescript
code/core/src/preview-api/modules/store/autoTitle.ts
42
[ "paths" ]
true
1
7.04
storybookjs/storybook
88,865
jsdoc
false
get_console_size
def get_console_size() -> tuple[int | None, int | None]: """ Return console size as tuple = (width, height). Returns (None,None) in non-interactive session. """ from pandas import get_option display_width = get_option("display.width") display_height = get_option("display.max_rows") # ...
Return console size as tuple = (width, height). Returns (None,None) in non-interactive session.
python
pandas/io/formats/console.py
10
[]
tuple[int | None, int | None]
true
7
6.72
pandas-dev/pandas
47,362
unknown
false
castCap
function castCap(name, func) { if (config.cap) { var indexes = mapping.iterateeRearg[name]; if (indexes) { return iterateeRearg(func, indexes); } var n = !isLib && mapping.iterateeAry[name]; if (n) { return iterateeAry(func, n); } } return func; }
Casts `func` to a function with an arity capped iteratee if needed. @private @param {string} name The name of the function to inspect. @param {Function} func The function to inspect. @returns {Function} Returns the cast function.
javascript
fp/_baseConvert.js
277
[ "name", "func" ]
false
5
6.24
lodash/lodash
61,490
jsdoc
false
_match_levels
def _match_levels( tensor: torch.Tensor, from_levels: list[DimEntry], to_levels: list[DimEntry], drop_levels: bool = False, ) -> torch.Tensor: """ Reshape a tensor to match target levels using as_strided. Args: tensor: Input tensor to reshape from_levels: Current levels of t...
Reshape a tensor to match target levels using as_strided. Args: tensor: Input tensor to reshape from_levels: Current levels of the tensor to_levels: Target levels to match drop_levels: If True, missing dimensions are assumed to have stride 0 Returns: Reshaped tensor
python
functorch/dim/_dim_entry.py
80
[ "tensor", "from_levels", "to_levels", "drop_levels" ]
torch.Tensor
true
7
7.92
pytorch/pytorch
96,034
google
false
trim_zeros
def trim_zeros(filt, trim='fb', axis=None): """Remove values along a dimension which are zero along all other. Parameters ---------- filt : array_like Input array. trim : {"fb", "f", "b"}, optional A string with 'f' representing trim from front and 'b' to trim from back. By ...
Remove values along a dimension which are zero along all other. Parameters ---------- filt : array_like Input array. trim : {"fb", "f", "b"}, optional A string with 'f' representing trim from front and 'b' to trim from back. By default, zeros are trimmed on both sides. Front and back refer to the edges...
python
numpy/lib/_function_base_impl.py
1,941
[ "filt", "trim", "axis" ]
false
11
7.76
numpy/numpy
31,054
numpy
false
_get_series_list
def _get_series_list(self, others): """ Auxiliary function for :meth:`str.cat`. Turn potentially mixed input into a list of Series (elements without an index must match the length of the calling Series/Index). Parameters ---------- others : Series, DataFrame, np....
Auxiliary function for :meth:`str.cat`. Turn potentially mixed input into a list of Series (elements without an index must match the length of the calling Series/Index). Parameters ---------- others : Series, DataFrame, np.ndarray, list-like or list-like of Objects that are either Series, Index or np.ndarray (1-di...
python
pandas/core/strings/accessor.py
418
[ "self", "others" ]
false
14
6
pandas-dev/pandas
47,362
numpy
false
loadBeanDefinitions
public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException { return loadBeanDefinitions(encodedResource, null); }
Load bean definitions from the specified properties file. @param encodedResource the resource descriptor for the properties file, allowing to specify an encoding to use for parsing the file @return the number of bean definitions found @throws BeanDefinitionStoreException in case of loading or parsing errors
java
spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java
237
[ "encodedResource" ]
true
1
6
spring-projects/spring-framework
59,386
javadoc
false
addInitializer
public void addInitializer(final String name, final BackgroundInitializer<?> backgroundInitializer) { Objects.requireNonNull(name, "name"); Objects.requireNonNull(backgroundInitializer, "backgroundInitializer"); synchronized (this) { if (isStarted()) { throw new Illeg...
Adds a new {@link BackgroundInitializer} to this object. When this {@link MultiBackgroundInitializer} is started, the given initializer will be processed. This method must not be called after {@link #start()} has been invoked. @param name the name of the initializer (must not be <strong>null</strong>)....
java
src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java
252
[ "name", "backgroundInitializer" ]
void
true
2
6.4
apache/commons-lang
2,896
javadoc
false
to_iceberg
def to_iceberg( df: DataFrame, table_identifier: str, catalog_name: str | None = None, *, catalog_properties: dict[str, Any] | None = None, location: str | None = None, append: bool = False, snapshot_properties: dict[str, str] | None = None, ) -> None: """ Write a DataFrame to an...
Write a DataFrame to an Apache Iceberg table. .. versionadded:: 3.0.0 Parameters ---------- table_identifier : str Table identifier. catalog_name : str, optional The name of the catalog. catalog_properties : dict of {str: str}, optional The properties that are used next to the catalog configuration. locat...
python
pandas/io/iceberg.py
100
[ "df", "table_identifier", "catalog_name", "catalog_properties", "location", "append", "snapshot_properties" ]
None
true
5
6.64
pandas-dev/pandas
47,362
numpy
false
get
public Object get(int index) throws JSONException { try { Object value = this.values.get(index); if (value == null) { throw new JSONException("Value at " + index + " is null."); } return value; } catch (IndexOutOfBoundsException e) { throw new JSONException("Index " + index + " out of range [0....
Returns the value at {@code index}. @param index the index to get the value from @return the value at {@code index}. @throws JSONException if this array has no value at {@code index}, or if that value is the {@code null} reference. This method returns normally if the value is {@code JSONObject#NULL}.
java
cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONArray.java
279
[ "index" ]
Object
true
3
8.24
spring-projects/spring-boot
79,428
javadoc
false
toString
@Override public String toString() { return "ItemIgnore{" + "type=" + this.type + ", name='" + this.name + '\'' + '}'; }
Create an ignore for a property with the given name. @param name the name @return the item ignore
java
configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemIgnore.java
82
[]
String
true
1
6.96
spring-projects/spring-boot
79,428
javadoc
false
fchownSync
function fchownSync(fd, uid, gid) { validateInteger(uid, 'uid', -1, kMaxUserId); validateInteger(gid, 'gid', -1, kMaxUserId); if (permission.isEnabled()) { throw new ERR_ACCESS_DENIED('fchown API is disabled when Permission Model is enabled.'); } binding.fchown(fd, uid, gid); }
Synchronously sets the owner of the file. @param {number} fd @param {number} uid @param {number} gid @returns {void}
javascript
lib/fs.js
2,093
[ "fd", "uid", "gid" ]
false
2
6.08
nodejs/node
114,839
jsdoc
false
binaryToHexDigit
public static char binaryToHexDigit(final boolean[] src) { return binaryToHexDigit(src, 0); }
Converts binary (represented as boolean array) to a hexadecimal digit using the default (LSB0) bit ordering. <p> (1, 0, 0, 0) is converted as follow: '1'. </p> @param src the binary to convert. @return a hexadecimal digit representing the selected bits. @throws IllegalArgumentException if {@code src} is empty. @throws ...
java
src/main/java/org/apache/commons/lang3/Conversion.java
184
[ "src" ]
true
1
6.64
apache/commons-lang
2,896
javadoc
false
transformModuleBody
function transformModuleBody(node: ModuleDeclaration, namespaceLocalName: Identifier): Block { const savedCurrentNamespaceContainerName = currentNamespaceContainerName; const savedCurrentNamespace = currentNamespace; const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclaratio...
Transforms the body of a module declaration. @param node The module declaration node.
typescript
src/compiler/transformers/ts.ts
2,168
[ "node", "namespaceLocalName" ]
true
9
6.64
microsoft/TypeScript
107,154
jsdoc
false
assignedPartitionsList
public synchronized List<TopicPartition> assignedPartitionsList() { return new ArrayList<>(this.assignment.partitionSet()); }
@return a modifiable copy of the currently assigned partitions as a list
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java
473
[]
true
1
6.16
apache/kafka
31,560
javadoc
false
iterator
@Override public Iterator<ObjectError> iterator() { return this.errors.iterator(); }
Return the list of all validation errors. @return the errors
java
core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationErrors.java
131
[]
true
1
6.8
spring-projects/spring-boot
79,428
javadoc
false
extractTargetClassFromFactoryBean
private Class<?> extractTargetClassFromFactoryBean(Class<?> factoryBeanType, ResolvableType beanType) { ResolvableType target = ResolvableType.forType(factoryBeanType).as(FactoryBean.class).getGeneric(0); if (target.getType().equals(Class.class)) { return target.toClass(); } else if (factoryBeanType.isAssign...
Extract the target class of a public {@link FactoryBean} based on its constructor. If the implementation does not resolve the target class because it itself uses a generic, attempt to extract it from the bean type. @param factoryBeanType the factory bean type @param beanType the bean type @return the target class to us...
java
spring-beans/src/main/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragments.java
110
[ "factoryBeanType", "beanType" ]
true
3
7.76
spring-projects/spring-framework
59,386
javadoc
false
hasProgrammaticallySetProfiles
private boolean hasProgrammaticallySetProfiles(Type type, @Nullable String environmentPropertyValue, Set<String> environmentPropertyProfiles, Set<String> environmentProfiles) { if (!StringUtils.hasLength(environmentPropertyValue)) { return !type.getDefaultValue().equals(environmentProfiles); } if (type.getD...
Create a new {@link Profiles} instance based on the {@link Environment} and {@link Binder}. @param environment the source environment @param binder the binder for profile properties @param additionalProfiles any additional active profiles
java
core/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java
122
[ "type", "environmentPropertyValue", "environmentPropertyProfiles", "environmentProfiles" ]
true
3
6.08
spring-projects/spring-boot
79,428
javadoc
false
generateCodeForInaccessibleFactoryMethod
private CodeBlock generateCodeForInaccessibleFactoryMethod( String beanName, Method factoryMethod, Class<?> targetClass) { this.generationContext.getRuntimeHints().reflection().registerMethod(factoryMethod, ExecutableMode.INVOKE); GeneratedMethod getInstanceMethod = generateGetInstanceSupplierMethod(method -> {...
Generate the instance supplier code. @param registeredBean the bean to handle @param instantiationDescriptor the executable to use to create the bean @return the generated code @since 6.1.7
java
spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java
293
[ "beanName", "factoryMethod", "targetClass" ]
CodeBlock
true
1
6.24
spring-projects/spring-framework
59,386
javadoc
false
initialize
@SuppressWarnings("unchecked") protected T initialize() throws E { try { return initializer.get(); } catch (final Exception e) { // Do this first so we don't pass a RuntimeException or Error into an exception constructor ExceptionUtils.throwUnchecked(e); ...
Creates and initializes the object managed by this {@code ConcurrentInitializer}. This method is called by {@link #get()} when the object is accessed for the first time. An implementation can focus on the creation of the object. No synchronization is needed, as this is already handled by {@code get()}. <p> Subclasses a...
java
src/main/java/org/apache/commons/lang3/concurrent/AbstractConcurrentInitializer.java
176
[]
T
true
3
8.08
apache/commons-lang
2,896
javadoc
false
validate
public ActionRequestValidationException validate() { ActionRequestValidationException err = new ActionRequestValidationException(); // how do we cross the id validation divide here? or do we? it seems unfortunate to not invoke it at all. // name validation if (Strings.hasText(name) == ...
An id is intended to be alphanumerics, dashes, and underscores (only), but we're reserving leading dashes and underscores for ourselves in the future, that is, they're not for the ones that users can PUT.
java
modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/direct/DatabaseConfiguration.java
190
[]
ActionRequestValidationException
true
8
7.04
elastic/elasticsearch
75,680
javadoc
false
get_conn_value
def get_conn_value(self, conn_id: str) -> str | None: """ Get serialized representation of Connection. :param conn_id: connection id """ if self.connections_prefix is None: return None secret = self._get_secret(self.connections_prefix, conn_id, self.connecti...
Get serialized representation of Connection. :param conn_id: connection id
python
providers/amazon/src/airflow/providers/amazon/aws/secrets/secrets_manager.py
200
[ "self", "conn_id" ]
str | None
true
4
6.56
apache/airflow
43,597
sphinx
false
createCJSModuleWrap
function createCJSModuleWrap(url, translateContext, parentURL, loadCJS = loadCJSModule) { debug(`Translating CJSModule ${url}`, translateContext); const { format: sourceFormat } = translateContext; let { source } = translateContext; const isMain = (parentURL === undefined); const filename = urlToFilename(url...
Creates a ModuleWrap object for a CommonJS module. @param {string} url - The URL of the module. @param {{ format: ModuleFormat, source: ModuleSource }} translateContext Context for the translator @param {string|undefined} parentURL URL of the module initiating the module loading for the first time. Undefined if it's ...
javascript
lib/internal/modules/esm/translators.js
217
[ "url", "translateContext", "parentURL" ]
false
11
6.08
nodejs/node
114,839
jsdoc
false
join
function join(array, separator) { return array == null ? '' : nativeJoin.call(array, separator); }
Converts all elements in `array` into a string separated by `separator`. @static @memberOf _ @since 4.0.0 @category Array @param {Array} array The array to convert. @param {string} [separator=','] The element separator. @returns {string} Returns the joined string. @example _.join(['a', 'b', 'c'], '~'); // => 'a~b~c'
javascript
lodash.js
7,694
[ "array", "separator" ]
false
2
7.12
lodash/lodash
61,490
jsdoc
false
getIpinfoLookup
@Nullable static Function<Set<Database.Property>, IpDataLookup> getIpinfoLookup(final Database database) { return switch (database) { case AsnV2 -> IpinfoIpDataLookups.Asn::new; case CountryV2 -> IpinfoIpDataLookups.Country::new; case CityV2 -> IpinfoIpDataLookups.Geoloca...
Cleans up the database_type String from an ipinfo database by splitting on punctuation, removing stop words, and then joining with an underscore. <p> e.g. "ipinfo free_foo_sample.mmdb" -> "foo" @param type the database_type from an ipinfo database @return a cleaned up database_type string
java
modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IpinfoIpDataLookups.java
114
[ "database" ]
true
1
7.04
elastic/elasticsearch
75,680
javadoc
false
inRange
function inRange(number, start, end) { start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { end = toFinite(end); } number = toNumber(number); return baseInRange(number, start, end); }
Checks if `n` is between `start` and up to, but not including, `end`. If `end` is not specified, it's set to `start` with `start` then set to `0`. If `start` is greater than `end` the params are swapped to support negative ranges. @static @memberOf _ @since 3.3.0 @category Number @param {number} number The number to ch...
javascript
lodash.js
14,142
[ "number", "start", "end" ]
false
3
7.52
lodash/lodash
61,490
jsdoc
false
update_range
def update_range(self, start: int, end: int, value: T) -> None: """ Update a range of values in the segment tree. Args: start: Start index of the range to update (inclusive) end: End index of the range to update (inclusive) value: Value to apply to the range ...
Update a range of values in the segment tree. Args: start: Start index of the range to update (inclusive) end: End index of the range to update (inclusive) value: Value to apply to the range Raises: ValueError: If start > end or indices are out of bounds
python
torch/_inductor/codegen/segmented_tree.py
196
[ "self", "start", "end", "value" ]
None
true
6
6.72
pytorch/pytorch
96,034
google
false
add
public boolean add(CompoundStat stat) { return add(stat, null); }
Register a compound statistic with this sensor with no config override @param stat The stat to register @return true if stat is added to sensor, false if sensor is expired
java
clients/src/main/java/org/apache/kafka/common/metrics/Sensor.java
279
[ "stat" ]
true
1
6.32
apache/kafka
31,560
javadoc
false
buildIndexedPropertyName
private @Nullable String buildIndexedPropertyName(@Nullable String propertyName, int index) { return (propertyName != null ? propertyName + PropertyAccessor.PROPERTY_KEY_PREFIX + index + PropertyAccessor.PROPERTY_KEY_SUFFIX : null); }
Convert the given text value using the given property editor. @param oldValue the previous value, if available (may be {@code null}) @param newTextValue the proposed text value @param editor the PropertyEditor to use @return the converted value
java
spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
626
[ "propertyName", "index" ]
String
true
2
7.6
spring-projects/spring-framework
59,386
javadoc
false
zfill
def zfill(self, width: int): """ Pad strings in the Series/Index by prepending '0' characters. Strings in the Series/Index are padded with '0' characters on the left of the string to reach a total string length `width`. Strings in the Series/Index with length greater or equal t...
Pad strings in the Series/Index by prepending '0' characters. Strings in the Series/Index are padded with '0' characters on the left of the string to reach a total string length `width`. Strings in the Series/Index with length greater or equal to `width` are unchanged. Parameters ---------- width : int Minimum l...
python
pandas/core/strings/accessor.py
1,891
[ "self", "width" ]
true
2
8.4
pandas-dev/pandas
47,362
numpy
false
reader
protected Reader reader(Path path) throws IOException { return Files.newBufferedReader(path, StandardCharsets.UTF_8); }
Retrieves the data with the given keys at the given Properties file. @param path the file where the data resides @param keys the keys whose values will be retrieved @return the configuration data
java
clients/src/main/java/org/apache/kafka/common/config/provider/FileConfigProvider.java
134
[ "path" ]
Reader
true
1
6.96
apache/kafka
31,560
javadoc
false
loadDocument
Document loadDocument( InputSource inputSource, EntityResolver entityResolver, ErrorHandler errorHandler, int validationMode, boolean namespaceAware) throws Exception;
Load a {@link Document document} from the supplied {@link InputSource source}. @param inputSource the source of the document that is to be loaded @param entityResolver the resolver that is to be used to resolve any entities @param errorHandler used to report any errors during document loading @param validationMode the ...
java
spring-beans/src/main/java/org/springframework/beans/factory/xml/DocumentLoader.java
45
[ "inputSource", "entityResolver", "errorHandler", "validationMode", "namespaceAware" ]
Document
true
1
6.16
spring-projects/spring-framework
59,386
javadoc
false
isSameInstant
public static boolean isSameInstant(final Date date1, final Date date2) { Objects.requireNonNull(date1, "date1"); Objects.requireNonNull(date2, "date2"); return date1.getTime() == date2.getTime(); }
Tests whether two date objects represent the same instant in time. <p>This method compares the long millisecond time of the two objects.</p> @param date1 the first date, not altered, not null. @param date2 the second date, not altered, not null. @return true if they represent the same millisecond instant. @throws Nul...
java
src/main/java/org/apache/commons/lang3/time/DateUtils.java
916
[ "date1", "date2" ]
true
1
6.88
apache/commons-lang
2,896
javadoc
false
checkDisconnects
private void checkDisconnects(long now) { // any disconnects affecting requests that have already been transmitted will be handled // by NetworkClient, so we just need to check whether connections for any of the unsent // requests have been disconnected; if they have, then we complete the corres...
Check whether there is pending request. This includes both requests that have been transmitted (i.e. in-flight requests) and those which are awaiting transmission. @return A boolean indicating whether there is pending request
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java
438
[ "now" ]
void
true
2
6.88
apache/kafka
31,560
javadoc
false
getExternallyManagedConfigMembers
public Set<Member> getExternallyManagedConfigMembers() { synchronized (this.postProcessingLock) { return (this.externallyManagedConfigMembers != null ? Collections.unmodifiableSet(new LinkedHashSet<>(this.externallyManagedConfigMembers)) : Collections.emptySet()); } }
Get all externally managed configuration methods and fields (as an immutable Set). @since 5.3.11
java
spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java
481
[]
true
2
6.88
spring-projects/spring-framework
59,386
javadoc
false
runDownloader
@Override void runDownloader() { if (isCancelled() || isCompleted()) { logger.debug("Not running downloader because task is cancelled or completed"); return; } // by the time we reach here, the state will never be null assert this.state != null : "this.state i...
This method fetches the database file for the given database from the passed-in source, then indexes that database file into the .geoip_databases Elasticsearch index, deleting any old versions of the database from the index if they exist. @param name The name of the database to be downloaded and indexed into an Elastic...
java
modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloader.java
385
[]
void
true
5
6.72
elastic/elasticsearch
75,680
javadoc
false
intersect1d
def intersect1d(ar1, ar2, assume_unique=False, return_indices=False): """ Find the intersection of two arrays. Return the sorted, unique values that are in both of the input arrays. Parameters ---------- ar1, ar2 : array_like Input arrays. Will be flattened if not already 1D. assum...
Find the intersection of two arrays. Return the sorted, unique values that are in both of the input arrays. Parameters ---------- ar1, ar2 : array_like Input arrays. Will be flattened if not already 1D. assume_unique : bool If True, the input arrays are both assumed to be unique, which can speed up the ca...
python
numpy/lib/_arraysetops_impl.py
667
[ "ar1", "ar2", "assume_unique", "return_indices" ]
false
10
7.6
numpy/numpy
31,054
numpy
false
pprint_thing
def pprint_thing( thing: object, _nest_lvl: int = 0, escape_chars: EscapeChars | None = None, default_escapes: bool = False, quote_strings: bool = False, max_seq_items: int | None = None, ) -> str: """ This function is the sanctioned way of converting objects to a string representati...
This function is the sanctioned way of converting objects to a string representation and properly handles nested sequences. Parameters ---------- thing : anything to be formatted _nest_lvl : internal use only. pprint_thing() is mutually-recursive with pprint_sequence, this argument is used to keep track of the ...
python
pandas/io/formats/printing.py
174
[ "thing", "_nest_lvl", "escape_chars", "default_escapes", "quote_strings", "max_seq_items" ]
str
true
15
6.8
pandas-dev/pandas
47,362
numpy
false
collect
@SafeVarargs public static <T, R, A> R collect(final Collector<? super T, A, R> collector, final T... array) { return Streams.of(array).collect(collector); }
Delegates to {@link Stream#collect(Collector)} for a Stream on the given array. @param <T> The type of the array elements. @param <R> the type of the result. @param <A> the intermediate accumulation type of the {@code Collector}. @param collector the {@code Collector} describing the reduction. @param ...
java
src/main/java/org/apache/commons/lang3/stream/LangCollectors.java
110
[ "collector" ]
R
true
1
6.64
apache/commons-lang
2,896
javadoc
false
finalize
@SuppressWarnings({"removal", "Finalize"}) // b/260137033 @Override protected void finalize() { if (state.get().equals(OPEN)) { logger.get().log(SEVERE, "Uh oh! An open ClosingFuture has leaked and will close: {0}", this); FluentFuture<V> unused = finishToFuture(); } }
A generic {@link Combiner} that lets you use a lambda or method reference to combine five {@link ClosingFuture}s. Use {@link #whenAllSucceed(ClosingFuture, ClosingFuture, ClosingFuture, ClosingFuture, ClosingFuture)} to start this combination. @param <V1> the type returned by the first future @param <V2> the type retur...
java
android/guava/src/com/google/common/util/concurrent/ClosingFuture.java
2,096
[]
void
true
2
6.56
google/guava
51,352
javadoc
false
optimizedTextOrNull
XContentString optimizedTextOrNull() throws IOException;
Returns an instance of {@link Map} holding parsed map. Serves as a replacement for the "map", "mapOrdered" and "mapStrings" methods above. @param mapFactory factory for creating new {@link Map} objects @param mapValueParser parser for parsing a single map value @param <T> map value type @return {@link Map} object
java
libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParser.java
114
[]
XContentString
true
1
6.32
elastic/elasticsearch
75,680
javadoc
false
setUncaughtExceptionCaptureCallback
function setUncaughtExceptionCaptureCallback(fn) { if (fn === null) { exceptionHandlerState.captureFn = fn; shouldAbortOnUncaughtToggle[0] = 1; process.report.reportOnUncaughtException = exceptionHandlerState.reportFlag; return; } if (typeof fn !== 'function') { throw new ERR_INVALID_ARG_TYPE(...
Evaluate an ESM entry point and return the promise that gets fulfilled after it finishes evaluation. @param {string} source Source code the ESM @param {boolean} print Whether the result should be printed. @returns {Promise}
javascript
lib/internal/process/execution.js
112
[ "fn" ]
false
4
6.08
nodejs/node
114,839
jsdoc
false
write_gh_step_summary
def write_gh_step_summary(md: str, *, append_content: bool = True) -> bool: """ Write Markdown content to the GitHub Step Summary file if GITHUB_STEP_SUMMARY is set. append_content: default true, if True, append to the end of the file, else overwrite the whole file Returns: True if written succ...
Write Markdown content to the GitHub Step Summary file if GITHUB_STEP_SUMMARY is set. append_content: default true, if True, append to the end of the file, else overwrite the whole file Returns: True if written successfully (in GitHub Actions environment), False if skipped (e.g., running locally where the vari...
python
.ci/lumen_cli/cli/lib/common/gh_summary.py
61
[ "md", "append_content" ]
bool
true
3
7.92
pytorch/pytorch
96,034
unknown
false
ensure_plugins_loaded
def ensure_plugins_loaded(): """ Load plugins from plugins directory and entrypoints. Plugins are only loaded if they have not been previously loaded. """ from airflow.observability.stats import Stats global plugins if plugins is not None: log.debug("Plugins are already loaded. Sk...
Load plugins from plugins directory and entrypoints. Plugins are only loaded if they have not been previously loaded.
python
airflow-core/src/airflow/plugins_manager.py
334
[]
false
5
6.08
apache/airflow
43,597
unknown
false
close
public static void close(final Exception ex, final Closeable... objects) throws IOException { Exception firstException = ex; for (final Closeable object : objects) { try { close(object); } catch (final IOException | RuntimeException e) { firstExcep...
Closes all given {@link Closeable}s. Some of the {@linkplain Closeable}s may be null; they are ignored. After everything is closed, the method adds any exceptions as suppressed to the original exception, or throws the first exception it hit if {@code Exception} is null. If no exceptions are encountered and the passed i...
java
libs/core/src/main/java/org/elasticsearch/core/IOUtils.java
83
[ "ex" ]
void
true
3
6.88
elastic/elasticsearch
75,680
javadoc
false
inner
def inner(*args: _P.args, **kwargs: _P.kwargs) -> _R: """Call the original function and cache the result. Args: *args: Positional arguments to pass to the function. **kwargs: Keyword arguments to pass to the function. Returns: ...
Call the original function and cache the result. Args: *args: Positional arguments to pass to the function. **kwargs: Keyword arguments to pass to the function. Returns: The result of calling the original function.
python
torch/_inductor/runtime/caching/interfaces.py
467
[]
_R
true
5
8.08
pytorch/pytorch
96,034
google
false
_sign_bundle_url
def _sign_bundle_url(url: str, bundle_name: str) -> str: """ Sign a bundle URL for integrity verification. :param url: The URL to sign :param bundle_name: The name of the bundle (used in the payload) :return: The signed URL token """ serializer = URLSafeSerializer(conf.get_mandatory_value("...
Sign a bundle URL for integrity verification. :param url: The URL to sign :param bundle_name: The name of the bundle (used in the payload) :return: The signed URL token
python
airflow-core/src/airflow/dag_processing/bundles/manager.py
148
[ "url", "bundle_name" ]
str
true
1
7.04
apache/airflow
43,597
sphinx
false
toString
@Override public String toString() { return getDir().toString(); }
Returns the application home directory. @return the home directory (never {@code null})
java
core/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java
174
[]
String
true
1
6.32
spring-projects/spring-boot
79,428
javadoc
false
_compute_oob_predictions
def _compute_oob_predictions(self, X, y): """Compute and set the OOB score. Parameters ---------- X : array-like of shape (n_samples, n_features) The data matrix. y : ndarray of shape (n_samples, n_outputs) The target matrix. Returns ----...
Compute and set the OOB score. Parameters ---------- X : array-like of shape (n_samples, n_features) The data matrix. y : ndarray of shape (n_samples, n_outputs) The target matrix. Returns ------- oob_pred : ndarray of shape (n_samples, n_classes, n_outputs) or \ (n_samples, 1, n_outputs) The OOB ...
python
sklearn/ensemble/_forest.py
558
[ "self", "X", "y" ]
false
8
6
scikit-learn/scikit-learn
64,340
numpy
false
_validate_usecols_arg
def _validate_usecols_arg(usecols): """ Validate the 'usecols' parameter. Checks whether or not the 'usecols' parameter contains all integers (column selection by index), strings (column by name) or is a callable. Raises a ValueError if that is not the case. Parameters ---------- useco...
Validate the 'usecols' parameter. Checks whether or not the 'usecols' parameter contains all integers (column selection by index), strings (column by name) or is a callable. Raises a ValueError if that is not the case. Parameters ---------- usecols : list-like, callable, or None List of columns to use when parsin...
python
pandas/io/parsers/base_parser.py
921
[ "usecols" ]
false
5
6.08
pandas-dev/pandas
47,362
numpy
false
connecting
public void connecting(String id, long now, String host) { NodeConnectionState connectionState = nodeState.get(id); if (connectionState != null && connectionState.host().equals(host)) { connectionState.lastConnectAttemptMs = now; connectionState.state = ConnectionState.CONNECTING...
Enter the connecting state for the given connection, moving to a new resolved address if necessary. @param id the id of the connection @param now the current time in ms @param host the host of the connection, to be resolved internally if needed
java
clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java
147
[ "id", "now", "host" ]
void
true
4
7.04
apache/kafka
31,560
javadoc
false
make_checkerboard
def make_checkerboard( shape, n_clusters, *, noise=0.0, minval=10, maxval=100, shuffle=True, random_state=None, ): """Generate an array with block checkerboard structure for biclustering. Read more in the :ref:`User Guide <sample_generators>`. Parameters ---------- ...
Generate an array with block checkerboard structure for biclustering. Read more in the :ref:`User Guide <sample_generators>`. Parameters ---------- shape : tuple of shape (n_rows, n_cols) The shape of the result. n_clusters : int or array-like or shape (n_row_clusters, n_column_clusters) The number of row an...
python
sklearn/datasets/_samples_generator.py
2,256
[ "shape", "n_clusters", "noise", "minval", "maxval", "shuffle", "random_state" ]
false
7
7.12
scikit-learn/scikit-learn
64,340
numpy
false
createImportCallExpressionUMD
function createImportCallExpressionUMD(arg: Expression, containsLexicalThis: boolean): Expression { // (function (factory) { // ... (regular UMD) // } // })(function (require, exports, useSyncRequire) { // "use strict"; // Object.defineProperty(export...
Visits the body of a Block to hoist declarations. @param node The node to visit.
typescript
src/compiler/transformers/module/module.ts
1,232
[ "arg", "containsLexicalThis" ]
true
5
6.72
microsoft/TypeScript
107,154
jsdoc
false
startAsync
@CanIgnoreReturnValue @Override public final Service startAsync() { if (monitor.enterIf(isStartable)) { try { snapshot = new StateSnapshot(STARTING); enqueueStartingEvent(); doStart(); } catch (Throwable startupFailure) { restoreInterruptIfIsInterruptedException(start...
This method is called by {@link #stopAsync} when the service is still starting (i.e. {@link #startAsync} has been called but {@link #notifyStarted} has not). Subclasses can override the method to cancel pending work and then call {@link #notifyStopped} to stop the service. <p>This method should return promptly; prefer ...
java
android/guava/src/com/google/common/util/concurrent/AbstractService.java
243
[]
Service
true
3
6.88
google/guava
51,352
javadoc
false
errorForResponse
public abstract Errors errorForResponse(R response);
Returns the error for the response. @param response The heartbeat response @return The error {@link Errors}
java
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractHeartbeatRequestManager.java
507
[ "response" ]
Errors
true
1
6.8
apache/kafka
31,560
javadoc
false
get_dag_by_file_location
def get_dag_by_file_location(dag_id: str): """Return DAG of a given dag_id by looking up file location.""" # TODO: AIP-66 - investigate more, can we use serdag? from airflow.dag_processing.dagbag import DagBag from airflow.models import DagModel # Benefit is that logging from other dags in dagbag w...
Return DAG of a given dag_id by looking up file location.
python
airflow-core/src/airflow/utils/cli.py
230
[ "dag_id" ]
true
2
6
apache/airflow
43,597
unknown
false
streamPropertySources
private static Stream<PropertySource<?>> streamPropertySources(PropertySources sources) { return sources.stream() .flatMap(ConfigurationPropertySources::flatten) .filter(ConfigurationPropertySources::isIncluded); }
Return {@link Iterable} containing new {@link ConfigurationPropertySource} instances adapted from the given Spring {@link PropertySource PropertySources}. <p> This method will flatten any nested property sources and will filter all {@link StubPropertySource stub property sources}. Updates to the underlying source, iden...
java
core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java
160
[ "sources" ]
true
1
6.24
spring-projects/spring-boot
79,428
javadoc
false
logNonMatchingType
private void logNonMatchingType(C callback, ClassCastException ex) { if (this.logger.isDebugEnabled()) { Class<?> expectedType = ResolvableType.forClass(this.callbackType).resolveGeneric(); String expectedTypeName = (expectedType != null) ? ClassUtils.getShortName(expectedType) + " type" : "type"; ...
Use a specific filter to determine when a callback should apply. If no explicit filter is set filter will be attempted using the generic type on the callback type. @param filter the filter to use @return this instance @since 3.4.8
java
core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java
217
[ "callback", "ex" ]
void
true
3
8.24
spring-projects/spring-boot
79,428
javadoc
false
commit_sha
def commit_sha(): """Returns commit SHA of current repo. Cached for various usages.""" command_result = run_command(["git", "rev-parse", "HEAD"], capture_output=True, text=True, check=False) if command_result.stdout: return command_result.stdout.strip() return "COMMIT_SHA_NOT_FOUND"
Returns commit SHA of current repo. Cached for various usages.
python
dev/breeze/src/airflow_breeze/utils/run_utils.py
413
[]
false
2
6.08
apache/airflow
43,597
unknown
false
close
@Override public void close() { if (closed) { assert false : "ExponentialHistogramMerger closed multiple times"; } else { closed = true; if (result != null) { result.close(); result = null; } if (buffer != nu...
Creates a new instance with the specified bucket limit. @param bucketLimit the maximum number of buckets the result histogram is allowed to have, must be at least 4 @param circuitBreaker the circuit breaker to use to limit memory allocations
java
libs/exponential-histogram/src/main/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramMerger.java
110
[]
void
true
4
6.56
elastic/elasticsearch
75,680
javadoc
false
asToken
function asToken<TKind extends SyntaxKind>(value: TKind | Token<TKind>): Token<TKind> { return typeof value === "number" ? createToken(value) : value; }
Lifts a NodeArray containing only Statement nodes to a block. @param nodes The NodeArray.
typescript
src/compiler/factory/nodeFactory.ts
7,157
[ "value" ]
true
2
6.64
microsoft/TypeScript
107,154
jsdoc
false
redirect
def redirect( location: str, code: int = 302, Response: type[BaseResponse] | None = None ) -> BaseResponse: """Create a redirect response object. If :data:`~flask.current_app` is available, it will use its :meth:`~flask.Flask.redirect` method, otherwise it will use :func:`werkzeug.utils.redirect`. ...
Create a redirect response object. If :data:`~flask.current_app` is available, it will use its :meth:`~flask.Flask.redirect` method, otherwise it will use :func:`werkzeug.utils.redirect`. :param location: The URL to redirect to. :param code: The status code for the redirect. :param Response: The response class to use...
python
src/flask/helpers.py
241
[ "location", "code", "Response" ]
BaseResponse
true
2
6.4
pallets/flask
70,946
sphinx
false
toLong
public Long toLong() { return Long.valueOf(longValue()); }
Gets this mutable as an instance of Long. @return a Long instance containing the value from this mutable, never null.
java
src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
363
[]
Long
true
1
6.96
apache/commons-lang
2,896
javadoc
false
instantiate
@Override public Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner) { // Don't override the class with CGLIB if no overrides. if (!bd.hasMethodOverrides()) { Constructor<?> constructorToUse; synchronized (bd.constructorArgumentLock) { constructorToUse = (Constructor<?...
Invoke the given {@code instanceSupplier} with the factory method exposed as being invoked. @param method the factory method to expose @param instanceSupplier the instance supplier @param <T> the type of the instance @return the result of the instance supplier @since 6.2
java
spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java
85
[ "bd", "beanName", "owner" ]
Object
true
5
7.76
spring-projects/spring-framework
59,386
javadoc
false
_are_inputs_layout_compatible
def _are_inputs_layout_compatible(self, layouts: list[Layout]) -> bool: """ Evaluates whether input layouts are compatible for General Matrix Multiply (GEMM). This function checks compatibility of A, B, and possibly C operand layouts for a General Matrix Multiply (GEMM) operation, expre...
Evaluates whether input layouts are compatible for General Matrix Multiply (GEMM). This function checks compatibility of A, B, and possibly C operand layouts for a General Matrix Multiply (GEMM) operation, expressed as 'alpha * matmul(A, B) + beta * C'. It verifies requirements such as matching data types, minimum ran...
python
torch/_inductor/codegen/cuda/gemm_template.py
1,390
[ "self", "layouts" ]
bool
true
30
6.64
pytorch/pytorch
96,034
google
false
escapeUnsafe
protected abstract char @Nullable [] escapeUnsafe(int cp);
Escapes a code point that has no direct explicit value in the replacement array and lies outside the stated safe range. Subclasses should override this method to provide generalized escaping for code points if required. <p>Note that arrays returned by this method must not be modified once they have been returned. Howev...
java
android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java
204
[ "cp" ]
true
1
6.8
google/guava
51,352
javadoc
false
ultimateTargetClass
public static Class<?> ultimateTargetClass(Object candidate) { Assert.notNull(candidate, "Candidate object must not be null"); Object current = candidate; Class<?> result = null; while (current instanceof TargetClassAware targetClassAware) { result = targetClassAware.getTargetClass(); current = getSinglet...
Determine the ultimate target class of the given bean instance, traversing not only a top-level proxy but any number of nested proxies as well &mdash; as long as possible without side effects, that is, just for singleton targets. @param candidate the instance to check (might be an AOP proxy) @return the ultimate target...
java
spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java
82
[ "candidate" ]
true
4
7.92
spring-projects/spring-framework
59,386
javadoc
false
empty
def empty(shape, dtype=None, order='C'): """Return a new matrix of given shape and type, without initializing entries. Parameters ---------- shape : int or tuple of int Shape of the empty matrix. dtype : data-type, optional Desired output data-type. order : {'C', 'F'}, optional ...
Return a new matrix of given shape and type, without initializing entries. Parameters ---------- shape : int or tuple of int Shape of the empty matrix. dtype : data-type, optional Desired output data-type. order : {'C', 'F'}, optional Whether to store multi-dimensional data in row-major (C-style) or co...
python
numpy/matlib.py
25
[ "shape", "dtype", "order" ]
false
1
6
numpy/numpy
31,054
numpy
false
combine
@CanIgnoreReturnValue Builder<E> combine(Builder<E> other) { requireNonNull(impl); requireNonNull(other.impl); /* * For discussion of requireNonNull, see the comment on the field. * * (And I don't believe there's any situation in which we call x.combine(y) when x is a plain ...
Adds each element of {@code elements} to the {@code ImmutableSet}, ignoring duplicate elements (only the first duplicate element is added). @param elements the elements to add @return this {@code Builder} object @throws NullPointerException if {@code elements} is null or contains a null element
java
guava/src/com/google/common/collect/ImmutableSet.java
556
[ "other" ]
true
1
6.56
google/guava
51,352
javadoc
false
indexer_at_time
def indexer_at_time(self, time, asof: bool = False) -> npt.NDArray[np.intp]: """ Return index locations of values at particular time of day. Parameters ---------- time : datetime.time or str Time passed in either as object (datetime.time) or as string in ...
Return index locations of values at particular time of day. Parameters ---------- time : datetime.time or str Time passed in either as object (datetime.time) or as string in appropriate format ("%H:%M", "%H%M", "%I:%M%p", "%I%M%p", "%H:%M:%S", "%H%M%S", "%I:%M:%S%p", "%I%M%S%p"). asof : bool, default False...
python
pandas/core/indexes/datetimes.py
1,102
[ "self", "time", "asof" ]
npt.NDArray[np.intp]
true
8
8.08
pandas-dev/pandas
47,362
numpy
false
period_array
def period_array( data: Sequence[Period | str | None] | AnyArrayLike, freq: str | Tick | BaseOffset | None = None, copy: bool = False, ) -> PeriodArray: """ Construct a new PeriodArray from a sequence of Period scalars. Parameters ---------- data : Sequence of Period objects A s...
Construct a new PeriodArray from a sequence of Period scalars. Parameters ---------- data : Sequence of Period objects A sequence of Period objects. These are required to all have the same ``freq.`` Missing values can be indicated by ``None`` or ``pandas.NaT``. freq : str, Tick, or Offset The frequency...
python
pandas/core/arrays/period.py
1,193
[ "data", "freq", "copy" ]
PeriodArray
true
12
8.08
pandas-dev/pandas
47,362
numpy
false
serialize
@SuppressWarnings("resource") // outputStream is managed by the caller public static void serialize(final Serializable obj, final OutputStream outputStream) { Objects.requireNonNull(outputStream, "outputStream"); try (ObjectOutputStream out = new ObjectOutputStream(outputStream)) { out.w...
Serializes an {@link Object} to the specified stream. <p>The stream will be closed once the object is written. This avoids the need for a finally clause, and maybe also exception handling, in the application code.</p> <p>The stream passed in is not buffered internally within this method. This is the responsibility of y...
java
src/main/java/org/apache/commons/lang3/SerializationUtils.java
256
[ "obj", "outputStream" ]
void
true
2
6.72
apache/commons-lang
2,896
javadoc
false
appendWithSeparators
public StrBuilder appendWithSeparators(final Object[] array, final String separator) { if (array != null && array.length > 0) { final String sep = Objects.toString(separator, ""); append(array[0]); for (int i = 1; i < array.length; i++) { append(sep); ...
Appends an array placing separators between each value, but not before the first or after the last. Appending a null array will have no effect. Each object is appended using {@link #append(Object)}. @param array the array to append @param separator the separator to use, null means no separator @return {@code this} in...
java
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
1,450
[ "array", "separator" ]
StrBuilder
true
4
8.24
apache/commons-lang
2,896
javadoc
false
nullToEmpty
public static Long[] nullToEmpty(final Long[] array) { return nullTo(array, EMPTY_LONG_OBJECT_ARRAY); }
Defensive programming technique to change a {@code null} reference to an empty one. <p> This method returns an empty array for a {@code null} input array. </p> <p> As a memory optimizing technique an empty array passed in will be overridden with the empty {@code public static} references in this class. </p> @param arra...
java
src/main/java/org/apache/commons/lang3/ArrayUtils.java
4,546
[ "array" ]
true
1
6.96
apache/commons-lang
2,896
javadoc
false
ensureOpenForRecordAppend
private void ensureOpenForRecordAppend() { if (appendStream == CLOSED_STREAM) throw new IllegalStateException("Tried to append a record, but MemoryRecordsBuilder is closed for record appends"); }
Append the record at the next consecutive offset. If no records have been appended yet, use the base offset of this builder. @param record The record to add
java
clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java
804
[]
void
true
2
6.96
apache/kafka
31,560
javadoc
false
format
@Override public StringBuffer format(final Date date, final StringBuffer buf) { final Calendar c = newCalendar(); c.setTime(date); return (StringBuffer) applyRules(c, (Appendable) buf); }
Compares two objects for equality. @param obj the object to compare to. @return {@code true} if equal.
java
src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
1,172
[ "date", "buf" ]
StringBuffer
true
1
7.04
apache/commons-lang
2,896
javadoc
false
indexOf
public int indexOf(final StrMatcher matcher, int startIndex) { startIndex = Math.max(startIndex, 0); if (matcher == null || startIndex >= size) { return -1; } final int len = size; final char[] buf = buffer; for (int i = startIndex; i < len; i++) { ...
Searches the string builder using the matcher to find the first match searching from the given index. <p> Matchers can be used to perform advanced searching behavior. For example you could write a matcher to find the character 'a' followed by a number. </p> @param matcher the matcher to use, null returns -1 @param sta...
java
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
2,070
[ "matcher", "startIndex" ]
true
5
8.08
apache/commons-lang
2,896
javadoc
false
is_scipy_sparse
def is_scipy_sparse(arr) -> bool: """ Check whether an array-like is a scipy.sparse.spmatrix instance. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a scipy.sparse.spmatrix instance. Notes ...
Check whether an array-like is a scipy.sparse.spmatrix instance. Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a scipy.sparse.spmatrix instance. Notes ----- If scipy is not installed, this function will always return False. Examples ...
python
pandas/core/dtypes/common.py
250
[ "arr" ]
bool
true
2
7.84
pandas-dev/pandas
47,362
numpy
false
nextFloat
@Deprecated public static float nextFloat() { return secure().randomFloat(); }
Generates a random float between 0 (inclusive) and Float.MAX_VALUE (exclusive). @return the random float. @see #nextFloat(float, float) @since 3.5 @deprecated Use {@link #secure()}, {@link #secureStrong()}, or {@link #insecure()}.
java
src/main/java/org/apache/commons/lang3/RandomUtils.java
166
[]
true
1
6.32
apache/commons-lang
2,896
javadoc
false
startsWithArgumentClassName
private boolean startsWithArgumentClassName(String message) { Predicate<@Nullable Object> startsWith = (argument) -> startsWithArgumentClassName(message, argument); return startsWith.test(this.argument) || additionalArgumentsStartsWith(startsWith); }
Use a specific filter to determine when a callback should apply. If no explicit filter is set filter will be attempted using the generic type on the callback type. @param filter the filter to use @return this instance @since 3.4.8
java
core/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java
177
[ "message" ]
true
2
8.16
spring-projects/spring-boot
79,428
javadoc
false
getCacheStats
public CacheStats getCacheStats() { Cache.Stats stats = cache.stats(); return new CacheStats( cache.count(), stats.getHits(), stats.getMisses(), stats.getEvictions(), TimeValue.nsecToMSec(hitsTimeInNanos.sum()), TimeValue.nsecToMSec...
Returns stats about this cache as of this moment. There is no guarantee that the counts reconcile (for example hits + misses = count) because no locking is performed when requesting these stats. @return Current stats about this cache
java
modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpCache.java
122
[]
CacheStats
true
1
7.04
elastic/elasticsearch
75,680
javadoc
false
_read
def _read( obj: FilePath | BaseBuffer, encoding: str | None, storage_options: StorageOptions | None, ) -> str | bytes: """ Try to read from a url, file or string. Parameters ---------- obj : str, unicode, path object, or file-like object Returns ------- raw_text : str "...
Try to read from a url, file or string. Parameters ---------- obj : str, unicode, path object, or file-like object Returns ------- raw_text : str
python
pandas/io/html.py
117
[ "obj", "encoding", "storage_options" ]
str | bytes
true
2
7.04
pandas-dev/pandas
47,362
numpy
false
get
@ParametricNullness public static <T extends @Nullable Object> T get(Iterable<T> iterable, int position) { checkNotNull(iterable); return (iterable instanceof List) ? ((List<T>) iterable).get(position) : Iterators.get(iterable.iterator(), position); }
Returns the element at the specified position in an iterable. <p><b>{@code Stream} equivalent:</b> {@code stream.skip(position).findFirst().get()} (throws {@code NoSuchElementException} if out of bounds) @param position position of the element to return @return the element at the specified position in {@code iterable} ...
java
android/guava/src/com/google/common/collect/Iterables.java
776
[ "iterable", "position" ]
T
true
2
7.44
google/guava
51,352
javadoc
false
deleteWhitespace
public static String deleteWhitespace(final String str) { if (isEmpty(str)) { return str; } final int sz = str.length(); final char[] chs = new char[sz]; int count = 0; for (int i = 0; i < sz; i++) { if (!Character.isWhitespace(str.charAt(i))) { ...
Deletes all whitespaces from a String as defined by {@link Character#isWhitespace(char)}. <pre> StringUtils.deleteWhitespace(null) = null StringUtils.deleteWhitespace("") = "" StringUtils.deleteWhitespace("abc") = "abc" StringUtils.deleteWhitespace(" ab c ") = "abc" </pre> @param str the St...
java
src/main/java/org/apache/commons/lang3/StringUtils.java
1,617
[ "str" ]
String
true
6
7.76
apache/commons-lang
2,896
javadoc
false
getBestScoringError
function getBestScoringError(errors: NonUnionError[]) { return maxWithComparator(errors, (errorA, errorB) => { const aPathLength = getCombinedPathLength(errorA) const bPathLength = getCombinedPathLength(errorB) if (aPathLength !== bPathLength) { return aPathLength - bPathLength } return getE...
Function that attempts to pick the best error from the list by ranking them. In most cases, highest ranking error would be the one which has the longest combined "selectionPath" + "argumentPath". Justification for that is that type that made it deeper into validation tree before failing is probably closer to the one us...
typescript
packages/client/src/runtime/core/errorRendering/applyUnionError.ts
99
[ "errors" ]
false
2
7.12
prisma/prisma
44,834
jsdoc
false
find_airflow_root_path_to_operate_on
def find_airflow_root_path_to_operate_on() -> Path: """ Find the root of airflow sources we operate on. Handle the case when Breeze is installed via `pipx` or `uv tool` from a different source tree, so it searches upwards of the current directory to find the right root of airflow directory we are actual...
Find the root of airflow sources we operate on. Handle the case when Breeze is installed via `pipx` or `uv tool` from a different source tree, so it searches upwards of the current directory to find the right root of airflow directory we are actually in. This **might** be different than the sources of Airflow Breeze wa...
python
dev/breeze/src/airflow_breeze/utils/path_utils.py
185
[]
Path
true
6
8.24
apache/airflow
43,597
unknown
false
connectionDelay
long connectionDelay(Node node, long now);
Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects the reconnect backoff time. When connecting or connected, this handles slow/stalled connections. @param node The node to check @param now The current timestamp @return The number of...
java
clients/src/main/java/org/apache/kafka/clients/KafkaClient.java
59
[ "node", "now" ]
true
1
6.8
apache/kafka
31,560
javadoc
false
setAsText
@Override public void setAsText(@Nullable String text) throws IllegalArgumentException { Properties props = new Properties(); if (text != null) { try { // Must use the ISO-8859-1 encoding because Properties.load(stream) expects it. props.load(new ByteArrayInputStream(text.getBytes(StandardCharsets.ISO_8...
Convert {@link String} into {@link Properties}, considering it as properties content. @param text the text to be so converted
java
spring-beans/src/main/java/org/springframework/beans/propertyeditors/PropertiesEditor.java
49
[ "text" ]
void
true
3
7.04
spring-projects/spring-framework
59,386
javadoc
false