def _command_line_ok(_cache=[]):
""" Return True if command line does not contain any
help or display requests.
"""
if _cache:
return _cache[0]
ok = True
display_opts = ['--'+n for n in Distribution.display_option_names]
for o in Distribution.display_options:
if o[1]:
display_opts.append('-'+o[1])
for arg in sys.argv:
if arg.startswith('--help') or arg=='-h' or arg in display_opts:
ok = False
break
_cache.append(ok)
return ok
python类help()的实例源码
def _command_line_ok(_cache=[]):
""" Return True if command line does not contain any
help or display requests.
"""
if _cache:
return _cache[0]
ok = True
display_opts = ['--'+n for n in Distribution.display_option_names]
for o in Distribution.display_options:
if o[1]:
display_opts.append('-'+o[1])
for arg in sys.argv:
if arg.startswith('--help') or arg=='-h' or arg in display_opts:
ok = False
break
_cache.append(ok)
return ok
core.py 文件源码
项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda
作者: SignalMedia
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def _command_line_ok(_cache=[]):
""" Return True if command line does not contain any
help or display requests.
"""
if _cache:
return _cache[0]
ok = True
display_opts = ['--'+n for n in Distribution.display_option_names]
for o in Distribution.display_options:
if o[1]:
display_opts.append('-'+o[1])
for arg in sys.argv:
if arg.startswith('--help') or arg=='-h' or arg in display_opts:
ok = False
break
_cache.append(ok)
return ok
def _command_line_ok(_cache=[]):
""" Return True if command line does not contain any
help or display requests.
"""
if _cache:
return _cache[0]
ok = True
display_opts = ['--'+n for n in Distribution.display_option_names]
for o in Distribution.display_options:
if o[1]:
display_opts.append('-'+o[1])
for arg in sys.argv:
if arg.startswith('--help') or arg=='-h' or arg in display_opts:
ok = False
break
_cache.append(ok)
return ok
def _command_line_ok(_cache=[]):
""" Return True if command line does not contain any
help or display requests.
"""
if _cache:
return _cache[0]
ok = True
display_opts = ['--'+n for n in Distribution.display_option_names]
for o in Distribution.display_options:
if o[1]:
display_opts.append('-'+o[1])
for arg in sys.argv:
if arg.startswith('--help') or arg=='-h' or arg in display_opts:
ok = False
break
_cache.append(ok)
return ok
def _command_line_ok(_cache=[]):
""" Return True if command line does not contain any
help or display requests.
"""
if _cache:
return _cache[0]
ok = True
display_opts = ['--'+n for n in Distribution.display_option_names]
for o in Distribution.display_options:
if o[1]:
display_opts.append('-'+o[1])
for arg in sys.argv:
if arg.startswith('--help') or arg=='-h' or arg in display_opts:
ok = False
break
_cache.append(ok)
return ok
def _command_line_ok(_cache=[]):
""" Return True if command line does not contain any
help or display requests.
"""
if _cache:
return _cache[0]
ok = True
display_opts = ['--'+n for n in Distribution.display_option_names]
for o in Distribution.display_options:
if o[1]:
display_opts.append('-'+o[1])
for arg in sys.argv:
if arg.startswith('--help') or arg=='-h' or arg in display_opts:
ok = False
break
_cache.append(ok)
return ok
def test_show_help(self):
# smoke test, just makes sure some help is displayed
dist = Distribution()
sys.argv = []
dist.help = 1
dist.script_name = 'setup.py'
with captured_stdout() as s:
dist.parse_command_line()
output = [line for line in s.getvalue().split('\n')
if line.strip() != '']
self.assertTrue(output)
def test_show_help(self):
# smoke test, just makes sure some help is displayed
self.addCleanup(log.set_threshold, log._global_log.threshold)
dist = Distribution()
sys.argv = []
dist.help = 1
dist.script_name = 'setup.py'
with captured_stdout() as s:
dist.parse_command_line()
output = [line for line in s.getvalue().split('\n')
if line.strip() != '']
self.assertTrue(output)
def test_show_help(self):
# smoke test, just makes sure some help is displayed
self.addCleanup(log.set_threshold, log._global_log.threshold)
dist = Distribution()
sys.argv = []
dist.help = 1
dist.script_name = 'setup.py'
with captured_stdout() as s:
dist.parse_command_line()
output = [line for line in s.getvalue().split('\n')
if line.strip() != '']
self.assertTrue(output)
def test_show_help(self):
# smoke test, just makes sure some help is displayed
dist = Distribution()
sys.argv = []
dist.help = 1
dist.script_name = 'setup.py'
with captured_stdout() as s:
dist.parse_command_line()
output = [line for line in s.getvalue().split('\n')
if line.strip() != '']
self.assertTrue(output)
def test_show_help(self):
# smoke test, just makes sure some help is displayed
dist = Distribution()
sys.argv = []
dist.help = 1
dist.script_name = 'setup.py'
with captured_stdout() as s:
dist.parse_command_line()
output = [line for line in s.getvalue().split('\n')
if line.strip() != '']
self.assertTrue(output)
def test_show_help(self):
# smoke test, just makes sure some help is displayed
dist = Distribution()
sys.argv = []
dist.help = 1
dist.script_name = 'setup.py'
with captured_stdout() as s:
dist.parse_command_line()
output = [line for line in s.getvalue().split('\n')
if line.strip() != '']
self.assertTrue(output)