Commit Graph

125 Commits

Author SHA1 Message Date
Sebastian Rittau
d2a7889fe0 Drop support for Python 3.5 (#4675)
Python 3.5 EOL was on 2020-09-30.
2020-11-02 16:18:20 +01:00
Sebastian Rittau
4603728a15 Clean up files with former forced consistency (#4717)
Replace Text with str in Python 3 code
2020-10-27 07:52:35 +01:00
Shantanu
6ff5b88ca7 typeshed: remove crufty comments (#4699)
Co-authored-by: hauntsaninja <>
2020-10-23 09:40:06 +02:00
Utsav
6f943d43ea Added __class_getitem__ (#4695)
Resolves #4682

Co-authored-by: hauntsaninja <>
2020-10-22 14:05:04 -07:00
Shantanu
d140885898 statvfs_result: type structseq better (#4587)
Fixes #4572

Co-authored-by: hauntsaninja <>
2020-10-02 03:02:36 -07:00
Shantanu
e3889c776e pep 484: explicit reexport as intended (#4586)
See discussion on typing-sig.
This doesn't take care of some third_party libraries, will follow up on
those.

Co-authored-by: hauntsaninja <>
2020-09-30 10:04:23 -07:00
Cebtenzzre
1334840323 Make os.fchdir, os.fsync, and os.fdatasync accept FileDescriptorLike (#4544)
For the fd passed to these functions, CPython accepts not just an int,
but also anything with a fileno() method.

Fixes #4539
2020-09-15 16:30:34 -07:00
Shantanu
fdd01b0036 os._AddedDllDirectory: add __init__ (#4498) 2020-08-31 11:52:28 +02:00
Jelle Zijlstra
5f9fd3d127 upgrade black version (#4486)
Manually removed a number of trailing commas to prevent black from unnecessarily
exploding some collections.
2020-08-26 18:36:01 +02:00
Shantanu
b438ccc3bc PathLike: change to Protocol (#4447)
Co-authored-by: hauntsaninja <>
2020-08-16 05:15:51 -07:00
Sebastian Rittau
b8f6d5fc54 Replace a few instances of IO with protocols (#4296) 2020-06-30 18:05:30 -07:00
Jelle Zijlstra
0142a87da8 adjust isort config (#4290)
Fixes #4288.

- Default imports to THIRD_PARTY, so in effect we merge the FIRST_PARTY and THIRD_PARTY stubs. This means import order is no longer affected by whether typing_extensions is installed locally.
- Treat typing_extensions, _typeshed and some others as standard library modules.

Note that isort master is very different from the latest release; we'll have to do something
different if and when the next isort release comes out.
2020-06-29 00:00:21 -07:00
Jelle Zijlstra
5d553c9584 apply black and isort (#4287)
* apply black and isort

* move some type ignores
2020-06-28 13:31:00 -07:00
Jelle Zijlstra
e1d89e5742 remove references to "Text" in Python 3-only stubs (#4251) 2020-06-22 12:39:01 +02:00
Russell Davis
aca6bd7e88 Fix os.exec* and os.spawn* to allow PathLike for all args (#4236) 2020-06-21 13:41:19 -07:00
Martijn Pieters
5c739ef4c3 os.fsencode(PathLike[AnyStr]) produces AnyStr (#4233)
PathLike is generic over AnyStr of 7587e7f1c1. Also see 89de36afa4, which changed this to `Any` before `AnyStr` was available.
2020-06-16 15:57:58 -07:00
Sebastian Rittau
89d3a55f1a Preparations for the Big Reformat (#4228)
A few comments between imports were removed or moved to the top of the
import block, due to behavioral differences between black and isort. See
psf/black#251 for details.

In two instances @overloads at the top of the file needed to be moved
due to psf/black#1490.
2020-06-14 07:58:26 -07:00
Jelle Zijlstra
43e93f803f use _typeshed's Path aliases (#4214) 2020-06-10 20:57:09 -07:00
Kevin Wojniak
17aa20cd95 Add st_file_attributes to stat_result for Windows (#4156)
This member is documented at https://docs.python.org/3/library/os.html#os.stat_result.st_file_attributes and https://docs.python.org/3/whatsnew/3.5.html#os

Co-authored-by: hauntsaninja <>
2020-06-01 23:53:11 -07:00
Shantanu
de2c2947fe windows: fix splitunc param name (#4143)
Co-authored-by: hauntsaninja <>
2020-05-29 20:37:19 -04:00
Rune Tynan
ed4993bd50 Fix stubtest failures for os.__init__ on windows (#4098) 2020-05-27 17:25:30 +02:00
Rune Tynan
5e80ca9e44 Fix stubtest failures for path files on windows (#4096) 2020-05-27 09:39:26 +02:00
Debjyoti Biswas
f4a646d43c Add PathLike to genericpath.exists and re-export (#3897)
Closes#3492
2020-04-02 09:51:59 +02:00
Shantanu
2d3635f10d os: fix platform availability (#3832) 2020-03-07 12:59:55 +01:00
Shantanu
a19caac361 os.path: fix arg names (#3748) 2020-02-21 11:55:21 +01:00
Shantanu
7924d36656 os: fix various arg names (#3726) 2020-02-05 20:57:51 +01:00
Shantanu
10d33f5364 os: fix getenvb, scandir (#3723)
* os: fix getenvb
* os: scandir accepts None
2020-02-05 20:55:45 +01:00
Shantanu
fb286e1eb2 os.register_at_fork: fix signature (#3720) 2020-02-05 16:22:24 +01:00
Shantanu
12cbdcf337 os: mark positional-only args (#3719)
Also remove unnecessary branch for os.urandom
2020-02-05 16:21:03 +01:00
Erick
394ee4a9ae added f_fsid: int to os.statvfs_result for >= 3.7 (#3608) 2020-01-13 20:08:59 +01:00
Rebecca Chen
3b3fc6a57f Make os.statvfs_result inherit from typing.NamedTuple. (#3603) 2020-01-10 22:42:29 +01:00
Vury Leo
e7430508b0 Fix argument name of os.link/symlink (#3590) 2020-01-08 13:16:02 +01:00
Daniel Hahler
2f65683d7b Fix type for os.terminal_size to Tuple (#3450) 2019-11-10 19:30:12 +01:00
Benjamin Peterson
2023394b37 exec, spawn: Allow bytes for environment keys and values. (#3419)
A more correct type would be Mapping[Union[bytes, str], Union[bytes, str]], but our hands are tied by the invariance of mapping keys.
2019-10-29 11:48:36 -07:00
Sebastian Rittau
ec7960a8cb Convert namedtuples to class syntax (#3321) 2019-10-20 10:37:33 +02:00
Sebastian Rittau
0501e2b329 Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
2019-10-14 09:53:48 +02:00
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