-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide 'types' and 'enums' submodule view (#273)
This is a minor hack to preserve the module interface from the monocode: types and enums for a service live in distinct submodules. Includes tests for enums
- Loading branch information
1 parent
68f72be
commit f4bc871
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
gapic/templates/%namespace/%name_%version/%sub/enums.py.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends '_base.py.j2' %} | ||
|
||
{% block content %} | ||
{% for p in api.protos.values() if p.file_to_generate and p.enums -%} | ||
from .types.{{ p.module_name }} import ({% for e in p.enums.values() %}{{ e.name }}, {% endfor %}) | ||
{% endfor %} | ||
|
||
__all__ = ( | ||
{%- for p in api.protos.values() if p.file_to_generate %}{% for e in p.enums.values() %} | ||
'{{ e.name }}', | ||
{%- endfor %}{% endfor %} | ||
) | ||
{% endblock %} |
13 changes: 13 additions & 0 deletions
13
gapic/templates/%namespace/%name_%version/%sub/types/__init__.py.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends '_base.py.j2' %} | ||
|
||
{% block content %} | ||
{% for p in api.protos.values() if p.file_to_generate and p.messages -%} | ||
from .{{ p.module_name }} import ({% for m in p.messages.values() %}{{ m.name }}, {% endfor %}) | ||
{% endfor %} | ||
|
||
__all__ = ( | ||
{%- for p in api.protos.values() if p.file_to_generate %}{% for m in p.messages.values() %} | ||
'{{ m.name }}', | ||
{%- endfor %}{% endfor %} | ||
) | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters