-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
os.po
7687 lines (6652 loc) · 358 KB
/
os.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# isombyt <isombyt@isombyt.me>, 2021
# Steve Ni <wincss@gmail.com>, 2021
# Zombie110year <zombie110year@gmail.com>, 2021
# SKY H. <sky19960802@gmail.com>, 2021
# 1lin24 <1lin24@sina.com>, 2021
# sunsol s <sunsolzn@gmail.com>, 2021
# ChenYuan <github@qiushi.ac.cn>, 2021
# Kade For, 2021
# sgqy <sgqyzh@gmail.com>, 2021
# cdarlint <cdarling@126.com>, 2021
# Shengjing Zhu <zsj950618@gmail.com>, 2021
# Trim21 <i@trim21.me>, 2021
# 96ea86b025a96effe58335f7b3bef4bc_e6c340d <e08e1f6a23a9b48bf97be6e67771cdbc_822089>, 2021
# Arisaka97 <solitaire2312@gmail.com>, 2021
# 林行众 <linxzh1989@gmail.com>, 2021
# CCXXXI <ccxxxi@qq.com>, 2021
# Alpha Du <alphanow@gmail.com>, 2022
# ProgramRipper, 2023
# Dai Xu <daixu61@hotmail.com>, 2023
# WH-2099 <wh2099@outlook.com>, 2023
# ppcfish <ppcfish@gmail.com>, 2023
# starklin, 2023
# Sefank <sefank@foxmail.com>, 2023
# lit, 2024
# lqks, 2024
# Freesand Leo <yuqinju@163.com>, 2024
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-11 14:17+0000\n"
"PO-Revision-Date: 2021-06-28 01:10+0000\n"
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2024\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../library/os.rst:2
msgid ":mod:`!os` --- Miscellaneous operating system interfaces"
msgstr ":mod:`!os` --- 多种操作系统接口"
#: ../../library/os.rst:7
msgid "**Source code:** :source:`Lib/os.py`"
msgstr "**源代码:** :source:`Lib/os.py`"
#: ../../library/os.rst:11
msgid ""
"This module provides a portable way of using operating system dependent "
"functionality. If you just want to read or write a file see :func:`open`, "
"if you want to manipulate paths, see the :mod:`os.path` module, and if you "
"want to read all the lines in all the files on the command line see the "
":mod:`fileinput` module. For creating temporary files and directories see "
"the :mod:`tempfile` module, and for high-level file and directory handling "
"see the :mod:`shutil` module."
msgstr ""
"本模块提供了一种使用与操作系统相关的功能的便捷式途径。 如果你只是想读写一个文件,请参阅 :func:`open`,如果你想操作文件路径,请参阅 "
":mod:`os.path` 模块,如果你想读取通过命令行给出的所有文件中的所有行,请参阅 :mod:`fileinput` 模块。 "
"为了创建临时文件和目录,请参阅 :mod:`tempfile` 模块,对于高级文件和目录处理,请参阅 :mod:`shutil` 模块。"
#: ../../library/os.rst:19
msgid "Notes on the availability of these functions:"
msgstr "关于这些函数的适用性的说明:"
#: ../../library/os.rst:21
msgid ""
"The design of all built-in operating system dependent modules of Python is "
"such that as long as the same functionality is available, it uses the same "
"interface; for example, the function ``os.stat(path)`` returns stat "
"information about *path* in the same format (which happens to have "
"originated with the POSIX interface)."
msgstr ""
"Python中所有依赖于操作系统的内置模块的设计都是这样,只要不同的操作系统某一相同的功能可用,它就使用相同的接口。例如,函数 "
"``os.stat(path)`` 以相同的格式返回关于 *path* 的状态信息(该格式源于 POSIX 接口)。"
#: ../../library/os.rst:27
msgid ""
"Extensions peculiar to a particular operating system are also available "
"through the :mod:`os` module, but using them is of course a threat to "
"portability."
msgstr "特定于某一操作系统的扩展通过操作 :mod:`os` 模块也是可用的,但是使用它们当然是对可移植性的一种威胁。"
#: ../../library/os.rst:31
msgid ""
"All functions accepting path or file names accept both bytes and string "
"objects, and result in an object of the same type, if a path or file name is"
" returned."
msgstr "所有接受路径或文件名的函数都同时支持字节串和字符串对象,并在返回路径或文件名时使用相应类型的对象作为结果。"
#: ../../library/os.rst:35
msgid ""
"On VxWorks, os.popen, os.fork, os.execv and os.spawn*p* are not supported."
msgstr "在 VxWorks 系统上,os.popen, os.fork, os.execv 和 os.spawn*p* 都未支持。"
#: ../../library/os.rst:37
msgid ""
"On WebAssembly platforms, Android and iOS, large parts of the :mod:`os` "
"module are not available or behave differently. APIs related to processes "
"(e.g. :func:`~os.fork`, :func:`~os.execve`) and resources (e.g. "
":func:`~os.nice`) are not available. Others like :func:`~os.getuid` and "
":func:`~os.getpid` are emulated or stubs. WebAssembly platforms also lack "
"support for signals (e.g. :func:`~os.kill`, :func:`~os.wait`)."
msgstr ""
"在 WebAssembly 平台、Android 和 iOS 上,:mod:`os` 模块的很大一部分都不可用或具有不同的行为。 与进程相关联的 API"
" (例如 :func:`~os.fork`, :func:`~os.execve`) 和资源 (例如 :func:`~os.nice`) 都不可用。 "
"其他诸如 :func:`~os.getuid` 和 :func:`~os.getpid` 等则为模拟或空盒。 WebAssembly 平台还缺少对信号 "
"(例如 :func:`~os.kill`, :func:`~os.wait`) 的支持。"
#: ../../library/os.rst:47
msgid ""
"All functions in this module raise :exc:`OSError` (or subclasses thereof) in"
" the case of invalid or inaccessible file names and paths, or other "
"arguments that have the correct type, but are not accepted by the operating "
"system."
msgstr ""
"如果使用无效或无法访问的文件名与路径,或者其他类型正确但操作系统不接受的参数,此模块的所有函数都抛出 :exc:`OSError` (或者它的子类)。"
#: ../../library/os.rst:53
msgid "An alias for the built-in :exc:`OSError` exception."
msgstr "内建的 :exc:`OSError` 异常的一个别名。"
#: ../../library/os.rst:58
msgid ""
"The name of the operating system dependent module imported. The following "
"names have currently been registered: ``'posix'``, ``'nt'``, ``'java'``."
msgstr "导入的依赖特定操作系统的模块的名称。以下名称目前已注册: ``'posix'``, ``'nt'``, ``'java'``."
#: ../../library/os.rst:63
msgid ""
":data:`sys.platform` has a finer granularity. :func:`os.uname` gives "
"system-dependent version information."
msgstr ":data:`sys.platform` 具有更细的粒度。 :func:`os.uname` 将给出基于不同系统的版本信息。"
#: ../../library/os.rst:66
msgid ""
"The :mod:`platform` module provides detailed checks for the system's "
"identity."
msgstr ":mod:`platform` 模块对系统的标识有更详细的检查。"
#: ../../library/os.rst:74
msgid "File Names, Command Line Arguments, and Environment Variables"
msgstr "文件名,命令行参数,以及环境变量。"
#: ../../library/os.rst:76
msgid ""
"In Python, file names, command line arguments, and environment variables are"
" represented using the string type. On some systems, decoding these strings "
"to and from bytes is necessary before passing them to the operating system. "
"Python uses the :term:`filesystem encoding and error handler` to perform "
"this conversion (see :func:`sys.getfilesystemencoding`)."
msgstr ""
"在 Python 中,使用字符串类型表示文件名、命令行参数和环境变量。 在某些系统上,在将这些字符串传递给操作系统之前,必须将这些字符串解码为字节。 "
"Python 使用 :term:`filesystem encoding and error handler` 来执行此转换(请参阅 "
":func:`sys.getfilesystemencoding` )。"
#: ../../library/os.rst:82
msgid ""
"The :term:`filesystem encoding and error handler` are configured at Python "
"startup by the :c:func:`PyConfig_Read` function: see "
":c:member:`~PyConfig.filesystem_encoding` and "
":c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`."
msgstr ""
":term:`filesystem encoding and error handler` 是在 Python 启动时通过 "
":c:func:`PyConfig_Read` 函数来配置的:请参阅 :c:type:`PyConfig` 的 "
":c:member:`~PyConfig.filesystem_encoding` 和 "
":c:member:`~PyConfig.filesystem_errors` 等成员。"
#: ../../library/os.rst:87
msgid ""
"On some systems, conversion using the file system encoding may fail. In this"
" case, Python uses the :ref:`surrogateescape encoding error handler "
"<surrogateescape>`, which means that undecodable bytes are replaced by a "
"Unicode character U+DC\\ *xx* on decoding, and these are again translated to"
" the original byte on encoding."
msgstr ""
"在某些系统上,使用文件系统编码格式进行转换可能会失败。 在这种情况下,Python 会使用 :ref:`surrogateescape 编码错误处理器 "
"<surrogateescape>`,这意味着不可解码的字节在解码时会被 Unicode 字符 U+DC\\ *xx* "
"替换,并且这些字节在编码时又会再次被转换为原始字节。"
#: ../../library/os.rst:95
msgid ""
"The :term:`file system encoding <filesystem encoding and error handler>` "
"must guarantee to successfully decode all bytes below 128. If the file "
"system encoding fails to provide this guarantee, API functions can raise "
":exc:`UnicodeError`."
msgstr ""
":term:`文件系统编码器 <filesystem encoding and error handler>` 必须保证能成功解码所有 128 "
"以内的字节。如果不能保证,API 函数可能触发 :exc:`UnicodeError` 。"
#: ../../library/os.rst:100
msgid "See also the :term:`locale encoding`."
msgstr "另请参见 :term:`locale encoding`。"
#: ../../library/os.rst:106
msgid "Python UTF-8 Mode"
msgstr "Python UTF-8 模式"
#: ../../library/os.rst:108
msgid "See :pep:`540` for more details."
msgstr "有关更多详细信息,请参阅 :pep:`540` 。"
#: ../../library/os.rst:111
msgid ""
"The Python UTF-8 Mode ignores the :term:`locale encoding` and forces the "
"usage of the UTF-8 encoding:"
msgstr "Python UTF-8 模式会忽略 :term:`locale encoding` 并强制使用 UTF-8 编码。"
#: ../../library/os.rst:114
msgid ""
"Use UTF-8 as the :term:`filesystem encoding <filesystem encoding and error "
"handler>`."
msgstr "用 UTF-8 作为 :term:`文件系统编码 <filesystem encoding and error handler>`。"
#: ../../library/os.rst:116
msgid ":func:`sys.getfilesystemencoding` returns ``'utf-8'``."
msgstr ":func:`sys.getfilesystemencoding` 返回 ``'utf-8'``。"
#: ../../library/os.rst:117
msgid ""
":func:`locale.getpreferredencoding` returns ``'utf-8'`` (the *do_setlocale* "
"argument has no effect)."
msgstr ""
":func:`locale.getpreferredencoding` 返回 ``'utf-8'`` (*do_setlocale* 参数不起作用)。"
#: ../../library/os.rst:119
msgid ""
":data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr` all use UTF-8 "
"as their text encoding, with the ``surrogateescape`` :ref:`error handler "
"<error-handlers>` being enabled for :data:`sys.stdin` and :data:`sys.stdout`"
" (:data:`sys.stderr` continues to use ``backslashreplace`` as it does in the"
" default locale-aware mode)"
msgstr ""
":data:`sys.stdin`, :data:`sys.stdout` 和 :data:`sys.stderr` 都将 UTF-8 "
"用作它们的文本编码,并且为 :data:`sys.stdin` 和 :data:`sys.stdout` 启用 ``surrogateescape`` "
":ref:`错误处理器 <error-handlers>` (:data:`sys.stderr` 会继续使用 ``backslashreplace``"
" 如同在默认的局部感知模式下一样)"
#: ../../library/os.rst:124
msgid ""
"On Unix, :func:`os.device_encoding` returns ``'utf-8'`` rather than the "
"device encoding."
msgstr "在 Unix 上,:func:`os.device_encoding` 返回 ``'utf-8'`` 而不是设备的编码格式。"
#: ../../library/os.rst:127
msgid ""
"Note that the standard stream settings in UTF-8 mode can be overridden by "
":envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware "
"mode)."
msgstr ""
"请注意 UTF-8 模式下的标准流设置可以被 :envvar:`PYTHONIOENCODING` 所覆盖(在默认的区域感知模式下也同样如此)。"
#: ../../library/os.rst:131
msgid ""
"As a consequence of the changes in those lower level APIs, other higher "
"level APIs also exhibit different default behaviours:"
msgstr "作为低层级 API 发生改变的结果,其他高层级 API 也会表现出不同的默认行为:"
#: ../../library/os.rst:134
msgid ""
"Command line arguments, environment variables and filenames are decoded to "
"text using the UTF-8 encoding."
msgstr "命令行参数,环境变量和文件名会使用 UTF-8 编码来解码为文本。"
#: ../../library/os.rst:136
msgid ":func:`os.fsdecode` and :func:`os.fsencode` use the UTF-8 encoding."
msgstr ":func:`os.fsdecode` 和 :func:`os.fsencode` 使用 UTF-8 编码格式。"
#: ../../library/os.rst:137
msgid ""
":func:`open`, :func:`io.open`, and :func:`codecs.open` use the UTF-8 "
"encoding by default. However, they still use the strict error handler by "
"default so that attempting to open a binary file in text mode is likely to "
"raise an exception rather than producing nonsense data."
msgstr ""
":func:`open`, :func:`io.open` 和 :func:`codecs.open` 默认会使用 UTF-8 编码格式。 "
"但是,它们默认仍将使用 strict 错误处理器因此试图在文本模式下打开二进制文件可能会引发异常而不是产生无意义的数据。"
#: ../../library/os.rst:142
msgid ""
"The :ref:`Python UTF-8 Mode <utf8-mode>` is enabled if the LC_CTYPE locale "
"is ``C`` or ``POSIX`` at Python startup (see the :c:func:`PyConfig_Read` "
"function)."
msgstr ""
"如果在 Python 启动时 LC_CTYPE 区域设为 ``C`` 或 ``POSIX`` ,则启用 :ref:`Python UTF-8 模式 "
"<utf8-mode>` (参见 :c:func:`PyConfig_Read` 函数)。"
#: ../../library/os.rst:146
msgid ""
"It can be enabled or disabled using the :option:`-X utf8 <-X>` command line "
"option and the :envvar:`PYTHONUTF8` environment variable."
msgstr "它可以通过命令行选项 :option:`-X utf8 <-X>` 和环境变量 :envvar:`PYTHONUTF8`,来启用或禁用。"
#: ../../library/os.rst:149
msgid ""
"If the :envvar:`PYTHONUTF8` environment variable is not set at all, then the"
" interpreter defaults to using the current locale settings, *unless* the "
"current locale is identified as a legacy ASCII-based locale (as described "
"for :envvar:`PYTHONCOERCECLOCALE`), and locale coercion is either disabled "
"or fails. In such legacy locales, the interpreter will default to enabling "
"UTF-8 mode unless explicitly instructed not to do so."
msgstr ""
"如果没有设置 :envvar:`PYTHONUTF8` 环境变量,那么解释器默认使用当前的地区设置,*除非* 当前地区识别为基于 ASCII "
"的传统地区(如 :envvar:`PYTHONCOERCECLOCALE` 所述),并且 locale coercion "
"被禁用或失败。在这种传统地区,除非显式指明不要如此,解释器将默认启用 UTF-8 模式。"
#: ../../library/os.rst:156
msgid ""
"The Python UTF-8 Mode can only be enabled at the Python startup. Its value "
"can be read from :data:`sys.flags.utf8_mode <sys.flags>`."
msgstr ""
"Python UTF-8 模式只能在 Python 启动时启用。其值可以从 :data:`sys.flags.utf8_mode "
"<sys.flags>` 读取。"
#: ../../library/os.rst:159
msgid ""
"See also the :ref:`UTF-8 mode on Windows <win-utf8-mode>` and the "
":term:`filesystem encoding and error handler`."
msgstr ""
"另请参阅 :ref:`在 Windows 中的 UTF-8 模式 <win-utf8-mode>` 和 :term:`filesystem "
"encoding and error handler`。"
#: ../../library/os.rst:164
msgid ":pep:`686`"
msgstr ":pep:`686`"
#: ../../library/os.rst:165
msgid "Python 3.15 will make :ref:`utf8-mode` default."
msgstr "Python 3.15 将把 :ref:`utf8-mode` 设为默认值。"
#: ../../library/os.rst:171
msgid "Process Parameters"
msgstr "进程参数"
#: ../../library/os.rst:173
msgid ""
"These functions and data items provide information and operate on the "
"current process and user."
msgstr "这些函数和数据项提供了操作当前进程和用户的信息。"
#: ../../library/os.rst:179
msgid ""
"Return the filename corresponding to the controlling terminal of the "
"process."
msgstr "返回与进程控制终端对应的文件名。"
#: ../../library/os.rst:181 ../../library/os.rst:322 ../../library/os.rst:337
#: ../../library/os.rst:358 ../../library/os.rst:367 ../../library/os.rst:376
#: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:426
#: ../../library/os.rst:434 ../../library/os.rst:442 ../../library/os.rst:462
#: ../../library/os.rst:480 ../../library/os.rst:491 ../../library/os.rst:503
#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:533
#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586
#: ../../library/os.rst:593 ../../library/os.rst:602 ../../library/os.rst:639
#: ../../library/os.rst:652 ../../library/os.rst:661 ../../library/os.rst:678
#: ../../library/os.rst:687 ../../library/os.rst:694 ../../library/os.rst:703
#: ../../library/os.rst:712 ../../library/os.rst:719 ../../library/os.rst:726
#: ../../library/os.rst:735 ../../library/os.rst:792 ../../library/os.rst:831
#: ../../library/os.rst:953 ../../library/os.rst:979 ../../library/os.rst:992
#: ../../library/os.rst:1009 ../../library/os.rst:1027
#: ../../library/os.rst:1038 ../../library/os.rst:1061
#: ../../library/os.rst:1082 ../../library/os.rst:1094
#: ../../library/os.rst:1105 ../../library/os.rst:1118
#: ../../library/os.rst:1139 ../../library/os.rst:1160
#: ../../library/os.rst:1172 ../../library/os.rst:1183
#: ../../library/os.rst:1244 ../../library/os.rst:1367
#: ../../library/os.rst:1379 ../../library/os.rst:1393
#: ../../library/os.rst:1403 ../../library/os.rst:1418
#: ../../library/os.rst:1433 ../../library/os.rst:1446
#: ../../library/os.rst:1463 ../../library/os.rst:1489
#: ../../library/os.rst:1506 ../../library/os.rst:1520
#: ../../library/os.rst:1535 ../../library/os.rst:1547
#: ../../library/os.rst:1574 ../../library/os.rst:1586
#: ../../library/os.rst:1596 ../../library/os.rst:1610
#: ../../library/os.rst:1662 ../../library/os.rst:1682
#: ../../library/os.rst:1691 ../../library/os.rst:1703
#: ../../library/os.rst:1738 ../../library/os.rst:1762
#: ../../library/os.rst:1772 ../../library/os.rst:1780
#: ../../library/os.rst:1789 ../../library/os.rst:1800
#: ../../library/os.rst:1837 ../../library/os.rst:1864
#: ../../library/os.rst:1915 ../../library/os.rst:1921
#: ../../library/os.rst:2087 ../../library/os.rst:2164
#: ../../library/os.rst:2181 ../../library/os.rst:2195
#: ../../library/os.rst:2221 ../../library/os.rst:2239
#: ../../library/os.rst:2255 ../../library/os.rst:2271
#: ../../library/os.rst:2334 ../../library/os.rst:2358
#: ../../library/os.rst:2378 ../../library/os.rst:2514
#: ../../library/os.rst:2536 ../../library/os.rst:2580
#: ../../library/os.rst:2592 ../../library/os.rst:2614
#: ../../library/os.rst:3322 ../../library/os.rst:3456
#: ../../library/os.rst:3479 ../../library/os.rst:3493
#: ../../library/os.rst:3712 ../../library/os.rst:3737
#: ../../library/os.rst:3762 ../../library/os.rst:3816
#: ../../library/os.rst:3825 ../../library/os.rst:3834
#: ../../library/os.rst:3842 ../../library/os.rst:3851
#: ../../library/os.rst:3860 ../../library/os.rst:3932
#: ../../library/os.rst:3995 ../../library/os.rst:4005
#: ../../library/os.rst:4023 ../../library/os.rst:4032
#: ../../library/os.rst:4042 ../../library/os.rst:4052
#: ../../library/os.rst:4062 ../../library/os.rst:4073
#: ../../library/os.rst:4218 ../../library/os.rst:4287
#: ../../library/os.rst:4322 ../../library/os.rst:4330
#: ../../library/os.rst:4337 ../../library/os.rst:4344
#: ../../library/os.rst:4351 ../../library/os.rst:4358
#: ../../library/os.rst:4365 ../../library/os.rst:4372
#: ../../library/os.rst:4380 ../../library/os.rst:4388
#: ../../library/os.rst:4395 ../../library/os.rst:4402
#: ../../library/os.rst:4411 ../../library/os.rst:4419
#: ../../library/os.rst:4427 ../../library/os.rst:4434
#: ../../library/os.rst:4441 ../../library/os.rst:4490
#: ../../library/os.rst:4517 ../../library/os.rst:4541
#: ../../library/os.rst:4557 ../../library/os.rst:4564
#: ../../library/os.rst:4575 ../../library/os.rst:4585
#: ../../library/os.rst:4594 ../../library/os.rst:4626
#: ../../library/os.rst:4734 ../../library/os.rst:4750
#: ../../library/os.rst:4783 ../../library/os.rst:4852
#: ../../library/os.rst:4871 ../../library/os.rst:4882
#: ../../library/os.rst:4894 ../../library/os.rst:4939
#: ../../library/os.rst:4976 ../../library/os.rst:4999
#: ../../library/os.rst:5020 ../../library/os.rst:5054
#: ../../library/os.rst:5095 ../../library/os.rst:5115
#: ../../library/os.rst:5129 ../../library/os.rst:5146
#: ../../library/os.rst:5161 ../../library/os.rst:5172
#: ../../library/os.rst:5184 ../../library/os.rst:5197
#: ../../library/os.rst:5206 ../../library/os.rst:5216
#: ../../library/os.rst:5229 ../../library/os.rst:5264
#: ../../library/os.rst:5280 ../../library/os.rst:5291
#: ../../library/os.rst:5303 ../../library/os.rst:5310
#: ../../library/os.rst:5319 ../../library/os.rst:5328
#: ../../library/os.rst:5337 ../../library/os.rst:5346
#: ../../library/os.rst:5496 ../../library/os.rst:5505
#: ../../library/os.rst:5529 ../../library/os.rst:5556
#: ../../library/os.rst:5565 ../../library/os.rst:5688
msgid "Availability"
msgstr "Availability"
#: ../../library/os.rst:186
msgid ""
"A :term:`mapping` object where keys and values are strings that represent "
"the process environment. For example, ``environ['HOME']`` is the pathname "
"of your home directory (on some platforms), and is equivalent to "
"``getenv(\"HOME\")`` in C."
msgstr ""
"一个 :term:`mapping` 对象,其中键值是代表进程环境的字符串。 例如,``environ['HOME']`` "
"是你的主目录(在某些平台上)的路径名,相当于 C 中的 ``getenv(\"HOME\")``。"
#: ../../library/os.rst:191
msgid ""
"This mapping is captured the first time the :mod:`os` module is imported, "
"typically during Python startup as part of processing :file:`site.py`. "
"Changes to the environment made after this time are not reflected in "
":data:`os.environ`, except for changes made by modifying :data:`os.environ` "
"directly."
msgstr ""
"这个映射是在第一次导入 :mod:`os` 模块时捕获的,通常作为 Python 启动时处理 :file:`site.py` 的一部分。除了通过直接修改"
" :data:`os.environ` 之外,在此之后对环境所做的更改不会反映在 :data:`os.environ` 中。"
#: ../../library/os.rst:196
msgid ""
"This mapping may be used to modify the environment as well as query the "
"environment. :func:`putenv` will be called automatically when the mapping "
"is modified."
msgstr "该映射除了可以用于查询环境外,还能用于修改环境。当该映射被修改时,将自动调用 :func:`putenv`。"
#: ../../library/os.rst:200
msgid ""
"On Unix, keys and values use :func:`sys.getfilesystemencoding` and "
"``'surrogateescape'`` error handler. Use :data:`environb` if you would like "
"to use a different encoding."
msgstr ""
"在Unix系统上,键和值会使用 :func:`sys.getfilesystemencoding` 和 ``'surrogateescape'`` "
"的错误处理。如果你想使用其他的编码,使用 :data:`environb`。"
#: ../../library/os.rst:204
msgid ""
"On Windows, the keys are converted to uppercase. This also applies when "
"getting, setting, or deleting an item. For example, ``environ['monty'] = "
"'python'`` maps the key ``'MONTY'`` to the value ``'python'``."
msgstr ""
"在 Windows 上,这些键会被转换为大写形式。 这也会在获取、设备或删除条目时被应用。 例如,``environ['monty'] = "
"'python'`` 会将键 ``'MONTY'`` 映射到值 ``'python'``。"
#: ../../library/os.rst:211
msgid ""
"Calling :func:`putenv` directly does not change :data:`os.environ`, so it's "
"better to modify :data:`os.environ`."
msgstr ""
"直接调用 :func:`putenv` 并不会影响 :data:`os.environ` ,所以推荐直接修改 :data:`os.environ` 。"
#: ../../library/os.rst:216
msgid ""
"On some platforms, including FreeBSD and macOS, setting ``environ`` may "
"cause memory leaks. Refer to the system documentation for "
":c:func:`!putenv`."
msgstr ""
"在某些平台上,包括 FreeBSD 和 macOS 等,设置 ``environ`` 可能会导致内存泄漏。 请参阅有关 "
":c:func:`!putenv` 的系统文档。"
#: ../../library/os.rst:220
msgid ""
"You can delete items in this mapping to unset environment variables. "
":func:`unsetenv` will be called automatically when an item is deleted from "
":data:`os.environ`, and when one of the :meth:`pop` or :meth:`clear` methods"
" is called."
msgstr ""
"可以删除映射中的元素来删除对应的环境变量。当从 :data:`os.environ` 删除元素时,以及调用 :meth:`pop` 或 "
":meth:`clear` 之一时,将自动调用 :func:`unsetenv`。"
#: ../../library/os.rst:225 ../../library/os.rst:241
msgid ""
"Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators."
msgstr "已更新并支持了 :pep:`584` 的合并 (``|``) 和更新 (``|=``) 运算符。"
#: ../../library/os.rst:231
msgid ""
"Bytes version of :data:`environ`: a :term:`mapping` object where both keys "
"and values are :class:`bytes` objects representing the process environment. "
":data:`environ` and :data:`environb` are synchronized (modifying "
":data:`environb` updates :data:`environ`, and vice versa)."
msgstr ""
":data:`environ` 的字节版本:一个 :term:`mapping` 对象,其中键值都是 :class:`bytes` 对象,代表进程环境。"
" :data:`environ` 和 :data:`environb` 是同步的(修改 :data:`environb` 会更新 "
":data:`environ`,反之亦然)。"
#: ../../library/os.rst:236
msgid ""
":data:`environb` is only available if :const:`supports_bytes_environ` is "
"``True``."
msgstr ":data:`environb` 仅在 :const:`supports_bytes_environ` 为 ``True`` 时可用。"
#: ../../library/os.rst:250
msgid "These functions are described in :ref:`os-file-dir`."
msgstr "以上函数请参阅 :ref:`os-file-dir` 。"
#: ../../library/os.rst:255
msgid ""
"Encode :term:`path-like <path-like object>` *filename* to the "
":term:`filesystem encoding and error handler`; return :class:`bytes` "
"unchanged."
msgstr ""
"将 :term:`类似路径形式的 <path-like object>` *filename* 编码为 :term:`filesystem "
"encoding and error handler`;原样返回 :class:`bytes`。"
#: ../../library/os.rst:259
msgid ":func:`fsdecode` is the reverse function."
msgstr ":func:`fsdecode` 是此函数的逆向函数。"
#: ../../library/os.rst:263 ../../library/os.rst:278
msgid ""
"Support added to accept objects implementing the :class:`os.PathLike` "
"interface."
msgstr "增加对实现了 :class:`os.PathLike` 接口的对象的支持。"
#: ../../library/os.rst:270
msgid ""
"Decode the :term:`path-like <path-like object>` *filename* from the "
":term:`filesystem encoding and error handler`; return :class:`str` "
"unchanged."
msgstr ""
"根据 :term:`filesystem encoding and error handler` 来解码 :term:`类似路径形式的 <path-"
"like object>` *filename*;原样返回 :class:`str`。"
#: ../../library/os.rst:274
msgid ":func:`fsencode` is the reverse function."
msgstr ":func:`fsencode` 是此函数的逆向函数。"
#: ../../library/os.rst:285
msgid "Return the file system representation of the path."
msgstr "返回路径的文件系统表示。"
#: ../../library/os.rst:287
msgid ""
"If :class:`str` or :class:`bytes` is passed in, it is returned unchanged. "
"Otherwise :meth:`~os.PathLike.__fspath__` is called and its value is "
"returned as long as it is a :class:`str` or :class:`bytes` object. In all "
"other cases, :exc:`TypeError` is raised."
msgstr ""
"如果传入的是 :class:`str` 或 :class:`bytes` 类型的字符串,将原样返回。否则 "
":meth:`~os.PathLike.__fspath__` 将被调用,如果得到的是一个 :class:`str` 或 :class:`bytes` "
"类型的对象,那就返回这个值。其他所有情况则会抛出 :exc:`TypeError` 异常。"
#: ../../library/os.rst:297
msgid ""
"An :term:`abstract base class` for objects representing a file system path, "
"e.g. :class:`pathlib.PurePath`."
msgstr ""
"某些对象用于表示文件系统中的路径(如 :class:`pathlib.PurePath` 对象),本类是这些对象的 :term:`抽象基类 "
"<abstract base class>`。"
#: ../../library/os.rst:304
msgid "Return the file system path representation of the object."
msgstr "返回当前对象的文件系统表示。"
#: ../../library/os.rst:306
msgid ""
"The method should only return a :class:`str` or :class:`bytes` object, with "
"the preference being for :class:`str`."
msgstr ""
"这个方法只应该返回一个 :class:`str` 字符串或 :class:`bytes` 字节串,请优先选择 :class:`str` 字符串。"
#: ../../library/os.rst:312
msgid ""
"Return the value of the environment variable *key* as a string if it exists,"
" or *default* if it doesn't. *key* is a string. Note that since "
":func:`getenv` uses :data:`os.environ`, the mapping of :func:`getenv` is "
"similarly also captured on import, and the function may not reflect future "
"environment changes."
msgstr ""
"如果环境变量 *key* 存在则将其值作为字符串返回,如果不存在则返回 *default*。 *key* 是一个字符串。 请注意由于 "
":func:`getenv` 使用了 :data:`os.environ`,因此 :func:`getenv` "
"的映射同样也会在导入时被捕获,并且该函数可能无法反映未来的环境变化。"
#: ../../library/os.rst:318
msgid ""
"On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` "
"and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would"
" like to use a different encoding."
msgstr ""
"在Unix系统上,键和值会使用 :func:`sys.getfilesystemencoding` 和 ``'surrogateescape'`` "
"错误处理进行解码。如果你想使用其他的编码,使用 :func:`os.getenvb`。"
#: ../../library/os.rst:327
msgid ""
"Return the value of the environment variable *key* as bytes if it exists, or"
" *default* if it doesn't. *key* must be bytes. Note that since "
":func:`getenvb` uses :data:`os.environb`, the mapping of :func:`getenvb` is "
"similarly also captured on import, and the function may not reflect future "
"environment changes."
msgstr ""
"如果环境变量 *key* 存在则将其值作为字节串返回,如果不存在则返回 *default*。 *key* 必须为字节串。 请注意由于 "
":func:`getenvb` 使用了 :data:`os.environb`,因此 :func:`getenvb` "
"的映射同样也会在导入时被捕获,并且该函数可能无法反映未来的环境变化。"
#: ../../library/os.rst:334
msgid ""
":func:`getenvb` is only available if :const:`supports_bytes_environ` is "
"``True``."
msgstr ":func:`getenvb` 仅在 :const:`supports_bytes_environ` 为 ``True`` 时可用。"
#: ../../library/os.rst:344
msgid ""
"Returns the list of directories that will be searched for a named "
"executable, similar to a shell, when launching a process. *env*, when "
"specified, should be an environment variable dictionary to lookup the PATH "
"in. By default, when *env* is ``None``, :data:`environ` is used."
msgstr ""
"返回将用于搜索可执行文件的目录列表,与在外壳程序中启动一个进程时相似。指定的 *env* 应为用于搜索 PATH 的环境变量字典。默认情况下,当 "
"*env* 为 ``None`` 时,将会使用 :data:`environ` 。"
#: ../../library/os.rst:355
msgid ""
"Return the effective group id of the current process. This corresponds to "
"the \"set id\" bit on the file being executed in the current process."
msgstr "返回当前进程的有效组ID。对应当前进程执行文件的 \"set id\" 位。"
#: ../../library/os.rst:365
msgid "Return the current process's effective user id."
msgstr "返回当前进程的有效用户ID。"
#: ../../library/os.rst:374
msgid "Return the real group id of the current process."
msgstr "返回当前进程的实际组ID。"
#: ../../library/os.rst:378 ../../library/os.rst:451 ../../library/os.rst:535
#: ../../library/os.rst:758
msgid ""
"The function is a stub on WASI, see :ref:`wasm-availability` for more "
"information."
msgstr "该函数在 WASI 上为空代码段,请参阅 :ref:`wasm-availability` 了解详情。"
#: ../../library/os.rst:384
msgid ""
"Return list of group ids that *user* belongs to. If *group* is not in the "
"list, it is included; typically, *group* is specified as the group ID field "
"from the password record for *user*, because that group ID will otherwise be"
" potentially omitted."
msgstr ""
"返回 *user* 所属的组 ID 列表。 如果 *group* 不在该列表中,它将被包括在内;通常,*group* 将会被指定为来自 *user* "
"的密码记录文件的组 ID 字段,因为在其他情况下该组 ID 有可能会被略去。"
#: ../../library/os.rst:396
msgid ""
"Return list of supplemental group ids associated with the current process."
msgstr "返回当前进程关联的附加组ID列表"
#: ../../library/os.rst:402
msgid ""
"On macOS, :func:`getgroups` behavior differs somewhat from other Unix "
"platforms. If the Python interpreter was built with a deployment target of "
"``10.5`` or earlier, :func:`getgroups` returns the list of effective group "
"ids associated with the current user process; this list is limited to a "
"system-defined number of entries, typically 16, and may be modified by calls"
" to :func:`setgroups` if suitably privileged. If built with a deployment "
"target greater than ``10.5``, :func:`getgroups` returns the current group "
"access list for the user associated with the effective user id of the "
"process; the group access list may change over the lifetime of the process, "
"it is not affected by calls to :func:`setgroups`, and its length is not "
"limited to 16. The deployment target value, "
":const:`MACOSX_DEPLOYMENT_TARGET`, can be obtained with "
":func:`sysconfig.get_config_var`."
msgstr ""
"在 macOS 上,:func:`getgroups` 的行为与其他 Unix 平台有所不同。 如果 Python 解释器是以 ``10.5`` "
"或更早版本作为部署目标的,则 :func:`getgroups` 会返回与当前用户进程相关联的有效组 ID "
"列表;该列表受限于系统预定义的条目数量,通常为 16,并且在适当的权限下还可通过调用 :func:`setgroups` 来修改。 "
"如果所用的部署目标版本大于 ``10.5``,则 :func:`getgroups` 会返回与进程的有效用户 ID "
"相关联的当前组访问列表;组访问列表可能会在进程的生命周期之内发生改变,它不会受对 :func:`setgroups` 的调用影响,且其长度也不会被限制为"
" 16。 部署目标值 :const:`MACOSX_DEPLOYMENT_TARGET` 可以通过 "
":func:`sysconfig.get_config_var` 来获取。"
#: ../../library/os.rst:419
msgid ""
"Return the name of the user logged in on the controlling terminal of the "
"process. For most purposes, it is more useful to use "
":func:`getpass.getuser` since the latter checks the environment variables "
":envvar:`LOGNAME` or :envvar:`USERNAME` to find out who the user is, and "
"falls back to ``pwd.getpwuid(os.getuid())[0]`` to get the login name of the "
"current real user id."
msgstr ""
"返回通过控制终端进程进行登录的用户名。在多数情况下,使用 :func:`getpass.getuser` 会更有效,因为后者会通过检查环境变量 "
":envvar:`LOGNAME` 或 :envvar:`USERNAME` 来查找用户,再由 "
"``pwd.getpwuid(os.getuid())[0]`` 来获取当前用户 ID 的登录名。"
#: ../../library/os.rst:431
msgid ""
"Return the process group id of the process with process id *pid*. If *pid* "
"is 0, the process group id of the current process is returned."
msgstr "根据进程id *pid* 返回进程的组 ID 列表。如果 *pid* 为 0,则返回当前进程的进程组 ID 列表"
#: ../../library/os.rst:440
msgid "Return the id of the current process group."
msgstr "返回当时进程组的ID"
#: ../../library/os.rst:449
msgid "Return the current process id."
msgstr "返回当前进程ID"
#: ../../library/os.rst:458
msgid ""
"Return the parent's process id. When the parent process has exited, on Unix"
" the id returned is the one of the init process (1), on Windows it is still "
"the same id, which may be already reused by another process."
msgstr ""
"返回父进程ID。当父进程已经结束,在Unix中返回的ID是初始进程(1)中的一个,在Windows中仍然是同一个进程ID,该进程ID有可能已经被进行进程所占用。"
#: ../../library/os.rst:464
msgid "Added support for Windows."
msgstr "添加WIndows的支持。"
#: ../../library/os.rst:472
msgid ""
"Get program scheduling priority. The value *which* is one of "
":const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* "
"is interpreted relative to *which* (a process identifier for "
":const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and "
"a user ID for :const:`PRIO_USER`). A zero value for *who* denotes "
"(respectively) the calling process, the process group of the calling "
"process, or the real user ID of the calling process."
msgstr ""
"获取程序调度优先级。*which* 参数值可以是 :const:`PRIO_PROCESS`,:const:`PRIO_PGRP`,或 "
":const:`PRIO_USER` 中的一个,*who* 是相对于 *which* (:const:`PRIO_PROCESS` "
"的进程标识符,:const:`PRIO_PGRP` 的进程组标识符和 :const:`PRIO_USER` 的用户ID)。当 *who* 为 0 "
"时(分别)表示调用的进程,调用进程的进程组或调用进程所属的真实用户 ID。"
#: ../../library/os.rst:489 ../../library/os.rst:501
msgid ""
"Parameters for the :func:`getpriority` and :func:`setpriority` functions."
msgstr "函数 :func:`getpriority` 和 :func:`setpriority` 的参数。"
#: ../../library/os.rst:509
msgid ""
"Return a tuple (ruid, euid, suid) denoting the current process's real, "
"effective, and saved user ids."
msgstr "返回一个由 (ruid, euid, suid) 所组成的元组,分别表示当前进程的真实用户ID,有效用户ID和暂存用户ID。"
#: ../../library/os.rst:519
msgid ""
"Return a tuple (rgid, egid, sgid) denoting the current process's real, "
"effective, and saved group ids."
msgstr "返回一个由 (rgid, egid, sgid) 所组成的元组,分别表示当前进程的真实组ID,有效组ID和暂存组ID。"
#: ../../library/os.rst:531
msgid "Return the current process's real user id."
msgstr "返回当前进程的真实用户ID。"
#: ../../library/os.rst:541
msgid ""
"Call the system initgroups() to initialize the group access list with all of"
" the groups of which the specified username is a member, plus the specified "
"group id."
msgstr "调用系统 initgroups(),使用指定用户所在的所有值来初始化组访问列表,包括指定的组ID。"
#: ../../library/os.rst:554
msgid ""
"Set the environment variable named *key* to the string *value*. Such "
"changes to the environment affect subprocesses started with "
":func:`os.system`, :func:`popen` or :func:`fork` and :func:`execv`."
msgstr ""
"将名为 *key* 的环境变量值设置为 *value*。该变量名修改会影响由 :func:`os.system`, :func:`popen` "
",:func:`fork` 和 :func:`execv` 发起的子进程。"
#: ../../library/os.rst:558
msgid ""
"Assignments to items in :data:`os.environ` are automatically translated into"
" corresponding calls to :func:`putenv`; however, calls to :func:`putenv` "
"don't update :data:`os.environ`, so it is actually preferable to assign to "
"items of :data:`os.environ`. This also applies to :func:`getenv` and "
":func:`getenvb`, which respectively use :data:`os.environ` and "
":data:`os.environb` in their implementations."
msgstr ""
"对 :data:`os.environ` 中的项目的赋值会自动转化为对 :func:`putenv` 的相应调用;然而,对 :func:`putenv`"
" 的调用并不更新 :data:`os.environ` ,所以实际上最好是赋值到 :data:`os.environ` 的项目。这也适用于 "
":func:`getenv` 和 :func:`getenvb` ,它们分别使用 :data:`os.environ` 和 "
":data:`os.environb` 在它们的实现中。"
#: ../../library/os.rst:566
msgid ""
"On some platforms, including FreeBSD and macOS, setting ``environ`` may "
"cause memory leaks. Refer to the system documentation for :c:func:`!putenv`."
msgstr ""
"在某些平台上,包括 FreeBSD 和 macOS 等,设置 ``environ`` 可能会导致内存泄漏。 请参阅有关 "
":c:func:`!putenv` 的系统文档。"
#: ../../library/os.rst:569
msgid ""
"Raises an :ref:`auditing event <auditing>` ``os.putenv`` with arguments "
"``key``, ``value``."
msgstr "引发一个 :ref:`审计事件 <auditing>` ``os.putenv`` 并附带参数 ``key``, ``value``。"
#: ../../library/os.rst:571
msgid "The function is now always available."
msgstr "该函数现在总是可用。"
#: ../../library/os.rst:577
msgid "Set the current process's effective group id."
msgstr "设置当前进程的有效组ID。"
#: ../../library/os.rst:584
msgid "Set the current process's effective user id."
msgstr "设置当前进程的有效用户ID。"
#: ../../library/os.rst:591
msgid "Set the current process' group id."
msgstr "设置当前进程的组ID。"
#: ../../library/os.rst:598
msgid ""
"Set the list of supplemental group ids associated with the current process "
"to *groups*. *groups* must be a sequence, and each element must be an "
"integer identifying a group. This operation is typically available only to "
"the superuser."
msgstr ""
"将 *group* 参数值设置为与当进程相关联的附加组ID列表。*group* "
"参数必须为一个序列,每个元素应为每个组的数字ID。该操作通常只适用于超级用户。"
#: ../../library/os.rst:604
msgid ""
"On macOS, the length of *groups* may not exceed the system-defined maximum "
"number of effective group ids, typically 16. See the documentation for "
":func:`getgroups` for cases where it may not return the same group list set "
"by calling setgroups()."
msgstr ""
"在 macOS 中,*groups* 的长度不能超过系统定义的最大有效组 ID 数量,通常为 16。 对于未返回与调用 setgroups() "
"产生的相同组列表的情况,请参阅 :func:`getgroups` 的文档。"
#: ../../library/os.rst:611
msgid ""
"Reassociate the current thread with a Linux namespace. See the "
":manpage:`setns(2)` and :manpage:`namespaces(7)` man pages for more details."
msgstr ""
"将当前线程与 Linux 命名空间重新关联。 详情参见 :manpage:`setns(2)` 和 :manpage:`namespaces(7)` "
"手册页面。"
#: ../../library/os.rst:615
msgid ""
"If *fd* refers to a :file:`/proc/{pid}/ns/` link, ``setns()`` reassociates "
"the calling thread with the namespace associated with that link, and "
"*nstype* may be set to one of the :ref:`CLONE_NEW* constants <os-unshare-"
"clone-flags>` to impose constraints on the operation (``0`` means no "
"constraints)."
msgstr ""
"如果 *fd* 是指向一个 :file:`/proc/{pid}/ns/` 链接,``setns()`` "
"会将调用线程与该链接所关联的命名空间重新关联起来,并且 *nstype* 可以设为某个 :ref:`CLONE_NEW* 常量 <os-unshare-"
"clone-flags>` 以便对操作施加约束 (``0`` 表示没有任何约束)。"
#: ../../library/os.rst:622
msgid ""
"Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from "
":func:`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling "
"thread into one or more of the same namespaces as the thread referred to by "
"*fd*. This is subject to any constraints imposed by *nstype*, which is a bit"
" mask combining one or more of the :ref:`CLONE_NEW* constants <os-unshare-"
"clone-flags>`, e.g. ``setns(fd, os.CLONE_NEWUTS | os.CLONE_NEWPID)``. The "
"caller's memberships in unspecified namespaces are left unchanged."
msgstr ""
"自 Linux 5.8 起,*fd* 可以是通过 :func:`~os.pidfd_open` 获取的 PID "
"文件描述符。在这种情况下,``setns()`` 会将调用线程重新关联到与 *fd* 引用的线程相同的一个或多个命名空间。位掩码 *nstype* "
"通常会结合一个或多个 :ref:`CLONE_NEW* 常量 <os-unshare-clone-flags>` ,例如 ``setns(fd, "
"os.CLONE_NEWUTS | os.CLONE_NEWPID)``,其施加的任何约束限制仍然保留,调用者在未指定的命名空间中的成员资格保持不变。"
#: ../../library/os.rst:631
msgid ""
"*fd* can be any object with a :meth:`~io.IOBase.fileno` method, or a raw "
"file descriptor."
msgstr "*fd* 可以是任何带有 :meth:`~io.IOBase.fileno` 方法的对象,或是一个原始文件描述符。"
#: ../../library/os.rst:633
msgid ""
"This example reassociates the thread with the ``init`` process's network "
"namespace::"
msgstr "此示例将线程与 ``init`` 进程的网络命名空间进行了重新关联::"
#: ../../library/os.rst:635
msgid ""
"fd = os.open(\"/proc/1/ns/net\", os.O_RDONLY)\n"
"os.setns(fd, os.CLONE_NEWNET)\n"
"os.close(fd)"
msgstr ""
"fd = os.open(\"/proc/1/ns/net\", os.O_RDONLY)\n"
"os.setns(fd, os.CLONE_NEWNET)\n"
"os.close(fd)"
#: ../../library/os.rst:645
msgid "The :func:`~os.unshare` function."
msgstr ":func:`~os.unshare` 函数。"
#: ../../library/os.rst:649
msgid ""
"Call the system call :c:func:`!setpgrp` or ``setpgrp(0, 0)`` depending on "
"which version is implemented (if any). See the Unix manual for the "
"semantics."
msgstr ""
"在系统调用 :c:func:`!setpgrp` 和 ``setpgrp(0, 0)`` "
"中择一调用,具体取决于何种实现版本可用(如果任一实现存在的话)。请参阅 Unix 手册以了解语义。"
#: ../../library/os.rst:657
msgid ""
"Call the system call :c:func:`!setpgid` to set the process group id of the "
"process with id *pid* to the process group with id *pgrp*. See the Unix "
"manual for the semantics."
msgstr ""
"使用系统调用 :c:func:`!setpgid` 将 *pid* 对应进程的组 ID 设置为 *pgrp*。请参阅 Unix 手册以了解语义。"
#: ../../library/os.rst:668
msgid ""
"Set program scheduling priority. The value *which* is one of "
":const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* "
"is interpreted relative to *which* (a process identifier for "
":const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and "
"a user ID for :const:`PRIO_USER`). A zero value for *who* denotes "
"(respectively) the calling process, the process group of the calling "
"process, or the real user ID of the calling process. *priority* is a value "
"in the range -20 to 19. The default priority is 0; lower priorities cause "
"more favorable scheduling."
msgstr ""
"设置程序调度优先级。 *which* 的值为 :const:`PRIO_PROCESS`, :const:`PRIO_PGRP` 或 "
":const:`PRIO_USER` 之一,而 *who* 会相对于 *which* (:const:`PRIO_PROCESS` 的进程标识符, "
":const:`PRIO_PGRP` 的进程组标识符和 :const:`PRIO_USER` 的用户 ID) 被解析。 *who* 值为零 (分别) "
"表示调用进程,调用进程的进程组或调用进程的真实用户 ID。 *priority* 是范围在 -20 至 19 的值。 默认优先级为 "
"0;较小的优先级数值会更优先被调度。"
#: ../../library/os.rst:685
msgid "Set the current process's real and effective group ids."
msgstr "设置当前进程的真实和有效组ID。"
#: ../../library/os.rst:692
msgid "Set the current process's real, effective, and saved group ids."
msgstr "设置当前进程的真实,有效和暂存组ID。"
#: ../../library/os.rst:701
msgid "Set the current process's real, effective, and saved user ids."
msgstr "设置当前进程的真实,有效和暂存用户ID。"
#: ../../library/os.rst:710
msgid "Set the current process's real and effective user ids."
msgstr "设置当前进程的真实和有效用户ID。"
#: ../../library/os.rst:717
msgid ""
"Call the system call :c:func:`!getsid`. See the Unix manual for the "
"semantics."
msgstr "调用系统调用 :c:func:`!getsid`。 其语义请参见 Unix 手册。"
#: ../../library/os.rst:724
msgid ""
"Call the system call :c:func:`!setsid`. See the Unix manual for the "
"semantics."
msgstr "调用系统调用 :c:func:`!setsid`。 其语义请参见 Unix 手册。"
#: ../../library/os.rst:733
msgid "Set the current process's user id."
msgstr "设置当前进程的用户ID。"