Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
0acb6f70
Commit
0acb6f70
authored
10 years ago
by
Nathaniel Manista
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetic tweaks to Python Route Guide
parent
191628f3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/route_guide/route_guide_client.py
+8
-9
8 additions, 9 deletions
python/route_guide/route_guide_client.py
python/route_guide/route_guide_server.py
+8
-12
8 additions, 12 deletions
python/route_guide/route_guide_server.py
with
16 additions
and
21 deletions
python/route_guide/route_guide_client.py
+
8
−
9
View file @
0acb6f70
...
...
@@ -39,10 +39,9 @@ _TIMEOUT_SECONDS = 30
def
make_route_note
(
message
,
latitude
,
longitude
):
route_note
=
route_guide_pb2
.
RouteNote
(
message
=
message
)
route_note
.
location
.
latitude
=
latitude
route_note
.
location
.
longitude
=
longitude
return
route_note
return
route_guide_pb2
.
RouteNote
(
message
=
message
,
location
=
route_guide_pb2
.
Point
(
latitude
=
latitude
,
longitude
=
longitude
))
def
guide_get_one_feature
(
stub
,
point
):
...
...
@@ -63,11 +62,11 @@ def guide_get_feature(stub):
def
guide_list_features
(
stub
):
rect
=
route_guide_pb2
.
Rectangle
(
)
rect
.
lo
.
latitude
=
400000000
rect
.
lo
.
longitude
=
-
750000000
rect
.
hi
.
latitude
=
420000000
rect
.
hi
.
longitude
=
-
730000000
rect
=
route_guide_pb2
.
Rectangle
(
lo
=
route_guide_pb2
.
Point
(
latitude
=
400000000
,
longitude
=
-
750000000
),
hi
=
route_guide_pb2
.
Point
(
latitude
=
420000000
,
longitude
=
-
730000000
))
print
"
Looking for features between 40, -75 and 42, -73
"
features
=
stub
.
ListFeatures
(
rect
,
_TIMEOUT_SECONDS
)
...
...
This diff is collapsed.
Click to expand it.
python/route_guide/route_guide_server.py
+
8
−
12
View file @
0acb6f70
...
...
@@ -73,20 +73,16 @@ class RouteGuideServicer(route_guide_pb2.EarlyAdopterRouteGuideServicer):
def
GetFeature
(
self
,
request
,
context
):
feature
=
get_feature
(
self
.
db
,
request
)
if
not
feature
:
feature
=
route_guide_pb2
.
Feature
(
name
=
""
,
location
=
route_guide_pb2
.
Point
(
latitude
=
request
.
latitude
,
longitude
=
request
.
longitude
))
return
feature
if
feature
is
None
:
return
route_guide_pb2
.
Feature
(
name
=
""
,
location
=
request
)
else
:
return
feature
def
ListFeatures
(
self
,
request
,
context
):
lo
=
request
.
lo
hi
=
request
.
hi
left
=
min
(
lo
.
longitude
,
hi
.
longitude
)
right
=
max
(
lo
.
longitude
,
hi
.
longitude
)
top
=
max
(
lo
.
latitude
,
hi
.
latitude
)
bottom
=
min
(
lo
.
latitude
,
hi
.
latitude
)
left
=
min
(
request
.
lo
.
longitude
,
request
.
hi
.
longitude
)
right
=
max
(
request
.
lo
.
longitude
,
request
.
hi
.
longitude
)
top
=
max
(
request
.
lo
.
latitude
,
request
.
hi
.
latitude
)
bottom
=
min
(
request
.
lo
.
latitude
,
request
.
hi
.
latitude
)
for
feature
in
self
.
db
:
if
(
feature
.
location
.
longitude
>=
left
and
feature
.
location
.
longitude
<=
right
and
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment