Commit d0972641 authored by dpranke's avatar dpranke Committed by Commit bot

Roll //third_party/typ to v0.9.9

This rolls //third_party/typ to v0.9.9 to pick up dglazkov's patch
to allow "foreign arguments" to typ. A foreign argument is one
that the typ arg parser ignores.

This roll includes:

  d77f1a5 bump version to 0.9.9
  69c6119 Merge pull request #7 from dglazkov/foreign-argument
  0a2f193 fix indentation
  c8845b2 Introduce the concept of a foreign argument.

R=dglazkov@chromium.org

Review-Url: https://codereview.chromium.org/2568683002
Cr-Commit-Position: refs/heads/master@{#437789}
parent 64a8d3b5
Name: typ Name: typ
URL: https://github.com/dpranke/typ.git URL: https://github.com/dpranke/typ.git
Version: 0.9.8 Version: 0.9.9
Revision: 3df460d1b6d83594e75f6b50f889a240a2e1925e Revision: d77f1a5b246a0bbf04eee73c0bef134bf7a7dbcd
Security Critical: no Security Critical: no
License: Apache 2.0 License: Apache 2.0
License File: NOT_SHIPPED License File: NOT_SHIPPED
......
...@@ -280,6 +280,8 @@ class ArgumentParser(argparse.ArgumentParser): ...@@ -280,6 +280,8 @@ class ArgumentParser(argparse.ArgumentParser):
v = d[k] v = d[k]
argname = _argname_from_key(k) argname = _argname_from_key(k)
action = self._action_for_key(k) action = self._action_for_key(k)
if not action:
continue
action_str = _action_str(action) action_str = _action_str(action)
if k == 'tests': if k == 'tests':
tests = v tests = v
...@@ -310,8 +312,9 @@ class ArgumentParser(argparse.ArgumentParser): ...@@ -310,8 +312,9 @@ class ArgumentParser(argparse.ArgumentParser):
if action.dest == key: if action.dest == key:
return action return action
assert False, ('Could not find an action for %s' # pragma: no cover # Assume foreign argument: something used by the embedder of typ, for
% key) # example.
return None
def _action_str(action): def _action_str(action):
......
...@@ -44,6 +44,13 @@ class ArgumentParserTest(unittest.TestCase): ...@@ -44,6 +44,13 @@ class ArgumentParserTest(unittest.TestCase):
check(['--jobs', '3']) check(['--jobs', '3'])
check(['-vv'], ['--verbose', '--verbose']) check(['-vv'], ['--verbose', '--verbose'])
def test_argv_from_args_foreign_argument(self):
parser = ArgumentParser()
parser.add_argument('--some-foreign-argument', default=False,
action='store_true')
args = parser.parse_args(['--some-foreign-argument', '--verbose'])
self.assertEqual(['--verbose'], ArgumentParser().argv_from_args(args))
def test_valid_shard_options(self): def test_valid_shard_options(self):
parser = ArgumentParser() parser = ArgumentParser()
......
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
VERSION = '0.9.8' VERSION = '0.9.9'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment