mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-30166: Import command-line parsing modules only when needed. (#1293)
This commit is contained in:
parent
1c4670ea0c
commit
7e4db2f253
7 changed files with 20 additions and 12 deletions
|
@ -25,10 +25,8 @@
|
|||
|
||||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import marshal
|
||||
from optparse import OptionParser
|
||||
|
||||
__all__ = ["run", "runctx", "Profile"]
|
||||
|
||||
|
@ -179,7 +177,7 @@ class Profile:
|
|||
self.t = self.get_time()
|
||||
self.simulate_call('profiler')
|
||||
|
||||
# Heavily optimized dispatch routine for os.times() timer
|
||||
# Heavily optimized dispatch routine for time.process_time() timer
|
||||
|
||||
def trace_dispatch(self, frame, event, arg):
|
||||
timer = self.timer
|
||||
|
@ -552,6 +550,9 @@ class Profile:
|
|||
#****************************************************************************
|
||||
|
||||
def main():
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
|
||||
usage = "profile.py [-o output_file_path] [-s sort] scriptfile [arg] ..."
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.allow_interspersed_args = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue