py2docfx 0.1.11rc1981066__py3-none-any.whl → 0.1.11rc1996319__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/authorization_code.py +1 -1
  2. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azd_cli.py +20 -14
  3. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_arc.py +1 -1
  4. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_cli.py +36 -14
  5. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_powershell.py +1 -1
  6. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/chained.py +2 -2
  7. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/default.py +4 -3
  8. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/imds.py +2 -2
  9. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/managed_identity.py +1 -1
  10. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/__init__.py +2 -0
  11. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/auth_code_redirect_handler.py +1 -1
  12. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/decorators.py +15 -7
  13. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/interactive.py +1 -1
  14. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/managed_identity_client.py +0 -1
  15. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/msal_client.py +1 -1
  16. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/msal_managed_identity_client.py +2 -1
  17. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/shared_token_cache.py +3 -3
  18. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/utils.py +17 -2
  19. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_version.py +1 -1
  20. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azd_cli.py +14 -11
  21. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_cli.py +30 -12
  22. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/default.py +2 -2
  23. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/imds.py +3 -3
  24. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/managed_identity.py +1 -1
  25. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_internal/decorators.py +15 -7
  26. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_internal/managed_identity_client.py +1 -1
  27. py2docfx/venv/venv1/Lib/site-packages/cryptography/__about__.py +1 -1
  28. py2docfx/venv/venv1/Lib/site-packages/google/api/annotations_pb2.py +7 -4
  29. py2docfx/venv/venv1/Lib/site-packages/google/api/auth_pb2.py +6 -3
  30. py2docfx/venv/venv1/Lib/site-packages/google/api/backend_pb2.py +14 -7
  31. py2docfx/venv/venv1/Lib/site-packages/google/api/billing_pb2.py +6 -3
  32. py2docfx/venv/venv1/Lib/site-packages/google/api/client_pb2.py +47 -38
  33. py2docfx/venv/venv1/Lib/site-packages/google/api/config_change_pb2.py +6 -3
  34. py2docfx/venv/venv1/Lib/site-packages/google/api/consumer_pb2.py +6 -3
  35. py2docfx/venv/venv1/Lib/site-packages/google/api/context_pb2.py +6 -3
  36. py2docfx/venv/venv1/Lib/site-packages/google/api/control_pb2.py +6 -4
  37. py2docfx/venv/venv1/Lib/site-packages/google/api/distribution_pb2.py +7 -5
  38. py2docfx/venv/venv1/Lib/site-packages/google/api/documentation_pb2.py +6 -3
  39. py2docfx/venv/venv1/Lib/site-packages/google/api/endpoint_pb2.py +6 -3
  40. py2docfx/venv/venv1/Lib/site-packages/google/api/error_reason_pb2.py +6 -3
  41. py2docfx/venv/venv1/Lib/site-packages/google/api/field_behavior_pb2.py +8 -6
  42. py2docfx/venv/venv1/Lib/site-packages/google/api/field_info_pb2.py +6 -4
  43. py2docfx/venv/venv1/Lib/site-packages/google/api/http_pb2.py +7 -4
  44. py2docfx/venv/venv1/Lib/site-packages/google/api/httpbody_pb2.py +6 -4
  45. py2docfx/venv/venv1/Lib/site-packages/google/api/label_pb2.py +7 -4
  46. py2docfx/venv/venv1/Lib/site-packages/google/api/launch_stage_pb2.py +6 -3
  47. py2docfx/venv/venv1/Lib/site-packages/google/api/log_pb2.py +6 -4
  48. py2docfx/venv/venv1/Lib/site-packages/google/api/logging_pb2.py +6 -3
  49. py2docfx/venv/venv1/Lib/site-packages/google/api/metric_pb2.py +12 -9
  50. py2docfx/venv/venv1/Lib/site-packages/google/api/monitored_resource_pb2.py +15 -10
  51. py2docfx/venv/venv1/Lib/site-packages/google/api/monitoring_pb2.py +6 -3
  52. py2docfx/venv/venv1/Lib/site-packages/google/api/policy_pb2.py +7 -5
  53. py2docfx/venv/venv1/Lib/site-packages/google/api/quota_pb2.py +10 -7
  54. py2docfx/venv/venv1/Lib/site-packages/google/api/resource_pb2.py +7 -5
  55. py2docfx/venv/venv1/Lib/site-packages/google/api/routing_pb2.py +6 -4
  56. py2docfx/venv/venv1/Lib/site-packages/google/api/service_pb2.py +15 -12
  57. py2docfx/venv/venv1/Lib/site-packages/google/api/source_info_pb2.py +6 -4
  58. py2docfx/venv/venv1/Lib/site-packages/google/api/system_parameter_pb2.py +6 -3
  59. py2docfx/venv/venv1/Lib/site-packages/google/api/usage_pb2.py +6 -3
  60. py2docfx/venv/venv1/Lib/site-packages/google/api/visibility_pb2.py +7 -5
  61. py2docfx/venv/venv1/Lib/site-packages/google/cloud/extended_operations_pb2.py +6 -4
  62. py2docfx/venv/venv1/Lib/site-packages/google/cloud/location/locations_pb2.py +18 -13
  63. py2docfx/venv/venv1/Lib/site-packages/google/gapic/metadata/gapic_metadata_pb2.py +31 -26
  64. py2docfx/venv/venv1/Lib/site-packages/google/logging/type/http_request_pb2.py +6 -4
  65. py2docfx/venv/venv1/Lib/site-packages/google/logging/type/log_severity_pb2.py +6 -3
  66. py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_grpc.py +2 -1
  67. py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_grpc_pb2.py +11 -10
  68. py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_pb2.py +20 -17
  69. py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_pb2_grpc.py +1 -2
  70. py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_proto.py +2 -1
  71. py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_proto_pb2.py +22 -19
  72. py2docfx/venv/venv1/Lib/site-packages/google/rpc/code_pb2.py +6 -3
  73. py2docfx/venv/venv1/Lib/site-packages/google/rpc/context/attribute_context_pb2.py +20 -16
  74. py2docfx/venv/venv1/Lib/site-packages/google/rpc/context/audit_context_pb2.py +7 -5
  75. py2docfx/venv/venv1/Lib/site-packages/google/rpc/error_details_pb2.py +21 -19
  76. py2docfx/venv/venv1/Lib/site-packages/google/rpc/http_pb2.py +6 -3
  77. py2docfx/venv/venv1/Lib/site-packages/google/rpc/status_pb2.py +6 -4
  78. py2docfx/venv/venv1/Lib/site-packages/google/type/calendar_period_pb2.py +6 -3
  79. py2docfx/venv/venv1/Lib/site-packages/google/type/color_pb2.py +6 -4
  80. py2docfx/venv/venv1/Lib/site-packages/google/type/date_pb2.py +6 -3
  81. py2docfx/venv/venv1/Lib/site-packages/google/type/datetime_pb2.py +6 -4
  82. py2docfx/venv/venv1/Lib/site-packages/google/type/dayofweek_pb2.py +6 -3
  83. py2docfx/venv/venv1/Lib/site-packages/google/type/decimal_pb2.py +6 -3
  84. py2docfx/venv/venv1/Lib/site-packages/google/type/expr_pb2.py +6 -3
  85. py2docfx/venv/venv1/Lib/site-packages/google/type/fraction_pb2.py +6 -3
  86. py2docfx/venv/venv1/Lib/site-packages/google/type/interval_pb2.py +6 -4
  87. py2docfx/venv/venv1/Lib/site-packages/google/type/latlng_pb2.py +6 -3
  88. py2docfx/venv/venv1/Lib/site-packages/google/type/localized_text_pb2.py +6 -3
  89. py2docfx/venv/venv1/Lib/site-packages/google/type/money_pb2.py +6 -3
  90. py2docfx/venv/venv1/Lib/site-packages/google/type/month_pb2.py +6 -3
  91. py2docfx/venv/venv1/Lib/site-packages/google/type/phone_number_pb2.py +6 -3
  92. py2docfx/venv/venv1/Lib/site-packages/google/type/postal_address_pb2.py +6 -3
  93. py2docfx/venv/venv1/Lib/site-packages/google/type/quaternion_pb2.py +6 -3
  94. py2docfx/venv/venv1/Lib/site-packages/google/type/timeofday_pb2.py +6 -3
  95. py2docfx/venv/venv1/Lib/site-packages/psutil/__init__.py +122 -201
  96. py2docfx/venv/venv1/Lib/site-packages/psutil/_common.py +84 -128
  97. py2docfx/venv/venv1/Lib/site-packages/psutil/_psaix.py +24 -38
  98. py2docfx/venv/venv1/Lib/site-packages/psutil/_psbsd.py +44 -58
  99. py2docfx/venv/venv1/Lib/site-packages/psutil/_pslinux.py +170 -254
  100. py2docfx/venv/venv1/Lib/site-packages/psutil/_psosx.py +8 -16
  101. py2docfx/venv/venv1/Lib/site-packages/psutil/_psposix.py +13 -49
  102. py2docfx/venv/venv1/Lib/site-packages/psutil/_pssunos.py +41 -60
  103. py2docfx/venv/venv1/Lib/site-packages/psutil/_pswindows.py +75 -145
  104. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/__init__.py +105 -193
  105. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_aix.py +2 -2
  106. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_bsd.py +27 -26
  107. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_connections.py +16 -17
  108. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_contracts.py +5 -19
  109. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_linux.py +153 -211
  110. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_memleaks.py +0 -6
  111. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_misc.py +22 -207
  112. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_osx.py +9 -4
  113. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_posix.py +8 -15
  114. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process.py +104 -184
  115. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process_all.py +28 -36
  116. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_scripts.py +240 -0
  117. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_sunos.py +1 -1
  118. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_system.py +44 -50
  119. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_testutils.py +23 -33
  120. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_unicode.py +8 -67
  121. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_windows.py +32 -52
  122. {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1996319.dist-info}/METADATA +1 -1
  123. {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1996319.dist-info}/RECORD +125 -125
  124. py2docfx/venv/venv1/Lib/site-packages/psutil/_compat.py +0 -477
  125. {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1996319.dist-info}/WHEEL +0 -0
  126. {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1996319.dist-info}/top_level.txt +0 -0
@@ -10,7 +10,7 @@ import functools
10
10
  import os
11
11
  from collections import defaultdict
12
12
  from collections import namedtuple
13
- from xml.etree import ElementTree # noqa ICN001
13
+ from xml.etree import ElementTree # noqa: ICN001
14
14
 
15
15
  from . import _common
16
16
  from . import _psposix
@@ -28,10 +28,6 @@ from ._common import debug
28
28
  from ._common import memoize
29
29
  from ._common import memoize_when_activated
30
30
  from ._common import usage_percent
31
- from ._compat import FileNotFoundError
32
- from ._compat import PermissionError
33
- from ._compat import ProcessLookupError
34
- from ._compat import which
35
31
 
36
32
 
37
33
  __extra__all__ = []
@@ -196,8 +192,8 @@ def virtual_memory():
196
192
  # #2233), so zabbix seems to be wrong. Htop calculates it
197
193
  # differently, and the used value seem more realistic, so let's
198
194
  # match htop.
199
- # https://github.com/htop-dev/htop/blob/e7f447b/netbsd/NetBSDProcessList.c#L162 # noqa
200
- # https://github.com/zabbix/zabbix/blob/af5e0f8/src/libs/zbxsysinfo/netbsd/memory.c#L135 # noqa
195
+ # https://github.com/htop-dev/htop/blob/e7f447b/netbsd/NetBSDProcessList.c#L162
196
+ # https://github.com/zabbix/zabbix/blob/af5e0f8/src/libs/zbxsysinfo/netbsd/memory.c#L135
201
197
  used = active + wired
202
198
  avail = total - used
203
199
  else:
@@ -206,7 +202,7 @@ def virtual_memory():
206
202
  # * https://people.freebsd.org/~rse/dist/freebsd-memory
207
203
  # * https://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt
208
204
  # matches zabbix:
209
- # * https://github.com/zabbix/zabbix/blob/af5e0f8/src/libs/zbxsysinfo/freebsd/memory.c#L143 # noqa
205
+ # * https://github.com/zabbix/zabbix/blob/af5e0f8/src/libs/zbxsysinfo/freebsd/memory.c#L143
210
206
  avail = inactive + cached + free
211
207
  used = active + wired + cached
212
208
 
@@ -439,14 +435,8 @@ def net_if_stats():
439
435
 
440
436
  def net_connections(kind):
441
437
  """System-wide network connections."""
442
- if kind not in _common.conn_tmap:
443
- raise ValueError(
444
- "invalid %r kind argument; choose between %s"
445
- % (kind, ', '.join([repr(x) for x in conn_tmap]))
446
- )
447
438
  families, types = conn_tmap[kind]
448
439
  ret = set()
449
-
450
440
  if OPENBSD:
451
441
  rawlist = cext.net_connections(-1, families, types)
452
442
  elif NETBSD:
@@ -495,7 +485,7 @@ if FREEBSD:
495
485
  current, high = cext.sensors_cpu_temperature(cpu)
496
486
  if high <= 0:
497
487
  high = None
498
- name = "Core %s" % cpu
488
+ name = f"Core {cpu}"
499
489
  ret["coretemp"].append(
500
490
  _common.shwtemp(name, current, high, high)
501
491
  )
@@ -600,21 +590,18 @@ def wrap_exceptions(fun):
600
590
 
601
591
  @functools.wraps(fun)
602
592
  def wrapper(self, *args, **kwargs):
593
+ pid, ppid, name = self.pid, self._ppid, self._name
603
594
  try:
604
595
  return fun(self, *args, **kwargs)
605
- except ProcessLookupError:
606
- if is_zombie(self.pid):
607
- raise ZombieProcess(self.pid, self._name, self._ppid)
608
- else:
609
- raise NoSuchProcess(self.pid, self._name)
610
- except PermissionError:
611
- raise AccessDenied(self.pid, self._name)
612
- except OSError:
613
- if self.pid == 0:
614
- if 0 in pids():
615
- raise AccessDenied(self.pid, self._name)
616
- else:
617
- raise
596
+ except ProcessLookupError as err:
597
+ if is_zombie(pid):
598
+ raise ZombieProcess(pid, name, ppid) from err
599
+ raise NoSuchProcess(pid, name) from err
600
+ except PermissionError as err:
601
+ raise AccessDenied(pid, name) from err
602
+ except OSError as err:
603
+ if pid == 0 and 0 in pids():
604
+ raise AccessDenied(pid, name) from err
618
605
  raise
619
606
 
620
607
  return wrapper
@@ -623,18 +610,19 @@ def wrap_exceptions(fun):
623
610
  @contextlib.contextmanager
624
611
  def wrap_exceptions_procfs(inst):
625
612
  """Same as above, for routines relying on reading /proc fs."""
613
+ pid, name, ppid = inst.pid, inst._name, inst._ppid
626
614
  try:
627
615
  yield
628
- except (ProcessLookupError, FileNotFoundError):
616
+ except (ProcessLookupError, FileNotFoundError) as err:
629
617
  # ENOENT (no such file or directory) gets raised on open().
630
618
  # ESRCH (no such process) can get raised on read() if
631
619
  # process is gone in meantime.
632
620
  if is_zombie(inst.pid):
633
- raise ZombieProcess(inst.pid, inst._name, inst._ppid)
621
+ raise ZombieProcess(pid, name, ppid) from err
634
622
  else:
635
- raise NoSuchProcess(inst.pid, inst._name)
636
- except PermissionError:
637
- raise AccessDenied(inst.pid, inst._name)
623
+ raise NoSuchProcess(pid, name) from err
624
+ except PermissionError as err:
625
+ raise AccessDenied(pid, name) from err
638
626
 
639
627
 
640
628
  class Process:
@@ -683,16 +671,18 @@ class Process:
683
671
  # /proc/0 dir exists but /proc/0/exe doesn't
684
672
  return ""
685
673
  with wrap_exceptions_procfs(self):
686
- return os.readlink("/proc/%s/exe" % self.pid)
674
+ return os.readlink(f"/proc/{self.pid}/exe")
687
675
  else:
688
676
  # OpenBSD: exe cannot be determined; references:
689
677
  # https://chromium.googlesource.com/chromium/src/base/+/
690
678
  # master/base_paths_posix.cc
691
679
  # We try our best guess by using which against the first
692
680
  # cmdline arg (may return None).
681
+ import shutil
682
+
693
683
  cmdline = self.cmdline()
694
684
  if cmdline:
695
- return which(cmdline[0]) or ""
685
+ return shutil.which(cmdline[0]) or ""
696
686
  else:
697
687
  return ""
698
688
 
@@ -709,15 +699,15 @@ class Process:
709
699
  return cext.proc_cmdline(self.pid)
710
700
  except OSError as err:
711
701
  if err.errno == errno.EINVAL:
702
+ pid, name, ppid = self.pid, self._name, self._ppid
712
703
  if is_zombie(self.pid):
713
- raise ZombieProcess(self.pid, self._name, self._ppid)
714
- elif not pid_exists(self.pid):
715
- raise NoSuchProcess(self.pid, self._name, self._ppid)
716
- else:
717
- # XXX: this happens with unicode tests. It means the C
718
- # routine is unable to decode invalid unicode chars.
719
- debug("ignoring %r and returning an empty list" % err)
720
- return []
704
+ raise ZombieProcess(pid, name, ppid) from err
705
+ if not pid_exists(self.pid):
706
+ raise NoSuchProcess(pid, name, ppid) from err
707
+ # XXX: this happens with unicode tests. It means the C
708
+ # routine is unable to decode invalid unicode chars.
709
+ debug(f"ignoring {err!r} and returning an empty list")
710
+ return []
721
711
  else:
722
712
  raise
723
713
  else:
@@ -822,11 +812,6 @@ class Process:
822
812
 
823
813
  @wrap_exceptions
824
814
  def net_connections(self, kind='inet'):
825
- if kind not in conn_tmap:
826
- raise ValueError(
827
- "invalid %r kind argument; choose between %s"
828
- % (kind, ', '.join([repr(x) for x in conn_tmap]))
829
- )
830
815
  families, types = conn_tmap[kind]
831
816
  ret = []
832
817
 
@@ -945,12 +930,11 @@ class Process:
945
930
  # Pre-emptively check if CPUs are valid because the C
946
931
  # function has a weird behavior in case of invalid CPUs,
947
932
  # see: https://github.com/giampaolo/psutil/issues/586
948
- allcpus = tuple(range(len(per_cpu_times())))
933
+ allcpus = set(range(len(per_cpu_times())))
949
934
  for cpu in cpus:
950
935
  if cpu not in allcpus:
951
- raise ValueError(
952
- "invalid CPU #%i (choose between %s)" % (cpu, allcpus)
953
- )
936
+ msg = f"invalid CPU {cpu!r} (choose between {allcpus})"
937
+ raise ValueError(msg)
954
938
  try:
955
939
  cext.proc_cpu_affinity_set(self.pid, cpus)
956
940
  except OSError as err:
@@ -961,10 +945,11 @@ class Process:
961
945
  if err.errno in {errno.EINVAL, errno.EDEADLK}:
962
946
  for cpu in cpus:
963
947
  if cpu not in allcpus:
964
- raise ValueError(
965
- "invalid CPU #%i (choose between %s)"
966
- % (cpu, allcpus)
948
+ msg = (
949
+ f"invalid CPU {cpu!r} (choose between"
950
+ f" {allcpus})"
967
951
  )
952
+ raise ValueError(msg) from err
968
953
  raise
969
954
 
970
955
  @wrap_exceptions
@@ -977,9 +962,10 @@ class Process:
977
962
  return cext.proc_getrlimit(self.pid, resource)
978
963
  else:
979
964
  if len(limits) != 2:
980
- raise ValueError(
981
- "second argument must be a (soft, hard) tuple, got %s"
982
- % repr(limits)
965
+ msg = (
966
+ "second argument must be a (soft, hard) tuple, got"
967
+ f" {limits!r}"
983
968
  )
969
+ raise ValueError(msg)
984
970
  soft, hard = limits
985
971
  return cext.proc_setrlimit(self.pid, resource, soft, hard)