You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/ansible_mitogen
Alex Willmer 0e5f47f145 mitogen: Refactor scan_code_imports() as mitogen.imports.codeobj_imports()
This replaces `mitogen.master.scan_code_imports()` with
`mitogen.imports.codeobj_imports()`. The Python 3.x implementation now uses
`str.find()`, relying on Python >= 3.6 "widecode" format. Behaviour and
semantics should be unchanged. Now implementations are approx
- 1.5 x faster on Python 2.x
- 2 - 3 x faster on Python 3.x

Before
```console
$ ./tests/bench/scan_code
scan_code_imports python2.7  100 loops, best of 3: 3.19 msec per loop
scan_code_imports python3.9  500 loops, best of 5: 685 usec per loop
scan_code_imports python3.10  500 loops, best of 5: 727 usec per loop
scan_code_imports python3.11  500 loops, best of 5: 601 usec per loop
scan_code_imports python3.12  500 loops, best of 5: 609 usec per loop
scan_code_imports python3.13  500 loops, best of 5: 586 usec per loop
```

After
```console
codeobj_imports python2.7  1000 loops, best of 3: 1.98 msec per loop
codeobj_imports python3.9  1000 loops, best of 5: 302 usec per loop
codeobj_imports python3.10  1000 loops, best of 5: 297 usec per loop
codeobj_imports python3.11  1000 loops, best of 5: 243 usec per loop
codeobj_imports python3.12  1000 loops, best of 5: 278 usec per loop
codeobj_imports python3.13  1000 loops, best of 5: 259 usec per loop
```
```console
$ uname -a
Darwin kintha 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT
2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64
```
4 months ago
..
compat Remove vendored mitogen.compat.simplejson 3 years ago
plugins Fix usage of connection_loader__get by wrapping the correct upstream functions. 11 months ago
utils ansible_mitogen: alpha datatag handling & CI for Ansible 12 (ansible-core 2.19) 6 months ago
__init__.py ansible: restructure to avoid intermediate imports 8 years ago
affinity.py ansible_mitogen: Remove Python 2.4 and 2.5 backward compatibility fallbacks 1 year ago
connection.py ansible_mitogen: Fix become_method=doas, add tests 4 months ago
loaders.py Allow running with ansible-core 2.19 6 months ago
logging.py ansible_mitogen: Remove fallback imports for Ansible < 2.10 1 year ago
mixins.py ansible_mitogen: Replace use of `ansible.parsing.utils.jsonify.jsonify()` 6 months ago
module_finder.py mitogen: Refactor scan_code_imports() as mitogen.imports.codeobj_imports() 4 months ago
parsing.py ansible_mitogen: Standardise __future__ imports to match Ansible 4 years ago
planner.py ansible_mitogen: alpha datatag handling & CI for Ansible 12 (ansible-core 2.19) 6 months ago
process.py mitogen: Fix BlockingIOError & EAGAIN in subprocess stdio 4 months ago
runner.py ansible_mitogen: alpha datatag handling & CI for Ansible 12 (ansible-core 2.19) 6 months ago
services.py ansible_mitogen: alpha datatag handling & CI for Ansible 12 (ansible-core 2.19) 6 months ago
strategy.py Disallow connection redirection of sub-connections if the top-level connection in the play is not a Mitogen connection. 11 months ago
target.py mitogen: Use pty.STD*_FILENO constants 6 months ago
transport_config.py ansible_mitogen: Support ANSIBLE_SSH_VERBOSITY with Ansible >= 12 5 months ago