Skip to content

Commit c4a4ead

Browse files
committed
Prepare for 0.8.0 release
1 parent fb4c4aa commit c4a4ead

26 files changed

+851
-731
lines changed

.gitignore

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,45 @@
1+
# Usually these files are written by a python script from a template
2+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
13
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
54
# C extensions
6-
*.so
7-
85
# Distribution / packaging
6+
# Installer logs
7+
# PyBuilder
8+
# PyInstaller
9+
# Sphinx documentation
10+
# Unit test / coverage reports
11+
*,cover
12+
*.egg-info/
13+
*.manifest
14+
*.py[cod]
15+
*.so
16+
*.spec
917
.Python
10-
/env/
18+
.coverage
19+
.coverage.*
20+
.eggs/
21+
.installed.cfg
22+
.pytest_cache
23+
/*.egg
24+
/.cache
25+
/.tox/
1126
/build/
12-
develop-eggs/
1327
/dist/
28+
/env/
29+
__pycache__/
30+
coverage.xml
31+
develop-eggs/
32+
docs/_build/
1433
downloads/
1534
eggs/
16-
.eggs/
35+
geckodriver.log
36+
htmlcov/
1737
lib/
1838
lib64/
39+
nosetests.xml
1940
parts/
20-
sdist/
21-
var/
22-
*.egg-info/
23-
.installed.cfg
24-
/*.egg
25-
26-
# PyInstaller
27-
# Usually these files are written by a python script from a template
28-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
29-
*.manifest
30-
*.spec
31-
32-
# Installer logs
33-
pip-log.txt
3441
pip-delete-this-directory.txt
35-
36-
# Unit test / coverage reports
37-
htmlcov/
38-
/.tox/
39-
.coverage
40-
.coverage.*
41-
/.cache
42-
nosetests.xml
43-
coverage.xml
44-
*,cover
45-
46-
# Sphinx documentation
47-
docs/_build/
48-
49-
# PyBuilder
42+
pip-log.txt
43+
sdist/
5044
target/
51-
52-
geckodriver.log
53-
.pytest_cache
45+
var/

.jshintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"eqeqeq": true,
1313
"eqnull": true,
1414
"es3": true,
15-
"esnext": false,
1615
"evil": false,
1716
"expr": true,
1817
"forin": false,

.pre-commit-config.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: 'v5.0.0'
4+
hooks:
5+
- id: check-merge-conflict
6+
exclude: "rst$"
7+
- repo: https://github.com/asottile/yesqa
8+
rev: v1.5.0
9+
hooks:
10+
- id: yesqa
11+
- repo: https://github.com/PyCQA/isort
12+
rev: '6.0.1'
13+
hooks:
14+
- id: isort
15+
- repo: https://github.com/psf/black
16+
rev: '25.1.0'
17+
hooks:
18+
- id: black
19+
language_version: python3 # Should be a command that runs python3.6+
20+
- repo: https://github.com/pre-commit/pre-commit-hooks
21+
rev: 'v5.0.0'
22+
hooks:
23+
- id: check-case-conflict
24+
- id: check-json
25+
- id: check-xml
26+
- id: check-yaml
27+
- id: debug-statements
28+
- id: check-added-large-files
29+
- id: end-of-file-fixer
30+
exclude: "[.]md$"
31+
- id: requirements-txt-fixer
32+
- id: trailing-whitespace
33+
exclude: "[.]ref$"
34+
- id: check-symlinks
35+
- id: debug-statements
36+
- repo: https://github.com/asottile/pyupgrade
37+
rev: 'v3.19.1'
38+
hooks:
39+
- id: pyupgrade
40+
args: ['--py39-plus']
41+
- repo: https://github.com/PyCQA/flake8
42+
rev: '7.1.2'
43+
hooks:
44+
- id: flake8

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
CHANGES
33
=========
44

5+
0.8.0 (2025-03-11)
6+
==================
7+
8+
- Make the library compatible with aiohttp 3.9+ and Python 3.9+
9+
510
0.7.0 (2018-03-05)
611
==================
712

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,3 @@
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202-

aiohttp_cors/__about__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"""
2020

2121
__title__ = "aiohttp-cors"
22-
__version__ = "0.7.0"
22+
__version__ = "0.8.0"
2323
__author__ = "Vladimir Rutsky and aio-libs team"
2424
__email__ = "[email protected]"
2525
__summary__ = "CORS support for aiohttp"
2626
__uri__ = "https://github.com/aio-libs/aiohttp-cors"
2727
__license__ = "Apache License, Version 2.0"
28-
__copyright__ = "2015-2018 {}".format(__author__)
28+
__copyright__ = f"2015 aio-libs team"

aiohttp_cors/__init__.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,52 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""CORS support for aiohttp.
16-
"""
15+
"""CORS support for aiohttp."""
1716

18-
from typing import Mapping, Union, Any
17+
from collections.abc import Mapping
18+
from typing import Any, Union
1919

2020
from aiohttp import web
2121

2222
from .__about__ import (
23-
__title__, __version__, __author__, __email__, __summary__, __uri__,
24-
__license__, __copyright__,
23+
__author__,
24+
__copyright__,
25+
__email__,
26+
__license__,
27+
__summary__,
28+
__title__,
29+
__uri__,
30+
__version__,
2531
)
26-
from .resource_options import ResourceOptions
2732
from .cors_config import CorsConfig
2833
from .mixin import CorsViewMixin, custom_cors
34+
from .resource_options import ResourceOptions
2935

3036
__all__ = (
31-
"__title__", "__version__", "__author__", "__email__", "__summary__",
32-
"__uri__", "__license__", "__copyright__",
33-
"setup", "CorsConfig", "ResourceOptions", "CorsViewMixin", "custom_cors"
37+
"CorsConfig",
38+
"CorsViewMixin",
39+
"ResourceOptions",
40+
"__author__",
41+
"__copyright__",
42+
"__email__",
43+
"__license__",
44+
"__summary__",
45+
"__title__",
46+
"__uri__",
47+
"__version__",
48+
"custom_cors",
49+
"setup",
3450
)
3551

3652

3753
APP_CONFIG_KEY: web.AppKey[CorsConfig] = web.AppKey("aiohttp_cors", CorsConfig)
3854

3955

40-
def setup(app: web.Application, *,
41-
defaults: Mapping[str, Union[ResourceOptions,
42-
Mapping[str, Any]]]=None) -> CorsConfig:
56+
def setup(
57+
app: web.Application,
58+
*,
59+
defaults: Mapping[str, Union[ResourceOptions, Mapping[str, Any]]] = None
60+
) -> CorsConfig:
4361
"""Setup CORS processing for the application.
4462
4563
To enable CORS for a resource you need to explicitly add route for

aiohttp_cors/abc.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""Abstract base classes.
16-
"""
15+
"""Abstract base classes."""
1716

1817
from abc import ABCMeta, abstractmethod
1918

2019
from aiohttp import web
2120

22-
2321
__all__ = ("AbstractRouterAdapter",)
2422

2523

@@ -46,14 +44,11 @@ class AbstractRouterAdapter(metaclass=ABCMeta):
4644
4745
In aiohttp >= 0.21.0 there are two routing entities: Resource and Route.
4846
You can configure CORS for Resource (which will be interpreted as default
49-
for all Routes on Resoures), and configure CORS for specific Route.
47+
for all Routes on Resources), and configure CORS for specific Route.
5048
"""
5149

5250
@abstractmethod
53-
def add_preflight_handler(self,
54-
routing_entity,
55-
handler,
56-
webview: bool=False):
51+
def add_preflight_handler(self, routing_entity, handler, webview: bool = False):
5752
"""Add OPTIONS handler for all routes defined by `routing_entity`.
5853
5954
Does nothing if CORS handler already handles routing entity.
@@ -69,9 +64,7 @@ def is_cors_enabled_on_request(self, request: web.Request) -> bool:
6964
"""Is `request` is a request for CORS-enabled resource."""
7065

7166
@abstractmethod
72-
def set_config_for_routing_entity(self,
73-
routing_entity,
74-
config):
67+
def set_config_for_routing_entity(self, routing_entity, config):
7568
"""Record configuration for routing entity.
7669
7770
If router implements hierarchical routing entities, stored config
@@ -83,10 +76,8 @@ def set_config_for_routing_entity(self,
8376

8477
@abstractmethod
8578
async def get_preflight_request_config(
86-
self,
87-
preflight_request: web.Request,
88-
origin: str,
89-
requested_method: str):
79+
self, preflight_request: web.Request, origin: str, requested_method: str
80+
):
9081
"""Get stored CORS configuration for specified HTTP method and origin
9182
that corresponds to preflight request.
9283

0 commit comments

Comments
 (0)