aboutsummaryrefslogtreecommitdiffstats
path: root/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-06-11 14:33:57 +0300
committerPavel Aharoni <pa0916@att.com>2017-06-11 14:33:57 +0300
commit04387deeab820e75c6d37d2ddd5b514cb7bcfd9e (patch)
tree2f4dfacba74ec390c4371c62dc96af2b1d5f19ef /jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg
parentfff70fce14ebe7dec3a4d52b7b90cee4414d0562 (diff)
[SDC-32] separate Tosca Parser from DC
Change-Id: I7e7f31ff2bd92fec22031f75b7051d129a21d01b Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg')
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/PKG-INFO44
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/SOURCES.txt84
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/dependency_links.txt1
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/entry_points.txt18
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/not-zip-safe1
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/pbr.json1
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/requires.txt10
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/top_level.txt1
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/__init__.py0
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/app.py423
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/argparse.py30
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/columns.py40
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/command.py90
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/commandmanager.py104
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/complete.py221
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/display.py118
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/__init__.py0
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/base.py75
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/commaseparated.py63
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/json_format.py53
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/shell.py65
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/table.py203
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/value.py44
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/yaml_format.py45
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/help.py96
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/interactive.py147
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/lister.py55
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/show.py59
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/__init__.py0
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_app.py498
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_columns.py30
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_command.py64
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_commandmanager.py132
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_complete.py173
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_csv.py85
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_json.py129
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_shell.py96
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_table.py547
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_value.py65
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_yaml.py100
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_help.py180
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_interactive.py74
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_lister.py75
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_show.py84
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_utils.py79
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/utils.py48
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/utils.py155
47 files changed, 0 insertions, 4705 deletions
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/PKG-INFO b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/PKG-INFO
deleted file mode 100644
index c5c9890..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/PKG-INFO
+++ /dev/null
@@ -1,44 +0,0 @@
-Metadata-Version: 1.1
-Name: cliff
-Version: 2.4.0
-Summary: Command Line Interface Formulation Framework
-Home-page: http://docs.openstack.org/developer/cliff
-Author: OpenStack
-Author-email: openstack-dev@lists.openstack.org
-License: UNKNOWN
-Description: ========================
- Team and repository tags
- ========================
-
- .. image:: http://governance.openstack.org/badges/cliff.svg
- :target: http://governance.openstack.org/reference/tags/index.html
-
- .. Change things from this point on
-
- =======================================================
- cliff -- Command Line Interface Formulation Framework
- =======================================================
-
- cliff is a framework for building command line programs. It uses
- `setuptools entry points`_ to provide subcommands, output formatters, and
- other extensions.
-
- .. _setuptools entry points: http://setuptools.readthedocs.io/en/latest/pkg_resources.html#convenience-api
-
- * Free software: Apache license
- * Documentation: http://docs.openstack.org/developer/cliff
- * Source: http://git.openstack.org/cgit/openstack/cliff
- * Bugs: https://bugs.launchpad.net/python-cliff
-
-
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: License :: OSI Approved :: Apache Software License
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Intended Audience :: Developers
-Classifier: Environment :: Console
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/SOURCES.txt b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/SOURCES.txt
deleted file mode 100644
index af4cfd5..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/SOURCES.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-.travis.yml
-AUTHORS
-CONTRIBUTING.rst
-ChangeLog
-LICENSE
-MANIFEST.in
-Makefile
-README.rst
-openstack-common.conf
-requirements.txt
-setup.cfg
-setup.py
-test-requirements.txt
-tox.ini
-cliff/__init__.py
-cliff/app.py
-cliff/argparse.py
-cliff/columns.py
-cliff/command.py
-cliff/commandmanager.py
-cliff/complete.py
-cliff/display.py
-cliff/help.py
-cliff/interactive.py
-cliff/lister.py
-cliff/show.py
-cliff/utils.py
-cliff.egg-info/PKG-INFO
-cliff.egg-info/SOURCES.txt
-cliff.egg-info/dependency_links.txt
-cliff.egg-info/entry_points.txt
-cliff.egg-info/not-zip-safe
-cliff.egg-info/pbr.json
-cliff.egg-info/requires.txt
-cliff.egg-info/top_level.txt
-cliff/formatters/__init__.py
-cliff/formatters/base.py
-cliff/formatters/commaseparated.py
-cliff/formatters/json_format.py
-cliff/formatters/shell.py
-cliff/formatters/table.py
-cliff/formatters/value.py
-cliff/formatters/yaml_format.py
-cliff/tests/__init__.py
-cliff/tests/test_app.py
-cliff/tests/test_columns.py
-cliff/tests/test_command.py
-cliff/tests/test_commandmanager.py
-cliff/tests/test_complete.py
-cliff/tests/test_formatters_csv.py
-cliff/tests/test_formatters_json.py
-cliff/tests/test_formatters_shell.py
-cliff/tests/test_formatters_table.py
-cliff/tests/test_formatters_value.py
-cliff/tests/test_formatters_yaml.py
-cliff/tests/test_help.py
-cliff/tests/test_interactive.py
-cliff/tests/test_lister.py
-cliff/tests/test_show.py
-cliff/tests/test_utils.py
-cliff/tests/utils.py
-demoapp/README.rst
-demoapp/setup.py
-demoapp/cliffdemo/__init__.py
-demoapp/cliffdemo/encoding.py
-demoapp/cliffdemo/list.py
-demoapp/cliffdemo/main.py
-demoapp/cliffdemo/show.py
-demoapp/cliffdemo/simple.py
-doc/Makefile
-doc/source/classes.rst
-doc/source/complete.rst
-doc/source/conf.py
-doc/source/demoapp.rst
-doc/source/developers.rst
-doc/source/history.rst
-doc/source/index.rst
-doc/source/install.rst
-doc/source/interactive_mode.rst
-doc/source/introduction.rst
-doc/source/list_commands.rst
-doc/source/show_commands.rst
-integration-tests/neutronclient-tip.sh
-integration-tests/openstackclient-tip.sh \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/dependency_links.txt b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/dependency_links.txt
deleted file mode 100644
index 8b13789..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/dependency_links.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/entry_points.txt b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/entry_points.txt
deleted file mode 100644
index 12d2c3a..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/entry_points.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-[cliff.formatter.completion]
-bash = cliff.complete:CompleteBash
-none = cliff.complete:CompleteNoCode
-
-[cliff.formatter.list]
-csv = cliff.formatters.commaseparated:CSVLister
-json = cliff.formatters.json_format:JSONFormatter
-table = cliff.formatters.table:TableFormatter
-value = cliff.formatters.value:ValueFormatter
-yaml = cliff.formatters.yaml_format:YAMLFormatter
-
-[cliff.formatter.show]
-json = cliff.formatters.json_format:JSONFormatter
-shell = cliff.formatters.shell:ShellFormatter
-table = cliff.formatters.table:TableFormatter
-value = cliff.formatters.value:ValueFormatter
-yaml = cliff.formatters.yaml_format:YAMLFormatter
-
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/not-zip-safe b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/not-zip-safe
deleted file mode 100644
index 8b13789..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/not-zip-safe
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/pbr.json b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/pbr.json
deleted file mode 100644
index 5064f61..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/pbr.json
+++ /dev/null
@@ -1 +0,0 @@
-{"git_version": "1dd3eda", "is_release": true} \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/requires.txt b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/requires.txt
deleted file mode 100644
index b6cf327..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/requires.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-pbr>=1.8
-cmd2>=0.6.7
-PrettyTable<0.8,>=0.7.1
-pyparsing>=2.0.7
-six>=1.9.0
-stevedore>=1.17.1
-PyYAML>=3.10.0
-
-[:(python_version<'3.0')]
-unicodecsv>=0.8.0
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/top_level.txt b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/top_level.txt
deleted file mode 100644
index 1810bb7..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/EGG-INFO/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-cliff
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/__init__.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/__init__.py
+++ /dev/null
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/app.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/app.py
deleted file mode 100644
index 2c2f219..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/app.py
+++ /dev/null
@@ -1,423 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Application base class.
-"""
-
-import codecs
-import inspect
-import locale
-import logging
-import logging.handlers
-import os
-import six
-import sys
-
-from cliff import argparse
-from . import complete
-from . import help
-from . import utils
-
-
-logging.getLogger('cliff').addHandler(logging.NullHandler())
-
-
-class App(object):
- """Application base class.
-
- :param description: one-liner explaining the program purpose
- :paramtype description: str
- :param version: application version number
- :paramtype version: str
- :param command_manager: plugin loader
- :paramtype command_manager: cliff.commandmanager.CommandManager
- :param stdin: Standard input stream
- :paramtype stdin: readable I/O stream
- :param stdout: Standard output stream
- :paramtype stdout: writable I/O stream
- :param stderr: Standard error output stream
- :paramtype stderr: writable I/O stream
- :param interactive_app_factory: callable to create an
- interactive application
- :paramtype interactive_app_factory: cliff.interactive.InteractiveApp
- :param deferred_help: True - Allow subcommands to accept --help with
- allowing to defer help print after initialize_app
- :paramtype deferred_help: bool
- """
-
- NAME = os.path.splitext(os.path.basename(sys.argv[0]))[0]
- LOG = logging.getLogger(NAME)
-
- CONSOLE_MESSAGE_FORMAT = '%(message)s'
- LOG_FILE_MESSAGE_FORMAT = \
- '[%(asctime)s] %(levelname)-8s %(name)s %(message)s'
- DEFAULT_VERBOSE_LEVEL = 1
- DEFAULT_OUTPUT_ENCODING = 'utf-8'
-
- def __init__(self, description, version, command_manager,
- stdin=None, stdout=None, stderr=None,
- interactive_app_factory=None,
- deferred_help=False):
- """Initialize the application.
- """
- self.command_manager = command_manager
- self.command_manager.add_command('help', help.HelpCommand)
- self.command_manager.add_command('complete', complete.CompleteCommand)
- self._set_streams(stdin, stdout, stderr)
- self.interactive_app_factory = interactive_app_factory
- self.deferred_help = deferred_help
- self.parser = self.build_option_parser(description, version)
- self.interactive_mode = False
- self.interpreter = None
-
- def _set_streams(self, stdin, stdout, stderr):
- try:
- locale.setlocale(locale.LC_ALL, '')
- except locale.Error:
- pass
-
- # Unicode must be encoded/decoded for text I/O streams, the
- # correct encoding for the stream must be selected and it must
- # be capable of handling the set of characters in the stream
- # or Python will raise a codec error. The correct codec is
- # selected based on the locale. Python2 uses the locales
- # encoding but only when the I/O stream is attached to a
- # terminal (TTY) otherwise it uses the default ASCII
- # encoding. The effect is internationalized text written to
- # the terminal works as expected but if command line output is
- # redirected (file or pipe) the ASCII codec is used and the
- # program aborts with a codec error.
- #
- # The default I/O streams stdin, stdout and stderr can be
- # wrapped in a codec based on the locale thus assuring the
- # users desired encoding is always used no matter the I/O
- # destination. Python3 does this by default.
- #
- # If the caller supplies an I/O stream we use it unmodified on
- # the assumption the caller has taken all responsibility for
- # the stream. But with Python2 if the caller allows us to
- # default the I/O streams to sys.stdin, sys.stdout and
- # sys.stderr we apply the locales encoding just as Python3
- # would do. We also check to make sure the main Python program
- # has not already already wrapped sys.stdin, sys.stdout and
- # sys.stderr as this is a common recommendation.
-
- if six.PY2:
- encoding = locale.getpreferredencoding()
- if encoding:
- if not (stdin or isinstance(sys.stdin, codecs.StreamReader)):
- stdin = codecs.getreader(encoding)(sys.stdin)
-
- if not (stdout or isinstance(sys.stdout, codecs.StreamWriter)):
- stdout = codecs.getwriter(encoding)(sys.stdout)
-
- if not (stderr or isinstance(sys.stderr, codecs.StreamWriter)):
- stderr = codecs.getwriter(encoding)(sys.stderr)
-
- self.stdin = stdin or sys.stdin
- self.stdout = stdout or sys.stdout
- self.stderr = stderr or sys.stderr
-
- def build_option_parser(self, description, version,
- argparse_kwargs=None):
- """Return an argparse option parser for this application.
-
- Subclasses may override this method to extend
- the parser with more global options.
-
- :param description: full description of the application
- :paramtype description: str
- :param version: version number for the application
- :paramtype version: str
- :param argparse_kwargs: extra keyword argument passed to the
- ArgumentParser constructor
- :paramtype extra_kwargs: dict
- """
- argparse_kwargs = argparse_kwargs or {}
- parser = argparse.ArgumentParser(
- description=description,
- add_help=False,
- **argparse_kwargs
- )
- parser.add_argument(
- '--version',
- action='version',
- version='%(prog)s {0}'.format(version),
- )
- verbose_group = parser.add_mutually_exclusive_group()
- verbose_group.add_argument(
- '-v', '--verbose',
- action='count',
- dest='verbose_level',
- default=self.DEFAULT_VERBOSE_LEVEL,
- help='Increase verbosity of output. Can be repeated.',
- )
- verbose_group.add_argument(
- '-q', '--quiet',
- action='store_const',
- dest='verbose_level',
- const=0,
- help='Suppress output except warnings and errors.',
- )
- parser.add_argument(
- '--log-file',
- action='store',
- default=None,
- help='Specify a file to log output. Disabled by default.',
- )
- if self.deferred_help:
- parser.add_argument(
- '-h', '--help',
- dest='deferred_help',
- action='store_true',
- help="Show help message and exit.",
- )
- else:
- parser.add_argument(
- '-h', '--help',
- action=help.HelpAction,
- nargs=0,
- default=self, # tricky
- help="Show help message and exit.",
- )
- parser.add_argument(
- '--debug',
- default=False,
- action='store_true',
- help='Show tracebacks on errors.',
- )
- return parser
-
- def configure_logging(self):
- """Create logging handlers for any log output.
- """
- root_logger = logging.getLogger('')
- root_logger.setLevel(logging.DEBUG)
-
- # Set up logging to a file
- if self.options.log_file:
- file_handler = logging.FileHandler(
- filename=self.options.log_file,
- )
- formatter = logging.Formatter(self.LOG_FILE_MESSAGE_FORMAT)
- file_handler.setFormatter(formatter)
- root_logger.addHandler(file_handler)
-
- # Always send higher-level messages to the console via stderr
- console = logging.StreamHandler(self.stderr)
- console_level = {0: logging.WARNING,
- 1: logging.INFO,
- 2: logging.DEBUG,
- }.get(self.options.verbose_level, logging.DEBUG)
- console.setLevel(console_level)
- formatter = logging.Formatter(self.CONSOLE_MESSAGE_FORMAT)
- console.setFormatter(formatter)
- root_logger.addHandler(console)
- return
-
- def print_help_if_requested(self):
- """Print help and exits if deferred help is enabled and requested.
-
- '--help' shows the help message and exits:
- * without calling initialize_app if not self.deferred_help (default),
- * after initialize_app call if self.deferred_help,
- * during initialize_app call if self.deferred_help and subclass calls
- explicitly this method in initialize_app.
- """
- if self.deferred_help and self.options.deferred_help:
- action = help.HelpAction(None, None, default=self)
- action(self.parser, self.options, None, None)
-
- def run(self, argv):
- """Equivalent to the main program for the application.
-
- :param argv: input arguments and options
- :paramtype argv: list of str
- """
- try:
- self.options, remainder = self.parser.parse_known_args(argv)
- self.configure_logging()
- self.interactive_mode = not remainder
- if self.deferred_help and self.options.deferred_help and remainder:
- # When help is requested and `remainder` has any values disable
- # `deferred_help` and instead allow the help subcommand to
- # handle the request during run_subcommand(). This turns
- # "app foo bar --help" into "app help foo bar". However, when
- # `remainder` is empty use print_help_if_requested() to allow
- # for an early exit.
- # Disabling `deferred_help` here also ensures that
- # print_help_if_requested will not fire if called by a subclass
- # during its initialize_app().
- self.options.deferred_help = False
- remainder.insert(0, "help")
- self.initialize_app(remainder)
- self.print_help_if_requested()
- except Exception as err:
- if hasattr(self, 'options'):
- debug = self.options.debug
- else:
- debug = True
- if debug:
- self.LOG.exception(err)
- raise
- else:
- self.LOG.error(err)
- return 1
- result = 1
- if self.interactive_mode:
- result = self.interact()
- else:
- result = self.run_subcommand(remainder)
- return result
-
- # FIXME(dhellmann): Consider moving these command handling methods
- # to a separate class.
- def initialize_app(self, argv):
- """Hook for subclasses to take global initialization action
- after the arguments are parsed but before a command is run.
- Invoked only once, even in interactive mode.
-
- :param argv: List of arguments, including the subcommand to run.
- Empty for interactive mode.
- """
- return
-
- def prepare_to_run_command(self, cmd):
- """Perform any preliminary work needed to run a command.
-
- :param cmd: command processor being invoked
- :paramtype cmd: cliff.command.Command
- """
- return
-
- def clean_up(self, cmd, result, err):
- """Hook run after a command is done to shutdown the app.
-
- :param cmd: command processor being invoked
- :paramtype cmd: cliff.command.Command
- :param result: return value of cmd
- :paramtype result: int
- :param err: exception or None
- :paramtype err: Exception
- """
- return
-
- def interact(self):
- # Defer importing .interactive as cmd2 is a slow import
- from .interactive import InteractiveApp
-
- if self.interactive_app_factory is None:
- self.interactive_app_factory = InteractiveApp
- self.interpreter = self.interactive_app_factory(self,
- self.command_manager,
- self.stdin,
- self.stdout,
- )
- self.interpreter.cmdloop()
- return 0
-
- def get_fuzzy_matches(self, cmd):
- """return fuzzy matches of unknown command
- """
-
- sep = '_'
- if self.command_manager.convert_underscores:
- sep = ' '
- all_cmds = [k[0] for k in self.command_manager]
- dist = []
- for candidate in sorted(all_cmds):
- prefix = candidate.split(sep)[0]
- # Give prefix match a very good score
- if candidate.startswith(cmd):
- dist.append((0, candidate))
- continue
- # Levenshtein distance
- dist.append((utils.damerau_levenshtein(cmd, prefix, utils.COST)+1,
- candidate))
-
- matches = []
- match_distance = 0
- for distance, candidate in sorted(dist):
- if distance > match_distance:
- if match_distance:
- # we copied all items with minimum distance, we are done
- break
- # we copied all items with distance=0,
- # now we match all candidates at the minimum distance
- match_distance = distance
- matches.append(candidate)
-
- return matches
-
- def run_subcommand(self, argv):
- try:
- subcommand = self.command_manager.find_command(argv)
- except ValueError as err:
- # If there was no exact match, try to find a fuzzy match
- the_cmd = argv[0]
- fuzzy_matches = self.get_fuzzy_matches(the_cmd)
- if fuzzy_matches:
- article = 'a'
- if self.NAME[0] in 'aeiou':
- article = 'an'
- self.stdout.write('%s: \'%s\' is not %s %s command. '
- 'See \'%s --help\'.\n'
- % (self.NAME, ' '.join(argv), article,
- self.NAME, self.NAME))
- self.stdout.write('Did you mean one of these?\n')
- for match in fuzzy_matches:
- self.stdout.write(' %s\n' % match)
- else:
- if self.options.debug:
- raise
- else:
- self.LOG.error(err)
- return 2
- cmd_factory, cmd_name, sub_argv = subcommand
- kwargs = {}
- if 'cmd_name' in inspect.getargspec(cmd_factory.__init__).args:
- kwargs['cmd_name'] = cmd_name
- cmd = cmd_factory(self, self.options, **kwargs)
- err = None
- result = 1
- try:
- self.prepare_to_run_command(cmd)
- full_name = (cmd_name
- if self.interactive_mode
- else ' '.join([self.NAME, cmd_name])
- )
- cmd_parser = cmd.get_parser(full_name)
- parsed_args = cmd_parser.parse_args(sub_argv)
- result = cmd.run(parsed_args)
- except Exception as err:
- if self.options.debug:
- self.LOG.exception(err)
- else:
- self.LOG.error(err)
- try:
- self.clean_up(cmd, result, err)
- except Exception as err2:
- if self.options.debug:
- self.LOG.exception(err2)
- else:
- self.LOG.error('Could not clean up: %s', err2)
- if self.options.debug:
- raise
- else:
- try:
- self.clean_up(cmd, result, None)
- except Exception as err3:
- if self.options.debug:
- self.LOG.exception(err3)
- else:
- self.LOG.error('Could not clean up: %s', err3)
- return result
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/argparse.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/argparse.py
deleted file mode 100644
index e48dc79..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/argparse.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Special argparse module that allows to bypass abbrev mode."""
-
-from __future__ import absolute_import
-from argparse import * # noqa
-import sys
-
-
-if sys.version_info < (3, 5):
- class ArgumentParser(ArgumentParser): # noqa
- def __init__(self, *args, **kwargs):
- self.allow_abbrev = kwargs.pop("allow_abbrev", True)
- super(ArgumentParser, self).__init__(*args, **kwargs)
-
- def _get_option_tuples(self, option_string):
- if self.allow_abbrev:
- return super(ArgumentParser, self)._get_option_tuples(
- option_string)
- return ()
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/columns.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/columns.py
deleted file mode 100644
index abf1c4f..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/columns.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Formattable column tools.
-"""
-
-import abc
-
-import six
-
-
-@six.add_metaclass(abc.ABCMeta)
-class FormattableColumn(object):
-
- def __init__(self, value):
- self._value = value
-
- @abc.abstractmethod
- def human_readable(self):
- """Return a basic human readable version of the data.
- """
-
- def machine_readable(self):
- """Return a raw data structure using only Python built-in types.
-
- It must be possible to serialize the return value directly
- using a formatter like JSON, and it will be up to the
- formatter plugin to decide how to make that transformation.
-
- """
- return self._value
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/command.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/command.py
deleted file mode 100644
index 8430563..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/command.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import abc
-import inspect
-
-import six
-
-from cliff import argparse
-
-
-@six.add_metaclass(abc.ABCMeta)
-class Command(object):
- """Base class for command plugins.
-
- :param app: Application instance invoking the command.
- :paramtype app: cliff.app.App
-
- """
-
- deprecated = False
-
- _description = ''
-
- def __init__(self, app, app_args, cmd_name=None):
- self.app = app
- self.app_args = app_args
- self.cmd_name = cmd_name
- return
-
- def get_description(self):
- """Return the command description.
-
- The default is to use the first line of the class' docstring
- as the description. Set the ``_description`` class attribute
- to a one-line description of a command to use a different
- value. This is useful for enabling translations, for example,
- with ``_description`` set to a string wrapped with a gettext
- translation marker.
-
- """
- # NOTE(dhellmann): We need the trailing "or ''" because under
- # Python 2.7 the default for the docstring is None instead of
- # an empty string, and we always want this method to return a
- # string.
- desc = self._description or inspect.getdoc(self.__class__) or ''
- # The base class command description isn't useful for any
- # real commands, so ignore that value.
- if desc == inspect.getdoc(Command):
- desc = ''
- return desc
-
- def get_parser(self, prog_name):
- """Return an :class:`argparse.ArgumentParser`.
- """
- parser = argparse.ArgumentParser(
- description=self.get_description(),
- prog=prog_name,
- )
- return parser
-
- @abc.abstractmethod
- def take_action(self, parsed_args):
- """Override to do something useful.
-
- The returned value will be returned by the program.
- """
-
- def run(self, parsed_args):
- """Invoked by the application when the command is run.
-
- Developers implementing commands should override
- :meth:`take_action`.
-
- Developers creating new command base classes (such as
- :class:`Lister` and :class:`ShowOne`) should override this
- method to wrap :meth:`take_action`.
-
- Return the value returned by :meth:`take_action` or 0.
- """
- return self.take_action(parsed_args) or 0
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/commandmanager.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/commandmanager.py
deleted file mode 100644
index f10685e..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/commandmanager.py
+++ /dev/null
@@ -1,104 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Discover and lookup command plugins.
-"""
-
-import inspect
-import logging
-
-import pkg_resources
-
-
-LOG = logging.getLogger(__name__)
-
-
-class EntryPointWrapper(object):
- """Wrap up a command class already imported to make it look like a plugin.
- """
-
- def __init__(self, name, command_class):
- self.name = name
- self.command_class = command_class
-
- def load(self, require=False):
- return self.command_class
-
-
-class CommandManager(object):
- """Discovers commands and handles lookup based on argv data.
-
- :param namespace: String containing the setuptools entrypoint namespace
- for the plugins to be loaded. For example,
- ``'cliff.formatter.list'``.
- :param convert_underscores: Whether cliff should convert underscores to
- spaces in entry_point commands.
- """
- def __init__(self, namespace, convert_underscores=True):
- self.commands = {}
- self.namespace = namespace
- self.convert_underscores = convert_underscores
- self._load_commands()
-
- def _load_commands(self):
- # NOTE(jamielennox): kept for compatibility.
- self.load_commands(self.namespace)
-
- def load_commands(self, namespace):
- """Load all the commands from an entrypoint"""
- for ep in pkg_resources.iter_entry_points(namespace):
- LOG.debug('found command %r', ep.name)
- cmd_name = (ep.name.replace('_', ' ')
- if self.convert_underscores
- else ep.name)
- self.commands[cmd_name] = ep
- return
-
- def __iter__(self):
- return iter(self.commands.items())
-
- def add_command(self, name, command_class):
- self.commands[name] = EntryPointWrapper(name, command_class)
-
- def find_command(self, argv):
- """Given an argument list, find a command and
- return the processor and any remaining arguments.
- """
- start = self._get_last_possible_command_index(argv)
- for i in range(start, 0, -1):
- name = ' '.join(argv[:i])
- search_args = argv[i:]
- if name in self.commands:
- cmd_ep = self.commands[name]
- if hasattr(cmd_ep, 'resolve'):
- cmd_factory = cmd_ep.resolve()
- else:
- # NOTE(dhellmann): Some fake classes don't take
- # require as an argument. Yay?
- arg_spec = inspect.getargspec(cmd_ep.load)
- if 'require' in arg_spec[0]:
- cmd_factory = cmd_ep.load(require=False)
- else:
- cmd_factory = cmd_ep.load()
- return (cmd_factory, name, search_args)
- else:
- raise ValueError('Unknown command %r' %
- (argv,))
-
- def _get_last_possible_command_index(self, argv):
- """Returns the index after the last argument
- in argv that can be a command word
- """
- for i, arg in enumerate(argv):
- if arg.startswith('-'):
- return i
- return len(argv)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/complete.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/complete.py
deleted file mode 100644
index 1e4df76..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/complete.py
+++ /dev/null
@@ -1,221 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Bash completion for the CLI.
-"""
-
-import logging
-
-import six
-import stevedore
-
-from cliff import command
-
-
-class CompleteDictionary:
- """dictionary for bash completion
- """
-
- def __init__(self):
- self._dictionary = {}
-
- def add_command(self, command, actions):
- optstr = ' '.join(opt for action in actions
- for opt in action.option_strings)
- dicto = self._dictionary
- last_cmd = command[-1]
- for subcmd in command[:-1]:
- subdata = dicto.get(subcmd)
- # If there is a string in corresponding dictionary, it means the
- # verb used for the command exists already.
- # For example, {'cmd': 'action'}, and we add the command
- # 'cmd_other'. We want the result to be
- # {'cmd': 'action other', 'cmd_other': 'sub_action'}
- if isinstance(subdata, six.string_types):
- subdata += ' ' + last_cmd
- dicto[subcmd] = subdata
- last_cmd = subcmd + '_' + last_cmd
- else:
- dicto = dicto.setdefault(subcmd, {})
- dicto[last_cmd] = optstr
-
- def get_commands(self):
- return ' '.join(k for k in sorted(self._dictionary.keys()))
-
- def _get_data_recurse(self, dictionary, path):
- ray = []
- keys = sorted(dictionary.keys())
- for cmd in keys:
- name = path + "_" + cmd if path else cmd
- value = dictionary[cmd]
- if isinstance(value, six.string_types):
- ray.append((name, value))
- else:
- cmdlist = ' '.join(sorted(value.keys()))
- ray.append((name, cmdlist))
- ray += self._get_data_recurse(value, name)
- return ray
-
- def get_data(self):
- return sorted(self._get_data_recurse(self._dictionary, ""))
-
-
-class CompleteShellBase(object):
- """base class for bash completion generation
- """
- def __init__(self, name, output):
- self.name = str(name)
- self.output = output
-
- def write(self, cmdo, data):
- self.output.write(self.get_header())
- self.output.write(" cmds='{0}'\n".format(cmdo))
- for datum in data:
- datum = (datum[0].replace('-', '_'), datum[1])
- self.output.write(' cmds_{0}=\'{1}\'\n'.format(*datum))
- self.output.write(self.get_trailer())
-
- @property
- def escaped_name(self):
- return self.name.replace('-', '_')
-
-
-class CompleteNoCode(CompleteShellBase):
- """completion with no code
- """
- def __init__(self, name, output):
- super(CompleteNoCode, self).__init__(name, output)
-
- def get_header(self):
- return ''
-
- def get_trailer(self):
- return ''
-
-
-class CompleteBash(CompleteShellBase):
- """completion for bash
- """
- def __init__(self, name, output):
- super(CompleteBash, self).__init__(name, output)
-
- def get_header(self):
- return ('_' + self.escaped_name + """()
-{
- local cur prev words
- COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev words
-
- # Command data:
-""")
-
- def get_trailer(self):
- return ("""
- dash=-
- underscore=_
- cmd=""
- words[0]=""
- completed="${cmds}"
- for var in "${words[@]:1}"
- do
- if [[ ${var} == -* ]] ; then
- break
- fi
- if [ -z "${cmd}" ] ; then
- proposed="${var}"
- else
- proposed="${cmd}_${var}"
- fi
- local i="cmds_${proposed}"
- i=${i//$dash/$underscore}
- local comp="${!i}"
- if [ -z "${comp}" ] ; then
- break
- fi
- if [[ ${comp} == -* ]] ; then
- if [[ ${cur} != -* ]] ; then
- completed=""
- break
- fi
- fi
- cmd="${proposed}"
- completed="${comp}"
- done
-
- if [ -z "${completed}" ] ; then
- COMPREPLY=( $( compgen -f -- "$cur" ) $( compgen -d -- "$cur" ) )
- else
- COMPREPLY=( $(compgen -W "${completed}" -- ${cur}) )
- fi
- return 0
-}
-complete -F _""" + self.escaped_name + ' ' + self.name + '\n')
-
-
-class CompleteCommand(command.Command):
- """print bash completion command
- """
-
- log = logging.getLogger(__name__ + '.CompleteCommand')
-
- def __init__(self, app, app_args):
- super(CompleteCommand, self).__init__(app, app_args)
- self._formatters = stevedore.ExtensionManager(
- namespace='cliff.formatter.completion',
- )
-
- def get_parser(self, prog_name):
- parser = super(CompleteCommand, self).get_parser(prog_name)
- parser.add_argument(
- "--name",
- default=None,
- metavar='<command_name>',
- help="Command name to support with command completion"
- )
- parser.add_argument(
- "--shell",
- default='bash',
- metavar='<shell>',
- choices=sorted(self._formatters.names()),
- help="Shell being used. Use none for data only (default: bash)"
- )
- return parser
-
- def get_actions(self, command):
- the_cmd = self.app.command_manager.find_command(command)
- cmd_factory, cmd_name, search_args = the_cmd
- cmd = cmd_factory(self.app, search_args)
- if self.app.interactive_mode:
- full_name = (cmd_name)
- else:
- full_name = (' '.join([self.app.NAME, cmd_name]))
- cmd_parser = cmd.get_parser(full_name)
- return cmd_parser._get_optional_actions()
-
- def take_action(self, parsed_args):
- self.log.debug('take_action(%s)' % parsed_args)
-
- name = parsed_args.name or self.app.NAME
- try:
- shell_factory = self._formatters[parsed_args.shell].plugin
- except KeyError:
- raise RuntimeError('Unknown shell syntax %r' % parsed_args.shell)
- shell = shell_factory(name, self.app.stdout)
-
- dicto = CompleteDictionary()
- for cmd in self.app.command_manager:
- command = cmd[0].split()
- dicto.add_command(command, self.get_actions(command))
-
- shell.write(dicto.get_commands(), dicto.get_data())
-
- return 0
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/display.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/display.py
deleted file mode 100644
index 0c69352..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/display.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Application base class for displaying data.
-"""
-import abc
-from itertools import compress
-
-import six
-import stevedore
-
-from . import command
-
-
-@six.add_metaclass(abc.ABCMeta)
-class DisplayCommandBase(command.Command):
- """Command base class for displaying data about a single object.
- """
-
- def __init__(self, app, app_args, cmd_name=None):
- super(DisplayCommandBase, self).__init__(app, app_args,
- cmd_name=cmd_name)
- self._formatter_plugins = self._load_formatter_plugins()
-
- @abc.abstractproperty
- def formatter_namespace(self):
- "String specifying the namespace to use for loading formatter plugins."
-
- @abc.abstractproperty
- def formatter_default(self):
- "String specifying the name of the default formatter."
-
- def _load_formatter_plugins(self):
- # Here so tests can override
- return stevedore.ExtensionManager(
- self.formatter_namespace,
- invoke_on_load=True,
- )
-
- def get_parser(self, prog_name):
- parser = super(DisplayCommandBase, self).get_parser(prog_name)
- formatter_group = parser.add_argument_group(
- title='output formatters',
- description='output formatter options',
- )
- formatter_choices = sorted(self._formatter_plugins.names())
- formatter_default = self.formatter_default
- if formatter_default not in formatter_choices:
- formatter_default = formatter_choices[0]
- formatter_group.add_argument(
- '-f', '--format',
- dest='formatter',
- action='store',
- choices=formatter_choices,
- default=formatter_default,
- help='the output format, defaults to %s' % formatter_default,
- )
- formatter_group.add_argument(
- '-c', '--column',
- action='append',
- default=[],
- dest='columns',
- metavar='COLUMN',
- help='specify the column(s) to include, can be repeated',
- )
- for formatter in self._formatter_plugins:
- formatter.obj.add_argument_group(parser)
- return parser
-
- @abc.abstractmethod
- def produce_output(self, parsed_args, column_names, data):
- """Use the formatter to generate the output.
-
- :param parsed_args: argparse.Namespace instance with argument values
- :param column_names: sequence of strings containing names
- of output columns
- :param data: iterable with values matching the column names
- """
-
- def _generate_columns_and_selector(self, parsed_args, column_names):
- """Generate included columns and selector according to parsed args.
-
- :param parsed_args: argparse.Namespace instance with argument values
- :param column_names: sequence of strings containing names
- of output columns
- """
- if not parsed_args.columns:
- columns_to_include = column_names
- selector = None
- else:
- columns_to_include = [c for c in column_names
- if c in parsed_args.columns]
- if not columns_to_include:
- raise ValueError('No recognized column names in %s' %
- str(parsed_args.columns))
- # Set up argument to compress()
- selector = [(c in columns_to_include)
- for c in column_names]
- return columns_to_include, selector
-
- def run(self, parsed_args):
- self.formatter = self._formatter_plugins[parsed_args.formatter].obj
- column_names, data = self.take_action(parsed_args)
- self.produce_output(parsed_args, column_names, data)
- return 0
-
- @staticmethod
- def _compress_iterable(iterable, selectors):
- return compress(iterable, selectors)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/__init__.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/__init__.py
+++ /dev/null
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/base.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/base.py
deleted file mode 100644
index 920cb32..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/base.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Base classes for formatters.
-"""
-
-import abc
-
-import six
-
-
-@six.add_metaclass(abc.ABCMeta)
-class Formatter(object):
-
- @abc.abstractmethod
- def add_argument_group(self, parser):
- """Add any options to the argument parser.
-
- Should use our own argument group.
- """
-
-
-@six.add_metaclass(abc.ABCMeta)
-class ListFormatter(Formatter):
- """Base class for formatters that know how to deal with multiple objects.
- """
-
- @abc.abstractmethod
- def emit_list(self, column_names, data, stdout, parsed_args):
- """Format and print the list from the iterable data source.
-
- Data values can be primitive types like ints and strings, or
- can be an instance of a :class:`FormattableColumn` for
- situations where the value is complex, and may need to be
- handled differently for human readable output vs. machine
- readable output.
-
- :param column_names: names of the columns
- :param data: iterable data source, one tuple per object
- with values in order of column names
- :param stdout: output stream where data should be written
- :param parsed_args: argparse namespace from our local options
-
- """
-
-
-@six.add_metaclass(abc.ABCMeta)
-class SingleFormatter(Formatter):
- """Base class for formatters that work with single objects.
- """
-
- @abc.abstractmethod
- def emit_one(self, column_names, data, stdout, parsed_args):
- """Format and print the values associated with the single object.
-
- Data values can be primitive types like ints and strings, or
- can be an instance of a :class:`FormattableColumn` for
- situations where the value is complex, and may need to be
- handled differently for human readable output vs. machine
- readable output.
-
- :param column_names: names of the columns
- :param data: iterable data source with values in order of column names
- :param stdout: output stream where data should be written
- :param parsed_args: argparse namespace from our local options
- """
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/commaseparated.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/commaseparated.py
deleted file mode 100644
index 46a7bc5..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/commaseparated.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Output formatters using csv format.
-"""
-
-import os
-import sys
-
-from .base import ListFormatter
-from cliff import columns
-
-import six
-
-if sys.version_info[0] == 3:
- import csv
-else:
- import unicodecsv as csv
-
-
-class CSVLister(ListFormatter):
-
- QUOTE_MODES = {
- 'all': csv.QUOTE_ALL,
- 'minimal': csv.QUOTE_MINIMAL,
- 'nonnumeric': csv.QUOTE_NONNUMERIC,
- 'none': csv.QUOTE_NONE,
- }
-
- def add_argument_group(self, parser):
- group = parser.add_argument_group('CSV Formatter')
- group.add_argument(
- '--quote',
- choices=sorted(self.QUOTE_MODES.keys()),
- dest='quote_mode',
- default='nonnumeric',
- help='when to include quotes, defaults to nonnumeric',
- )
-
- def emit_list(self, column_names, data, stdout, parsed_args):
- writer = csv.writer(stdout,
- quoting=self.QUOTE_MODES[parsed_args.quote_mode],
- lineterminator=os.linesep,
- escapechar='\\',
- )
- writer.writerow(column_names)
- for row in data:
- writer.writerow(
- [(six.text_type(c.machine_readable())
- if isinstance(c, columns.FormattableColumn)
- else c)
- for c in row]
- )
- return
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/json_format.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/json_format.py
deleted file mode 100644
index 2af5260..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/json_format.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Output formatters for JSON.
-"""
-
-import json
-
-from . import base
-from cliff import columns
-
-
-class JSONFormatter(base.ListFormatter, base.SingleFormatter):
-
- def add_argument_group(self, parser):
- group = parser.add_argument_group(title='json formatter')
- group.add_argument(
- '--noindent',
- action='store_true',
- dest='noindent',
- help='whether to disable indenting the JSON'
- )
-
- def emit_list(self, column_names, data, stdout, parsed_args):
- items = []
- for item in data:
- items.append(
- {n: (i.machine_readable()
- if isinstance(i, columns.FormattableColumn)
- else i)
- for n, i in zip(column_names, item)}
- )
- indent = None if parsed_args.noindent else 2
- json.dump(items, stdout, indent=indent)
-
- def emit_one(self, column_names, data, stdout, parsed_args):
- one = {
- n: (i.machine_readable()
- if isinstance(i, columns.FormattableColumn)
- else i)
- for n, i in zip(column_names, data)
- }
- indent = None if parsed_args.noindent else 2
- json.dump(one, stdout, indent=indent)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/shell.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/shell.py
deleted file mode 100644
index 6e7bae9..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/shell.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Output formatters using shell syntax.
-"""
-
-from . import base
-from cliff import columns
-
-import argparse
-import six
-
-
-class ShellFormatter(base.SingleFormatter):
-
- def add_argument_group(self, parser):
- group = parser.add_argument_group(
- title='shell formatter',
- description='a format a UNIX shell can parse (variable="value")',
- )
- group.add_argument(
- '--variable',
- action='append',
- default=[],
- dest='variables',
- metavar='VARIABLE',
- help=argparse.SUPPRESS,
- )
- group.add_argument(
- '--prefix',
- action='store',
- default='',
- dest='prefix',
- help='add a prefix to all variable names',
- )
-
- def emit_one(self, column_names, data, stdout, parsed_args):
- variable_names = [c.lower().replace(' ', '_')
- for c in column_names
- ]
- desired_columns = parsed_args.variables
- for name, value in zip(variable_names, data):
- if name in desired_columns or not desired_columns:
- value = (six.text_type(value.machine_readable())
- if isinstance(value, columns.FormattableColumn)
- else value)
- if isinstance(value, six.string_types):
- value = value.replace('"', '\\"')
- if isinstance(name, six.string_types):
- # Colons and dashes may appear as a resource property but
- # are invalid to use in a shell, replace them with an
- # underscore.
- name = name.replace(':', '_')
- name = name.replace('-', '_')
- stdout.write('%s%s="%s"\n' % (parsed_args.prefix, name, value))
- return
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/table.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/table.py
deleted file mode 100644
index df4616b..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/table.py
+++ /dev/null
@@ -1,203 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Output formatters using prettytable.
-"""
-
-import prettytable
-import six
-import os
-
-from cliff import utils
-from . import base
-from cliff import columns
-
-
-def _format_row(row):
- new_row = []
- for r in row:
- if isinstance(r, columns.FormattableColumn):
- r = r.human_readable()
- if isinstance(r, six.string_types):
- r = r.replace('\r\n', '\n').replace('\r', ' ')
- new_row.append(r)
- return new_row
-
-
-class TableFormatter(base.ListFormatter, base.SingleFormatter):
-
- ALIGNMENTS = {
- int: 'r',
- str: 'l',
- float: 'r',
- }
- try:
- ALIGNMENTS[unicode] = 'l'
- except NameError:
- pass
-
- def add_argument_group(self, parser):
- group = parser.add_argument_group('table formatter')
- group.add_argument(
- '--max-width',
- metavar='<integer>',
- default=int(os.environ.get('CLIFF_MAX_TERM_WIDTH', 0)),
- type=int,
- help=('Maximum display width, <1 to disable. You can also '
- 'use the CLIFF_MAX_TERM_WIDTH environment variable, '
- 'but the parameter takes precedence.'),
- )
- group.add_argument(
- '--print-empty',
- action='store_true',
- help='Print empty table if there is no data to show.',
- )
-
- def add_rows(self, table, column_names, data):
- # Figure out the types of the columns in the
- # first row and set the alignment of the
- # output accordingly.
- data_iter = iter(data)
- try:
- first_row = next(data_iter)
- except StopIteration:
- pass
- else:
- for value, name in zip(first_row, column_names):
- alignment = self.ALIGNMENTS.get(type(value), 'l')
- table.align[name] = alignment
- # Now iterate over the data and add the rows.
- table.add_row(_format_row(first_row))
- for row in data_iter:
- table.add_row(_format_row(row))
-
- def emit_list(self, column_names, data, stdout, parsed_args):
- x = prettytable.PrettyTable(
- column_names,
- print_empty=parsed_args.print_empty,
- )
- x.padding_width = 1
-
- # Add rows if data is provided
- if data:
- self.add_rows(x, column_names, data)
-
- # Choose a reasonable min_width to better handle many columns on a
- # narrow console. The table will overflow the console width in
- # preference to wrapping columns smaller than 8 characters.
- min_width = 8
- self._assign_max_widths(
- stdout, x, int(parsed_args.max_width), min_width)
-
- formatted = x.get_string()
- stdout.write(formatted)
- stdout.write('\n')
- return
-
- def emit_one(self, column_names, data, stdout, parsed_args):
- x = prettytable.PrettyTable(field_names=('Field', 'Value'),
- print_empty=False)
- x.padding_width = 1
- # Align all columns left because the values are
- # not all the same type.
- x.align['Field'] = 'l'
- x.align['Value'] = 'l'
- for name, value in zip(column_names, data):
- x.add_row(_format_row((name, value)))
-
- # Choose a reasonable min_width to better handle a narrow
- # console. The table will overflow the console width in preference
- # to wrapping columns smaller than 16 characters in an attempt to keep
- # the Field column readable.
- min_width = 16
- self._assign_max_widths(
- stdout, x, int(parsed_args.max_width), min_width)
-
- formatted = x.get_string()
- stdout.write(formatted)
- stdout.write('\n')
- return
-
- @staticmethod
- def _field_widths(field_names, first_line):
-
- # use the first line +----+-------+ to infer column widths
- # accounting for padding and dividers
- widths = [max(0, len(i) - 2) for i in first_line.split('+')[1:-1]]
- return dict(zip(field_names, widths))
-
- @staticmethod
- def _width_info(term_width, field_count):
- # remove padding and dividers for width available to actual content
- usable_total_width = max(0, term_width - 1 - 3 * field_count)
-
- # calculate width per column if all columns were equal
- if field_count == 0:
- optimal_width = 0
- else:
- optimal_width = max(0, usable_total_width // field_count)
-
- return usable_total_width, optimal_width
-
- @staticmethod
- def _build_shrink_fields(usable_total_width, optimal_width,
- field_widths, field_names):
- shrink_fields = []
- shrink_remaining = usable_total_width
- for field in field_names:
- w = field_widths[field]
- if w <= optimal_width:
- # leave alone columns which are smaller than the optimal width
- shrink_remaining -= w
- else:
- shrink_fields.append(field)
-
- return shrink_fields, shrink_remaining
-
- @staticmethod
- def _assign_max_widths(stdout, x, max_width, min_width=0):
- if min_width:
- x.min_width = min_width
-
- if max_width > 0:
- term_width = max_width
- else:
- term_width = utils.terminal_width(stdout)
- if not term_width:
- # not a tty, so do not set any max widths
- return
- field_count = len(x.field_names)
-
- try:
- first_line = x.get_string().splitlines()[0]
- if len(first_line) <= term_width:
- return
- except IndexError:
- return
-
- usable_total_width, optimal_width = TableFormatter._width_info(
- term_width, field_count)
-
- field_widths = TableFormatter._field_widths(x.field_names, first_line)
-
- shrink_fields, shrink_remaining = TableFormatter._build_shrink_fields(
- usable_total_width, optimal_width, field_widths, x.field_names)
-
- shrink_to = shrink_remaining // len(shrink_fields)
- # make all shrinkable fields size shrink_to apart from the last one
- for field in shrink_fields[:-1]:
- x.max_width[field] = max(min_width, shrink_to)
- shrink_remaining -= shrink_to
-
- # give the last shrinkable column shrink_to plus any remaining
- field = shrink_fields[-1]
- x.max_width[field] = max(min_width, shrink_remaining)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/value.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/value.py
deleted file mode 100644
index 24125c0..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/value.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Output formatters values only
-"""
-
-import six
-
-from . import base
-from cliff import columns
-
-
-class ValueFormatter(base.ListFormatter, base.SingleFormatter):
-
- def add_argument_group(self, parser):
- pass
-
- def emit_list(self, column_names, data, stdout, parsed_args):
- for row in data:
- stdout.write(
- ' '.join(
- six.text_type(c.machine_readable()
- if isinstance(c, columns.FormattableColumn)
- else c)
- for c in row) + u'\n')
- return
-
- def emit_one(self, column_names, data, stdout, parsed_args):
- for value in data:
- stdout.write('%s\n' % six.text_type(
- value.machine_readable()
- if isinstance(value, columns.FormattableColumn)
- else value)
- )
- return
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/yaml_format.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/yaml_format.py
deleted file mode 100644
index 8b1e64d..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/formatters/yaml_format.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Output formatters using PyYAML.
-"""
-
-import yaml
-
-from . import base
-from cliff import columns
-
-
-class YAMLFormatter(base.ListFormatter, base.SingleFormatter):
-
- def add_argument_group(self, parser):
- pass
-
- def emit_list(self, column_names, data, stdout, parsed_args):
- items = []
- for item in data:
- items.append(
- {n: (i.machine_readable()
- if isinstance(i, columns.FormattableColumn)
- else i)
- for n, i in zip(column_names, item)}
- )
- yaml.safe_dump(items, stream=stdout, default_flow_style=False)
-
- def emit_one(self, column_names, data, stdout, parsed_args):
- for key, value in zip(column_names, data):
- dict_data = {
- key: (value.machine_readable()
- if isinstance(value, columns.FormattableColumn)
- else value)
- }
- yaml.safe_dump(dict_data, stream=stdout, default_flow_style=False)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/help.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/help.py
deleted file mode 100644
index 3974124..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/help.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import argparse
-import sys
-import traceback
-
-from . import command
-
-
-class HelpAction(argparse.Action):
- """Provide a custom action so the -h and --help options
- to the main app will print a list of the commands.
-
- The commands are determined by checking the CommandManager
- instance, passed in as the "default" value for the action.
- """
- def __call__(self, parser, namespace, values, option_string=None):
- app = self.default
- parser.print_help(app.stdout)
- app.stdout.write('\nCommands:\n')
- command_manager = app.command_manager
- for name, ep in sorted(command_manager):
- try:
- factory = ep.load()
- except Exception:
- app.stdout.write('Could not load %r\n' % ep)
- if namespace.debug:
- traceback.print_exc(file=app.stdout)
- continue
- try:
- cmd = factory(app, None)
- if cmd.deprecated:
- continue
- except Exception as err:
- app.stdout.write('Could not instantiate %r: %s\n' % (ep, err))
- if namespace.debug:
- traceback.print_exc(file=app.stdout)
- continue
- one_liner = cmd.get_description().split('\n')[0]
- app.stdout.write(' %-13s %s\n' % (name, one_liner))
- sys.exit(0)
-
-
-class HelpCommand(command.Command):
- """print detailed help for another command
- """
-
- def get_parser(self, prog_name):
- parser = super(HelpCommand, self).get_parser(prog_name)
- parser.add_argument('cmd',
- nargs='*',
- help='name of the command',
- )
- return parser
-
- def take_action(self, parsed_args):
- if parsed_args.cmd:
- try:
- the_cmd = self.app.command_manager.find_command(
- parsed_args.cmd,
- )
- cmd_factory, cmd_name, search_args = the_cmd
- except ValueError:
- # Did not find an exact match
- cmd = parsed_args.cmd[0]
- fuzzy_matches = [k[0] for k in self.app.command_manager
- if k[0].startswith(cmd)
- ]
- if not fuzzy_matches:
- raise
- self.app.stdout.write('Command "%s" matches:\n' % cmd)
- for fm in sorted(fuzzy_matches):
- self.app.stdout.write(' %s\n' % fm)
- return
- self.app_args.cmd = search_args
- cmd = cmd_factory(self.app, self.app_args)
- full_name = (cmd_name
- if self.app.interactive_mode
- else ' '.join([self.app.NAME, cmd_name])
- )
- cmd_parser = cmd.get_parser(full_name)
- cmd_parser.print_help(self.app.stdout)
- else:
- action = HelpAction(None, None, default=self.app)
- action(self.app.parser, self.app.options, None, None)
- return 0
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/interactive.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/interactive.py
deleted file mode 100644
index 1d4e294..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/interactive.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Application base class.
-"""
-
-import itertools
-import shlex
-import sys
-
-import cmd2
-
-
-class InteractiveApp(cmd2.Cmd):
- """Provides "interactive mode" features.
-
- Refer to the cmd2_ and cmd_ documentation for details
- about subclassing and configuring this class.
-
- .. _cmd2: http://packages.python.org/cmd2/index.html
- .. _cmd: http://docs.python.org/library/cmd.html
-
- :param parent_app: The calling application (expected to be derived
- from :class:`cliff.main.App`).
- :param command_manager: A :class:`cliff.commandmanager.CommandManager`
- instance.
- :param stdin: Standard input stream
- :param stdout: Standard output stream
- """
-
- use_rawinput = True
- doc_header = "Shell commands (type help <topic>):"
- app_cmd_header = "Application commands (type help <topic>):"
-
- def __init__(self, parent_app, command_manager, stdin, stdout):
- self.parent_app = parent_app
- if not hasattr(sys.stdin, 'isatty') or sys.stdin.isatty():
- self.prompt = '(%s) ' % parent_app.NAME
- else:
- # batch/pipe mode
- self.prompt = ''
- self.command_manager = command_manager
- cmd2.Cmd.__init__(self, 'tab', stdin=stdin, stdout=stdout)
-
- def default(self, line):
- # Tie in the default command processor to
- # dispatch commands known to the command manager.
- # We send the message through our parent app,
- # since it already has the logic for executing
- # the subcommand.
- line_parts = shlex.split(line.parsed.raw)
- self.parent_app.run_subcommand(line_parts)
-
- def completenames(self, text, *ignored):
- """Tab-completion for command prefix without completer delimiter.
-
- This method returns cmd style and cliff style commands matching
- provided command prefix (text).
- """
- completions = cmd2.Cmd.completenames(self, text, *ignored)
- completions += self._complete_prefix(text)
- return completions
-
- def completedefault(self, text, line, begidx, endidx):
- """Default tab-completion for command prefix with completer delimiter.
-
- This method filters only cliff style commands matching provided
- command prefix (line) as cmd2 style commands cannot contain spaces.
- This method returns text + missing command part of matching commands.
- This method does not handle options in cmd2/cliff style commands, you
- must define complete_$method to handle them.
- """
- return [x[begidx:] for x in self._complete_prefix(line)]
-
- def _complete_prefix(self, prefix):
- """Returns cliff style commands with a specific prefix."""
- if not prefix:
- return [n for n, v in self.command_manager]
- return [n for n, v in self.command_manager if n.startswith(prefix)]
-
- def help_help(self):
- # Use the command manager to get instructions for "help"
- self.default('help help')
-
- def do_help(self, arg):
- if arg:
- # Check if the arg is a builtin command or something
- # coming from the command manager
- arg_parts = shlex.split(arg)
- method_name = '_'.join(
- itertools.chain(
- ['do'],
- itertools.takewhile(lambda x: not x.startswith('-'),
- arg_parts)
- )
- )
- # Have the command manager version of the help
- # command produce the help text since cmd and
- # cmd2 do not provide help for "help"
- if hasattr(self, method_name):
- return cmd2.Cmd.do_help(self, arg)
- # Dispatch to the underlying help command,
- # which knows how to provide help for extension
- # commands.
- self.default(self.parsed('help ' + arg))
- else:
- cmd2.Cmd.do_help(self, arg)
- cmd_names = sorted([n for n, v in self.command_manager])
- self.print_topics(self.app_cmd_header, cmd_names, 15, 80)
- return
-
- def get_names(self):
- # Override the base class version to filter out
- # things that look like they should be hidden
- # from the user.
- return [n
- for n in cmd2.Cmd.get_names(self)
- if not n.startswith('do__')
- ]
-
- def precmd(self, statement):
- # Pre-process the parsed command in case it looks like one of
- # our subcommands, since cmd2 does not handle multi-part
- # command names by default.
- line_parts = shlex.split(statement.parsed.raw)
- try:
- the_cmd = self.command_manager.find_command(line_parts)
- cmd_factory, cmd_name, sub_argv = the_cmd
- except ValueError:
- # Not a plugin command
- pass
- else:
- statement.parsed.command = cmd_name
- statement.parsed.args = ' '.join(sub_argv)
- return statement
-
- def cmdloop(self):
- self._cmdloop()
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/lister.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/lister.py
deleted file mode 100644
index e39c536..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/lister.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Application base class for providing a list of data as output.
-"""
-import abc
-import six
-
-from . import display
-
-
-@six.add_metaclass(abc.ABCMeta)
-class Lister(display.DisplayCommandBase):
- """Command base class for providing a list of data as output.
- """
-
- @property
- def formatter_namespace(self):
- return 'cliff.formatter.list'
-
- @property
- def formatter_default(self):
- return 'table'
-
- @abc.abstractmethod
- def take_action(self, parsed_args):
- """Return a tuple containing the column names and an iterable
- containing the data to be listed.
- """
-
- def produce_output(self, parsed_args, column_names, data):
- (columns_to_include, selector) = self._generate_columns_and_selector(
- parsed_args, column_names)
- if selector:
- # Generator expression to only return the parts of a row
- # of data that the user has expressed interest in
- # seeing. We have to convert the compress() output to a
- # list so the table formatter can ask for its length.
- data = (list(self._compress_iterable(row, selector))
- for row in data)
- self.formatter.emit_list(columns_to_include,
- data,
- self.app.stdout,
- parsed_args,
- )
- return 0
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/show.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/show.py
deleted file mode 100644
index dc6482a..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/show.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Application base class for displaying data about a single object.
-"""
-import abc
-
-import six
-
-from . import display
-
-
-@six.add_metaclass(abc.ABCMeta)
-class ShowOne(display.DisplayCommandBase):
- """Command base class for displaying data about a single object.
- """
-
- @property
- def formatter_namespace(self):
- return 'cliff.formatter.show'
-
- @property
- def formatter_default(self):
- return 'table'
-
- @abc.abstractmethod
- def take_action(self, parsed_args):
- """Return a two-part tuple with a tuple of column names
- and a tuple of values.
- """
-
- def produce_output(self, parsed_args, column_names, data):
- (columns_to_include, selector) = self._generate_columns_and_selector(
- parsed_args, column_names)
- if selector:
- data = list(self._compress_iterable(data, selector))
- self.formatter.emit_one(columns_to_include,
- data,
- self.app.stdout,
- parsed_args)
- return 0
-
- def dict2columns(self, data):
- """Implement the common task of converting a dict-based object
- to the two-column output that ShowOne expects.
- """
- if not data:
- return ({}, {})
- else:
- return zip(*sorted(data.items()))
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/__init__.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/__init__.py
+++ /dev/null
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_app.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_app.py
deleted file mode 100644
index 26149a2..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_app.py
+++ /dev/null
@@ -1,498 +0,0 @@
-# -*- encoding: utf-8 -*-
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import argparse
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
-
-import codecs
-import locale
-import mock
-import six
-import sys
-
-from cliff import app as application
-from cliff import command as c_cmd
-from cliff import commandmanager
-from cliff.tests import utils as test_utils
-from cliff import utils
-
-
-def make_app(**kwargs):
- cmd_mgr = commandmanager.CommandManager('cliff.tests')
-
- # Register a command that succeeds
- command = mock.MagicMock(spec=c_cmd.Command)
- command_inst = mock.MagicMock(spec=c_cmd.Command)
- command_inst.run.return_value = 0
- command.return_value = command_inst
- cmd_mgr.add_command('mock', command)
-
- # Register a command that fails
- err_command = mock.Mock(name='err_command', spec=c_cmd.Command)
- err_command_inst = mock.Mock(spec=c_cmd.Command)
- err_command_inst.run = mock.Mock(
- side_effect=RuntimeError('test exception')
- )
- err_command.return_value = err_command_inst
- cmd_mgr.add_command('error', err_command)
-
- app = application.App('testing interactive mode',
- '1',
- cmd_mgr,
- stderr=mock.Mock(), # suppress warning messages
- **kwargs
- )
- return app, command
-
-
-def test_no_args_triggers_interactive_mode():
- app, command = make_app()
- app.interact = mock.MagicMock(name='inspect')
- app.run([])
- app.interact.assert_called_once_with()
-
-
-def test_interactive_mode_cmdloop():
- app, command = make_app()
- app.interactive_app_factory = mock.MagicMock(
- name='interactive_app_factory'
- )
- assert app.interpreter is None
- app.run([])
- assert app.interpreter is not None
- app.interactive_app_factory.return_value.cmdloop.assert_called_once_with()
-
-
-def test_initialize_app():
- app, command = make_app()
- app.initialize_app = mock.MagicMock(name='initialize_app')
- app.run(['mock'])
- app.initialize_app.assert_called_once_with(['mock'])
-
-
-def test_prepare_to_run_command():
- app, command = make_app()
- app.prepare_to_run_command = mock.MagicMock(name='prepare_to_run_command')
- app.run(['mock'])
- app.prepare_to_run_command.assert_called_once_with(command())
-
-
-def test_clean_up_success():
- app, command = make_app()
- app.clean_up = mock.MagicMock(name='clean_up')
- app.run(['mock'])
- app.clean_up.assert_called_once_with(command.return_value, 0, None)
-
-
-def test_clean_up_error():
- app, command = make_app()
-
- app.clean_up = mock.MagicMock(name='clean_up')
- app.run(['error'])
-
- app.clean_up.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY)
- call_args = app.clean_up.call_args_list[0]
- assert call_args == mock.call(mock.ANY, 1, mock.ANY)
- args, kwargs = call_args
- assert isinstance(args[2], RuntimeError)
- assert args[2].args == ('test exception',)
-
-
-def test_clean_up_error_debug():
- app, command = make_app()
-
- app.clean_up = mock.MagicMock(name='clean_up')
- try:
- app.run(['--debug', 'error'])
- except RuntimeError as err:
- assert app.clean_up.call_args_list[0][0][2] is err
- else:
- assert False, 'Should have had an exception'
-
- assert app.clean_up.called
- call_args = app.clean_up.call_args_list[0]
- assert call_args == mock.call(mock.ANY, 1, mock.ANY)
- args, kwargs = call_args
- assert isinstance(args[2], RuntimeError)
- assert args[2].args == ('test exception',)
-
-
-def test_error_handling_clean_up_raises_exception():
- app, command = make_app()
-
- app.clean_up = mock.MagicMock(
- name='clean_up',
- side_effect=RuntimeError('within clean_up'),
- )
- app.run(['error'])
-
- assert app.clean_up.called
- call_args = app.clean_up.call_args_list[0]
- assert call_args == mock.call(mock.ANY, 1, mock.ANY)
- args, kwargs = call_args
- assert isinstance(args[2], RuntimeError)
- assert args[2].args == ('test exception',)
-
-
-def test_error_handling_clean_up_raises_exception_debug():
- app, command = make_app()
-
- app.clean_up = mock.MagicMock(
- name='clean_up',
- side_effect=RuntimeError('within clean_up'),
- )
- try:
- app.run(['--debug', 'error'])
- except RuntimeError as err:
- if not hasattr(err, '__context__'):
- # The exception passed to clean_up is not the exception
- # caused *by* clean_up. This test is only valid in python
- # 2 because under v3 the original exception is re-raised
- # with the new one as a __context__ attribute.
- assert app.clean_up.call_args_list[0][0][2] is not err
- else:
- assert False, 'Should have had an exception'
-
- assert app.clean_up.called
- call_args = app.clean_up.call_args_list[0]
- assert call_args == mock.call(mock.ANY, 1, mock.ANY)
- args, kwargs = call_args
- assert isinstance(args[2], RuntimeError)
- assert args[2].args == ('test exception',)
-
-
-def test_normal_clean_up_raises_exception():
- app, command = make_app()
-
- app.clean_up = mock.MagicMock(
- name='clean_up',
- side_effect=RuntimeError('within clean_up'),
- )
- app.run(['mock'])
-
- assert app.clean_up.called
- call_args = app.clean_up.call_args_list[0]
- assert call_args == mock.call(mock.ANY, 0, None)
-
-
-def test_normal_clean_up_raises_exception_debug():
- app, command = make_app()
-
- app.clean_up = mock.MagicMock(
- name='clean_up',
- side_effect=RuntimeError('within clean_up'),
- )
- app.run(['--debug', 'mock'])
-
- assert app.clean_up.called
- call_args = app.clean_up.call_args_list[0]
- assert call_args == mock.call(mock.ANY, 0, None)
-
-
-def test_build_option_parser_conflicting_option_should_throw():
- class MyApp(application.App):
- def __init__(self):
- super(MyApp, self).__init__(
- description='testing',
- version='0.1',
- command_manager=commandmanager.CommandManager('tests'),
- )
-
- def build_option_parser(self, description, version):
- parser = super(MyApp, self).build_option_parser(description,
- version)
- parser.add_argument(
- '-h', '--help',
- default=self, # tricky
- help="Show help message and exit.",
- )
-
- # TODO: tests should really use unittest2.
- try:
- MyApp()
- except argparse.ArgumentError:
- pass
- else:
- raise Exception('Exception was not thrown')
-
-
-def test_option_parser_conflicting_option_custom_arguments_should_not_throw():
- class MyApp(application.App):
- def __init__(self):
- super(MyApp, self).__init__(
- description='testing',
- version='0.1',
- command_manager=commandmanager.CommandManager('tests'),
- )
-
- def build_option_parser(self, description, version):
- argparse_kwargs = {'conflict_handler': 'resolve'}
- parser = super(MyApp, self).build_option_parser(
- description,
- version,
- argparse_kwargs=argparse_kwargs)
- parser.add_argument(
- '-h', '--help',
- default=self, # tricky
- help="Show help message and exit.",
- )
-
- MyApp()
-
-
-def test_option_parser_abbrev_issue():
- class MyCommand(c_cmd.Command):
- def get_parser(self, prog_name):
- parser = super(MyCommand, self).get_parser(prog_name)
- parser.add_argument("--end")
- return parser
-
- def take_action(self, parsed_args):
- assert(parsed_args.end == '123')
-
- class MyCommandManager(commandmanager.CommandManager):
- def load_commands(self, namespace):
- self.add_command("mycommand", MyCommand)
-
- class MyApp(application.App):
- def __init__(self):
- super(MyApp, self).__init__(
- description='testing',
- version='0.1',
- command_manager=MyCommandManager(None),
- )
-
- def build_option_parser(self, description, version):
- parser = super(MyApp, self).build_option_parser(
- description,
- version,
- argparse_kwargs={'allow_abbrev': False})
- parser.add_argument('--endpoint')
- return parser
-
- app = MyApp()
- # NOTE(jd) --debug is necessary so assert in take_action() raises correctly
- # here
- app.run(['--debug', 'mycommand', '--end', '123'])
-
-
-def _test_help(deferred_help):
- app, _ = make_app(deferred_help=deferred_help)
- with mock.patch.object(app, 'initialize_app') as init:
- with mock.patch('cliff.help.HelpAction.__call__',
- side_effect=SystemExit(0)) as helper:
- try:
- app.run(['--help'])
- except SystemExit:
- pass
- else:
- raise Exception('Exception was not thrown')
- assert helper.called
- assert init.called == deferred_help
-
-
-def test_help():
- _test_help(False)
-
-
-def test_deferred_help():
- _test_help(True)
-
-
-def test_subcommand_help():
- app, _ = make_app(deferred_help=False)
-
- # Help is called immediately
- with mock.patch('cliff.help.HelpAction.__call__') as helper:
- app.run(['show', 'files', '--help'])
-
- assert helper.called
-
-
-def test_subcommand_deferred_help():
- app, _ = make_app(deferred_help=True)
-
- # Show that provide_help_if_requested() did not show help and exit
- with mock.patch.object(app, 'run_subcommand') as helper:
- app.run(['show', 'files', '--help'])
-
- helper.assert_called_once_with(['help', 'show', 'files'])
-
-
-def test_unknown_cmd():
- app, command = make_app()
- assert app.run(['hell']) == 2
-
-
-def test_unknown_cmd_debug():
- app, command = make_app()
- try:
- app.run(['--debug', 'hell']) == 2
- except ValueError as err:
- assert "['hell']" in ('%s' % err)
-
-
-def test_list_matching_commands():
- stdout = StringIO()
- app = application.App('testing', '1',
- test_utils.TestCommandManager(
- test_utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- try:
- assert app.run(['t']) == 2
- except SystemExit:
- pass
- output = stdout.getvalue()
- assert "test: 't' is not a test command. See 'test --help'." in output
- assert 'Did you mean one of these?' in output
- assert 'three word command\n two words\n' in output
-
-
-def test_fuzzy_no_commands():
- cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
- app = application.App('test', '1.0', cmd_mgr)
- cmd_mgr.commands = {}
- matches = app.get_fuzzy_matches('foo')
- assert matches == []
-
-
-def test_fuzzy_common_prefix():
- # searched string is a prefix of all commands
- cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
- app = application.App('test', '1.0', cmd_mgr)
- cmd_mgr.commands = {}
- cmd_mgr.add_command('user list', test_utils.TestCommand)
- cmd_mgr.add_command('user show', test_utils.TestCommand)
- matches = app.get_fuzzy_matches('user')
- assert matches == ['user list', 'user show']
-
-
-def test_fuzzy_same_distance():
- # searched string has the same distance to all commands
- cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
- app = application.App('test', '1.0', cmd_mgr)
- cmd_mgr.add_command('user', test_utils.TestCommand)
- for cmd in cmd_mgr.commands.keys():
- assert utils.damerau_levenshtein('node', cmd, utils.COST) == 8
- matches = app.get_fuzzy_matches('node')
- assert matches == ['complete', 'help', 'user']
-
-
-def test_fuzzy_no_prefix():
- # search by distance, no common prefix with any command
- cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
- app = application.App('test', '1.0', cmd_mgr)
- cmd_mgr.add_command('user', test_utils.TestCommand)
- matches = app.get_fuzzy_matches('uesr')
- assert matches == ['user']
-
-
-def test_verbose():
- app, command = make_app()
- app.clean_up = mock.MagicMock(name='clean_up')
- app.run(['--verbose', 'mock'])
- app.clean_up.assert_called_once_with(command.return_value, 0, None)
- app.clean_up.reset_mock()
- app.run(['--quiet', 'mock'])
- app.clean_up.assert_called_once_with(command.return_value, 0, None)
- try:
- app.run(['--verbose', '--quiet', 'mock'])
- except SystemExit:
- pass
- else:
- raise Exception('Exception was not thrown')
-
-
-def test_io_streams():
- cmd_mgr = commandmanager.CommandManager('cliff.tests')
- io = mock.Mock()
-
- if six.PY2:
- stdin_save = sys.stdin
- stdout_save = sys.stdout
- stderr_save = sys.stderr
- encoding = locale.getpreferredencoding() or 'utf-8'
-
- app = application.App('no io streams', 1, cmd_mgr)
- assert isinstance(app.stdin, codecs.StreamReader)
- assert isinstance(app.stdout, codecs.StreamWriter)
- assert isinstance(app.stderr, codecs.StreamWriter)
-
- app = application.App('with stdin io stream', 1, cmd_mgr, stdin=io)
- assert app.stdin is io
- assert isinstance(app.stdout, codecs.StreamWriter)
- assert isinstance(app.stderr, codecs.StreamWriter)
-
- app = application.App('with stdout io stream', 1, cmd_mgr, stdout=io)
- assert isinstance(app.stdin, codecs.StreamReader)
- assert app.stdout is io
- assert isinstance(app.stderr, codecs.StreamWriter)
-
- app = application.App('with stderr io stream', 1, cmd_mgr, stderr=io)
- assert isinstance(app.stdin, codecs.StreamReader)
- assert isinstance(app.stdout, codecs.StreamWriter)
- assert app.stderr is io
-
- try:
- sys.stdin = codecs.getreader(encoding)(sys.stdin)
- app = application.App(
- 'with wrapped sys.stdin io stream', 1, cmd_mgr)
- assert app.stdin is sys.stdin
- assert isinstance(app.stdout, codecs.StreamWriter)
- assert isinstance(app.stderr, codecs.StreamWriter)
- finally:
- sys.stdin = stdin_save
-
- try:
- sys.stdout = codecs.getwriter(encoding)(sys.stdout)
- app = application.App('with wrapped stdout io stream', 1, cmd_mgr)
- assert isinstance(app.stdin, codecs.StreamReader)
- assert app.stdout is sys.stdout
- assert isinstance(app.stderr, codecs.StreamWriter)
- finally:
- sys.stdout = stdout_save
-
- try:
- sys.stderr = codecs.getwriter(encoding)(sys.stderr)
- app = application.App('with wrapped stderr io stream', 1, cmd_mgr)
- assert isinstance(app.stdin, codecs.StreamReader)
- assert isinstance(app.stdout, codecs.StreamWriter)
- assert app.stderr is sys.stderr
- finally:
- sys.stderr = stderr_save
-
- else:
- app = application.App('no io streams', 1, cmd_mgr)
- assert app.stdin is sys.stdin
- assert app.stdout is sys.stdout
- assert app.stderr is sys.stderr
-
- app = application.App('with stdin io stream', 1, cmd_mgr, stdin=io)
- assert app.stdin is io
- assert app.stdout is sys.stdout
- assert app.stderr is sys.stderr
-
- app = application.App('with stdout io stream', 1, cmd_mgr, stdout=io)
- assert app.stdin is sys.stdin
- assert app.stdout is io
- assert app.stderr is sys.stderr
-
- app = application.App('with stderr io stream', 1, cmd_mgr, stderr=io)
- assert app.stdin is sys.stdin
- assert app.stdout is sys.stdout
- assert app.stderr is io
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_columns.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_columns.py
deleted file mode 100644
index d7bb2b0..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_columns.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from cliff import columns
-
-
-class FauxColumn(columns.FormattableColumn):
-
- def human_readable(self):
- return u'I made this string myself: {}'.format(self._value)
-
-
-def test_faux_column_machine():
- c = FauxColumn(['list', 'of', 'values'])
- assert c.machine_readable() == ['list', 'of', 'values']
-
-
-def test_faux_column_human():
- c = FauxColumn(['list', 'of', 'values'])
- assert c.human_readable() == \
- u"I made this string myself: ['list', 'of', 'values']"
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_command.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_command.py
deleted file mode 100644
index ef6b051..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_command.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from cliff import command
-
-
-class TestCommand(command.Command):
- """Description of command.
- """
-
- def take_action(self, parsed_args):
- return 42
-
-
-class TestCommandNoDocstring(command.Command):
-
- def take_action(self, parsed_args):
- return 42
-
-
-def test_get_description_docstring():
- cmd = TestCommand(None, None)
- desc = cmd.get_description()
- assert desc == "Description of command.\n "
-
-
-def test_get_description_attribute():
- cmd = TestCommand(None, None)
- # Artificially inject a value for _description to verify that it
- # overrides the docstring.
- cmd._description = 'this is not the default'
- desc = cmd.get_description()
- assert desc == 'this is not the default'
-
-
-def test_get_description_default():
- cmd = TestCommandNoDocstring(None, None)
- desc = cmd.get_description()
- assert desc == ''
-
-
-def test_get_parser():
- cmd = TestCommand(None, None)
- parser = cmd.get_parser('NAME')
- assert parser.prog == 'NAME'
-
-
-def test_get_name():
- cmd = TestCommand(None, None, cmd_name='object action')
- assert cmd.cmd_name == 'object action'
-
-
-def test_run_return():
- cmd = TestCommand(None, None, cmd_name='object action')
- assert cmd.run(None) == 42
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_commandmanager.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_commandmanager.py
deleted file mode 100644
index 7f5ce0c..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_commandmanager.py
+++ /dev/null
@@ -1,132 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-
-from cliff import commandmanager
-from cliff.tests import utils
-
-
-def test_lookup_and_find():
- def check(mgr, argv):
- cmd, name, remaining = mgr.find_command(argv)
- assert cmd
- assert name == ' '.join(argv)
- assert not remaining
- mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
- for expected in [['one'],
- ['two', 'words'],
- ['three', 'word', 'command'],
- ]:
- yield check, mgr, expected
- return
-
-
-def test_lookup_with_remainder():
- def check(mgr, argv):
- cmd, name, remaining = mgr.find_command(argv)
- assert cmd
- assert remaining == ['--opt']
- mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
- for expected in [['one', '--opt'],
- ['two', 'words', '--opt'],
- ['three', 'word', 'command', '--opt'],
- ]:
- yield check, mgr, expected
- return
-
-
-def test_find_invalid_command():
- mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
-
- def check_one(argv):
- try:
- mgr.find_command(argv)
- except ValueError as err:
- # make sure err include 'a' when ['a', '-b']
- assert argv[0] in ('%s' % err)
- assert '-b' in ('%s' % err)
- else:
- assert False, 'expected a failure'
- for argv in [['a', '-b'],
- ['-b'],
- ]:
- yield check_one, argv
-
-
-def test_find_unknown_command():
- mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
- try:
- mgr.find_command(['a', 'b'])
- except ValueError as err:
- assert "['a', 'b']" in ('%s' % err)
- else:
- assert False, 'expected a failure'
-
-
-def test_add_command():
- mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
- mock_cmd = mock.Mock()
- mgr.add_command('mock', mock_cmd)
- found_cmd, name, args = mgr.find_command(['mock'])
- assert found_cmd is mock_cmd
-
-
-def test_intersected_commands():
- def foo(arg):
- pass
-
- def foo_bar():
- pass
-
- mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
- mgr.add_command('foo', foo)
- mgr.add_command('foo bar', foo_bar)
-
- assert mgr.find_command(['foo', 'bar'])[0] is foo_bar
- assert mgr.find_command(['foo', 'arg0'])[0] is foo
-
-
-def test_load_commands():
- testcmd = mock.Mock(name='testcmd')
- testcmd.name.replace.return_value = 'test'
- mock_pkg_resources = mock.Mock(return_value=[testcmd])
- with mock.patch('pkg_resources.iter_entry_points',
- mock_pkg_resources) as iter_entry_points:
- mgr = commandmanager.CommandManager('test')
- iter_entry_points.assert_called_once_with('test')
- names = [n for n, v in mgr]
- assert names == ['test']
-
-
-def test_load_commands_keep_underscores():
- testcmd = mock.Mock()
- testcmd.name = 'test_cmd'
- mock_pkg_resources = mock.Mock(return_value=[testcmd])
- with mock.patch('pkg_resources.iter_entry_points',
- mock_pkg_resources) as iter_entry_points:
- mgr = commandmanager.CommandManager('test', convert_underscores=False)
- iter_entry_points.assert_called_once_with('test')
- names = [n for n, v in mgr]
- assert names == ['test_cmd']
-
-
-def test_load_commands_replace_underscores():
- testcmd = mock.Mock()
- testcmd.name = 'test_cmd'
- mock_pkg_resources = mock.Mock(return_value=[testcmd])
- with mock.patch('pkg_resources.iter_entry_points',
- mock_pkg_resources) as iter_entry_points:
- mgr = commandmanager.CommandManager('test', convert_underscores=True)
- iter_entry_points.assert_called_once_with('test')
- names = [n for n, v in mgr]
- assert names == ['test cmd']
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_complete.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_complete.py
deleted file mode 100644
index b1523ec..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_complete.py
+++ /dev/null
@@ -1,173 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Bash completion tests
-"""
-
-import mock
-
-from cliff import app as application
-from cliff import commandmanager
-from cliff import complete
-
-
-def test_complete_dictionary():
- sot = complete.CompleteDictionary()
- sot.add_command("image delete".split(),
- [mock.Mock(option_strings=["1"])])
- sot.add_command("image list".split(),
- [mock.Mock(option_strings=["2"])])
- sot.add_command("image create".split(),
- [mock.Mock(option_strings=["3"])])
- sot.add_command("volume type create".split(),
- [mock.Mock(option_strings=["4"])])
- sot.add_command("volume type delete".split(),
- [mock.Mock(option_strings=["5"])])
- assert "image volume" == sot.get_commands()
- result = sot.get_data()
- assert "image" == result[0][0]
- assert "create delete list" == result[0][1]
- assert "image_create" == result[1][0]
- assert "3" == result[1][1]
- assert "image_delete" == result[2][0]
- assert "1" == result[2][1]
- assert "image_list" == result[3][0]
- assert "2" == result[3][1]
-
-
-def test_complete_dictionary_subcmd():
- sot = complete.CompleteDictionary()
- sot.add_command("image delete".split(),
- [mock.Mock(option_strings=["1"])])
- sot.add_command("image list".split(),
- [mock.Mock(option_strings=["2"])])
- sot.add_command("image list better".split(),
- [mock.Mock(option_strings=["3"])])
- assert "image" == sot.get_commands()
- result = sot.get_data()
- assert "image" == result[0][0]
- assert "delete list list_better" == result[0][1]
- assert "image_delete" == result[1][0]
- assert "1" == result[1][1]
- assert "image_list" == result[2][0]
- assert "2 better" == result[2][1]
- assert "image_list_better" == result[3][0]
- assert "3" == result[3][1]
-
-
-class FakeStdout:
- def __init__(self):
- self.content = []
-
- def write(self, text):
- self.content.append(text)
-
- def make_string(self):
- result = ''
- for line in self.content:
- result = result + line
- return result
-
-
-def given_cmdo_data():
- cmdo = "image server"
- data = [("image", "create"),
- ("image_create", "--eolus"),
- ("server", "meta ssh"),
- ("server_meta_delete", "--wilson"),
- ("server_ssh", "--sunlight")]
- return cmdo, data
-
-
-def then_data(content):
- assert " cmds='image server'\n" in content
- assert " cmds_image='create'\n" in content
- assert " cmds_image_create='--eolus'\n" in content
- assert " cmds_server='meta ssh'\n" in content
- assert " cmds_server_meta_delete='--wilson'\n" in content
- assert " cmds_server_ssh='--sunlight'\n" in content
-
-
-def test_complete_no_code():
- output = FakeStdout()
- sot = complete.CompleteNoCode("doesNotMatter", output)
- sot.write(*given_cmdo_data())
- then_data(output.content)
-
-
-def test_complete_bash():
- output = FakeStdout()
- sot = complete.CompleteBash("openstack", output)
- sot.write(*given_cmdo_data())
- then_data(output.content)
- assert "_openstack()\n" in output.content[0]
- assert "complete -F _openstack openstack\n" in output.content[-1]
-
-
-def test_complete_command_parser():
- sot = complete.CompleteCommand(mock.Mock(), mock.Mock())
- parser = sot.get_parser('nothing')
- assert "nothing" == parser.prog
- assert "print bash completion command\n " == parser.description
-
-
-def given_complete_command():
- cmd_mgr = commandmanager.CommandManager('cliff.tests')
- app = application.App('testing', '1', cmd_mgr, stdout=FakeStdout())
- sot = complete.CompleteCommand(app, mock.Mock())
- cmd_mgr.add_command('complete', complete.CompleteCommand)
- return sot, app, cmd_mgr
-
-
-def then_actions_equal(actions):
- optstr = ' '.join(opt for action in actions
- for opt in action.option_strings)
- assert '-h --help --name --shell' == optstr
-
-
-def test_complete_command_get_actions():
- sot, app, cmd_mgr = given_complete_command()
- app.interactive_mode = False
- actions = sot.get_actions(["complete"])
- then_actions_equal(actions)
-
-
-def test_complete_command_get_actions_interactive():
- sot, app, cmd_mgr = given_complete_command()
- app.interactive_mode = True
- actions = sot.get_actions(["complete"])
- then_actions_equal(actions)
-
-
-def test_complete_command_take_action():
- sot, app, cmd_mgr = given_complete_command()
- parsed_args = mock.Mock()
- parsed_args.name = "test_take"
- parsed_args.shell = "bash"
- content = app.stdout.content
- assert 0 == sot.take_action(parsed_args)
- assert "_test_take()\n" in content[0]
- assert "complete -F _test_take test_take\n" in content[-1]
- assert " cmds='complete help'\n" in content
- assert " cmds_complete='-h --help --name --shell'\n" in content
- assert " cmds_help='-h --help'\n" in content
-
-
-def test_complete_command_remove_dashes():
- sot, app, cmd_mgr = given_complete_command()
- parsed_args = mock.Mock()
- parsed_args.name = "test-take"
- parsed_args.shell = "bash"
- content = app.stdout.content
- assert 0 == sot.take_action(parsed_args)
- assert "_test_take()\n" in content[0]
- assert "complete -F _test_take test-take\n" in content[-1]
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_csv.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_csv.py
deleted file mode 100644
index 27c6f84..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_csv.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-import argparse
-import six
-
-from cliff.formatters import commaseparated
-from cliff.tests import test_columns
-
-
-def test_commaseparated_list_formatter():
- sf = commaseparated.CSVLister()
- c = ('a', 'b', 'c')
- d1 = ('A', 'B', 'C')
- d2 = ('D', 'E', 'F')
- data = [d1, d2]
- expected = 'a,b,c\nA,B,C\nD,E,F\n'
- output = six.StringIO()
- parsed_args = mock.Mock()
- parsed_args.quote_mode = 'none'
- sf.emit_list(c, data, output, parsed_args)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_commaseparated_list_formatter_quoted():
- sf = commaseparated.CSVLister()
- c = ('a', 'b', 'c')
- d1 = ('A', 'B', 'C')
- d2 = ('D', 'E', 'F')
- data = [d1, d2]
- expected = '"a","b","c"\n"A","B","C"\n"D","E","F"\n'
- output = six.StringIO()
- # Parse arguments as if passed on the command-line
- parser = argparse.ArgumentParser(description='Testing...')
- sf.add_argument_group(parser)
- parsed_args = parser.parse_args(['--quote', 'all'])
- sf.emit_list(c, data, output, parsed_args)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_commaseparated_list_formatter_formattable_column():
- sf = commaseparated.CSVLister()
- c = ('a', 'b', 'c')
- d1 = ('A', 'B', test_columns.FauxColumn(['the', 'value']))
- data = [d1]
- expected = 'a,b,c\nA,B,[\'the\'\\, \'value\']\n'
- output = six.StringIO()
- parsed_args = mock.Mock()
- parsed_args.quote_mode = 'none'
- sf.emit_list(c, data, output, parsed_args)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_commaseparated_list_formatter_unicode():
- sf = commaseparated.CSVLister()
- c = (u'a', u'b', u'c')
- d1 = (u'A', u'B', u'C')
- happy = u'高兴'
- d2 = (u'D', u'E', happy)
- data = [d1, d2]
- expected = u'a,b,c\nA,B,C\nD,E,%s\n' % happy
- output = six.StringIO()
- parsed_args = mock.Mock()
- parsed_args.quote_mode = 'none'
- sf.emit_list(c, data, output, parsed_args)
- actual = output.getvalue()
- if six.PY2:
- actual = actual.decode('utf-8')
- assert expected == actual
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_json.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_json.py
deleted file mode 100644
index eb7397d..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_json.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import six
-
-from cliff.formatters import json_format
-from cliff.tests import test_columns
-
-import mock
-
-
-def test_json_format_one():
- sf = json_format.JSONFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', '"escape me"')
- expected = {
- 'a': 'A',
- 'b': 'B',
- 'c': 'C',
- 'd': '"escape me"'
- }
- args = mock.Mock()
- sf.add_argument_group(args)
-
- args.noindent = True
- output = six.StringIO()
- sf.emit_one(c, d, output, args)
- value = output.getvalue()
- print(len(value.splitlines()))
- assert 1 == len(value.splitlines())
- actual = json.loads(value)
- assert expected == actual
-
- args.noindent = False
- output = six.StringIO()
- sf.emit_one(c, d, output, args)
- value = output.getvalue()
- assert 6 == len(value.splitlines())
- actual = json.loads(value)
- assert expected == actual
-
-
-def test_json_format_formattablecolumn_one():
- sf = json_format.JSONFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', test_columns.FauxColumn(['the', 'value']))
- expected = {
- 'a': 'A',
- 'b': 'B',
- 'c': 'C',
- 'd': ['the', 'value'],
- }
- args = mock.Mock()
- sf.add_argument_group(args)
-
- args.noindent = True
- output = six.StringIO()
- sf.emit_one(c, d, output, args)
- value = output.getvalue()
- print(len(value.splitlines()))
- assert 1 == len(value.splitlines())
- actual = json.loads(value)
- assert expected == actual
-
-
-def test_json_format_list():
- sf = json_format.JSONFormatter()
- c = ('a', 'b', 'c')
- d = (
- ('A1', 'B1', 'C1'),
- ('A2', 'B2', 'C2'),
- ('A3', 'B3', 'C3')
- )
- expected = [
- {'a': 'A1', 'b': 'B1', 'c': 'C1'},
- {'a': 'A2', 'b': 'B2', 'c': 'C2'},
- {'a': 'A3', 'b': 'B3', 'c': 'C3'}
- ]
- args = mock.Mock()
- sf.add_argument_group(args)
-
- args.noindent = True
- output = six.StringIO()
- sf.emit_list(c, d, output, args)
- value = output.getvalue()
- assert 1 == len(value.splitlines())
- actual = json.loads(value)
- assert expected == actual
-
- args.noindent = False
- output = six.StringIO()
- sf.emit_list(c, d, output, args)
- value = output.getvalue()
- assert 17 == len(value.splitlines())
- actual = json.loads(value)
- assert expected == actual
-
-
-def test_json_format_formattablecolumn_list():
- sf = json_format.JSONFormatter()
- c = ('a', 'b', 'c')
- d = (
- ('A1', 'B1', test_columns.FauxColumn(['the', 'value'])),
- )
- expected = [
- {'a': 'A1', 'b': 'B1', 'c': ['the', 'value']},
- ]
- args = mock.Mock()
- sf.add_argument_group(args)
-
- args.noindent = True
- output = six.StringIO()
- sf.emit_list(c, d, output, args)
- value = output.getvalue()
- assert 1 == len(value.splitlines())
- actual = json.loads(value)
- assert expected == actual
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_shell.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_shell.py
deleted file mode 100644
index 7689f73..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_shell.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import argparse
-import six
-
-from cliff.formatters import shell
-from cliff.tests import test_columns
-
-import mock
-
-
-def test_shell_formatter():
- sf = shell.ShellFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', '"escape me"')
- expected = 'a="A"\nb="B"\nd="\\"escape me\\""\n'
- output = six.StringIO()
- args = mock.Mock()
- args.variables = ['a', 'b', 'd']
- args.prefix = ''
- sf.emit_one(c, d, output, args)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_shell_formatter_args():
- sf = shell.ShellFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', '"escape me"')
- expected = 'Xd="\\"escape me\\""\n'
- output = six.StringIO()
- # Parse arguments as if passed on the command-line
- parser = argparse.ArgumentParser(description='Testing...')
- sf.add_argument_group(parser)
- parsed_args = parser.parse_args(['--variable', 'd', '--prefix', 'X'])
- sf.emit_one(c, d, output, parsed_args)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_shell_formatter_formattable_column():
- sf = shell.ShellFormatter()
- c = ('a', 'b', 'c')
- d = ('A', 'B', test_columns.FauxColumn(['the', 'value']))
- expected = '\n'.join([
- 'a="A"',
- 'b="B"',
- 'c="[\'the\', \'value\']"\n',
- ])
- output = six.StringIO()
- args = mock.Mock()
- args.variables = ['a', 'b', 'c']
- args.prefix = ''
- sf.emit_one(c, d, output, args)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_shell_formatter_with_non_string_values():
- sf = shell.ShellFormatter()
- c = ('a', 'b', 'c', 'd', 'e')
- d = (True, False, 100, '"esc"', six.text_type('"esc"'))
- expected = 'a="True"\nb="False"\nc="100"\nd="\\"esc\\""\ne="\\"esc\\""\n'
- output = six.StringIO()
- args = mock.Mock()
- args.variables = ['a', 'b', 'c', 'd', 'e']
- args.prefix = ''
- sf.emit_one(c, d, output, args)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_shell_formatter_with_non_bash_friendly_values():
- sf = shell.ShellFormatter()
- c = ('a', 'foo-bar', 'provider:network_type')
- d = (True, 'baz', 'vxlan')
- expected = 'a="True"\nfoo_bar="baz"\nprovider_network_type="vxlan"\n'
- output = six.StringIO()
- args = mock.Mock()
- args.variables = ['a', 'foo-bar', 'provider:network_type']
- args.prefix = ''
- sf.emit_one(c, d, output, args)
- actual = output.getvalue()
- assert expected == actual
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_table.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_table.py
deleted file mode 100644
index 7e8cf97..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_table.py
+++ /dev/null
@@ -1,547 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-from six import StringIO
-import os
-import argparse
-
-from cliff.formatters import table
-from cliff.tests import test_columns
-
-
-class args(object):
- def __init__(self, max_width=0, print_empty=False):
- if max_width > 0:
- self.max_width = max_width
- else:
- # Envvar is only taken into account iff CLI parameter not given
- self.max_width = int(os.environ.get('CLIFF_MAX_TERM_WIDTH', 0))
- self.print_empty = print_empty
-
-
-def _table_tester_helper(tags, data, extra_args=None):
- """Get table output as a string, formatted according to
- CLI arguments, environment variables and terminal size
-
- tags - tuple of strings for data tags (column headers or fields)
- data - tuple of strings for single data row
- - list of tuples of strings for multiple rows of data
- extra_args - an instance of class args
- - a list of strings for CLI arguments
- """
- sf = table.TableFormatter()
-
- if extra_args is None:
- # Default to no CLI arguments
- parsed_args = args()
- elif type(extra_args) == args:
- # Use the given CLI arguments
- parsed_args = extra_args
- else:
- # Parse arguments as if passed on the command-line
- parser = argparse.ArgumentParser(description='Testing...')
- sf.add_argument_group(parser)
- parsed_args = parser.parse_args(extra_args)
-
- output = StringIO()
- emitter = sf.emit_list if type(data) is list else sf.emit_one
- emitter(tags, data, output, parsed_args)
- return output.getvalue()
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_formatter(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', 'test\rcarriage\r\nreturn')
- expected = '''\
-+-------+---------------+
-| Field | Value |
-+-------+---------------+
-| a | A |
-| b | B |
-| c | C |
-| d | test carriage |
-| | return |
-+-------+---------------+
-'''
- assert expected == _table_tester_helper(c, d)
-
-
-# Multi-line output when width is restricted to 42 columns
-expected_ml_val = '''\
-+-------+--------------------------------+
-| Field | Value |
-+-------+--------------------------------+
-| a | A |
-| b | B |
-| c | C |
-| d | dddddddddddddddddddddddddddddd |
-| | dddddddddddddddddddddddddddddd |
-| | ddddddddddddddddd |
-+-------+--------------------------------+
-'''
-
-# Multi-line output when width is restricted to 80 columns
-expected_ml_80_val = '''\
-+-------+----------------------------------------------------------------------+
-| Field | Value |
-+-------+----------------------------------------------------------------------+
-| a | A |
-| b | B |
-| c | C |
-| d | dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd |
-| | ddddddddd |
-+-------+----------------------------------------------------------------------+
-''' # noqa
-
-# Single-line output, for when no line length restriction apply
-expected_sl_val = '''\
-+-------+-------------------------------------------------------------------------------+
-| Field | Value |
-+-------+-------------------------------------------------------------------------------+
-| a | A |
-| b | B |
-| c | C |
-| d | ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd |
-+-------+-------------------------------------------------------------------------------+
-''' # noqa
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_formatter_no_cli_param(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', 'd' * 77)
- assert expected_ml_80_val == _table_tester_helper(c, d, extra_args=args())
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_formatter_cli_param(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', 'd' * 77)
- assert (expected_ml_val ==
- _table_tester_helper(c, d, extra_args=['--max-width', '42']))
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_formatter_no_cli_param_unlimited_tw(tw):
- tw.return_value = 0
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', 'd' * 77)
- # output should not be wrapped to multiple lines
- assert expected_sl_val == _table_tester_helper(c, d, extra_args=args())
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_formatter_cli_param_unlimited_tw(tw):
- tw.return_value = 0
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', 'd' * 77)
- assert (expected_ml_val ==
- _table_tester_helper(c, d, extra_args=['--max-width', '42']))
-
-
-@mock.patch('cliff.utils.terminal_width')
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '666'})
-def test_table_formatter_cli_param_envvar_big(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', 'd' * 77)
- assert (expected_ml_val ==
- _table_tester_helper(c, d, extra_args=['--max-width', '42']))
-
-
-@mock.patch('cliff.utils.terminal_width')
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '23'})
-def test_table_formatter_cli_param_envvar_tiny(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', 'd' * 77)
- assert (expected_ml_val ==
- _table_tester_helper(c, d, extra_args=['--max-width', '42']))
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_formatter_max_width(tw):
- tw.return_value = 80
- c = ('field_name', 'a_really_long_field_name')
- d = ('the value', 'a value significantly longer than the field')
- expected = '''\
-+--------------------------+---------------------------------------------+
-| Field | Value |
-+--------------------------+---------------------------------------------+
-| field_name | the value |
-| a_really_long_field_name | a value significantly longer than the field |
-+--------------------------+---------------------------------------------+
-'''
- assert expected == _table_tester_helper(c, d)
-
- # resize value column
- tw.return_value = 70
- expected = '''\
-+--------------------------+-----------------------------------------+
-| Field | Value |
-+--------------------------+-----------------------------------------+
-| field_name | the value |
-| a_really_long_field_name | a value significantly longer than the |
-| | field |
-+--------------------------+-----------------------------------------+
-'''
- assert expected == _table_tester_helper(c, d)
-
- # resize both columns
- tw.return_value = 50
- expected = '''\
-+-----------------------+------------------------+
-| Field | Value |
-+-----------------------+------------------------+
-| field_name | the value |
-| a_really_long_field_n | a value significantly |
-| ame | longer than the field |
-+-----------------------+------------------------+
-'''
- assert expected == _table_tester_helper(c, d)
-
- # resize all columns limited by min_width=16
- tw.return_value = 10
- expected = '''\
-+------------------+------------------+
-| Field | Value |
-+------------------+------------------+
-| field_name | the value |
-| a_really_long_fi | a value |
-| eld_name | significantly |
-| | longer than the |
-| | field |
-+------------------+------------------+
-'''
- assert expected == _table_tester_helper(c, d)
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_list_formatter(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c')
- d1 = ('A', 'B', 'C')
- d2 = ('D', 'E', 'test\rcarriage\r\nreturn')
- data = [d1, d2]
- expected = '''\
-+---+---+---------------+
-| a | b | c |
-+---+---+---------------+
-| A | B | C |
-| D | E | test carriage |
-| | | return |
-+---+---+---------------+
-'''
- assert expected == _table_tester_helper(c, data)
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_formatter_formattable_column(tw):
- tw.return_value = 0
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', test_columns.FauxColumn(['the', 'value']))
- expected = '''\
-+-------+---------------------------------------------+
-| Field | Value |
-+-------+---------------------------------------------+
-| a | A |
-| b | B |
-| c | C |
-| d | I made this string myself: ['the', 'value'] |
-+-------+---------------------------------------------+
-'''
- assert expected == _table_tester_helper(c, d)
-
-
-_col_names = ('one', 'two', 'three')
-_col_data = [(
- 'one one one one one',
- 'two two two two',
- 'three three')]
-
-_expected_mv = {
- 80: '''\
-+---------------------+-----------------+-------------+
-| one | two | three |
-+---------------------+-----------------+-------------+
-| one one one one one | two two two two | three three |
-+---------------------+-----------------+-------------+
-''',
-
- 50: '''\
-+----------------+-----------------+-------------+
-| one | two | three |
-+----------------+-----------------+-------------+
-| one one one | two two two two | three three |
-| one one | | |
-+----------------+-----------------+-------------+
-''',
-
- 47: '''\
-+---------------+---------------+-------------+
-| one | two | three |
-+---------------+---------------+-------------+
-| one one one | two two two | three three |
-| one one | two | |
-+---------------+---------------+-------------+
-''',
-
- 45: '''\
-+--------------+--------------+-------------+
-| one | two | three |
-+--------------+--------------+-------------+
-| one one one | two two two | three three |
-| one one | two | |
-+--------------+--------------+-------------+
-''',
-
- 40: '''\
-+------------+------------+------------+
-| one | two | three |
-+------------+------------+------------+
-| one one | two two | three |
-| one one | two two | three |
-| one | | |
-+------------+------------+------------+
-''',
-
- 10: '''\
-+----------+----------+----------+
-| one | two | three |
-+----------+----------+----------+
-| one one | two two | three |
-| one one | two two | three |
-| one | | |
-+----------+----------+----------+
-''',
-}
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_list_formatter_formattable_column(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c')
- d1 = ('A', 'B', test_columns.FauxColumn(['the', 'value']))
- data = [d1]
- expected = '''\
-+---+---+---------------------------------------------+
-| a | b | c |
-+---+---+---------------------------------------------+
-| A | B | I made this string myself: ['the', 'value'] |
-+---+---+---------------------------------------------+
-'''
- assert expected == _table_tester_helper(c, data)
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_list_formatter_max_width(tw):
- # no resize
- l = tw.return_value = 80
- assert _expected_mv[l] == _table_tester_helper(_col_names, _col_data)
-
- # resize 1 column
- l = tw.return_value = 50
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[l] == actual
- assert len(actual.splitlines()[0]) == l
-
- # resize 2 columns
- l = tw.return_value = 45
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[l] == actual
- assert len(actual.splitlines()[0]) == l
-
- # resize all columns
- l = tw.return_value = 40
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[l] == actual
- assert len(actual.splitlines()[0]) == l
-
- # resize all columns limited by min_width=8
- l = tw.return_value = 10
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[l] == actual
- # 3 columns each 8 wide, plus table spacing and borders
- expected_width = 11 * 3 + 1
- assert len(actual.splitlines()[0]) == expected_width
-
-
-# Force a wide terminal by overriding its width with envvar
-@mock.patch('cliff.utils.terminal_width')
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '666'})
-def test_table_list_formatter_max_width_and_envvar_max(tw):
- # no resize
- tw.return_value = 80
- assert _expected_mv[80] == _table_tester_helper(_col_names, _col_data)
-
- # resize 1 column
- tw.return_value = 50
- assert _expected_mv[80] == _table_tester_helper(_col_names, _col_data)
-
- # resize 2 columns
- tw.return_value = 45
- assert _expected_mv[80] == _table_tester_helper(_col_names, _col_data)
-
- # resize all columns
- tw.return_value = 40
- assert _expected_mv[80] == _table_tester_helper(_col_names, _col_data)
-
- # resize all columns limited by min_width=8
- tw.return_value = 10
- assert _expected_mv[80] == _table_tester_helper(_col_names, _col_data)
-
-
-# Force a narrow terminal by overriding its width with envvar
-@mock.patch('cliff.utils.terminal_width')
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '47'})
-def test_table_list_formatter_max_width_and_envvar_mid(tw):
- # no resize
- tw.return_value = 80
- assert _expected_mv[47] == _table_tester_helper(_col_names, _col_data)
-
- # resize 1 column
- tw.return_value = 50
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[47] == actual
- assert len(actual.splitlines()[0]) == 47
-
- # resize 2 columns
- tw.return_value = 45
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[47] == actual
- assert len(actual.splitlines()[0]) == 47
-
- # resize all columns
- tw.return_value = 40
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[47] == actual
- assert len(actual.splitlines()[0]) == 47
-
- # resize all columns limited by min_width=8
- tw.return_value = 10
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[47] == actual
- assert len(actual.splitlines()[0]) == 47
-
-
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '80'})
-def test_table_list_formatter_env_maxwidth_noresize():
- # no resize
- assert _expected_mv[80] == _table_tester_helper(_col_names, _col_data)
-
-
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '50'})
-def test_table_list_formatter_env_maxwidth_resize_one():
- # resize 1 column
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[50] == actual
- assert len(actual.splitlines()[0]) == 50
-
-
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '45'})
-def test_table_list_formatter_env_maxwidth_resize_two():
- # resize 2 columns
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[45] == actual
- assert len(actual.splitlines()[0]) == 45
-
-
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '40'})
-def test_table_list_formatter_env_maxwidth_resize_all():
- # resize all columns
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[40] == actual
- assert len(actual.splitlines()[0]) == 40
-
-
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '8'})
-def test_table_list_formatter_env_maxwidth_resize_all_tiny():
- # resize all columns limited by min_width=8
- actual = _table_tester_helper(_col_names, _col_data)
- assert _expected_mv[10] == actual
- # 3 columns each 8 wide, plus table spacing and borders
- expected_width = 11 * 3 + 1
- assert len(actual.splitlines()[0]) == expected_width
-
-
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '42'})
-def test_table_list_formatter_env_maxwidth_args_big():
- assert _expected_mv[80] == _table_tester_helper(_col_names, _col_data,
- extra_args=args(666))
-
-
-@mock.patch.dict(os.environ, {'CLIFF_MAX_TERM_WIDTH': '42'})
-def test_table_list_formatter_env_maxwidth_args_tiny():
- assert _expected_mv[40] == _table_tester_helper(_col_names, _col_data,
- extra_args=args(40))
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_list_formatter_empty(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c')
- data = []
- expected = '\n'
- assert expected == _table_tester_helper(c, data)
-
-
-@mock.patch('cliff.utils.terminal_width')
-def test_table_list_formatter_empty_table(tw):
- tw.return_value = 80
- c = ('a', 'b', 'c')
- data = []
- expected = '''\
-+---+---+---+
-| a | b | c |
-+---+---+---+
-+---+---+---+
-'''
- assert expected == _table_tester_helper(c, data,
- extra_args=['--print-empty'])
-
-
-def test_field_widths():
- tf = table.TableFormatter
- assert {
- 'a': 1,
- 'b': 2,
- 'c': 3,
- 'd': 10
- } == tf._field_widths(
- ('a', 'b', 'c', 'd'),
- '+---+----+-----+------------+')
-
-
-def test_field_widths_zero():
- tf = table.TableFormatter
- assert {
- 'a': 0,
- 'b': 0,
- 'c': 0
- } == tf._field_widths(
- ('a', 'b', 'c'),
- '+--+-++')
-
-
-def test_width_info():
- tf = table.TableFormatter
- assert (49, 4) == (tf._width_info(80, 10))
- assert (76, 76) == (tf._width_info(80, 1))
- assert (79, 0) == (tf._width_info(80, 0))
- assert (0, 0) == (tf._width_info(0, 80))
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_value.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_value.py
deleted file mode 100644
index f704b08..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_value.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import six
-
-from cliff.formatters import value
-from cliff.tests import test_columns
-
-
-def test_value_formatter():
- sf = value.ValueFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', '"no escape me"')
- expected = 'A\nB\nC\n"no escape me"\n'
- output = six.StringIO()
- sf.emit_one(c, d, output, None)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_value_formatter_formattable_column():
- sf = value.ValueFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', test_columns.FauxColumn(['the', 'value']))
- expected = "A\nB\nC\n['the', 'value']\n"
- output = six.StringIO()
- sf.emit_one(c, d, output, None)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_value_list_formatter():
- sf = value.ValueFormatter()
- c = ('a', 'b', 'c')
- d1 = ('A', 'B', 'C')
- d2 = ('D', 'E', 'F')
- data = [d1, d2]
- expected = 'A B C\nD E F\n'
- output = six.StringIO()
- sf.emit_list(c, data, output, None)
- actual = output.getvalue()
- assert expected == actual
-
-
-def test_value_list_formatter_formattable_column():
- sf = value.ValueFormatter()
- c = ('a', 'b', 'c')
- d1 = ('A', 'B', test_columns.FauxColumn(['the', 'value']))
- data = [d1]
- expected = "A B ['the', 'value']\n"
- output = six.StringIO()
- sf.emit_list(c, data, output, None)
- actual = output.getvalue()
- assert expected == actual
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_yaml.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_yaml.py
deleted file mode 100644
index 61db5d8..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_formatters_yaml.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import six
-import yaml
-
-from cliff.formatters import yaml_format
-from cliff.tests import test_columns
-
-import mock
-
-
-def test_yaml_format_one():
- sf = yaml_format.YAMLFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', '"escape me"')
- expected = {
- 'a': 'A',
- 'b': 'B',
- 'c': 'C',
- 'd': '"escape me"'
- }
- output = six.StringIO()
- args = mock.Mock()
- sf.emit_one(c, d, output, args)
- actual = yaml.safe_load(output.getvalue())
- assert expected == actual
-
-
-def test_yaml_format_formattablecolumn_one():
- sf = yaml_format.YAMLFormatter()
- c = ('a', 'b', 'c', 'd')
- d = ('A', 'B', 'C', test_columns.FauxColumn(['the', 'value']))
- expected = {
- 'a': 'A',
- 'b': 'B',
- 'c': 'C',
- 'd': ['the', 'value'],
- }
- args = mock.Mock()
- sf.add_argument_group(args)
-
- args.noindent = True
- output = six.StringIO()
- sf.emit_one(c, d, output, args)
- value = output.getvalue()
- print(len(value.splitlines()))
- actual = yaml.safe_load(output.getvalue())
- assert expected == actual
-
-
-def test_yaml_format_list():
- sf = yaml_format.YAMLFormatter()
- c = ('a', 'b', 'c')
- d = (
- ('A1', 'B1', 'C1'),
- ('A2', 'B2', 'C2'),
- ('A3', 'B3', 'C3')
- )
- expected = [
- {'a': 'A1', 'b': 'B1', 'c': 'C1'},
- {'a': 'A2', 'b': 'B2', 'c': 'C2'},
- {'a': 'A3', 'b': 'B3', 'c': 'C3'}
- ]
- output = six.StringIO()
- args = mock.Mock()
- sf.add_argument_group(args)
- sf.emit_list(c, d, output, args)
- actual = yaml.safe_load(output.getvalue())
- assert expected == actual
-
-
-def test_yaml_format_formattablecolumn_list():
- sf = yaml_format.YAMLFormatter()
- c = ('a', 'b', 'c')
- d = (
- ('A1', 'B1', test_columns.FauxColumn(['the', 'value'])),
- )
- expected = [
- {'a': 'A1', 'b': 'B1', 'c': ['the', 'value']},
- ]
- args = mock.Mock()
- sf.add_argument_group(args)
-
- args.noindent = True
- output = six.StringIO()
- sf.emit_list(c, d, output, args)
- actual = yaml.safe_load(output.getvalue())
- assert expected == actual
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_help.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_help.py
deleted file mode 100644
index 23659a2..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_help.py
+++ /dev/null
@@ -1,180 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-try:
- from StringIO import StringIO
-except:
- from io import StringIO
-import os
-import sys
-
-import mock
-
-from cliff import app as application
-from cliff import commandmanager
-from cliff import help
-from cliff.tests import utils
-
-
-def test_show_help_for_command():
- # FIXME(dhellmann): Are commands tied too closely to the app? Or
- # do commands know too much about apps by using them to get to the
- # command manager?
- stdout = StringIO()
- app = application.App('testing', '1',
- utils.TestCommandManager(utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- help_cmd = help.HelpCommand(app, mock.Mock())
- parser = help_cmd.get_parser('test')
- parsed_args = parser.parse_args(['one'])
- try:
- help_cmd.run(parsed_args)
- except SystemExit:
- pass
- assert stdout.getvalue() == 'TestParser'
-
-
-def test_list_matching_commands():
- # FIXME(dhellmann): Are commands tied too closely to the app? Or
- # do commands know too much about apps by using them to get to the
- # command manager?
- stdout = StringIO()
- app = application.App('testing', '1',
- utils.TestCommandManager(utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- help_cmd = help.HelpCommand(app, mock.Mock())
- parser = help_cmd.get_parser('test')
- parsed_args = parser.parse_args(['t'])
- try:
- help_cmd.run(parsed_args)
- except SystemExit:
- pass
- help_output = stdout.getvalue()
- assert 'Command "t" matches:' in help_output
- assert 'three word command\n two words\n' in help_output
-
-
-def test_list_matching_commands_no_match():
- # FIXME(dhellmann): Are commands tied too closely to the app? Or
- # do commands know too much about apps by using them to get to the
- # command manager?
- stdout = StringIO()
- app = application.App('testing', '1',
- utils.TestCommandManager(utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- help_cmd = help.HelpCommand(app, mock.Mock())
- parser = help_cmd.get_parser('test')
- parsed_args = parser.parse_args(['z'])
- try:
- help_cmd.run(parsed_args)
- except SystemExit:
- pass
- except ValueError:
- pass
- else:
- assert False, 'Should have seen a ValueError'
-
-
-def test_show_help_for_help():
- # FIXME(dhellmann): Are commands tied too closely to the app? Or
- # do commands know too much about apps by using them to get to the
- # command manager?
- stdout = StringIO()
- app = application.App('testing', '1',
- utils.TestCommandManager(utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- app.options = mock.Mock()
- help_cmd = help.HelpCommand(app, mock.Mock())
- parser = help_cmd.get_parser('test')
- parsed_args = parser.parse_args([])
- try:
- help_cmd.run(parsed_args)
- except SystemExit:
- pass
- help_text = stdout.getvalue()
- basecommand = os.path.split(sys.argv[0])[1]
- assert 'usage: %s [--version]' % basecommand in help_text
- assert 'optional arguments:\n --version' in help_text
- expected = (
- ' one Test command.\n'
- ' three word command Test command.\n'
- )
- assert expected in help_text
-
-
-def test_list_deprecated_commands():
- # FIXME(dhellmann): Are commands tied too closely to the app? Or
- # do commands know too much about apps by using them to get to the
- # command manager?
- stdout = StringIO()
- app = application.App('testing', '1',
- utils.TestCommandManager(utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- try:
- app.run(['--help'])
- except SystemExit:
- pass
- help_output = stdout.getvalue()
- assert 'two words' in help_output
- assert 'three word command' in help_output
- assert 'old cmd' not in help_output
-
-
-@mock.patch.object(commandmanager.EntryPointWrapper, 'load',
- side_effect=Exception('Could not load EntryPoint'))
-def test_show_help_with_ep_load_fail(mock_load):
- stdout = StringIO()
- app = application.App('testing', '1',
- utils.TestCommandManager(utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- app.options = mock.Mock()
- app.options.debug = False
- help_cmd = help.HelpCommand(app, mock.Mock())
- parser = help_cmd.get_parser('test')
- parsed_args = parser.parse_args([])
- try:
- help_cmd.run(parsed_args)
- except SystemExit:
- pass
- help_output = stdout.getvalue()
- assert 'Commands:' in help_output
- assert 'Could not load' in help_output
- assert 'Exception: Could not load EntryPoint' not in help_output
-
-
-@mock.patch.object(commandmanager.EntryPointWrapper, 'load',
- side_effect=Exception('Could not load EntryPoint'))
-def test_show_help_print_exc_with_ep_load_fail(mock_load):
- stdout = StringIO()
- app = application.App('testing', '1',
- utils.TestCommandManager(utils.TEST_NAMESPACE),
- stdout=stdout)
- app.NAME = 'test'
- app.options = mock.Mock()
- app.options.debug = True
- help_cmd = help.HelpCommand(app, mock.Mock())
- parser = help_cmd.get_parser('test')
- parsed_args = parser.parse_args([])
- try:
- help_cmd.run(parsed_args)
- except SystemExit:
- pass
- help_output = stdout.getvalue()
- assert 'Commands:' in help_output
- assert 'Could not load' in help_output
- assert 'Exception: Could not load EntryPoint' in help_output
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_interactive.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_interactive.py
deleted file mode 100644
index 7d9667e..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_interactive.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- encoding: utf-8 -*-
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from cliff.interactive import InteractiveApp
-
-
-class FakeApp(object):
- NAME = 'Fake'
-
-
-def make_interactive_app(*command_names):
- fake_command_manager = [(x, None) for x in command_names]
- return InteractiveApp(FakeApp, fake_command_manager,
- stdin=None, stdout=None)
-
-
-def _test_completenames(expecteds, prefix):
- app = make_interactive_app('hips', 'hippo', 'nonmatching')
- assert set(app.completenames(prefix)) == set(expecteds)
-
-
-def test_cmd2_completenames():
- # cmd2.Cmd define do_help method
- _test_completenames(['help'], 'he')
-
-
-def test_cliff_completenames():
- _test_completenames(['hips', 'hippo'], 'hip')
-
-
-def test_no_completenames():
- _test_completenames([], 'taz')
-
-
-def test_both_completenames():
- # cmd2.Cmd define do_hi and do_history methods
- _test_completenames(['hi', 'history', 'hips', 'hippo'], 'hi')
-
-
-def _test_completedefault(expecteds, line, begidx):
- command_names = set(['show file', 'show folder', 'show long', 'list all'])
- app = make_interactive_app(*command_names)
- observeds = app.completedefault(None, line, begidx, None)
- assert set(observeds) == set(expecteds)
- assert set([line[:begidx] + x for x in observeds]) <= command_names
-
-
-def test_empty_text_completedefault():
- # line = 'show ' + begidx = 5 implies text = ''
- _test_completedefault(['file', 'folder', ' long'], 'show ', 5)
-
-
-def test_nonempty_text_completedefault2():
- # line = 'show f' + begidx = 6 implies text = 'f'
- _test_completedefault(['file', 'folder'], 'show f', 5)
-
-
-def test_long_completedefault():
- _test_completedefault(['long'], 'show ', 6)
-
-
-def test_no_completedefault():
- _test_completedefault([], 'taz ', 4)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_lister.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_lister.py
deleted file mode 100644
index f2e4a0d..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_lister.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import weakref
-
-from cliff import lister
-
-import mock
-
-
-class FauxFormatter(object):
-
- def __init__(self):
- self.args = []
- self.obj = weakref.proxy(self)
-
- def emit_list(self, columns, data, stdout, args):
- self.args.append((columns, data))
-
-
-class ExerciseLister(lister.Lister):
-
- def _load_formatter_plugins(self):
- return {
- 'test': FauxFormatter(),
- }
-
- def take_action(self, parsed_args):
- return (
- parsed_args.columns,
- [('a', 'A'), ('b', 'B')],
- )
-
-
-def test_formatter_args():
- app = mock.Mock()
- test_lister = ExerciseLister(app, [])
-
- parsed_args = mock.Mock()
- parsed_args.columns = ('Col1', 'Col2')
- parsed_args.formatter = 'test'
-
- test_lister.run(parsed_args)
- f = test_lister._formatter_plugins['test']
- assert len(f.args) == 1
- args = f.args[0]
- assert args[0] == list(parsed_args.columns)
- data = list(args[1])
- assert data == [['a', 'A'], ['b', 'B']]
-
-
-def test_no_exist_column():
- test_lister = ExerciseLister(mock.Mock(), [])
- parsed_args = mock.Mock()
- parsed_args.columns = ('no_exist_column',)
- parsed_args.formatter = 'test'
- with mock.patch.object(test_lister, 'take_action') as mock_take_action:
- mock_take_action.return_value = (('Col1', 'Col2', 'Col3'), [])
- try:
- test_lister.run(parsed_args)
- except ValueError:
- pass
- else:
- assert False, 'Should have had an exception'
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_show.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_show.py
deleted file mode 100644
index 9e46c54..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_show.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import weakref
-
-from cliff import show
-
-import mock
-
-
-class FauxFormatter(object):
-
- def __init__(self):
- self.args = []
- self.obj = weakref.proxy(self)
-
- def emit_one(self, columns, data, stdout, args):
- self.args.append((columns, data))
-
-
-class ExerciseShowOne(show.ShowOne):
-
- def _load_formatter_plugins(self):
- return {
- 'test': FauxFormatter(),
- }
-
- def take_action(self, parsed_args):
- return (
- parsed_args.columns,
- [('a', 'A'), ('b', 'B')],
- )
-
-
-def test_formatter_args():
- app = mock.Mock()
- test_show = ExerciseShowOne(app, [])
-
- parsed_args = mock.Mock()
- parsed_args.columns = ('Col1', 'Col2')
- parsed_args.formatter = 'test'
-
- test_show.run(parsed_args)
- f = test_show._formatter_plugins['test']
- assert len(f.args) == 1
- args = f.args[0]
- assert args[0] == list(parsed_args.columns)
- data = list(args[1])
- assert data == [('a', 'A'), ('b', 'B')]
-
-
-def test_dict2columns():
- app = mock.Mock()
- test_show = ExerciseShowOne(app, [])
- d = {'a': 'A', 'b': 'B', 'c': 'C'}
- expected = [('a', 'b', 'c'), ('A', 'B', 'C')]
- actual = list(test_show.dict2columns(d))
- assert expected == actual
-
-
-def test_no_exist_column():
- test_show = ExerciseShowOne(mock.Mock(), [])
- parsed_args = mock.Mock()
- parsed_args.columns = ('no_exist_column',)
- parsed_args.formatter = 'test'
- with mock.patch.object(test_show, 'take_action') as mock_take_action:
- mock_take_action.return_value = (('Col1', 'Col2', 'Col3'), [])
- try:
- test_show.run(parsed_args)
- except ValueError:
- pass
- else:
- assert False, 'Should have had an exception'
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_utils.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_utils.py
deleted file mode 100644
index 23c46c4..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/test_utils.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import os
-import struct
-import sys
-
-import mock
-import nose
-
-from cliff import utils
-
-
-def test_utils_terminal_width():
- width = utils.terminal_width(sys.stdout)
- # Results are specific to the execution environment, so only assert
- # that no error is raised.
- assert width is None or isinstance(width, int)
-
-
-@mock.patch('cliff.utils.os')
-def test_utils_terminal_width_get_terminal_size(mock_os):
- if not hasattr(os, 'get_terminal_size'):
- raise nose.SkipTest('only needed for python 3.3 onwards')
- ts = os.terminal_size((10, 5))
- mock_os.get_terminal_size.return_value = ts
- width = utils.terminal_width(sys.stdout)
- assert width == 10
-
- mock_os.get_terminal_size.side_effect = OSError()
- width = utils.terminal_width(sys.stdout)
- assert width is None
-
-
-@mock.patch('fcntl.ioctl')
-def test_utils_terminal_width_ioctl(mock_ioctl):
- if hasattr(os, 'get_terminal_size'):
- raise nose.SkipTest('only needed for python 3.2 and before')
- mock_ioctl.return_value = struct.pack('hhhh', 57, 101, 0, 0)
- width = utils.terminal_width(sys.stdout)
- assert width == 101
-
- mock_ioctl.side_effect = IOError()
- width = utils.terminal_width(sys.stdout)
- assert width is None
-
-
-@mock.patch('cliff.utils.ctypes')
-@mock.patch('sys.platform', 'win32')
-def test_utils_terminal_width_windows(mock_ctypes):
- if hasattr(os, 'get_terminal_size'):
- raise nose.SkipTest('only needed for python 3.2 and before')
-
- mock_ctypes.create_string_buffer.return_value.raw = struct.pack(
- 'hhhhHhhhhhh', 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
- mock_ctypes.windll.kernel32.GetStdHandle.return_value = -11
- mock_ctypes.windll.kernel32.GetConsoleScreenBufferInfo.return_value = 1
-
- width = utils.terminal_width(sys.stdout)
- assert width == 101
-
- mock_ctypes.windll.kernel32.GetConsoleScreenBufferInfo.return_value = 0
-
- width = utils.terminal_width(sys.stdout)
- assert width is None
-
- width = utils.terminal_width('foo')
- assert width is None
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/utils.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/utils.py
deleted file mode 100644
index b9cdba3..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/tests/utils.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from cliff.command import Command
-from cliff.commandmanager import CommandManager
-
-TEST_NAMESPACE = 'cliff.test'
-
-
-class TestParser(object):
-
- def print_help(self, stdout):
- stdout.write('TestParser')
-
-
-class TestCommand(Command):
- "Test command."
-
- def get_parser(self, ignore):
- # Make it look like this class is the parser
- # so parse_args() is called.
- return TestParser()
-
- def take_action(self, args):
- return
-
-
-class TestDeprecatedCommand(TestCommand):
-
- deprecated = True
-
-
-class TestCommandManager(CommandManager):
-
- def load_commands(self, namespace):
- if namespace == TEST_NAMESPACE:
- for key in ('one', 'two words', 'three word command'):
- self.add_command(key, TestCommand)
- self.add_command('old cmd', TestDeprecatedCommand)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/utils.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/utils.py
deleted file mode 100644
index 50f3ab6..0000000
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/cliff-2.4.0-py2.7.egg/cliff/utils.py
+++ /dev/null
@@ -1,155 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import ctypes
-import os
-import struct
-import sys
-
-# Each edit operation is assigned different cost, such as:
-# 'w' means swap operation, the cost is 0;
-# 's' means substitution operation, the cost is 2;
-# 'a' means insertion operation, the cost is 1;
-# 'd' means deletion operation, the cost is 3;
-# The smaller cost results in the better similarity.
-COST = {'w': 0, 's': 2, 'a': 1, 'd': 3}
-
-
-def damerau_levenshtein(s1, s2, cost):
- """Calculates the Damerau-Levenshtein distance between two strings.
-
- The Levenshtein distance says the minimum number of single-character edits
- (i.e. insertions, deletions, swap or substitution) required to change one
- string to the other.
- The idea is to reserve a matrix to hold the Levenshtein distances between
- all prefixes of the first string and all prefixes of the second, then we
- can compute the values in the matrix in a dynamic programming fashion. To
- avoid a large space complexity, only the last three rows in the matrix is
- needed.(row2 holds the current row, row1 holds the previous row, and row0
- the row before that.)
-
- More details:
- https://en.wikipedia.org/wiki/Levenshtein_distance
- https://github.com/git/git/commit/8af84dadb142f7321ff0ce8690385e99da8ede2f
- """
-
- if s1 == s2:
- return 0
-
- len1 = len(s1)
- len2 = len(s2)
-
- if len1 == 0:
- return len2 * cost['a']
- if len2 == 0:
- return len1 * cost['d']
-
- row1 = [i * cost['a'] for i in range(len2 + 1)]
- row2 = row1[:]
- row0 = row1[:]
-
- for i in range(len1):
- row2[0] = (i + 1) * cost['d']
-
- for j in range(len2):
-
- # substitution
- sub_cost = row1[j] + (s1[i] != s2[j]) * cost['s']
-
- # insertion
- ins_cost = row2[j] + cost['a']
-
- # deletion
- del_cost = row1[j + 1] + cost['d']
-
- # swap
- swp_condition = ((i > 0) and
- (j > 0) and
- (s1[i - 1] == s2[j]) and
- (s1[i] == s2[j - 1])
- )
-
- # min cost
- if swp_condition:
- swp_cost = row0[j - 1] + cost['w']
- p_cost = min(sub_cost, ins_cost, del_cost, swp_cost)
- else:
- p_cost = min(sub_cost, ins_cost, del_cost)
-
- row2[j + 1] = p_cost
-
- row0, row1, row2 = row1, row2, row0
-
- return row1[-1]
-
-
-def terminal_width(stdout):
- if hasattr(os, 'get_terminal_size'):
- # python 3.3 onwards has built-in support for getting terminal size
- try:
- return os.get_terminal_size().columns
- except OSError:
- return None
-
- if sys.platform == 'win32':
- return _get_terminal_width_windows(stdout)
- else:
- return _get_terminal_width_ioctl(stdout)
-
-
-def _get_terminal_width_windows(stdout):
- STD_INPUT_HANDLE = -10
- STD_OUTPUT_HANDLE = -11
- STD_ERROR_HANDLE = -12
-
- std_to_win_handle = {
- sys.stdin: STD_INPUT_HANDLE,
- sys.stdout: STD_OUTPUT_HANDLE,
- sys.stderr: STD_ERROR_HANDLE}
-
- std_handle = std_to_win_handle.get(stdout)
- if not std_handle:
- return None
-
- handle = ctypes.windll.kernel32.GetStdHandle(std_handle)
- csbi = ctypes.create_string_buffer(22)
-
- res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(handle, csbi)
- if res:
- (size_x, size_y, cur_pos_x, cur_pos_y, attr,
- left, top, right, bottom, max_size_x, max_size_y) = struct.unpack(
- "hhhhHhhhhhh", csbi.raw)
- return size_x
-
-
-def _get_terminal_width_ioctl(stdout):
- from fcntl import ioctl
- import termios
-
- try:
- # winsize structure has 4 unsigned short fields
- winsize = b'\0' * struct.calcsize('hhhh')
- try:
- winsize = ioctl(stdout, termios.TIOCGWINSZ, winsize)
- except IOError:
- return None
- except TypeError:
- # this is raised in unit tests as stdout is sometimes a StringIO
- return None
- winsize = struct.unpack('hhhh', winsize)
- columns = winsize[1]
- if not columns:
- return None
- return columns
- except IOError:
- return None