Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pathlib's mkdir documentation improvement #82695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jlaurens mannequin opened this issue Oct 18, 2019 · 2 comments
Closed

pathlib's mkdir documentation improvement #82695

jlaurens mannequin opened this issue Oct 18, 2019 · 2 comments
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir topic-pathlib type-feature A feature request or enhancement

Comments

@jlaurens
Copy link
Mannequin

jlaurens mannequin commented Oct 18, 2019

BPO 38514
Nosy @pitrou

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2019-10-18.10:00:46.964>
labels = ['type-feature', '3.7', 'docs']
title = "pathlib's mkdir documentation improvement"
updated_at = <Date 2019-10-19.16:52:11.642>
user = 'https://bugs.python.org/jlaurens'

bugs.python.org fields:

activity = <Date 2019-10-19.16:52:11.642>
actor = 'xtreak'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2019-10-18.10:00:46.964>
creator = 'jlaurens'
dependencies = []
files = []
hgrepos = []
issue_num = 38514
keywords = []
message_count = 1.0
messages = ['354874']
nosy_count = 3.0
nosy_names = ['pitrou', 'docs@python', 'jlaurens']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue38514'
versions = ['Python 3.7']

Linked PRs

@jlaurens
Copy link
Mannequin Author

jlaurens mannequin commented Oct 18, 2019

There are some inconsistencies in the actual documentation of path lib's mkdir doc.

Here is the 3.7 version, annotated and followed by a change proposal

Path.mkdir(mode=0o777, parents=False, exist_ok=False)
Create a new directory at this given path. If mode is given, it is combined with the processumask value to determine the file mode and access flags. If the path already exists, FileExistsError is raised. <<<<<<<<<<<<<<<<<< NOT ALWAYS due to exist_ok.

If parents is true, any missing parents of this path are created as needed; they are created with the default permissions without taking mode into account (mimicking the POSIX mkdir -p command).

If parents is false (the default), a missing parent raises FileNotFoundError.

If exist_ok is false (the default), FileExistsError is raised if the target directory already exists.

If exist_ok is true, FileExistsError exceptions will be ignored (same behavior as the POSIX mkdir -p command), but only if the last path component is not an existing non-directory file. <<<<<<<<<<<<<<<<<< UNCLEAR: 1) what is an ignored exception ? 2) The reference to POSIX should appear at the end, like above, 3) the last path component is a string 4) usage of a double negation ignore/is not

----- CHANGE ----

Path.mkdir(mode=0o777, parents=False, exist_ok=False)
Create a new directory in the file system at this given path.

If mode is given, it is combined with the process’ umask value to determine the file mode and access flags.

If parents is false (the default), a missing parent raises FileNotFoundError.

If parents is true, any missing parents of this path are created as needed; they are created with the default permissions without taking mode into account (mimicking the POSIX mkdir -p command).

If exist_ok is false (the default), FileExistsError is raised if the given path already exists in the file system, whether a directory or not.

If exist_ok is true, FileExistsError is raised only if the given path already exists in the file system and is not a directory (same behavior as the POSIX mkdir -p command).

Thanks for reading

JL

@jlaurens jlaurens mannequin added the 3.7 (EOL) end of life label Oct 18, 2019
@jlaurens jlaurens mannequin assigned docspython Oct 18, 2019
@jlaurens jlaurens mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Oct 18, 2019
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
barneygale added a commit to barneygale/cpython that referenced this issue Jan 13, 2024
Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.
barneygale added a commit that referenced this issue Jan 23, 2024
Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

Co-authored-by: Adam Turner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 23, 2024
…H-114032)

Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

(cherry picked from commit 32c2274)

Co-authored-by: Barney Gale <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 23, 2024
…H-114032)

Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

(cherry picked from commit 32c2274)

Co-authored-by: Barney Gale <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
barneygale added a commit that referenced this issue Jan 23, 2024
) (#114462)

Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

(cherry picked from commit 32c2274)

Co-authored-by: Barney Gale <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
barneygale added a commit that referenced this issue Jan 23, 2024
) (#114463)

Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

(cherry picked from commit 32c2274)

Co-authored-by: Barney Gale <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@barneygale
Copy link
Contributor

Sorted!

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…114032)

Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

Co-authored-by: Adam Turner <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…114032)

Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

Co-authored-by: Adam Turner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir topic-pathlib type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants