Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: None guardcheck #27

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/mypy.yml
Expand Up @@ -2,9 +2,9 @@ name: "Type Checking [mypy --strict]"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
unit_tests:
Expand All @@ -14,13 +14,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [ '3.6', '3.7', '3.8', '3.9' ]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all tags and branches
fetch-depth: 0 # fetch all tags and branches
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pyright.yml
Expand Up @@ -2,9 +2,9 @@ name: "Type Checking [pyright]"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
unit_tests:
Expand All @@ -14,15 +14,15 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [ '3.6', '3.7', '3.8', '3.9' ]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all tags and branches
fetch-depth: 0 # fetch all tags and branches
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '17'
node-version: "17"
- name: Install test dependencies
run: pip install .[test]
shell: bash
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -2,9 +2,9 @@ name: "Unit Test"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
jobs:
unit_tests:
name: Python ${{ matrix.python-version }}(${{ matrix.os }})
Expand All @@ -13,13 +13,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [ '3.6', '3.7', '3.8', '3.9' ]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all tags and branches
fetch-depth: 0 # fetch all tags and branches
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
Expand Down
8 changes: 6 additions & 2 deletions simple_di/providers.py
Expand Up @@ -196,7 +196,7 @@ def set(self, value: Any) -> None:
for i in self._path[:-1]:
if isinstance(i, Provider):
i = i.get()
_next: Union[_SentinelClass, Dict[Any, Any]] = _cursor.get(i, sentinel)
_next: Dict[Any, Any] = _cursor.get(i, sentinel)
if isinstance(_next, _SentinelClass):
_next = {}
_cursor[i] = _next
Expand All @@ -216,7 +216,11 @@ def get(self) -> Any:
for i in self._path:
if isinstance(i, Provider):
i = i.get()
_cursor = _cursor[i]
if isinstance(_cursor, dict):
_cursor = _cursor.get(i, None)
else:
if _cursor is not None:
_cursor = _cursor[i]
return _cursor

def reset(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py36,py37,py38
envlist = py36,py37,py38,py39,py310,py311

[testenv]
deps = pytest
Expand All @@ -9,4 +9,4 @@ commands =
pytest

[pytest]
addopts = -p no:warnings
addopts = -p no:warnings -vv