8000 gh-118761: Improve import time for `pstats` and `zipfile` by removing imports to `typing` by picnixz · Pull Request #128981 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-118761: Improve import time for pstats and zipfile by removing imports to typing #128981

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

Merged
merged 4 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
remove redundant imports to typing
  • Loading branch information
picnixz committed Jan 16, 2025
commit e9d72b78f6a3a32e76cbcb957520d66eef3a19e7
3 changes: 1 addition & 2 deletions Lib/pstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from enum import StrEnum, _simple_enum
from functools import cmp_to_key
from dataclasses import dataclass
from typing import Dict

__all__ = ["Stats", "SortKey", "FunctionProfile", "StatsProfile"]

Expand Down Expand Up @@ -69,7 +68,7 @@ class FunctionProfile:
class StatsProfile:
'''Class for keeping track of an item in inventory.'''
total_tt: float
func_profiles: Dict[str, FunctionProfile]
func_profiles: dict[str, FunctionProfile]

class Stats:
"""This class is used for creating reports from data generated by the
E 8000 xpand Down
3 changes: 1 addition & 2 deletions Lib/zipfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import sys
import threading
import time
from typing import Self

try:
import zlib # We may need its compression method
Expand Down Expand Up @@ -606,7 +605,7 @@ def from_file(cls, filename, arcname=None, *, strict_timestamps=True):

return zinfo

def _for_archive(self, archive: ZipFile) -> Self:
def _for_archive(self, archive):
"""Resolve suitable defaults from the archive.

Resolve the date_time, compression attributes, and external attributes
Expand Down
0