MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / counter

Function counter

lib/sqlalchemy/util/langhelpers.py:1402–1413  ·  view source on GitHub ↗

Return a threadsafe counter function.

()

Source from the content-addressed store, hash-verified

1400
1401
1402def counter() -> Callable[[], int]:
1403 """Return a threadsafe counter function."""
1404
1405 lock = threading.Lock()
1406 counter = itertools.count(1)
1407
1408 # avoid the 2to3 "next" transformation...
1409 def _next():
1410 with lock:
1411 return next(counter)
1412
1413 return _next
1414
1415
1416def duck_type_collection(

Callers 7

somethingMethod · 0.85
something_elseMethod · 0.85
my_propMethod · 0.85
__tablename__Method · 0.85
my_propMethod · 0.85
my_colMethod · 0.85
address_countMethod · 0.85

Calls 1

countMethod · 0.45

Tested by 7

somethingMethod · 0.68
something_elseMethod · 0.68
my_propMethod · 0.68
__tablename__Method · 0.68
my_propMethod · 0.68
my_colMethod · 0.68
address_countMethod · 0.68