Skip to content

Commit

Permalink
add from __future__ import annotations in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnv1 committed Jun 16, 2022
1 parent 3a51ebe commit 71234b2
Show file tree
Hide file tree
Showing 215 changed files with 430 additions and 1 deletion.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Expand Up @@ -17,7 +17,6 @@ repos:
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, 'from __future__ import annotations']
exclude: ^example/
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
hooks:
Expand Down
2 changes: 2 additions & 0 deletions example/-m_case/module/__main__.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from dynaconf import Dynaconf

settings = Dynaconf(
Expand Down
2 changes: 2 additions & 0 deletions example/app/app.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from dynaconf import settings

print(settings.MYSQL_HOST) # noqa
Expand Down
2 changes: 2 additions & 0 deletions example/app/mysettings.py
@@ -1,3 +1,5 @@
from __future__ import annotations

EXAMPLE = True
MYSQL_HOST = "server.com"
WORKS = "app"
2 changes: 2 additions & 0 deletions example/app_with_dotenv/app.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from dynaconf import settings

print(settings.MYSQL_HOST) # noqa
Expand Down
2 changes: 2 additions & 0 deletions example/apply_default_on_none/app.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from dynaconf import Dynaconf
from dynaconf import Validator

Expand Down
2 changes: 2 additions & 0 deletions example/common-encoding/program.py
@@ -1,4 +1,6 @@
# Take as example a program which connects to a database
from __future__ import annotations

import io
import os

Expand Down
1 change: 1 addition & 0 deletions example/common/program.py
@@ -1,4 +1,5 @@
# Take as example a program which connects to a database
from __future__ import annotations


def connect(server, port, username, password):
Expand Down
2 changes: 2 additions & 0 deletions example/compat.py
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import tempfile

Expand Down
2 changes: 2 additions & 0 deletions example/configure/app.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from dynaconf import settings

settings.configure(settings_module="/tmp/configure_test/settings.py")
Expand Down
2 changes: 2 additions & 0 deletions example/custom_loader/app.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from dynaconf import settings

with open(settings.find_file("settings.sff")) as settings_file:
Expand Down
1 change: 1 addition & 0 deletions example/custom_loader/my_custom_loader/sff_loader.py
@@ -1,5 +1,6 @@
# In order to have multiple envs support use BaseLoader
# Take a look in dynaconf/loaders/json_loader.py
from __future__ import annotations


def load(obj, env=None, silent=True, key=None, filename=None):
Expand Down
2 changes: 2 additions & 0 deletions example/debug/app.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from dynaconf import Dynaconf

settings = Dynaconf(settings_file="settings.toml")
Expand Down
3 changes: 3 additions & 0 deletions example/django_example/foo/a_plugin_folder/dynaconf_hooks.py
@@ -1,3 +1,6 @@
from __future__ import annotations


def post(settings):
data = {"dynaconf_merge": True}
if settings.get("ADD_BEATLES") is True:
Expand Down
2 changes: 2 additions & 0 deletions example/django_example/foo/a_plugin_folder/settings.py
@@ -1 +1,3 @@
from __future__ import annotations

BANDS = ["Metallica", "Black Sabbath", "Iron Maiden"]
3 changes: 3 additions & 0 deletions example/django_example/foo/dynaconf_hooks.py
@@ -1,2 +1,5 @@
from __future__ import annotations


def post(settings):
return {"HOOK_ON_DJANGO_APP": True}
2 changes: 2 additions & 0 deletions example/django_example/foo/settings.py
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import sys

Expand Down
2 changes: 2 additions & 0 deletions example/django_example/foo/urls.py
Expand Up @@ -13,6 +13,8 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from __future__ import annotations

from django.conf import settings
from django.contrib import admin
from django.urls import include
Expand Down
2 changes: 2 additions & 0 deletions example/django_example/foo/wsgi.py
Expand Up @@ -6,6 +6,8 @@
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
from __future__ import annotations

import os

from django.core.wsgi import get_wsgi_application
Expand Down
2 changes: 2 additions & 0 deletions example/django_example/manage.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import annotations

import os
import sys

Expand Down
2 changes: 2 additions & 0 deletions example/django_example/polls/admin.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.contrib import admin

# Register your models here.
2 changes: 2 additions & 0 deletions example/django_example/polls/apps.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.apps import AppConfig


Expand Down
2 changes: 2 additions & 0 deletions example/django_example/polls/models.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.db import models

# Create your models here.
2 changes: 2 additions & 0 deletions example/django_example/polls/tests.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
Expand Down
2 changes: 2 additions & 0 deletions example/django_example/polls/urls.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.urls import path

from . import views
Expand Down
2 changes: 2 additions & 0 deletions example/django_example/polls/views.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.conf import settings
from django.http import HttpResponse

Expand Down
2 changes: 2 additions & 0 deletions example/django_example/pulpsettings.py
@@ -1,3 +1,5 @@
from __future__ import annotations

REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES = (
"rest_framework.authentication.SessionAuthentication",
"pulpcore.app.authentication.PulpRemoteUserAuthentication",
Expand Down
2 changes: 2 additions & 0 deletions example/django_example/standalone_script.py
@@ -1,4 +1,6 @@
# You should start your standalone scripts with this:
from __future__ import annotations

from django.conf import settings

# This `DYNACONF.configure()` line may be useful in some cases
Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/foo/settings.py
@@ -1,3 +1,5 @@
from __future__ import annotations

import os

# Where is all the Django's settings?
Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/foo/urls.py
Expand Up @@ -13,6 +13,8 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from __future__ import annotations

from django.contrib import admin
from django.urls import include
from django.urls import path
Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/foo/wsgi.py
Expand Up @@ -6,6 +6,8 @@
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
from __future__ import annotations

import os

from django.core.wsgi import get_wsgi_application
Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/includes/plugin_settings.py
@@ -1,2 +1,4 @@
from __future__ import annotations

PLUGIN_ENABLED = True
PLUGIN_LIST = ["plugin1", "plugin2"]
2 changes: 2 additions & 0 deletions example/django_example_compat/manage.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import annotations

import os
import sys

Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/polls/admin.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.contrib import admin

# Register your models here.
2 changes: 2 additions & 0 deletions example/django_example_compat/polls/apps.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.apps import AppConfig


Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/polls/models.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.db import models

# Create your models here.
2 changes: 2 additions & 0 deletions example/django_example_compat/polls/tests.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.conf import settings
from django.test import TestCase

Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/polls/urls.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.urls import path

from . import views
Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/polls/views.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.conf import settings
from django.http import HttpResponse

Expand Down
2 changes: 2 additions & 0 deletions example/django_example_compat/standalone_script.py
@@ -1,4 +1,6 @@
# You should start your standalone scripts with this:
from __future__ import annotations

from django.conf import settings

# This `DYNACONF.configure()` line may be useful in some cases
Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/foo/settings.py
@@ -1,3 +1,5 @@
from __future__ import annotations

import os

# Where is all the Django's settings?
Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/foo/urls.py
Expand Up @@ -13,6 +13,8 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from __future__ import annotations

from django.conf import settings
from django.contrib import admin
from django.urls import include
Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/foo/wsgi.py
Expand Up @@ -6,6 +6,8 @@
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
from __future__ import annotations

import os

from django.core.wsgi import get_wsgi_application
Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/manage.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import annotations

import os
import sys

Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/polls/admin.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.contrib import admin

# Register your models here.
2 changes: 2 additions & 0 deletions example/django_pure/polls/apps.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.apps import AppConfig


Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/polls/models.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.db import models

# Create your models here.
2 changes: 2 additions & 0 deletions example/django_pure/polls/tests.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/polls/urls.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.urls import path

from . import views
Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/polls/views.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.conf import settings
from django.http import HttpResponse

Expand Down
2 changes: 2 additions & 0 deletions example/django_pure/standalone_script.py
@@ -1,4 +1,6 @@
# You should start your standalone scripts with this:
from __future__ import annotations

from django.conf import settings

# This `DYNACONF.configure()` line may be useful in some cases
Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/app/admin.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.contrib import admin

# Register your models here.
2 changes: 2 additions & 0 deletions example/django_pytest/app/apps.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.apps import AppConfig


Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/app/models.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.db import models

# Create your models here.
2 changes: 2 additions & 0 deletions example/django_pytest/app/tests/conftest.py
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest
from django.core.management import call_command

Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/app/tests/test_app.py
@@ -1,3 +1,5 @@
from __future__ import annotations

import django

django.setup() # noqa
Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/app/urls.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from app import views
from django.urls import include
from django.urls import path
Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/app/views.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.views.generic import TemplateView


Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/manage.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import annotations

import os
import sys

Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/project/settings.py
Expand Up @@ -3,6 +3,8 @@
https://docs.djangoproject.com/en/1.11/ref/settings/
https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
"""
from __future__ import annotations

import os
from collections import OrderedDict

Expand Down
2 changes: 2 additions & 0 deletions example/django_pytest/project/urls.py
@@ -1,4 +1,6 @@
# https://docs.djangoproject.com/en/1.10/topics/http/urls/
from __future__ import annotations

from django.contrib import admin
from django.urls import include
from django.urls import path
Expand Down

0 comments on commit 71234b2

Please sign in to comment.