Comments (9)
Hrm annoying, I'd call it a docs bug, since behaviour in CPython (and PyPy) going back forever is that it just takes an iterable. Does MyPy have some kind of override facility? Converting the sets to lists on every loop would be wasteful, just to match basically a doc bug (the structure passed to select is inherently useless and must internally be iterated to transform it into an fdset anyway).
from mitogen.
We could potentially try just replacing the sets with lists, in the usual case they're only going to contain <5 entries anyway, and the code might even end up faster. The question would be after I get async connect finished, whether scanning the lists for add/removal slows down with a master that has hundreds of connections
from mitogen.
I don't think so.. once a connection is established to a context, it is never removed from the readers set (so there is never any scan of the list until a disconnection occurs).
The writers set only contains contexts that currently have data buffered, and in the typical case it'll simply be empty. I'm not sure about the worst case, though
from mitogen.
mind.. blown.. select() is converting the set into a list internally (via PySequence_Fast()). So there's a real chance swapping the set for a list will improve things
from mitogen.
THank you for looking. FTR changing the arguments to sorted(self...)
didn't make any difference to unit test failures.
Does MyPy have some kind of override facility?
Yes, I can add a # type: ignore
on a per-line basis
from mitogen.
FTR I've push the MyPy trial to https://github.com/moreati/mitogen/tree/mypy-try. I'm not proposing to do anything more with it. I think I've learned what I can.
from mitogen.
What's your verdict on MyPy? I'm not completely averse to the idea of it, especially since the annotations are just comments, and don't forget you really did find a bug :).. maybe we could merge it
from mitogen.
What's your verdict on MyPy?
On a per bug found basis it was an expensive exercise. As a learning exercise for me it was useful. As a way of documenting the APIs in-situ I found it very handy. I don't know of a way to feed MyPy annotations into doctools, so there would be some duplicated effort and or chance of discrepancies there.
I'm not completely averse to the idea of it, especially since the annotations are just comments, and don't forget you really did find a bug :).. maybe we could merge it
Not all the changes are comments, e.g. I sprinked a few asserts, and changed a base class or two
moreati@5df74fc#diff-60eabbf230c5d9137e81bf0f41ed37bbR104
moreati@5df74fc#diff-3540c3617f4566023f000914cebe2d71L317
Edit: I also had to delete the vendored pkgutil to stop an import loop
from mitogen.
Going to close this and open a separate ticket to keep track of your MyPy stuff :)
from mitogen.
Related Issues (20)
- wait_for_connection to localhost explicitly specified in the inventory and ansible_python_interpreter set to ansible_playbook_python fails with 'timed out waiting for ping module test: 'int' object has no attribute 'template'"'
- Jinja expressions are not evaluated in (not only) credential variables HOT 2
- ansible_async_dir not working with mitogen strategy
- awx module: python executable not found
- httpapi connection support HOT 2
- Summer 2024 CI cleaning
- Ansible 10 + mitogen_linear + reset_connection fails HOT 1
- ansible_mitogen sometimes ignores ansible_facts.discovered_python_interpreter
- OpenIndiana: Mitogen fails to find/serve ansible.py
- tests/README.md instructions are out of date and unclear
- ModuleNotFoundError: 'mmap' is present in the Mitogen importer blacklist HOT 1
- Is ansible-core-2.11.12 still supported by latest mitogen-0.3.9? HOT 1
- ansible 10 with mitogen 0.3.9: SyntaxError: future feature annotations is not defined and interpreter discovery warning HOT 5
- `ansible_ssh_password` missing from mitogen HOT 1
- Too many cases of bare `except:` and `except Exception:`
- mitogen.unix.Listener.on_accept_client() does not verify all data has been sent by socket.send()
- DeprecationWarning: 'pkgutil.find_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead
- DeprecationWarning: This process (pid=3010) is multi-threaded, use of fork() may lead to deadlocks in the child.
- feat(ansible): Handle templated `ssh_user` HOT 3
- Update CI container images
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mitogen.