Skip to content

Commit 78ed018

Browse files
committed
update
1 parent 783c88b commit 78ed018

File tree

9 files changed

+272
-88
lines changed

9 files changed

+272
-88
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- dev
78
paths:
89
- 'LICENSE'
910
- 'CHANGELOG.md'

.gitignore

Lines changed: 132 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,135 @@
1-
*.egg-info/
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
211
build/
312
develop-eggs/
413
dist/
5-
.DS_store
6-
.venv/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
uv.lock
94+
95+
# celery beat schedule file
96+
celerybeat-schedule
97+
98+
# SageMath parsed files
99+
*.sage.py
100+
101+
# Environments
102+
.env
103+
.venv
104+
env/
105+
venv/
106+
ENV/
107+
env.bak/
108+
venv.bak/
109+
110+
# Spyder project settings
111+
.spyderproject
112+
.spyproject
113+
114+
# Rope project settings
115+
.ropeproject
116+
117+
# mkdocs documentation
118+
/site
119+
120+
# mypy
121+
.mypy_cache/
122+
.dmypy.json
123+
dmypy.json
124+
125+
# Pyre type checker
126+
.pyre/
127+
128+
# VS Code
129+
.vscode/
130+
131+
# PDM
132+
.pdm.toml
133+
__pypackages__/
134+
135+
.DS_Store

.pre-commit-config.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
repos:
2-
- repo: https://github.com/pycqa/isort
3-
rev: 5.13.2
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.12.5
44
hooks:
5-
- id: isort
6-
- repo: https://github.com/ambv/black
7-
rev: 22.12.0
5+
# Run the linter.
6+
- id: ruff
7+
args: [ --fix ]
8+
# Run the formatter.
9+
- id: ruff-format
10+
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
12+
rev: v5.0.0
813
hooks:
9-
- id: black
14+
- id: end-of-file-fixer
15+
- id: trailing-whitespace
16+
17+
- repo: https://github.com/aio-libs/sort-all
18+
rev: v1.3.0
19+
hooks:
20+
- id: sort-all

mkdocs.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ plugins:
103103
# - footnotes
104104
- search:
105105
lang: en
106+
- open-in-new-tab
106107
- mike:
107108
alias_type: symlink
108109
- glightbox
@@ -132,17 +133,11 @@ plugins:
132133
preload_modules: [ flet ]
133134
filters:
134135
- "!^_" # Exclude private members starting with only one underscore
135-
- "!before_update"
136-
- "!before_event"
137-
- "!clean"
138-
- "!did_mount"
139-
- "!init"
140-
- "!is_isolated"
141-
- "!update"
142-
- "!will_unmount"
143136
extensions:
144137
- griffe_modernized_annotations
138+
- griffe_warnings_deprecated
145139
inventories:
140+
- url: https://docs.flet.dev/objects.inv
146141
- url: https://docs.python.org/3/objects.inv
147142
domains: [ py, std ]
148143
- url: https://typing-extensions.readthedocs.io/en/latest/objects.inv

pyproject.toml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,40 @@ Issues = "https://github.com/flet-dev/flet-permission-handler/issues"
2222
"flutter.flet_permission_handler" = ["**/*"]
2323

2424
[dependency-groups]
25+
test = [
26+
"pytest >=7.2.0",
27+
]
2528
dev = [
26-
"pre-commit>=4.2.0",
27-
"ruff>=0.11.7",
29+
"pre-commit >=4.2.0",
30+
"ruff >=0.11.7",
31+
{ include-group = 'test' },
32+
]
33+
docs-coverage = [
34+
"docstr-coverage >=2.3.2",
2835
]
2936
docs = [
30-
"mkdocs",
31-
"mkdocs-material",
32-
"mkdocstrings[python]",
33-
"mkdocstrings-python-xref",
34-
"mike",
35-
"markdown>=3.6",
36-
"pymdown-extensions",
37-
"mkdocs-glightbox",
38-
"mkdocs-section-index",
39-
"griffe-modernized-annotations",
40-
"pygments>=2.16",
37+
"mkdocs >=1.6.1",
38+
"mkdocs-material >=9.6.15",
39+
"mkdocstrings-python >=1.16.12",
40+
"mkdocstrings-python-xref >=1.16.3",
41+
"mike >=2.1.3",
42+
"markdown >=3.6",
43+
"pymdown-extensions >=10.16",
44+
"mkdocs-exclude >=1.0.2",
45+
"mkdocs-glightbox >=0.4.0",
46+
"mkdocs-open-in-new-tab >=1.0.8",
47+
"mkdocs-section-index >=0.3.10",
48+
"griffe-modernized-annotations >=1.0.8",
49+
"griffe-warnings-deprecated >=1.1.0",
50+
"pygments >=2.16",
51+
"markdown-exec[ansi] >=1.11.0",
52+
"pydocstyle >=6.3.0",
53+
"linkcheckmd >=1.4.0",
54+
{ include-group = 'docs-coverage' },
55+
]
56+
all = [
57+
{ include-group = 'dev' },
58+
{ include-group = 'docs' },
4159
]
4260

4361
[build-system]
@@ -66,6 +84,7 @@ select = [
6684
"I"
6785
]
6886
preview = true
87+
pydocstyle = { convention = 'google' }
6988

7089
[tool.ruff.format]
7190
quote-style = "double"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
from .permission_handler import PermissionHandler
22
from .types import Permission, PermissionStatus
3+
4+
__all__ = [
5+
"Permission",
6+
"PermissionHandler",
7+
"PermissionStatus",
8+
]

src/flet_permission_handler/permission_handler.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ class PermissionHandler(ft.Service):
1515
This control is non-visual and should be added
1616
to [`Page.services`][flet.Page.services] list.
1717
18-
Note:
19-
Currently only supported on Android, iOS,
20-
Windows, and Web platforms.
18+
Danger: Platform support
19+
Currently only supported on Android, iOS, Windows, and Web platforms.
2120
2221
Raises:
2322
FletUnsupportedPlatformException: If the platform is not supported.
@@ -37,7 +36,8 @@ def before_update(self):
3736
]
3837
):
3938
raise ft.FletUnsupportedPlatformException(
40-
"PermissionHandler is currently only supported on Android, iOS, Windows, and Web platforms."
39+
"PermissionHandler is currently only supported on Android, iOS, "
40+
"Windows, and Web platforms."
4141
)
4242

4343
async def get_status_async(
@@ -57,28 +57,34 @@ async def get_status_async(
5757
TimeoutError: If the request times out.
5858
"""
5959
status = await self._invoke_method_async(
60-
"get_status", {"permission": permission}, timeout=timeout
60+
method_name="get_status",
61+
arguments={"permission": permission},
62+
timeout=timeout,
6163
)
6264
return PermissionStatus(status) if status is not None else None
6365

6466
async def request_async(
6567
self, permission: Permission, timeout: int = 60
6668
) -> Optional[PermissionStatus]:
6769
"""
68-
Request the user for access to the `permission` if access hasn't already been granted access before.
70+
Request the user for access to the `permission` if access hasn't already been
71+
granted access before.
6972
7073
Args:
7174
permission: The `Permission` to request.
7275
timeout: The maximum amount of time (in seconds) to wait for a response.
7376
7477
Returns:
75-
The new `PermissionStatus` after the request, or `None` if the request was not successful.
78+
The new `PermissionStatus` after the request, or `None` if the request
79+
was not successful.
7680
7781
Raises:
7882
TimeoutError: If the request times out.
7983
"""
8084
r = await self._invoke_method_async(
81-
"request", {"permission": permission}, timeout=timeout
85+
method_name="request",
86+
arguments={"permission": permission},
87+
timeout=timeout,
8288
)
8389
return PermissionStatus(r) if r is not None else None
8490

@@ -95,4 +101,7 @@ async def open_app_settings_async(self, timeout: int = 10) -> bool:
95101
Raises:
96102
TimeoutError: If the request times out.
97103
"""
98-
return await self._invoke_method_async("open_app_settings", timeout=timeout)
104+
return await self._invoke_method_async(
105+
method_name="open_app_settings",
106+
timeout=timeout,
107+
)

0 commit comments

Comments
 (0)