Skip to content

Commit 0b37422

Browse files
committed
204-create-workshop-files: 204 Process review comments
1 parent 7d941a2 commit 0b37422

4 files changed

Lines changed: 11 additions & 12 deletions

File tree

puma/apps/android/google_maps/google_maps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class TransportType(Enum):
1616
CAR = "car"
1717
BIKE = "bike"
1818

19+
1920
@deprecated('This class does not use the Puma state machine, and will therefore not be maintained. ' +
2021
'If you want to add functionality, please rewrite this class using StateGraph as the abstract base class.')
2122
@supported_version("26.10.01")

puma/apps/android/teleguard/teleguard.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def accept_invite(self) -> str:
133133
134134
If there are multiple invites, only the topmost invite in the UI will be accepted.
135135
136-
This method returns the name of the user that sent an invite. If no invite was sent, an exception is raised.
136+
If no invite was sent, an exception is raised.
137137
"""
138138
self.driver.swipe_to_click_element(CONVERSATION_STATE_YOU_HAVE_BEEN_INVITED)
139139
name = self.driver.get_element(CONVERSATION_STATE_INVITATION_NAME).get_attribute('content-desc')
@@ -146,6 +146,8 @@ def _extract_name(self, conversation_row: WebElement) -> str:
146146
For users with an avatar, the first line of the content description is the conversation name.
147147
For users without an avatar, there is an extra first line with just the first letter of the name.
148148
We try to detect this pattern and return the first or second line based on this.
149+
150+
:param conversation_row: The conversation row to extract a name from.
149151
"""
150152
content_description = conversation_row.get_attribute('content-desc')
151153
lines = content_description.split('\n')[:2]
@@ -168,8 +170,6 @@ def conversations_with_unread_messages(self) -> List[str]:
168170
except PumaClickException:
169171
return []
170172

171-
172-
173173
@action(chat_state)
174174
def send_message(self, message: str, conversation: str = None):
175175
"""

tutorial/2026/exercise1_TeleGuard.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"# Welcome to the Puma Tutorial\n",
88
"\n",
99
"Puma — *Programmable Utility for Mobile Automation* — is a Python library that lets you control Android apps through simple, high‑level actions.\n",
10-
"It supports a variety of popular applications such as **Telegram**, **TeleGuard**, **WhatsApp**, **Google Maps**, and more (See the README.md)\n",
10+
"It supports a variety of popular applications such as **Telegram**, **TeleGuard**, **WhatsApp**, **Google Maps**, and more (see the README.md)\n",
1111
"\n",
1212
"In this tutorial you will learn how to use Puma to interact with the a few of these apps: Sending messages with TeleGuard, navigating using Google Maps and conduct websearches using Google Chrome. Finally, you will build a full scenario, using multiple application simultaneously to mimick real user behaviour.\n",
1313
"\n",

tutorial/2026/exercise2_Google_Maps.ipynb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
"source": [
1616
"First, configure your start and end point by entering landmarks or addresses.\n",
1717
"\n",
18-
"**Important:** Both the start and end locations must be recognizable **landmarks** (e.g., a well‑known building or attraction) or **exact addresses**. OpenStreetMap resolves these names to geographic coordinates, so ambiguous or non‑existent names will cause the routing request to fail or to result in the wrong location.\n",
18+
"**Important:** Both the start and end locations must be recognizable **landmarks** (e.g., a well‑known building or attraction) or **exact addresses**. Puma uses OpenStreetMap for route planning to perform location spoofing, so OpenStreetMaps needs to resolve these names to geographic coordinates. Ambiguous or non‑existent addresses will cause the routing request to fail or to result in the wrong location, and no location spoofing can then be performened by Puma.\n",
1919
"\n",
20-
"This is important because Puma will do a lookup in OpenStreetMaps in the background to perform location spoofing. If the given locations cannot be found on OSM, no route can be spoofed. Any of the following should work landmarks/buildings\n",
20+
"Any of the following should work landmarks/buildings\n",
2121
" * Amsterdam Schiphol P1\n",
2222
" * Netherlands Forensic Institute\n",
2323
" * De Leeuwenhorst Noordwijk\n",
2424
" * Eiffel Tower\n",
2525
" * Your own work place\n",
2626
" * Any exact address (street + number + city)\n",
2727
"\n",
28-
"Once the start and destination locations are set, the script will request a route from the OpenStreetMap **OSRM** service, parse the returned geometry, and feed it to the Puma `RouteSimulator`. This component will spoof the location of the device in such a way the device moves along the route at the desired speed.\n",
28+
"Once the start and end locations are set, the script will request a route from the OpenStreetMap **OSRM** service, parse the returned geometry, and feed it to the Puma `RouteSimulator`. This component will spoof the location of the device in such a way the device moves along the route at the desired speed.\n",
2929
"\n",
3030
"Feel free to experiment with different start/end combinations to see how the simulated navigation behaves. Or think of an ambiguous name and see if you get the location you expected. Enter your location in the `search()` below to check if the location can be correctly found."
3131
],
@@ -35,8 +35,6 @@
3535
"metadata": {},
3636
"cell_type": "code",
3737
"source": [
38-
"import urllib3\n",
39-
"\n",
4038
"from puma.apps.android.google_maps.google_maps import GoogleMapsActions\n",
4139
"maps = GoogleMapsActions(device_udid=\"emulator-5554\")"
4240
],
@@ -122,9 +120,9 @@
122120
"cell_type": "markdown",
123121
"source": [
124122
"## ℹ️ How the navigation works\n",
125-
"Puma’s navigation feature works by first asking the OpenStreetMap routing service for a path between the two places you provide. The service returns a series of latitude‑longitude coordinates that describe the road network between the start and end points. Puma stores this list of points in a small simulator component that can feed them to the device as if they were real GPS readings.\n",
126-
"Once the route data is ready, Puma drives the Google Maps user interface: it opens the app, enters the destination, and taps the “Start” button to launch turn‑by‑turn navigation. At this moment Google Maps begins showing the route and navigation instructions, but because the device itself is stationary, nothing moves on the map.\n",
127-
"The simulator then takes over. It repeatedly injects the stored coordinates into the device’s location provider, spacing the updates so that the virtual vehicle travels at the speed you specify. The speed value is converted into a time interval between successive points, and optional variance can be added to make the motion look more realistic. While the navigation UI continues to run, you can change the speed at any time; the simulator instantly adjusts the interval, allowing the vehicle to accelerate, decelerate, or stop without restarting.\n",
123+
"Puma’s navigation feature works by first asking the OpenStreetMap routing service for a path between the two places you provide. The service returns a series of latitude‑longitude coordinates describing the route between the start and end points. Puma stores this list of points in a small simulator component that can feed them to the device as if they were real GPS readings.\n",
124+
"Once the route data is ready, Puma drives the Google Maps user interface: it opens the app, enters the end location, and taps the “Start” button to launch turn‑by‑turn navigation. At this moment Google Maps begins showing the route and navigation instructions, but because the device itself is stationary, nothing moves on the map.\n",
125+
"The simulator then start spoofing the location in the background. It repeatedly injects the stored coordinates into the device’s location provider, spacing the updates so that the virtual vehicle travels at the speed you specify. The speed value is converted into a time interval between successive points, and optional variance can be added to make the motion look more realistic. While the navigation UI continues to run, you can change the speed at any time; the simulator instantly adjusts the interval, allowing the vehicle to accelerate, decelerate, or stop without restarting.\n",
128126
"\n",
129127
"When the sudden speed change is very big, you can see that the speed does not change instantly, but seems to smooth out. This is because Google Maps corrects for temporary loss of connection, for example when you are in a tunnel."
130128
],

0 commit comments

Comments
 (0)