Skip to content

Commit 4a99f8f

Browse files
committed
Fixing demo runner: used to print empty newline at beginning of demo.
Also removing license from datastore demo.
1 parent 3b65abd commit 4a99f8f

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

gcloud/datastore/demo/demo.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# Copyright 2014 Google Inc. All rights reserved.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
141
# Welcome to the gCloud Datastore Demo! (hit enter)
152
# We're going to walk through some of the basics...
163
# Don't worry though. You don't need to do anything, just keep hitting enter...

gcloud/demo.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ def from_module(cls, module):
4141
def run(self):
4242
line_groups = itertools.groupby(self.lines, self.get_line_type)
4343

44+
newline = False # Don't use newline on the first statement.
4445
for group_type, lines in line_groups:
4546
if group_type == self.COMMENT:
46-
self.write(lines)
47+
self.write(lines, newline=newline)
48+
newline = True
4749

4850
elif group_type == self.CODE:
4951
self.code(lines)
@@ -70,8 +72,8 @@ def _print(self, text='', newline=True):
7072
if newline:
7173
sys.stdout.write('\n')
7274

73-
def write(self, lines):
74-
self._print()
75+
def write(self, lines, newline=True):
76+
self._print(newline=newline)
7577
self._print('\n'.join(lines), False)
7678
self.wait()
7779

0 commit comments

Comments
 (0)