Skip to content

Commit

Permalink
Merge pull request #68 from browniebroke/bugfix-deprecated-in
Browse files Browse the repository at this point in the history
Fix version deprecated for several Django 4.0 visitors
  • Loading branch information
browniebroke authored Jun 2, 2020
2 parents 7da11a6 + 608513c commit 05af3a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions django_codemod/visitors/encoding.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django_codemod.constants import DJANGO_20, DJANGO_40
from django_codemod.constants import DJANGO_30, DJANGO_40
from django_codemod.visitors.base import BaseSimpleFuncRenameTransformer


class ForceTextToForceStrTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.utils.encoding.force_text``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.utils.encoding.force_text"
rename_to = "django.utils.encoding.force_str"
Expand All @@ -14,7 +14,7 @@ class ForceTextToForceStrTransformer(BaseSimpleFuncRenameTransformer):
class SmartTextToForceStrTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.utils.encoding.smart_text``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.utils.encoding.smart_text"
rename_to = "django.utils.encoding.smart_str"
12 changes: 6 additions & 6 deletions django_codemod/visitors/translations.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django_codemod.constants import DJANGO_20, DJANGO_40
from django_codemod.constants import DJANGO_30, DJANGO_40
from django_codemod.visitors.base import BaseSimpleFuncRenameTransformer


class UGetTextToGetTextTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.utils.translation.ugettext``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.utils.translation.ugettext"
rename_to = "django.utils.translation.gettext"
Expand All @@ -14,7 +14,7 @@ class UGetTextToGetTextTransformer(BaseSimpleFuncRenameTransformer):
class UGetTextLazyToGetTextLazyTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.utils.translation.ugettext_lazy``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.utils.translation.ugettext_lazy"
rename_to = "django.utils.translation.gettext_lazy"
Expand All @@ -23,7 +23,7 @@ class UGetTextLazyToGetTextLazyTransformer(BaseSimpleFuncRenameTransformer):
class UGetTextNoopToGetTextNoopTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.utils.translation.ugettext_noop``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.utils.translation.ugettext_noop"
rename_to = "django.utils.translation.gettext_noop"
Expand All @@ -32,7 +32,7 @@ class UGetTextNoopToGetTextNoopTransformer(BaseSimpleFuncRenameTransformer):
class UNGetTextToNGetTextTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.utils.translation.ungettext``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.utils.translation.ungettext"
rename_to = "django.utils.translation.ngettext"
Expand All @@ -41,7 +41,7 @@ class UNGetTextToNGetTextTransformer(BaseSimpleFuncRenameTransformer):
class UNGetTextLazyToNGetTextLazyTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.utils.translation.ungettext_lazy``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.utils.translation.ungettext_lazy"
rename_to = "django.utils.translation.ngettext_lazy"
4 changes: 2 additions & 2 deletions django_codemod/visitors/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django_codemod.constants import DJANGO_20, DJANGO_40
from django_codemod.constants import DJANGO_30, DJANGO_40
from django_codemod.visitors.base import BaseSimpleFuncRenameTransformer


class URLToRePathTransformer(BaseSimpleFuncRenameTransformer):
"""Resolve deprecation of ``django.conf.urls.url``."""

deprecated_in = DJANGO_20
deprecated_in = DJANGO_30
removed_in = DJANGO_40
rename_from = "django.conf.urls.url"
rename_to = "django.urls.re_path"

0 comments on commit 05af3a3

Please sign in to comment.