Datasets:
nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setAxisMaxLabels | The maximum number of labels on the axis | public setAxisMaxLabels(labels: number): void {
if (labels > 0)
this.mAxisMaxLabels = labels;
} | AST#method_declaration#Left public setAxisMaxLabels AST#parameter_list#Left ( AST#parameter#Left labels : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | public setAxisMaxLabels(labels: number): void {
if (labels > 0)
this.mAxisMaxLabels = labels;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L172-L175 | 8f580a33a220f9a3363cf76cb8226cc8792acd5c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/SettingsTypes.ets | arkts | 数据设置接口(为DataSettings别名) | export interface DataSettings extends DataConfig {
// 继承DataConfig的所有属性
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DataSettings AST#extends_clause#Left extends DataConfig AST#extends_clause#Right AST#object_type#Left { // 继承DataConfig的所有属性 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface DataSettings extends DataConfig {
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L182-L184 | 78178a0565b6ac9e5e363052f658c9d32908fe20 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | createVideoOutputFn | [End create_photo_outputFn]
Creating a videoOutPut Output Object | createVideoOutputFn(cameraManager: camera.CameraManager, videoProfileObj: camera.VideoProfile,
surfaceId: string): camera.VideoOutput | undefined {
let videoOutput: camera.VideoOutput;
try {
videoOutput = cameraManager.createVideoOutput(videoProfileObj, surfaceId);
Logger.info(TAG, `createVideoO... | AST#method_declaration#Left createVideoOutputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left vi... | createVideoOutputFn(cameraManager: camera.CameraManager, videoProfileObj: camera.VideoProfile,
surfaceId: string): camera.VideoOutput | undefined {
let videoOutput: camera.VideoOutput;
try {
videoOutput = cameraManager.createVideoOutput(videoProfileObj, surfaceId);
Logger.info(TAG, `createVideoO... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L385-L397 | c4236dae084d96a4edf944d8c5fa3424a09138ab | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | getErrorMessage | 修改错误信息提取函数 | function getErrorMessage(error: Object | string | null | undefined): string {
let errorMessage = '未知错误';
if (error === null || error === undefined) {
return errorMessage;
}
if (typeof error === 'string') {
return error;
}
if (typeof error === 'object') {
// 检查是否有message属性,不使用in操作符
cons... | AST#function_declaration#Left function getErrorMessage AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#pri... | function getErrorMessage(error: Object | string | null | undefined): string {
let errorMessage = '未知错误';
if (error === null || error === undefined) {
return errorMessage;
}
if (typeof error === 'string') {
return error;
}
if (typeof error === 'object') {
const errorObj = error as Reco... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L243-L262 | 0fc51039604c664d9b2ab4888f4827b5171c9e71 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets | arkts | maybeNotCalledAtAllOptimize | [End import_change_global_var] | function maybeNotCalledAtAllOptimize() {
console.log(dataOptimize1);
console.log(dataOptimize2);
} | AST#function_declaration#Left function maybeNotCalledAtAllOptimize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#... | function maybeNotCalledAtAllOptimize() {
console.log(dataOptimize1);
console.log(dataOptimize2);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets#L30-L33 | 0fdbb0c49d07862aad838d2234c0f2dc89b2793f | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets | arkts | getHigh | Returns the upper shadows highest value.
@return | public getHigh(): number {
return this.mShadowHigh;
} | AST#method_declaration#Left public getHigh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressio... | public getHigh(): number {
return this.mShadowHigh;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets#L95-L97 | 857d0de3cd95d82ead64398d80dc5d9629a2d07a | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | Developers need to implement this interface to provide data to LazyForEach component.
@interface IDataSource
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface IDataSource<T> {
/**
* Total data count.
*
* @returns { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
totalCount(): number;
/**
* Return the data of index.
*
* @param { number } in... | AST#export_declaration#Left export AST#interface_declaration#Left interface IDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { /**
* Total data count.
*
* @returns { number }
* @syscap SystemCapability.ArkUI.Ar... | export interface IDataSource<T> {
totalCount(): number;
getData(index: number): T;
registerDataChangeListener(listener: DataChangeListener): void;
unregisterDataChangeListener(listener: DataChangeListener): void;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L570-L612 | ab0525b05c004efb9fbb256e4254782b29c2712e | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | sendChatRequest | 使用配置发送聊天请求 | async sendChatRequest(message: string, config?: LLMConfig, enableStream: boolean = false): Promise<string> {
const targetConfig = config || this.getDefaultConfig();
if (!targetConfig) {
throw new Error('⚠️ 未找到可用的大模型配置\n\n请点击右上角⚙️按钮配置您的AI模型:\n• 选择服务商(OpenAI、DeepSeek等)\n• 填入API密钥\n• 测试连接后保存\n\n配置完成后即可开始智能对... | AST#method_declaration#Left async sendChatRequest AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left LLMConfig AST... | async sendChatRequest(message: string, config?: LLMConfig, enableStream: boolean = false): Promise<string> {
const targetConfig = config || this.getDefaultConfig();
if (!targetConfig) {
throw new Error('⚠️ 未找到可用的大模型配置\n\n请点击右上角⚙️按钮配置您的AI模型:\n• 选择服务商(OpenAI、DeepSeek等)\n• 填入API密钥\n• 测试连接后保存\n\n配置完成后即可开始智能对... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L324-L544 | f3b58de3e45acd3e8dbd8cc958a9335398a32ca0 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinA.ets | arkts | SpinA | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinA {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local x: number = 0;
@Local y: number = 0;
@Local angle: number = 0;
build() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.backgroundColor(this.spinColor)
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinA AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinA {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local x: number = 0;
@Local y: number = 0;
@Local angle: number = 0;
build() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.backgroundColor(this.spinColor)
.... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinA.ets#L26-L72 | dcb054cb766da207c52c1207af9edca547a3d739 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidance3DES/entry/src/main/ets/pages/3des_ecb_encryption_decryption_synchronous.ets | arkts | decryptMessage | 解密消息 | function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('3DES192|ECB|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c... | function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('3DES192|ECB|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidance3DES/entry/src/main/ets/pages/3des_ecb_encryption_decryption_synchronous.ets#L29-L34 | 87510abac97e2a741ed1f3993fda0764a076578b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | limitRectInRotated | Rotating, limit in rect.
@param rect
@param outerLines | static limitRectInRotated(rect: RectF, outerLines: Array<LineSegment>): void {
let copy = new RectF();
copy.set(rect.left, rect.top, rect.right, rect.bottom);
let diagonal1 = new LineSegment(new Point(copy.left, copy.top), new Point(copy.right, copy.bottom));
for (let line of outerLines) {
MathUti... | AST#method_declaration#Left static limitRectInRotated AST#parameter_list#Left ( AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outerLines : AST#type_annotation#Left AST#primary_type#Left AST#generic... | static limitRectInRotated(rect: RectF, outerLines: Array<LineSegment>): void {
let copy = new RectF();
copy.set(rect.left, rect.top, rect.right, rect.bottom);
let diagonal1 = new LineSegment(new Point(copy.left, copy.top), new Point(copy.right, copy.bottom));
for (let line of outerLines) {
MathUti... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L299-L312 | 732e9b947cee61f97083ee599b31ae17e4db46d5 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/MergeSort.ets | arkts | 归并排序实现 | export class MergeSort {
/**
* 归并排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/
public static sort(arr: number[]): number[] {
const result = [...arr];
MergeSort.mergeSort(result, 0, result.length - 1);
return result;
}
/**
* 归并排序的递归实现
* @param arr 需要排序的数组
* @param left 左边界
*... | AST#export_declaration#Left export AST#class_declaration#Left class MergeSort AST#class_body#Left { /**
* 归并排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/ AST#method_declaration#Left public static sort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#arra... | export class MergeSort {
public static sort(arr: number[]): number[] {
const result = [...arr];
MergeSort.mergeSort(result, 0, result.length - 1);
return result;
}
private static mergeSort(arr: number[], left: number, right: number): void {
if (left < right) {
const mid = Math.floor((... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/MergeSort.ets#L4-L61 | baaee2df55f2ad1c522743f9d9960338cf8ccde8 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/InteractiveGameService.ets | arkts | 游戏状态枚举 | export enum GameState {
NOT_STARTED = 'not_started',
PLAYING = 'playing',
PAUSED = 'paused',
COMPLETED = 'completed',
FAILED = 'failed'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum GameState AST#enum_body#Left { AST#enum_member#Left NOT_STARTED = AST#expression#Left 'not_started' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left PLAYING = AST#expression#Left 'playing' AST#expression#Right AST#enum_member#Right , AST... | export enum GameState {
NOT_STARTED = 'not_started',
PLAYING = 'playing',
PAUSED = 'paused',
COMPLETED = 'completed',
FAILED = 'failed'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L40-L46 | f098053c9405158484d2e9389bd9533f66c86fbd | github | |
RicardoWesleyli/HarmonyNEXT_Examples.git | 6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670 | Chapter6/entry/src/main/ets/pages/Index.ets | arkts | bgColorView | 背景颜色代码块 | @Builder
bgColorView(){
Column()
.width('100%')
.height('100%')
.linearGradient({
colors: [[0x007BFF, 0.0], [Color.White, 1.0]]
})
.expandSafeArea([SafeAreaType.SYSTEM])
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bgColorView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expressio... | @Builder
bgColorView(){
Column()
.width('100%')
.height('100%')
.linearGradient({
colors: [[0x007BFF, 0.0], [Color.White, 1.0]]
})
.expandSafeArea([SafeAreaType.SYSTEM])
} | https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L102-L111 | cfa0fb24bb053121827bce996f7d66438fdd9c2a | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHA1.ets | arkts | rol | Bitwise rotate a 32-bit number to the left.
32位二进制数循环左移 | rol(num: number, cnt: number) {
return (num << cnt) | (num >> (32 - cnt));
} | AST#method_declaration#Left rol AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cnt : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a... | rol(num: number, cnt: number) {
return (num << cnt) | (num >> (32 - cnt));
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA1.ets#L185-L189 | 54494a4d5b730b8ec61fdaa78fdcf7ff495ac0e8 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets | arkts | push | 跳转到指定路由栈的指定路由页面 | public static push(info: NavRouterInfo, animated?: boolean) {
try {
if (info.onPop) {
RouterModule._stack.pushPathByName(info.url, info.param, info.onPop, animated);
} else {
RouterModule._stack.pushPathByName(info.url, info.param, animated);
}
} catch (err) {
Logger.erro... | AST#method_declaration#Left public static push AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left NavRouterInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AS... | public static push(info: NavRouterInfo, animated?: boolean) {
try {
if (info.onPop) {
RouterModule._stack.pushPathByName(info.url, info.param, info.onPop, animated);
} else {
RouterModule._stack.pushPathByName(info.url, info.param, animated);
}
} catch (err) {
Logger.erro... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets#L14-L24 | 86d93359c0ef210d9281a15bce8c9de10e6e7f49 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/GridSegmentedPicker.ets | arkts | generateColumnsTemplate | 生成网格列模板字符串
@returns 列模板字符串,如 "1fr 1fr 1fr" | private generateColumnsTemplate(): string {
// 如果尚未计算出列数或列数无效,返回默认一列模板
if (this.calculatedCols <= 0) {
return '1fr';
}
// 使用 repeat() 函数生成列模板,例如 repeat(3, 1fr) 表示三等分
return `repeat(${this.calculatedCols}, 1fr)`;
} | AST#method_declaration#Left private generateColumnsTemplate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 如果尚未计算出列数或列数无效,返回默认一列模板 AST#statement#Left AST#if_statement#Left if ( AS... | private generateColumnsTemplate(): string {
if (this.calculatedCols <= 0) {
return '1fr';
}
return `repeat(${this.calculatedCols}, 1fr)`;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/GridSegmentedPicker.ets#L127-L134 | d8c931cb5edc17c5b478bb2b820134f289629889 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBar.d.ets | arkts | Declare ToolBarModifier use in ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 13
Declare ToolBarModifier use in ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export declare class ToolBarModifier {
/**
* Sets the height of the toolBar.
*
* @param { LengthMetrics } height - toolBar's height.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
/**
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ToolBarModifier AST#class_body#Left { /**
* Sets the height of the toolBar.
*
* @param { LengthMetrics } height - toolBar's height.
* @returns { ToolBarModifier } returns the instance of the ToolBarMod... | export declare class ToolBarModifier {
height(height: LengthMetrics): ToolBarModifier;
backgroundColor(backgroundColor: ResourceColor): ToolBarModifier;
padding(padding: LengthMetrics): ToolBarModifier;
stateEffect(stateEffect: boolean): ToolBarModifier;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L416-L497 | 842f57b0832fe12a956f8a8c6009947e06efd58a | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets | arkts | replace | 将指定路由栈的栈顶页面退出,将info指定的NavDestination页面信息入栈 | public static replace(info: NavRouterInfo) {
try {
RouterModule._stack.replacePathByName(info.url, info.param);
} catch (err) {
Logger.error(
TAG,
'navigation stack replace failed::' + JSON.stringify(err),
);
}
} | AST#method_declaration#Left public static replace AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left NavRouterInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_stateme... | public static replace(info: NavRouterInfo) {
try {
RouterModule._stack.replacePathByName(info.url, info.param);
} catch (err) {
Logger.error(
TAG,
'navigation stack replace failed::' + JSON.stringify(err),
);
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets#L28-L37 | 3247edaed2de5a2fb66083d7a158a075cd7075fe | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets | arkts | getPause | 暂停视频 | getPause() {
if (this.isCreate) {
this.avPlayer.pause();
}
} | AST#method_declaration#Left getPause AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCreate AST#member_expression#Right AST#expres... | getPause() {
if (this.isCreate) {
this.avPlayer.pause();
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets#L93-L97 | b3389249851033f8a20af1a1a79c81de5b82eb85 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/opencustomdialog/openCustomDialog.ets | arkts | aboutToAppear | [End create_component_content] | aboutToAppear(): void {
PromptActionClass.setContext(this.ctx);
PromptActionClass.setContentNode(this.contentNode);
PromptActionClass.setOptions({ alignment: DialogAlignment.Top, offset: { dx: 0, dy: 50 } });
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
PromptActionClass.setContext(this.ctx);
PromptActionClass.setContentNode(this.contentNode);
PromptActionClass.setOptions({ alignment: DialogAlignment.Top, offset: { dx: 0, dy: 50 } });
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/opencustomdialog/openCustomDialog.ets#L98-L102 | 3d251b50610d8afa91f35a02ea3136025c52cefe | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets | arkts | getLengthOfStringWithoutKind | / 查找去除kind之后的字符串长度 | static getLengthOfStringWithoutKind(str: string): number {
const strPoint = BaseWordUtility.STR_POINT_HALF;
const indexNoFound = -1;
let strLength = 0;
if (str != null) {
strLength = str.length;
const index = str.indexOf(strPoint);
if (index !== indexNoFound) {
strLength = str... | AST#method_declaration#Left static getLengthOfStringWithoutKind AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number... | static getLengthOfStringWithoutKind(str: string): number {
const strPoint = BaseWordUtility.STR_POINT_HALF;
const indexNoFound = -1;
let strLength = 0;
if (str != null) {
strLength = str.length;
const index = str.indexOf(strPoint);
if (index !== indexNoFound) {
strLength = str... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L116-L129 | 57abb2fdb40b0f6ea6f52ed5427c818ec9f01c27 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/ui_effect/ets/@ohos.graphics.uiEffect.ets | arkts | Copyright (C) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface BrightnessBlenderParam {
cubicRate: number;
quadraticRate: number;
linearRate: number;
degree: number;
saturation: number;
positiveCoefficient: [number, number, number];
negativeCoefficient: [number, number, number];
fraction: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BrightnessBlenderParam AST#object_type#Left { AST#type_member#Left cubicRate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left quadraticRate : A... | export interface BrightnessBlenderParam {
cubicRate: number;
quadraticRate: number;
linearRate: number;
degree: number;
saturation: number;
positiveCoefficient: [number, number, number];
negativeCoefficient: [number, number, number];
fraction: number;
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/ui_effect/ets/@ohos.graphics.uiEffect.ets#L16-L25 | 1922d6d864ba64e6901e25aaf37169122d7fdb28 | gitee | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | getPreferencesFromStorage | 初始化Preferences首选项 | async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, 'mystore')
} catch (err) {
console.error(err)
}
} | AST#method_declaration#Left async getPreferencesFromStorage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left prefere... | async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, 'mystore')
} catch (err) {
console.error(err)
}
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L8-L14 | 09427513d1af8d86afa33923f25e0d94f9afc961 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | Page end event at the end of web page loading.
@typedef OnPageEndEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface OnPageEndEvent {
/**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
url: string;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnPageEndEvent AST#object_type#Left { /**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left url :... | export declare interface OnPageEndEvent {
url: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L284-L294 | ab751d28b8e5a0d8ab72bdf3dc4a249ccd1a7813 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | selectAISuggestion | 选择AI建议 | private selectAISuggestion(suggestion: string): void {
this.customContent = suggestion;
} | AST#method_declaration#Left private selectAISuggestion AST#parameter_list#Left ( AST#parameter#Left suggestion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST... | private selectAISuggestion(suggestion: string): void {
this.customContent = suggestion;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L170-L172 | a782bb0d4750912597ebcec51c21ffbbed6aa696 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets | arkts | The percentage of 50. | export const PERCENTAGE_50 = '50%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PERCENTAGE_50 = AST#expression#Left '50%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const PERCENTAGE_50 = '50%'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L50-L50 | 3eb246cc1e98a5b9d10bc78cabc2d91640447e83 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/component/TextInputDialogView.ets | arkts | TextInputDialogBuilder | TextInputDialog
@param options | @Builder
export function TextInputDialogBuilder(options: InputOptions) {
TextInputDialogView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TextInputDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left InputOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para... | @Builder
export function TextInputDialogBuilder(options: InputOptions) {
TextInputDialogView({ options: options });
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L31-L34 | 9b1f130232fc9fa8b1dc18d04ff2fed092a55b4c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ContactsPage.ets | arkts | exitSelectionMode | 退出选择模式 | private exitSelectionMode(): void {
this.isSelectionMode = false;
this.selectedContacts.clear();
} | AST#method_declaration#Left private exitSelectionMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#L... | private exitSelectionMode(): void {
this.isSelectionMode = false;
this.selectedContacts.clear();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L110-L113 | cbe4a5559b39a8f446762133d90099866801a2e1 | github |
texiwustion/chinese-herbal-shopping--arkts.git | 3f71338f3c6d88bc74342e0322867f3a0c2c17d1 | entry/src/main/ets/views/CartPage.ets | arkts | calculateTotalPrice | 计算订单总价的方法 | calculateTotalPrice() {
return this.orders.reduce((sum, order) => {
console.info('订单: 状态 ', order.status === 'added')
return sum + (order.status === 'added' ? (order.herbal.price * order.quantity) : 0);
}, 0);
} | AST#method_declaration#Left calculateTotalPrice AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left A... | calculateTotalPrice() {
return this.orders.reduce((sum, order) => {
console.info('订单: 状态 ', order.status === 'added')
return sum + (order.status === 'added' ? (order.herbal.price * order.quantity) : 0);
}, 0);
} | https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/views/CartPage.ets#L16-L21 | 45d806cbf491367026e0094b6548baf458922fbb | github |
ArkTS-CodeSearch: A Open-Source ArkTS Dataset for Code Retrieval
Paper | Evaluation Code | Fine-Tuned Model
This dataset collects function-level information from ArkTS (HarmonyOS Ark TypeScript) projects, including original functions, docstrings, abstract syntax tree (AST) representations, obfuscated versions, and source code metadata. It is suitable for tasks such as code analysis, code understanding, AST research, and code search.
ArkTS is a core programming language in the OpenHarmony ecosystem. This dataset was constructed from open-source repositories crawled from GitHub and Gitee, targeting code retrieval and code evaluation tasks.
Note: ⚠️ Not Enterprise-Ready: This dataset is designed for research only. Some of the collected code may come from repositories without an explicit open-source license. Users should be aware that usage of such code may be subject to copyright restrictions.
Dataset Structure
The dataset contains three splits:
train: Training setvalidation: Validation settest: Test set
Each split is a JSON Lines (.jsonl) file, where each line is a JSON object representing a single function.
Features / Columns
| Field | Type | Description |
|---|---|---|
nwo |
string | Repository name |
sha |
string | Commit SHA |
path |
string | File path |
language |
string | Programming language |
identifier |
string | Function identifier / name |
docstring |
string | Function docstring |
function |
string | Original function source code |
ast_function |
string | AST representation of the function |
obf_function |
string | Obfuscated function source code |
url |
string | URL to the code in the repository |
function_sha |
string | Function-level SHA |
source |
string | Code source (GitHub / Gitee) |
Usage
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("hreyulog/arkts-code-docstring")
# Inspect the first training example
print(dataset["train"][0])
# Check dataset features
print(dataset["train"].features)
Citation
If you use this dataset in your research, please cite the following paper:
@misc{he2026arktscodesearchopensourcearktsdataset,
title={ArkTS-CodeSearch: A Open-Source ArkTS Dataset for Code Retrieval},
author={Yulong He and Artem Ermakov and Sergey Kovalchuk and Artem Aliev and Dmitry Shalymov},
year={2026},
eprint={2602.05550},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2602.05550},
}
- Downloads last month
- 142