[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner
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

[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner
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

[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner
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/issue42

[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner
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: -> enhancem

[issue42497] New pathlib.Path attribute

2020-11-28 Thread ThatXliner
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

[issue42468] subprocess.CompletedProcess: Add boolean value

2020-11-25 Thread ThatXliner
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

[issue42468] subprocess.CompletedProcess: Add boolean value

2020-11-25 Thread ThatXliner
Change by ThatXliner : -- type: -> enhancement ___ Python tracker <https://bugs.python.org/issue42468> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue42023] Argparse: Add a "display" arg

2020-10-14 Thread ThatXliner
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/issue42

[issue42023] Argparse: Add a "display" arg

2020-10-14 Thread ThatXliner
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

[issue42023] Argparse: Add a "display" arg

2020-10-14 Thread ThatXliner
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

[issue42023] Argparse: Add a "display" arg

2020-10-14 Thread ThatXliner
ThatXliner added the comment: Should I rename this to "Argparse: finer control on help txt" -- ___ Python tracker <https://bugs.python.org/issue42023> ___ __

[issue42023] Argparse: Add a "display" arg

2020-10-14 Thread ThatXliner
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 manipu

[issue42023] Argparse: Add a "display" arg

2020-10-12 Thread ThatXliner
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't really helpful. I

[issue42017] Add new type in typing

2020-10-12 Thread ThatXliner
Change by ThatXliner : -- versions: +Python 3.9 -Python 3.10 ___ Python tracker <https://bugs.python.org/issue42017> ___ ___ Python-bugs-list mailing list Unsub

[issue42017] Add new type in typing

2020-10-12 Thread ThatXliner
Change by ThatXliner : -- versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue42017> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42017] Add new type in typing

2020-10-12 Thread ThatXliner
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",