addressed code review feedback and fixed pylint

This commit is contained in:
Burt Bielicki 2016-03-17 16:00:03 -07:00
Родитель c649859ca8
Коммит 7bc62e0380
4 изменённых файлов: 78 добавлений и 73 удалений

Просмотреть файл

@ -41,6 +41,7 @@
<Compile Include="azure\cli\tests\test_output.py" />
<Compile Include="azure\cli\_debug.py" />
<Compile Include="azure\cli\_help.py" />
<Compile Include="azure\cli\_help_files.py" />
<Compile Include="azure\cli\_locale.py" />
<Compile Include="azure\cli\tests\test_profile.py" />
<Compile Include="azure\cli\_argparse.py" />

Просмотреть файл

@ -1,7 +1,7 @@
from __future__ import print_function
import sys
import textwrap
from yaml import load
import yaml
from ._locale import L
from ._help_files import _load_help_file
@ -11,15 +11,19 @@ __all__ = ['print_detailed_help', 'print_welcome_message', 'GroupHelpFile', 'Com
_out = sys.stdout
def print_welcome_message(out=sys.stdout):
_printIndent(L(' /\\ \n'
' / \\ _____ _ _ __ ___ \n'
' / /\ \\ |_ / | | | \'__/ _ \\\n' #pylint: disable=anomalous-backslash-in-string
' / ____ \\ / /| |_| | | | __/\n'
' /_/ \\_\\/___|\\__,_|_| \\___|\n'))
global _out #pylint: disable=global-statement
_out = out
_printIndent(L(r"""
/\
/ \ _____ _ _ __ ___
/ /\ \ |_ / | | | \'__/ _ \
/ ____ \ / /| |_| | | | __/
/_/ \_\/___|\__,_|_| \___|
"""))
_printIndent(L('\nWelcome to the cool new Azure CLI!\n\nHere are the base commands:\n'))
def print_detailed_help(help_file, out=sys.stdout): #pylint: disable=unused-argument
global _out
global _out #pylint: disable=global-statement
_out = out
_print_header(help_file)
@ -226,7 +230,7 @@ def _get_column_indent(text, max_name_length):
return ' '*(max_name_length - len(text))
def _load_help_file_from_string(text):
return load(text) if text else None
return yaml.load(text) if text else None
class HelpAuthoringException(Exception):
pass

Просмотреть файл

@ -1,4 +1,4 @@
from yaml import load
import yaml
def _load_help_file(delimiters):
helps = {'test_group1.test_group2': """
@ -10,69 +10,69 @@ def _load_help_file(delimiters):
examples:
- name: foo example
text: example details
""",
'login': """
type: command
short-summary: this module does xyz one-line or so
long-summary: |
this module.... kjsdflkj... klsfkj paragraph1
this module.... kjsdflkj... klsfkj paragraph2
parameters:
- name: --username/-u
type: string
required: True
short-summary: one line partial sentence
long-summary: text, markdown, etc.
populator-commands:
- az vm list
- default
- name: --service-principal
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
- name: --tenant/-t
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
examples:
- name: foo example
text: example details
""",
'account': """
type: group
short-summary: this module does xyz one-line or so
long-summary: |
this module.... kjsdflkj... klsfkj paragraph1
this module.... kjsdflkj... klsfkj paragraph2
parameters:
- name: --username/-u
type: string
required: false
short-summary: one line partial sentence
long-summary: text, markdown, etc.
populator-commands:
- az vm list
- default
- name: --password/-p
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
- name: --service-principal
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
- name: --tenant/-t
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
examples:
- name: foo example
text: example details
""",
'azure-cli': 'detailed intro help'
}
""",
'login': """
type: command
short-summary: this module does xyz one-line or so
long-summary: |
this module.... kjsdflkj... klsfkj paragraph1
this module.... kjsdflkj... klsfkj paragraph2
parameters:
- name: --username/-u
type: string
required: True
short-summary: one line partial sentence
long-summary: text, markdown, etc.
populator-commands:
- az vm list
- default
- name: --service-principal
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
- name: --tenant/-t
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
examples:
- name: foo example
text: example details
""",
'account': """
type: group
short-summary: this module does xyz one-line or so
long-summary: |
this module.... kjsdflkj... klsfkj paragraph1
this module.... kjsdflkj... klsfkj paragraph2
parameters:
- name: --username/-u
type: string
required: false
short-summary: one line partial sentence
long-summary: text, markdown, etc.
populator-commands:
- az vm list
- default
- name: --password/-p
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
- name: --service-principal
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
- name: --tenant/-t
type: string
short-summary: one line partial sentence
long-summary: paragraph(s)
examples:
- name: foo example
text: example details
""",
'azure-cli': 'detailed intro help'
}
if delimiters in helps:
return load(helps[delimiters])
return yaml.load(helps[delimiters])
else:
return None

Просмотреть файл

@ -4,7 +4,7 @@ from .._locale import L
@command('account list')
@description(L('List the imported subscriptions.'))
def list_subscriptions(args, unexpected): #pylint: disable=unused-argument'
def list_subscriptions(args, unexpected): #pylint: disable=unused-argument
"""
type: command
long-summary: |
@ -30,7 +30,7 @@ def set_active_subscription(args, unexpected): #pylint: disable=unused-argument
long-summary: |
this module.... kjsdflkj... klsfkj paragraph1
this module.... kjsdflkj... klsfkj paragraph2
parameters:
parameters:
examples:
- name: foo example
text: example details