Skip to content

Commit f4240a4

Browse files
committed
Fixing demo runner: used to print empty newline at beginning of demo.
Also putting license below the fold (adding back to storage demo). This is so that the user sees the message "You don't need to do anything, just keep hitting enter..." is printed first.
1 parent aa684be commit f4240a4

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

gcloud/datastore/demo/demo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Welcome to the gCloud Datastore Demo! (hit enter)
2+
# We're going to walk through some of the basics...
3+
# Don't worry though. You don't need to do anything, just keep hitting enter...
4+
15
# Copyright 2014 Google Inc. All rights reserved.
26
#
37
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,9 +15,6 @@
1115
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1216
# See the License for the specific language governing permissions and
1317
# limitations under the License.
14-
# Welcome to the gCloud Datastore Demo! (hit enter)
15-
# We're going to walk through some of the basics...
16-
# Don't worry though. You don't need to do anything, just keep hitting enter...
1718

1819
# Let's start by importing the demo module and initializing our connection.
1920
from gcloud import datastore

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

gcloud/storage/demo/demo.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
# Welcome to the gCloud Storage Demo! (hit enter)
2-
3-
# We're going to walk through some of the basics...,
2+
# We're going to walk through some of the basics...
43
# Don't worry though. You don't need to do anything, just keep hitting enter...
54

5+
# Copyright 2014 Google Inc. All rights reserved.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
619
# Let's start by importing the demo module and getting a connection:
720
import time
821

0 commit comments

Comments
 (0)