[issue27796] Expose DirEntry constructor

2016-08-18 Thread Brendan Moloney
New submission from Brendan Moloney: As per a discussion on python-ideas [1], the consensus is that we should allow users to create a DirEntry object themselves. This would just take a path and call stat on it and cache the result of that stat call. Nick Coghlan mentioned possibly allowing

[issue27038] Make os.DirEntry exist

2016-08-15 Thread Brendan Moloney
Brendan Moloney added the comment: The functions were all written around DirEntry objects since that is what they will be processing 99% of the time and I want to do that as efficiently as possible. Converting a DirEntry object into a str representation doesn't help me with my use case at all

[issue27038] Make os.DirEntry exist

2016-08-15 Thread Brendan Moloney
Brendan Moloney added the comment: The pathlib Path class is different enough from the DirEntry class that it doesn't really help my goal of allowing a function to work with either a DirEntry or a plain (str) path. These functions are going to be working with DirEntry objects generated

[issue27038] Make os.DirEntry exist

2016-08-12 Thread Brendan Moloney
Brendan Moloney added the comment: It makes it much easier to write functions that can work with either a DirEntry object or a plain path. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27038] Make os.DirEntry exist

2016-08-12 Thread Brendan Moloney
Brendan Moloney added the comment: It would be nice if there was a supported way to create a DirEntry object from a path. If you don't want to document the constructor perhaps expose some helper function or class method (i.e. from_path)? -- nosy: +moloney

[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2014-07-16 Thread Brendan Moloney
Brendan Moloney added the comment: Here is a script illustrating the issue. -- Added file: http://bugs.python.org/file35976/tarfile_issue.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21987

[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2014-07-15 Thread Brendan Moloney
New submission from Brendan Moloney: If a directory path is under 100 char you have to omit the trailing slash from the name passed to 'getmember'. If it is over 100 you have to include the trailing slash. As a work around I can use the private '_getmember' with 'normalize=True'. I tested