Skip to content

Commit cd4a01e

Browse files
committed
Fix style
1 parent c471fe0 commit cd4a01e

File tree

6 files changed

+25
-29
lines changed

6 files changed

+25
-29
lines changed

trace/google/cloud/trace/_gax.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def list_traces(
131131
passed, the API will return the first page of
132132
entries.
133133
134-
:rtype: dict
134+
:rtype: :class:`~google.cloud.iterator.Iterator`
135135
:returns: Traces that match the specified filter conditions.
136136
"""
137137
if page_token is None:
@@ -187,7 +187,7 @@ def make_gax_trace_api(client):
187187
:param client: The client that holds configuration details.
188188
189189
:rtype: :class:`~google.cloud.trace._gax._TraceAPI`
190-
:return: A Trace API instance with the proper configurations.
190+
:returns: A Trace API instance with the proper configurations.
191191
"""
192192
channel = make_secure_channel(
193193
client._credentials,
@@ -206,7 +206,7 @@ def _traces_mapping_to_pb(traces_mapping):
206206
:param traces_mapping: A trace mapping.
207207
208208
:rtype: class:`google.cloud.proto.devtools.cloudtrace.v1.trace_pb2.Traces`
209-
:return: The converted protobuf type traces.
209+
:returns: The converted protobuf type traces.
210210
"""
211211
traces_pb = trace_pb2.Traces()
212212
ParseDict(traces_mapping, traces_pb)

trace/google/cloud/trace/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def trace(self, project_id=None, trace_id=None):
6161
:param trace_id: ID of the trace. 32 digits uuid.
6262
6363
:rtype: :class:`~google.cloud.trace.trace.Trace`
64-
:return: A Trace instance.
64+
:returns: A Trace instance.
6565
"""
6666
if project_id is None:
6767
project_id = self.project
@@ -85,7 +85,7 @@ def patch_traces(self, traces, project_id=None, options=None):
8585
if project_id is None:
8686
project_id = self.project
8787

88-
return self.trace_api.patch_traces(
88+
self.trace_api.patch_traces(
8989
project_id=project_id,
9090
traces=traces,
9191
options=options)
@@ -104,7 +104,7 @@ def get_trace(self, trace_id, project_id=None, options=None):
104104
:param options: (Optional) Overrides the default settings for this
105105
call, e.g, timeout, retries etc.
106106
107-
:rtype: :dict
107+
:rtype: dict
108108
:returns: A Trace dict.
109109
"""
110110
if project_id is None:
@@ -163,7 +163,7 @@ def list_traces(
163163
passed, the API will return the first page of
164164
entries.
165165
166-
:rtype: dict
166+
:rtype: :class:`~google.cloud.iterator.Iterator`
167167
:returns: Traces that match the specified filter conditions.
168168
"""
169169
if project_id is None:

trace/google/cloud/trace/trace.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def span(self, name='span'):
7474
"""Create a new span for the trace and append it to the spans list.
7575
7676
:type name: str
77-
:param name: The name of the span.
77+
:param name: (Optional) The name of the span.
7878
7979
:rtype: :class:`~google.cloud.trace.trace_span.TraceSpan`
8080
:returns: A TraceSpan to be added to the current Trace.
@@ -114,8 +114,6 @@ def send(self):
114114
traces=traces,
115115
options=None)
116116

117-
return spans_list
118-
119117

120118
def generate_trace_id():
121119
"""Generate a trace_id randomly.

trace/google/cloud/trace/trace_span.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class TraceSpan(object):
4343
distinguished using RPC_CLIENT and RPC_SERVER to identify
4444
queueing latency associated with the span.
4545
46-
:type parent_span_id: str
47-
:param parent_span_id: ID of the parent span. Optional.
46+
:type parent_span_id: int
47+
:param parent_span_id: (Optional) ID of the parent span.
4848
4949
:type labels: dict
5050
:param labels: Collection of labels associated with the span.
@@ -60,7 +60,7 @@ class TraceSpan(object):
6060
:param end_time: (Optional) End of the time interval (inclusive) during
6161
which the trace data was collected from the application.
6262
63-
:type span_id: str
63+
:type span_id: int
6464
:param span_id: Identifier for the span, unique within a trace.
6565
"""
6666

trace/nox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def lint(session):
5252
Returns a failure if flake8 finds linting errors or sufficiently
5353
serious code quality issues.
5454
"""
55-
session.interpreter = 'python3.6'
55+
session.interpreter = 'python2.7'
5656
session.install('flake8', *LOCAL_DEPS)
5757
session.install('.')
5858
session.run('flake8', 'google/cloud/trace')
@@ -73,7 +73,7 @@ def cover(session):
7373
This outputs the coverage report aggregating coverage from the unit
7474
test runs (not system test runs), and then erases coverage data.
7575
"""
76-
session.interpreter = 'python3.6'
76+
session.interpreter = 'python2.7'
7777
session.install('coverage', 'pytest-cov')
7878
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
7979
session.run('coverage', 'erase')

trace/tests/unit/test_client.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,44 +91,42 @@ def test_trace_explicit(self):
9191
def test_patch_traces_default(self):
9292
from google.cloud.trace._gax import _TraceAPI
9393

94-
def patch_traces(traces, project_id=None, options=None):
95-
_patch_traces_called_with = (traces, project_id, options)
96-
return _patch_traces_called_with
97-
9894
credentials = _make_credentials()
9995
client = self._make_one(project=self.project, credentials=credentials)
10096
traces = 'fake_traces_for_test'
10197

10298
mock_trace_api = mock.Mock(spec=_TraceAPI)
103-
mock_trace_api.patch_traces = patch_traces
99+
mock_trace_api.patch_traces = mock.Mock()
104100
patch = mock.patch('google.cloud.trace.client.make_gax_trace_api', return_value=mock_trace_api)
105101

106102
with patch:
107-
patch_traces_called_with = client.patch_traces(traces=traces)
103+
client.patch_traces(traces=traces)
108104

109-
self.assertEqual(patch_traces_called_with, (traces, self.project, None))
105+
mock_trace_api.patch_traces.assert_called_with(
106+
options=None,
107+
project_id='PROJECT',
108+
traces='fake_traces_for_test')
110109

111110
def test_patch_traces_explicit(self):
112111
from google.cloud.trace._gax import _TraceAPI
113112

114-
def patch_traces(traces, project_id=None, options=None):
115-
_patch_traces_called_with = (traces, project_id, options)
116-
return _patch_traces_called_with
117-
118113
credentials = _make_credentials()
119114
client = self._make_one(project=self.project, credentials=credentials)
120115
traces = 'fake_traces_for_test'
121116

122117
mock_trace_api = mock.Mock(spec=_TraceAPI)
123-
mock_trace_api.patch_traces = patch_traces
118+
mock_trace_api.patch_traces = mock.Mock()
124119
patch = mock.patch('google.cloud.trace.client.make_gax_trace_api', return_value=mock_trace_api)
125120

126121
with patch:
127-
patch_traces_called_with = client.patch_traces(
122+
client.patch_traces(
128123
project_id=self.project,
129124
traces=traces)
130125

131-
self.assertEqual(patch_traces_called_with, (traces, self.project, None))
126+
mock_trace_api.patch_traces.assert_called_with(
127+
options=None,
128+
project_id='PROJECT',
129+
traces='fake_traces_for_test')
132130

133131
def test_get_trace_default(self):
134132
from google.cloud.trace._gax import _TraceAPI

0 commit comments

Comments
 (0)