Nils Kattenbeck added the comment:
I implemented the logic and adjusted the existing tests to have a fixed program
name. I also fixed the build error by changing how zip files are detected.
Based on you comment Nick you however even had a different idea. Currently I
check if __spec__
Nils Kattenbeck added the comment:
A good alternative would be to use pathlib.Path. The only downside would be
that one has to manually handle `-` but besides that it solves most problems.
Still the fact that file descriptors are kept open should be added as a warning
to the docs
Nils Kattenbeck added the comment:
I expanded the patch from tebeka to also work with invocations like `python3 -m
serial.tools.miniterm` where `miniterm.py` is a file and not a directory with a
`__main__.py`. This was able to handle everything I threw at it.
However due to the import of
Nils Kattenbeck added the comment:
I am not sure if the patch correctly handles calling a nested module (e.g.
`python3 -m serial.tools.miniterm`). Would it also be possible to detect if
python or python3 was used for the invocation?
--
nosy: +Nils Kattenbeck
Nils Kattenbeck added the comment:
> The way I fixed this is I added `__forward_module__` to `typing.ForwardRef`,
> so that it can resolve the forward reference with the same globals as the
> ones specified by the module in `__forward_module__`. `TypedDict`'s metaclass
> sho
Nils Kattenbeck added the comment:
> I believe it had something to do with TypedDict instances being instances of
> dict at runtime, but I can't actually reconstruct the reason.
Hm that may be true.
My limited low-level Python knowledge leads me to believe that this could also
be
Nils Kattenbeck added the comment:
What is/was the initial reason to not preserve the MRO for a TypedDict?
The only thing which came to my mind would be instantiation performance but as
annotations are not evaluated by default and on the right-hide side of
assignment most people will use
Nils Kattenbeck added the comment:
While the proposal linked by C.A.M. solves one of the use cases but it does not
address the others.
One use cases which is rather common for me it is e.g. to have scripts/programs
which allow configuring whether temporary directories should get deleted or
Nils Kattenbeck added the comment:
Has there been any resolution regarding `sortTestMethodsUsing`? See
https://bugs.python.org/msg77261
I spend a decent time and read the documentation thrice before realizing it
received an old-style compare function. Brett's proposal for a new attr
Nils Kattenbeck added the comment:
Thanks for looking into it. Yes I can confirm that `importlib_resources` has
the expected behaviour - I did not download Python 3.10 as the code seems to be
the same.
--
___
Python tracker
<ht
Nils Kattenbeck added the comment:
Yes I understand that the function handles this specially to not raise an
exception if the file is not found in the package (even though the intention
behind this is not clear to me). However if a user causes a
FileNotFoundException itself inside of the
Change by Nils Kattenbeck :
--
title: importlib.resources.path raises RuntimeError import FileNotFoundError is
raise in context manager -> importlib.resources.path raises RuntimeError when
FileNotFoundError is raise in context manager
___
Pyt
New submission from Nils Kattenbeck :
When a FileNotFoundError is raised inside while the importlib.resources.path
context manager is active a RuntimeError is raised.
Looking at the (3.8) code it seems that FileNotFound exceptions are handled
specially from all other exceptions which may lead
Nils Kattenbeck added the comment:
Okay, if I want to start a discussion about adding weakref types to PEP 585
where should do it? The mailing list or as an issue in the PEP repo?
--
___
Python tracker
<https://bugs.python.org/issue38
New submission from Nils Kattenbeck :
Instances of weakref.WeakSet are not instances of Set and therefore not of
MutableSet but they are instances of Collection.
They however implement all required methods for a MutableSet and
Weak(Key|Value)Dictionary are correctly identified.
Is this just
Nils Kattenbeck added the comment:
Okay nevermind, after looking in the PEP again and inspecting the
__annotations__ property I learned that annotations are never evaluated and
just saved as a string when using said future statement.
However this may still be relevant as
Nils Kattenbeck added the comment:
Yes thank you, using 'from __future__ import annotations' works fantastic.
I did not knew about this functionality of the annotations future import
statement, I thought it was only for postponed evaluation but I probably missed
something
Nils Kattenbeck added the comment:
A possible use case would be having multiple users and some groups said users
can belong to. When using a WeakSet a user won't be part of a groups after he
deleted his account without having to iterate over all groups.
class User: pass
class
New submission from Nils Kattenbeck :
I would like to request the addition of generic variants of some of the types
in weakref to the typing module.
This would for example include weakref.WeakKeyDictionary among others.
Doing so would allow one to add type annotations to code using such data
19 matches
Mail list logo