MCPcopy Create free account
hub / github.com/bpython/bpython / token_is

Function token_is

bpython/repl.py:1283–1294  ·  view source on GitHub ↗

Return a callable object that returns whether a token is of the given type `token_type`.

(token_type)

Source from the content-addressed store, hash-verified

1281
1282
1283def token_is(token_type):
1284 """Return a callable object that returns whether a token is of the
1285 given type `token_type`."""
1286
1287 def token_is_type(token):
1288 """Return whether a token is of a certain type or not."""
1289 token = token[0]
1290 while token is not token_type and token.parent:
1291 token = token.parent
1292 return token is token_type
1293
1294 return token_is_type
1295
1296
1297def token_is_any_of(token_types):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected