Skip to content

Commit 9b27ceb

Browse files
committed
add ruff to pyproject dev-group
1 parent 710afbd commit 9b27ceb

File tree

3 files changed

+49
-65
lines changed

3 files changed

+49
-65
lines changed

CHANGELOG.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Added
1111

1212
- Deployed online documentation: https://flet-dev.github.io/flet-geolocator/
13-
- `Geolocator` control new methods:
14-
- `distance_between_async`
15-
- `Geolocator` control new properties:
16-
- `position`
17-
- `configuration`
13+
- `Geolocator` control new methods: `distance_between_async`
14+
- `Geolocator` control new properties: `position`, `configuration`
1815
- New dataclasses:
19-
- `GeolocatorConfiguration`
20-
- `GeolocatorWebConfiguration`
21-
- `GeolocatorIosConfiguration`
22-
- `GeolocatorAndroidConfiguration`
23-
- `ForegroundNotificationConfiguration`
16+
- `GeolocatorConfiguration`
17+
- `GeolocatorWebConfiguration`
18+
- `GeolocatorIosConfiguration`
19+
- `GeolocatorAndroidConfiguration`
20+
- `ForegroundNotificationConfiguration`
2421

2522
### Changed
2623

@@ -30,18 +27,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3027

3128
- `Geolocator` must now be added to `Page.services` instead of `Page.overlay`.
3229
- `Geolocator` method `get_current_position_async` parameters changed:
33-
- removed `accuracy`
34-
- `location_settings` renamed to `configuration` (type changed)
35-
- `wait_timeout` renamed to `timeout`
30+
- removed `accuracy`
31+
- `location_settings` renamed to `configuration` (type changed)
32+
- `wait_timeout` renamed to `timeout`
3633
- In all `Geolocator` methods, parameter `wait_timeout` renamed to `timeout`.
3734
- Removed sync methods from `Geolocator`:
38-
- `get_current_position` → use `get_current_position_async` instead
39-
- `get_last_known_position` → use `get_last_known_position_async` instead
40-
- `get_permission_status` → use `get_permission_status_async` instead
41-
- `request_permission` → use `request_permission_async` instead
42-
- `is_location_service_enabled` → use `is_location_service_enabled_async` instead
43-
- `open_app_settings` → use `open_app_settings_async` instead
44-
- `open_location_settings` → use `open_location_settings_async` instead
35+
- `get_current_position` → use `get_current_position_async` instead
36+
- `get_last_known_position` → use `get_last_known_position_async` instead
37+
- `get_permission_status` → use `get_permission_status_async` instead
38+
- `request_permission` → use `request_permission_async` instead
39+
- `is_location_service_enabled` → use `is_location_service_enabled_async` instead
40+
- `open_app_settings` → use `open_app_settings_async` instead
41+
- `open_location_settings` → use `open_location_settings_async` instead
4542
- Enum `GeolocatorActivityType` renamed to `GeolocatorIosActivityType`
4643

4744
## [0.1.0] - 2025-01-15

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Issues = "https://github.com/flet-dev/flet-geolocator/issues"
2222
[dependency-groups]
2323
dev = [
2424
"pre-commit>=4.2.0",
25+
"ruff>=0.11.7",
2526
]
2627
docs = [
2728
"mkdocs",

src/flet_geolocator/geolocator.py

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ async def get_current_position_async(
6262
configuration: Additional configuration for the location request.
6363
If not specified, then the [`Geolocator.configuration`][(p).] property is used.
6464
timeout: The maximum amount of time (in seconds) to wait for a response.
65-
66-
Raises:
67-
TimeoutError: If the request times out.
68-
6965
Returns:
7066
The current position of the device as a [`GeolocatorPosition`][(p).].
67+
Raises:
68+
TimeoutError: If the request times out.
7169
7270
Note:
7371
Depending on the availability of different location services, this can take several seconds.
@@ -88,17 +86,16 @@ async def get_last_known_position_async(
8886
Gets the last known position stored on the user's device.
8987
The accuracy can be defined using the [`Geolocator.configuration`][(p).] property.
9088
91-
Not supported on web plaform.
89+
Note:
90+
This method is not supported on web plaform.
9291
9392
Args:
9493
timeout: The maximum amount of time (in seconds) to wait for a response.
95-
96-
Raises:
97-
AssertionError: If called on a web page, as this method is not supported on web.
98-
TimeoutError: If the request times out.
99-
10094
Returns:
10195
`True` if the app's settings were opened successfully, `False` otherwise.
96+
Raises:
97+
AssertionError: If invoked on a web platform.
98+
TimeoutError: If the request times out.
10299
"""
103100
assert not self.page.web, "get_last_known_position is not supported on web"
104101
r = await self._invoke_method_async("get_last_known_position", timeout=timeout)
@@ -112,12 +109,10 @@ async def get_permission_status_async(
112109
113110
Args:
114111
timeout: The maximum amount of time (in seconds) to wait for a response.
115-
116-
Raises:
117-
TimeoutError: If the request times out.
118-
119112
Returns:
120113
The status of the permission.
114+
Raises:
115+
TimeoutError: If the request times out.
121116
"""
122117
r = await self._invoke_method_async("get_permission_status", timeout=timeout)
123118
return GeolocatorPermissionStatus(r)
@@ -130,12 +125,10 @@ async def request_permission_async(
130125
131126
Args:
132127
timeout: The maximum amount of time (in seconds) to wait for a response.
133-
134-
Raises:
135-
TimeoutError: If the request times out.
136-
137128
Returns:
138129
The status of the permission request.
130+
Raises:
131+
TimeoutError: If the request times out.
139132
"""
140133
r = await self._invoke_method_async("request_permission", timeout=timeout)
141134
return GeolocatorPermissionStatus(r)
@@ -146,12 +139,10 @@ async def is_location_service_enabled_async(self, timeout: float = 10) -> bool:
146139
147140
Args:
148141
timeout: The maximum amount of time (in seconds) to wait for a response.
149-
150-
Raises:
151-
TimeoutError: If the request times out.
152-
153142
Returns:
154143
`True` if location service is enabled, `False` otherwise.
144+
Raises:
145+
TimeoutError: If the request times out.
155146
"""
156147
return await self._invoke_method_async(
157148
"is_location_service_enabled", timeout=timeout
@@ -161,17 +152,16 @@ async def open_app_settings_async(self, timeout: float = 10) -> bool:
161152
"""
162153
Attempts to open the app's settings.
163154
164-
Not supported on web plaform.
155+
Note:
156+
This method is not supported on web plaform.
165157
166158
Args:
167159
timeout: The maximum amount of time (in seconds) to wait for a response.
168-
169-
Raises:
170-
AssertionError: If called on a web page, as this method is not supported on web.
171-
TimeoutError: If the request times out.
172-
173160
Returns:
174161
`True` if the app's settings were opened successfully, `False` otherwise.
162+
Raises:
163+
AssertionError: If invoked on a web platform.
164+
TimeoutError: If the request times out.
175165
"""
176166
assert not self.page.web, "open_app_settings is not supported on web"
177167
return await self._invoke_method_async("open_app_settings", timeout=timeout)
@@ -180,35 +170,33 @@ def open_location_settings(self, timeout: float = 10):
180170
"""
181171
Attempts to open the device's location settings.
182172
183-
Not supported on web plaform.
173+
Note:
174+
This method is not supported on web plaform.
184175
185176
Args:
186177
timeout: The maximum amount of time (in seconds) to wait for a response.
187-
188-
Raises:
189-
AssertionError: If called on a web page, as this method is not supported on web.
190-
TimeoutError: If the request times out.
191-
192178
Returns:
193179
`True` if the device's settings were opened successfully, `False` otherwise.
180+
Raises:
181+
AssertionError: If invoked on a web platform.
182+
TimeoutError: If the request times out.
194183
"""
195184
asyncio.create_task(self.open_location_settings_async(timeout=timeout))
196185

197186
async def open_location_settings_async(self, timeout: float = 10):
198187
"""
199188
Attempts to open the device's location settings.
200189
201-
Not supported on web plaform.
190+
Note:
191+
This method is not supported on web plaform.
202192
203193
Args:
204194
timeout: The maximum amount of time (in seconds) to wait for a response.
205-
206-
Raises:
207-
AssertionError: If called on a web page, as this method is not supported on web.
208-
TimeoutError: If the request times out.
209-
210195
Returns:
211196
`True` if the device's settings were opened successfully, `False` otherwise.
197+
Raises:
198+
AssertionError: If invoked on a web platform.
199+
TimeoutError: If the request times out.
212200
"""
213201
assert not self.page.web, "open_location_settings is not supported on web"
214202
await self._invoke_method_async("open_location_settings", timeout=timeout)
@@ -233,15 +221,13 @@ async def distance_between_async(
233221
end_latitude: The latitude of the ending point, in degrees.
234222
end_longitude: The longitude of the ending point, in degrees.
235223
timeout: The maximum amount of time (in seconds) to wait for a response.
236-
237-
Raises:
238-
TimeoutError: If the request times out.
239-
240224
Returns:
241225
The distance between the coordinates in meters.
226+
Raises:
227+
TimeoutError: If the request times out.
242228
"""
243229
await self._invoke_method_async(
244-
"distance_between",
230+
method_name="distance_between",
245231
arguments={
246232
"start_latitude": start_latitude,
247233
"start_longitude": start_longitude,

0 commit comments

Comments
 (0)