MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / get_incrementapi

Function get_incrementapi

tools/sampcd_processor_utils.py:358–391  ·  view source on GitHub ↗

this function will get the apis that difference between API_DEV.spec and API_PR.spec.

(
    api_dev_spec_fn: str | None = None,
    api_pr_spec_fn: str | None = None,
    api_diff_spec_fn: str | None = None,
)

Source from the content-addressed store, hash-verified

356
357
358def get_incrementapi(
359 api_dev_spec_fn: str | None = None,
360 api_pr_spec_fn: str | None = None,
361 api_diff_spec_fn: str | None = None,
362) -> None:
363 '''
364 this function will get the apis that difference between API_DEV.spec and API_PR.spec.
365 '''
366 global API_DEV_SPEC_FN, API_PR_SPEC_FN, API_DIFF_SPEC_FN # readonly
367
368 dev_api = get_api_md5(
369 API_DEV_SPEC_FN if api_dev_spec_fn is None else api_dev_spec_fn
370 )
371 pr_api = get_api_md5(
372 API_PR_SPEC_FN if api_pr_spec_fn is None else api_pr_spec_fn
373 )
374 with open(
375 API_DIFF_SPEC_FN if api_diff_spec_fn is None else api_diff_spec_fn, 'w'
376 ) as f:
377 for key in pr_api:
378 if key in dev_api:
379 if dev_api[key] != pr_api[key]:
380 logger.debug(
381 "%s in dev is %s, different from pr's %s",
382 key,
383 dev_api[key],
384 pr_api[key],
385 )
386 f.write(key)
387 f.write('\n')
388 else:
389 logger.debug("%s is not in dev", key)
390 f.write(key)
391 f.write('\n')
392
393
394def get_full_api_by_walk():

Callers 2

test_get_incrementapiMethod · 0.90
get_docstringFunction · 0.85

Calls 3

get_api_md5Function · 0.85
debugMethod · 0.45
writeMethod · 0.45

Tested by 1

test_get_incrementapiMethod · 0.72