MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / counter

Function counter

lib/sqlalchemy/util/langhelpers.py:1492–1503  ·  view source on GitHub ↗

Return a threadsafe counter function.

()

Source from the content-addressed store, hash-verified

1490
1491
1492def counter() -> Callable[[], int]:
1493 """Return a threadsafe counter function."""
1494
1495 lock = threading.Lock()
1496 counter = itertools.count(1)
1497
1498 # avoid the 2to3 "next" transformation...
1499 def _next():
1500 with lock:
1501 return next(counter)
1502
1503 return _next
1504
1505
1506def 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