ThatXliner added the comment:
Ok, so I just made a patch implementing this using os.access. It adds the
following methods to pathlib.Path
- can_read= Returns True if the user can read the path
- can_write = Returns True if the user can write on the path
- can_execute = Returns True
ThatXliner added the comment:
Now I think of it, it would be weird to just add attributes testing for
executable permissions. Why not add the attributes from os.access to
pathlib.Path?
- Path.can_execute = os.access(path, os.X_OK)
- Path.can_read= os.access(path, R_OK
ThatXliner added the comment:
Also, an App (at least on MacOS) is technically an executable (I've ran
iMessage from the command line before).
--
___
Python tracker
<https://bugs.python.org/is
ThatXliner added the comment:
Since pathlib.Path has module os synonyms, I think it would be reasonable to
test with os.X_OK. Correct me if I'm wrong.
I think most people would want to check if the current user running the script
could execute something.
--
type: -> enh
New submission from ThatXliner :
Add an attribute to pathlib.Path testing if a file/directory/symlink is
executable or the user has executable permissions.
I've been trying to find a pythonic way for this (preferably in pathlib.Path)
but all I found was trips to the shell and back.
New submission from ThatXliner :
I propose making subprocess.CompletedProcess a truthy value if the returncode
is 0. False, otherwise.
--
components: Library (Lib)
messages: 381871
nosy: ThatXliner
priority: normal
severity: normal
status: open
title: subprocess.CompletedProcess: Add
Change by ThatXliner :
--
type: -> enhancement
___
Python tracker
<https://bugs.python.org/issue42468>
___
___
Python-bugs-list mailing list
Unsubscrib
ThatXliner added the comment:
In the end, I think python's argparse needs more built-in help formatters...
Should I close this?
--
___
Python tracker
<https://bugs.python.org/is
ThatXliner added the comment:
Editing the description, etc. seems like a good way to do this. But it seems
"hacky". The other answer on StackOverflow implements a custom class which does
nice things, but not what I want.
--
___
Pyth
ThatXliner added the comment:
> So if you can get by with just customizing _format_action_invocation, there's
> no need for further action here.
Then maybe we could just make a new function that takes 2 arguments: Name of
another action class (or the action class itself), and a t
ThatXliner added the comment:
Should I rename this to "Argparse: finer control on help txt"
--
___
Python tracker
<https://bugs.python.org/issue42023>
___
__
ThatXliner added the comment:
>However, I can imagine adding a variable that gives the user full control over
>the action-invocation. In:
argparse.HelpFormatter._format_action_invocation method.
That's what I'm trying to change. If there was a public API/method for
New submission from ThatXliner :
In argparse, I've always wanted a way to make colored help text like those of
poetry and pipenv. But argparse's show help isn't well documented (Therefore, I
can't find a way to completely modify the help text), and the metavar arg isn&
Change by ThatXliner :
--
versions: +Python 3.9 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue42017>
___
___
Python-bugs-list mailing list
Unsub
Change by ThatXliner :
--
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue42017>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from ThatXliner :
Because there is a typing.AnyStr (which is equal to AnyStr = TypeVar("AnyStr",
str, bytes)), I think there should be a AnyNum which is equivalent to
from decimal import Decimal
from fractions import Fraction
AnyNum = TypeVar("AnyNum",
16 matches
Mail list logo