python / python/cpython

Clarify os.stat_result.st_mode as int and mention stat earlier in os.stat_result

オープン
#137,970 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

docs
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Documentation

Issue 1: Clarification that st_mode is an int while octal might be expected

Perhaps the description for st_mode here could use a .. note:: reminding the user that it is an int and a conversion to octal might be needed to see a familiar result.

When checking for file permission bits with os.stat() recently, I noticed the value of the st_mode member of the result was not what I expected - running the program on Unix I expected a familiar value such as 755 to appear at the end of the number. The number looked nothing like that and a quick web search told me I'd need to see that same int in octal notation to see the values I expected. This makes perfect sense after I've learned about it, but I figured maybe a note in the member's description could save someone else a web search.

Issue 2 (related): Moving the reference to the stat module earlier in os.stat_result

I'm also aware now that most such operations should involve the stat module instead of manual parsing of the values. The module is only mentioned at the end of the list of object's members (after st_reparse_tag), while for functions like chflags it is mentioned in the function's description. Could it be moved to the description of os.stat_result? If a user comes looking for a specific member of the os.stat_result object, they are most likely done with reading the member's list once they find it and therefore are unlikely to see the current mention of the module.

Thanks for looking into this!

Linked PRs
  • gh-138532

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue にリンクされている os.stat_result.st_mode のドキュメントから始め、続いて os.stat_result の周辺のメンバー一覧と、現在の stat-module リファレンスを確認します。st_mode が int であり、一般的なパーミッションビットには 8 進数表現が必要になる場合があることを文書化し、stat-module のガイダンスを前に移動できれば完了です。開始前にリンクされている PR gh-138532 を確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。