Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 3af2802

Browse files
committed
Rename AttachDebugger to enable(), which is more Pythonic.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125007958
1 parent 538a8a8 commit 3af2802

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ easy_install dist/google_python_cloud_debugger-*.egg
9595
# Attach Python Cloud Debugger
9696
try:
9797
import googleclouddebugger
98-
googleclouddebugger.AttachDebugger()
98+
googleclouddebugger.enable()
9999
except ImportError:
100100
pass
101101
```
@@ -133,7 +133,7 @@ _Option A_: add this code to the beginning of your `main()` function:
133133
# Attach Python Cloud Debugger
134134
try:
135135
import googleclouddebugger
136-
googleclouddebugger.AttachDebugger(
136+
googleclouddebugger.enable(
137137
enable_service_account_auth=True,
138138
project_id='my-gcp-project-id',
139139
project_number='123456789',

src/googleclouddebugger/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@
3939
__version__ = '1.9'
4040

4141
_flags = None
42+
_hub_client = None
43+
_breakpoints_manager = None
4244

4345

4446
def _StartDebugger():
47+
"""Configures and starts the debugger."""
4548
global _hub_client
4649
global _breakpoints_manager
4750

@@ -55,7 +58,6 @@ def _StartDebugger():
5558
capture_collector.log_warning_message = logging.warning
5659
capture_collector.log_error_message = logging.error
5760

58-
"""Configures and starts the debugger."""
5961
capture_collector.CaptureCollector.pretty_printers.append(
6062
appengine_pretty_printers.PrettyPrinter)
6163

@@ -112,7 +114,8 @@ def _DebuggerMain():
112114
exec 'execfile(%r)' % app_path in globals, locals # pylint: disable=exec-used
113115

114116

115-
def AttachDebugger(**kwargs):
117+
# pylint: disable=invalid-name
118+
def enable(**kwargs):
116119
"""Starts the debugger for already running application.
117120
118121
This function should only be called once.
@@ -132,3 +135,6 @@ def AttachDebugger(**kwargs):
132135
_flags = kwargs
133136
_StartDebugger()
134137

138+
139+
# AttachDebugger is an alias for enable, preserved for compatibility.
140+
AttachDebugger = enable

0 commit comments

Comments
 (0)