diff --git a/.github/pull.yml b/.github/pull.yml new file mode 100644 index 00000000..85bb7226 --- /dev/null +++ b/.github/pull.yml @@ -0,0 +1,12 @@ +version: "1" +rules: + - base: master + upstream: google:master + mergeMethod: rebase + mergeUnstable: false + assignees: + - alin23 + reviewers: + - alin23 + conflictReviewers: + - alin23 diff --git a/fire.sublime-project b/fire.sublime-project new file mode 100644 index 00000000..2a314617 --- /dev/null +++ b/fire.sublime-project @@ -0,0 +1,16 @@ +{ + "folders": + [ + { + "folder_exclude_patterns": + [ + ".pytest_cache", + "build", + "dist", + "*.egg-info", + "pip-wheel-metadata", + ], + "path": "." + } + ] +} diff --git a/fire/core.py b/fire/core.py index 763b3d13..f2cc01b4 100644 --- a/fire/core.py +++ b/fire/core.py @@ -49,9 +49,7 @@ def main(argv): --trace: Get the Fire Trace for the command. """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function +from __future__ import absolute_import, division, print_function import inspect import json @@ -62,16 +60,19 @@ def main(argv): import sys import types -from fire import completion -from fire import decorators -from fire import formatting -from fire import helptext -from fire import inspectutils -from fire import interact -from fire import parser -from fire import trace -from fire import value_types +from fire import ( + completion, + decorators, + formatting, + helptext, + inspectutils, + interact, + parser, + trace, + value_types, +) from fire.console import console_io + import six @@ -669,7 +670,15 @@ def _CallAndUpdateTrace(component, args, component_trace, treatment='class', fn = component.__call__ if treatment == 'callable' else component parse = _MakeParseFn(fn, metadata) (varargs, kwargs), consumed_args, remaining_args, capacity = parse(args) - component = fn(*varargs, **kwargs) + if six.PY34: + import asyncio + if asyncio.iscoroutinefunction(fn): + loop = asyncio.get_event_loop() + component = loop.run_until_complete(fn(*varargs, **kwargs)) + else: + component = fn(*varargs, **kwargs) + else: + component = fn(*varargs, **kwargs) if treatment == 'class': action = trace.INSTANTIATED_CLASS