| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This is so that "from gcloud.monitoring import *" doesn't import the package's module names.
|
-0, mostly because from foo import * is a truly evil pattern. I would definitely vote to reject any docs change which showed from gcloud.monitoring import *. |
Sorry, something went wrong.
|
Looking at the module: there are no names present which are not listed in __all__. |
Sorry, something went wrong.
|
This is a package, so it brings in all the module names: client, connection, label, metric, ... |
Sorry, something went wrong.
|
from gcloud.monitoring import * is useful interactively. |
Sorry, something went wrong.
>>> from gcloud import monitoring
>>> client = monitoring.Client('my-project')
>>> q = client.query(hours=2).align(Aligner.ALIGN_MEAN, minutes=5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Aligner' is not defined
>>> from gcloud.monitoring import *
>>> q = client.query(hours=2).align(Aligner.ALIGN_MEAN, minutes=5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'query'
|
Sorry, something went wrong.
|
I'm fine with defining __all__. But, @jonparrott recently pointed out that imported modules are not considered part of the public API. From PEP8
For an example from the stdlib. >>> import subprocess
>>> subprocess.sys
<module 'sys' (built-in)> |
Sorry, something went wrong.
|
I'm OK with this change -- though I'm -1 to using the import * pattern in our documentation. If people want to use that interactively that's fine with me, but it's certainly not recommended. |
Sorry, something went wrong.
|
Shall we merge then? @tseaver any objections? Ditto on that. Namespaces are one of Python's strengths (both in language design and community / "idiomatic" behavior). From the Zen of Python:
|
Sorry, something went wrong.
|
Defining __all__ in this circumstance is standard practice. You just don't see it that much outside of carefully curated libraries like the Python standard library, because it's of minor consequence, for the reasons you have mentioned. |
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* feat: add functionality to hash data (#1677) * feat: add functionality to hash data * change sensitive fields to private * update to sha512 * update docstring * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: add request-response log helpers (#1685) * chore: add request-response log helpers * fix presubmit * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: opt-in logging support for request / response (#1686) * feat: opt-in logging support for request/response * add pragma no cover * add test coverage for request/response * add code coverage * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: remove logging for async requests (#1698) * chore: remove logging for async requests * change Dict to Mapping * fix mypy and lint issues * address PR feedback * link issue * feat: parse request/response for logging (#1696) * feat: parse request/response for logging * add test case for list * address PR comments * address PR feedback * fix typo * add test coverage * add code coverage * feat: hash sensitive info in logs (#1700) * feat: hash sensitive info in logs * make helper private * add code coverage * address PR feedback * fix mypy type issue * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add support for async response log (#1733) * feat: add support for async response log * fix whitespace * add await * add code coverage * fix lint * fix lint issues * address PR feedback * address PR feedback * link issue * feat: add request response logs for sync api calls (#1747) * fix: remove dependency on api-core for logging (#1748) * fix: remove dep on api-core for logging * disable propagation to the root logger * update async helpers tests * fix lint issue --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…rovided (#1747) Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #1745 🦕
| Back | FazBrowse Home | New Git URL |
This is so that "from gcloud.monitoring import *" doesn't import
the package's module names.