MCPcopy
hub / github.com/pydantic/pydantic / update_lib

Function update_lib

docs/plugins/using_update.py:12–25  ·  view source on GitHub ↗
(lib, *, retry=0)

Source from the content-addressed store, hash-verified

10
11
12def update_lib(lib, *, retry=0):
13 repo = lib['repo']
14 url = f'https://api.github.com/repos/{repo}'
15 resp = session.get(url)
16 if resp.status_code == 403 and retry < 3:
17 print(f'retrying {repo} {retry}')
18 sleep(5)
19 return update_lib(lib, retry=retry + 1)
20
21 resp.raise_for_status()
22 data = resp.json()
23 stars = data['watchers_count']
24 print(f'{repo}: {stars}')
25 lib['stars'] = stars
26
27
28with (THIS_DIR / 'using.toml').open('rb') as f:

Callers 1

using_update.pyFile · 0.85

Calls 4

printFunction · 0.85
sleepFunction · 0.85
getMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected