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
David Euresti
ce3a76bb97
Fix arg types for os.execv* ( #1075 )
2017-03-22 10:50:15 -07:00
Guido van Rossum
af2fadc180
More fixes related to PathLike ( #1061 )
...
* Make DirEntry generic over AnyStr, and inherit from PathLike if it exists
* Make pathlib require PathLike[str] (when it exists)
2017-03-21 22:26:21 -07:00
Guido van Rossum
41561f11c7
Redo PathLike without importing os into builtins.
2017-03-21 10:50:10 -07:00
Jelle Zijlstra
25464cf0a7
Merge pull request #991 from JetBrains/sproshev/pep-519
...
Update `open`, `os.fspath`, `os.fsencode`, `os.fsdecode`, `pathlib.PurePath` and `pathlib.Path` stubs due to PEP-519
2017-03-21 07:38:50 -07:00
Semyon Proshev
89de36afa4
Update os.fspath(path: PathLike) to return Any since Union return types are troublesome
2017-03-21 15:00:46 +03:00
David Euresti
2804788efa
Bring some things back to Union types
2017-03-20 22:29:43 -07:00
David Euresti
a4d70e5b01
Bring some things back to Union types
2017-03-20 22:26:06 -07:00
David Euresti
eb5d8c9cf2
Missed some that were marked as str
2017-03-20 22:12:58 -07:00
David Euresti
66fbb26aec
Use Union[bytes, Text] in os.pyi
...
In order to unify these two versions I'm making all paths be _PathType = Union[bytes, Text]
Fixes #439
2017-03-20 21:56:14 -07:00
Semyon Proshev
99a1afd72b
Update input parameter type for os.fsencode (+bytes) and os.fsdecode (+str).
2017-03-18 18:12:27 +03:00
Eddie Antonio Santos
a2fe3f4c59
Add os.supports_* sets (new in 3.3) ( #1005 )
...
* Add os.supports_* sets (new in 3.3)
* Use Callable[..., Any] instead of builtin.function.
2017-03-15 22:24:16 -07:00
Semyon Proshev
10860386d8
Update stubs for os.path, os.fsencode and os.fsdecode functions due to PEP-519.
2017-03-13 18:34:18 +03:00
Avy Faingezicht
abd2995bad
add stub for os.get_terminal_size in python3 ( #859 )
2017-01-23 09:06:39 -08:00