Sebastian Rittau
256b3ce8ab
Remove a bunch of unused imports ( #3323 )
2019-10-08 07:59:32 -07:00
Sebastian Rittau
c32e1e2280
Enable --disallow-any-generics for stubs ( #3288 )
2019-10-01 05:31:34 -07:00
Rebecca Chen
3f8c2169d1
Define listdir in posix and import it in os. ( #3258 )
2019-09-23 23:41:05 +02:00
Sebastian Rittau
9ccf9356bf
Remove Python 3.4 support ( #3147 )
...
Closes #3123
2019-07-27 10:58:21 +02:00
Michael J. Sullivan
f06f2e97bb
Make os.altsep Optional on non-win32 platforms ( #2918 )
...
Keep it str on win32 to avoid breaking win32-specific code that relies
on it.
2019-04-12 23:00:19 -07:00
Rebecca Chen
d275e73e1f
Remove pytype workaround in os/__init__.pyi. ( #2797 )
...
Pytype release 2019.02.13 fixed the bug that
necessitated this workaround.
2019-02-14 12:29:19 -08:00
Utkarsh Gupta
1a37368cc0
__init__.pyi: Add __getitem__() to stat_result() ( #2753 )
...
Fixes #2751
2019-02-09 16:07:10 +01:00
Michael J. Sullivan
95afb86022
Move posix.stat_result to os.stat_result on python 3 ( #2683 )
...
In python 3, posix.stat_result is a re-export of os.stat_result, while
in python 2 it was the reverse. Update typeshed to reflect this.
2018-12-13 19:20:42 +01:00
Sebastian Rittau
517d2b6012
Remove unneeded ignores ( #2624 )
2018-11-23 09:51:44 -08:00
Sebastian Rittau
006a79220f
Flake8 fixes ( #2549 )
...
* Fix over-indented continuation lines
* Fix under-indented continuation lines
* Fix whitespace around default operator problems
* Limit line lengths
* Fix inconsistent files
2018-10-24 07:20:53 -07:00
Michael J. Sullivan
da6e18caf7
Make os.dup2 return int on Python 3.7 ( #2543 )
...
* Add inheritable param also
2018-10-23 23:15:35 +02:00
Adam Simpkins
79b2df4b24
os.DirEntry.stat() accepts a follow_symlinks keyword argument ( #2538 )
...
This function accepts the same arguments as the is_file() and is_dir()
methods in this class.
This also marks the follow_symlinks arguments to `is_dir()` and
`is_file()` as keyword only.
2018-10-23 23:13:33 +02:00
Sebastian Rittau
ea2122741f
os.path.exists (Py 3) accepts a file descriptor ( #2451 )
...
Closes #1653
2018-09-24 07:53:44 -07:00
Jelle Zijlstra
574807d9ea
os.get_terminal_size also exists on Windows ( #2338 )
...
... at least according to https://docs.python.org/3/library/os.html#os.get_terminal_size .
Related to python/mypy#5370 .
2018-07-18 10:25:12 -07:00
Linda_pp
8d13a377d4
Allow to specify None to encoding parameter of fdopen ( fix #2321 ) ( #2324 )
2018-07-11 19:43:13 -07:00
Yusuke Miyazaki
1ae2ba0fbe
Use sys.platform instead of comments ( #2286 )
2018-07-03 08:13:04 -07:00
Jelle Zijlstra
94ab32ba59
Fix abstract classes for Python 3 ( #2239 )
...
* add metaclass=ABCMeta to some classes
* mark some more classes as explicitly abstract
* make some more classes concrete
2018-06-16 10:18:54 -07:00
Anthony Sottile
56c93c85c0
Add NoReturn to execv* family of functions ( #2226 )
2018-06-15 07:55:45 -07:00
Michael J. Sullivan
db1316d26b
os.path.relpath can use a default argument and still use str ( #2159 )
2018-05-24 13:23:17 -07:00
Jelle Zijlstra
b89f9553e9
keep os.path in 2 and 3 consistent ( #2152 )
...
We can't merge these because os/__init__ is still different.
Also slight refactor of tests/check_consistent.py to avoid `from os import path`.
2018-05-22 07:14:13 -07:00
Michael Lee
709b193416
Rearrange overloads to account for optional arguments ( #2150 )
...
Basically, the same thing as [my previous pull request][0], except the
fixes are now focusing on functions with overlapping argument counts.
[0]: https://github.com/python/typeshed/pull/2138
2018-05-19 09:20:16 -07:00
Jelle Zijlstra
55be42f6d6
add __fspath__ support to os.path ( #2053 )
...
Fixes #1997 , #2068 .
This is tricky because we need to get the return values right (see #1960 for
prior attempts) and we often run into python/mypy#3644 . I found that I
could express most signatures correctly using a series of overloads.
A few other changes in here:
- Added splitunc, which according to https://docs.python.org/3/library/os.path.html
should exist in both Unix and Windows.
- Made the second argument to os.path.curdir Optional to match the implementation.
- Fixed os.path.split, whose previous Path-aware signature triggered python/mypy#3644 .
2018-05-15 10:31:40 -04:00
Jelle Zijlstra
482f207b3c
os.fwalk supports bytes ( #2013 )
...
python/cpython@8f6b344 and https://bugs.python.org/issue28682 .
I could not use the _PathLike alias because that includes bytes.
Part of #1965 .
2018-04-06 11:22:15 -07:00
Jelle Zijlstra
54ecefef04
removals in Python 3.7 ( #2018 )
...
Last part of #1965 .
2018-04-06 11:11:29 -07:00
Jelle Zijlstra
ce0656a8c7
add some more Python 3.7 features ( #2014 )
2018-04-06 11:08:30 -07:00
rchen152
38dc8f5a6a
Switch usages of mypy_extensions.NoReturn over to typing.NoReturn. ( #1942 )
...
* Change mypy_extensions.NoReturn to typing.NoReturn everywhere.
2018-03-05 12:42:29 -08:00
Roy Williams
71c2a94cb8
Allow os.listdir to accept a PathLike in Python3.6 ( #1894 )
2018-02-16 16:42:58 -08:00
Jelle Zijlstra
2dd85c3658
move os.stat_result into posix stub ( #1818 )
...
This removes the circular dependency between the os and posix stub, which
is somehow triggering python/mypy#4442 . We should ideally fix the mypy bug,
but since it's easy enough to fix the import cycle, we might as well do that
too.
2018-01-09 13:50:56 -08:00
Jelle Zijlstra
4ee508a032
make os.scandir work as a context manager ( #1787 )
...
Rework of #1583 . Fixes #1573 .
See documentation in https://docs.python.org/3/library/os.html#os.scandir .
2018-01-02 10:17:38 -08:00
hashstat
6accffca28
popen() is function, not method, so remove self argument ( #1671 )
2017-10-12 12:16:14 -07:00
hashstat
d333474ed9
Update and add stubs for os module ( #1645 )
2017-10-09 21:02:10 -07:00
Øystein Olsen
6bfd43d6b6
Update utime stub ( #1594 )
...
times can be either a tuple of ints or floats
2017-09-23 08:57:38 -04:00
Zack Hsi
a4285af4c2
Support PathLike argument to os.path.split ( #1588 )
2017-09-05 20:04:55 -07:00
Jelle Zijlstra
c40b7afc14
accept PathLike in os.scandir ( #1546 )
2017-08-21 13:54:22 -07:00
Adam Dangoor
7fe417ca58
In Python 3.4 and above, os.makedirs and os.removedirs use the kwarg "name" rather than "path" ( #1536 )
2017-08-08 18:42:29 -07:00
Jelle Zijlstra
318cada66c
os: merge the top and bottom of os/__init__.pyi ( #1458 )
...
* os: merge the top and bottom of os/__init__.pyi
Part of #1427 . In preparation for merging the two stubs, I'm making the files
identical as much as possible. This PR merges the top of the file, down to
but not including the definition of statvfs_result, and the bottom up to
and including os.utime.
This PR mostly adds more "if sys.version_info" block. Until the merger
completes, we'll have some Python 2 blocks in the Python 3 stub and vice versa.
I also add a few missing constants and arguments.
In followup PRs I'll merge the rest of the file. I'll put the trickiest part
(the return values of functions like os.stat) in its own PR.
* back out DirEntry from py2
It relies on stat_result which we don't have yet in py2.
2017-07-04 19:30:55 -07:00
Jelle Zijlstra
a419b696d4
make os.path identical in Python 2 and 3 ( #1459 )
...
Part of #1427 . I don't think we can actually merge these until we merge
os/__init__.pyi too, which will take a few more PRs.
2017-07-04 19:27:27 -07:00
Rhys Parry
9e7953515d
Allow os.readlink to accept path-like objects ( #1441 )
2017-06-30 22:00:36 -07:00
Rhys Parry
683c6e90a0
Support named attributes in os.uname() result ( #1445 )
...
`os.uname` changed in version 3.3: Return type changed from a tuple to
a tuple-like object with named attributes.
2017-06-30 21:58:44 -07:00
Jelle Zijlstra
4a5ff0bb11
use PEP 526-style annotations in os stubs ( #1428 )
...
And fix some TODOs.
This will help me check these stubs with my stubcheck tool, and is better
for consistency anyway.
2017-06-22 05:49:23 -07:00
elmar bucher
579f25896b
fix posix and win32 specific realpath path.pyi definition (PR 2) ( #1345 )
...
Fixes #1335 .
2017-05-24 18:54:50 -07:00
Jelle Zijlstra
14f7492fe0
os.walk allows PathLike ( #1306 )
2017-05-23 12:45:40 -07:00
Jelle Zijlstra
464761bfd3
Fixes to shutil stub in Python 3 ( #1227 )
...
Mostly PathLike support; also added the os.terminal_size namedtuple.
2017-05-01 08:30:41 -07:00
Cooper Lees
6e1d915944
- Add support for PathLike to _PathType for Python 3.6 Unions only ( #1165 )
2017-04-21 10:13:33 -07:00
David Euresti
26360e821b
Merge stdlib/{2,3}/os/path.pyi ( #1150 )
...
* Merge stdlib/{2,3}/os/path.pyi
To be renamed into stdlib/2and3/os/path.pyi later.
Also fixes #50
* CR fixes
2017-04-09 19:27:25 -07:00
David Euresti
b03e79886e
Fix os.getenv and friends to have consistent types ( #1131 )
2017-04-03 21:21:35 -07:00
Guido van Rossum
6a06dd40e1
Revert "Make os.stat_result and friends NamedTuples" ( #1113 )
...
* Revert "Added missing attributes of typing.Generator and typing.AsyncGenerator (#886 )"
This reverts commit 8b26422b95 .
2017-03-29 12:03:50 -07:00
David Euresti
6c3e175c8d
Make os.stat_result and friends NamedTuples ( #1103 )
2017-03-29 10:36:04 -07:00
David Euresti
ec83ed90eb
Fix some type errors in os module. ( #1101 )
...
* Fix some type errors in os module.
Found these because they were different between Python 2 and 3.
* Code Review changes
* Make it __arg0
2017-03-26 16:39:07 -07:00
David Euresti
2888b53924
Merge comments between stdlib/{2,3}/os/__init__.pyi to make diffing easier ( #1099 )
2017-03-25 20:50:21 -07:00