8000 Fix issue #2135 - project code style and linter tools by luzfcb · Pull Request #2196 · python/pythondotorg · GitHub
[go: up one dir, main page]

Skip to content

Fix issue #2135 - project code style and linter tools #2196

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

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed unused imports and optimize imports
  • Loading branch information
luzfcb committed Dec 13, 2022
commit 6a36defef3021eeaf530431bb457df7c16d99f2a
6 changes: 5 additions & 1 deletion blogs/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from django.contrib import admin
from django.core.management import call_command

from .models import BlogEntry, Feed, FeedAggregate
from .models import (
BlogEntry,
Feed,
FeedAggregate,
)


@admin.register(BlogEntry)
Expand Down
11 changes: 9 additions & 2 deletions blogs/management/commands/update_blogs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
from django.core.management.base import BaseCommand
from django.utils.timezone import now

from ...models import BlogEntry, RelatedBlog, Feed
from ...parser import get_all_entries, update_blog_supernav
from ...models import (
BlogEntry,
Feed,
RelatedBlog,
)
from ...parser import (
get_all_entries,
update_blog_supernav,
)


class Command(BaseCommand):
Expand Down
2 changes: 0 additions & 2 deletions blogs/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import feedparser

from bs4 import BeautifulSoup
from bs4.element import Comment

from django.db import models

from cms.models import ContentManageable
Expand Down
12 changes: 9 additions & 3 deletions blogs/parser.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import datetime
import feedparser

import feedparser
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.timezone import make_aware, utc
from django.utils.timezone import (
make_aware,
utc,
)

from boxes.models import Box
from .models import BlogEntry, Feed
from .models import (
BlogEntry,
Feed,
)


def get_all_entries(feed_url):
Expand Down
5 changes: 4 additions & 1 deletion blogs/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from django.test import TestCase
from django.utils import timezone

from ..models import BlogEntry, Feed
from ..models import (
BlogEntry,
Feed,
)


class BlogModelTest(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion blogs/tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import datetime
import unittest

from ..parser import get_all_entries
from .utils import get_test_rss_path
from ..parser import get_all_entries


class BlogParserTest(unittest.TestCase):
Expand Down
13 changes: 10 additions & 3 deletions blogs/tests/test_templatetags.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
from django.core.management import call_command
from django.template import (
Context,
Template,
)
from django.test import TestCase
from django.template import Template, Context
from django.utils.timezone import now

from ..templatetags.blogs import get_latest_blog_entries
from ..models import BlogEntry, Feed, FeedAggregate
from .utils import get_test_rss_path
from ..models import (
BlogEntry,
Feed,
FeedAggregate,
)
from ..templatetags.blogs import get_latest_blog_entries


class BlogTemplateTagTest(TestCase):
Expand Down
8 changes: 5 additions & 3 deletions blogs/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from django.core.management import call_command
from django.urls import reverse
from django.test import TestCase

from ..models import BlogEntry, Feed
from django.urls import reverse

from .utils import get_test_rss_path
from ..models import (
BlogEntry,
Feed,
)


class BlogViewTest(TestCase):
Expand Down
3 changes: 2 additions & 1 deletion blogs/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from . import views
from django.urls import path

from . import views

urlpatterns = [
path('', views.BlogHome.as_view(), name='blog'),
]
1 change: 1 addition & 0 deletions boxes/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin

from cms.admin import ContentManageableModelAdmin
from .models import Box

Expand Down
4 changes: 1 addition & 3 deletions boxes/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
import pathlib

import factory

from django.conf import settings
from factory.django import DjangoModelFactory

from .models import Box

from users.factories import UserFactory
from .models import Box


class BoxFactory(DjangoModelFactory):
Expand Down
1 change: 1 addition & 0 deletions boxes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from django.conf import settings
from django.db import models
from markupfield.fields import MarkupField

from cms.models import ContentManageable

DEFAULT_MARKUP_TYPE = getattr(settings, 'DEFAULT_MARKUP_TYPE', 'restructuredtext')
Expand Down
7 changes: 6 additions & 1 deletion boxes/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import logging

from django import template
from django.test import TestCase, override_settings
from django.test import (
TestCase,
override_settings,
)

from .models import Box

logging.disable(logging.CRITICAL)
Expand Down
3 changes: 2 additions & 1 deletion boxes/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .views import box
from django.urls import path

from .views import box

urlpatterns = [
path('<slug:label>/', box, name='box'),
]
1 change: 1 addition & 0 deletions boxes/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.http import HttpResponse
from django.shortcuts import get_object_or_404

from .models import Box


Expand Down
5 changes: 4 additions & 1 deletion cms/management/commands/create_initial_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import pprint

from django.apps import apps
from django.core.management import BaseCommand, call_command
from django.core.management import (
BaseCommand,
call_command,
)


class Command(BaseCommand):
Expand Down
7 changes: 5 additions & 2 deletions cms/tests.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import datetime
import unittest
from unittest import mock

from django.template import Template, Context
from django.template import (
Context,
Template,
)
from django.test import TestCase

from .admin import ContentManageableModelAdmin
from .views import legacy_path
import datetime


class ContentManageableAdminTests(unittest.TestCase):
Expand Down
5 changes: 3 additions & 2 deletions cms/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.urls import reverse
from django.shortcuts import render
from urllib.parse import urljoin

from django.shortcuts import render
from django.urls import reverse

LEGACY_PYTHON_DOMAIN = 'http://legacy.python.org'
PYPI_URL = 'https://pypi.org/'

Expand Down
3 changes: 1 addition & 2 deletions codesamples/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.contrib import admin

from .models import CodeSample
from cms.admin import ContentManageableModelAdmin

from .models import CodeSample

admin.site.register(CodeSample, ContentManageableModelAdmin)
3 changes: 1 addition & 2 deletions codesamples/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import factory
from factory.django import DjangoModelFactory

from .models import CodeSample

from users.factories import UserFactory
from .models import CodeSample


class CodeSampleFactory(DjangoModelFactory):
Expand Down
7 changes: 4 additions & 3 deletions codesamples/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from django.conf import settings
from django.db import models
from django.template.defaultfilters import truncatechars, striptags
from django.template.defaultfilters import (
striptags,
truncatechars,
)
from markupfield.fields import MarkupField

from cms.models import ContentManageable

from .managers import CodeSampleQuerySet


DEFAULT_MARKUP_TYPE = getattr(settings, 'DEFAULT_MARKUP_TYPE', 'html')


Expand Down
12 changes: 10 additions & 2 deletions community/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
from django.contrib import admin

from .models import Link, Photo, Post, Video
from cms.admin import ContentManageableModelAdmin, ContentManageableStackedInline
from cms.admin import (
ContentManageableModelAdmin,
ContentManageableStackedInline,
)
from .models import (
Link,
Photo,
Post,
Video,
)


class LinkInline(ContentManageableStackedInline):
Expand Down
5 changes: 1 addition & 4 deletions community/models.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
from django.contrib.postgres.fields import JSONField
from django.urls import reverse
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _

from markupfield.fields import MarkupField

from cms.models import ContentManageable

from .managers import PostQuerySet


DEFAULT_MARKUP_TYPE = 'html'


Expand Down
3 changes: 2 additions & 1 deletion community/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from . import views
from django.urls import path

from . import views

app_name = 'community'
urlpatterns = [
path('', views.PostList.as_view(), name='post_list'),
Expand Down
5 changes: 4 additions & 1 deletion community/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from django.views.generic import ListView, DetailView
from django.views.generic import (
DetailView,
ListView,
)

from .models import Post

Expand Down
1 change: 0 additions & 1 deletion companies/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.contrib import admin

from cms.admin import NameSlugAdmin

from .models import Company


Expand Down
1 change: 0 additions & 1 deletion companies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from cms.models import NameSlugModel


DEFAULT_MARKUP_TYPE = getattr(settings, 'DEFAULT_MARKUP_TYPE', 'restructuredtext')


Expand Down
2 changes: 1 addition & 1 deletion companies/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.test import TestCase

from . import admin # coverage FTW
from . import admin # noqa: F401 coverage FTW
from .templatetags.companies import render_email


Expand Down
12 changes: 8 additions & 4 deletions custom_storages/storage.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import os
import posixpath
import re

from urllib.parse import unquote, urldefrag
from urllib.parse import (
unquote,
urldefrag,
)

from django.conf import settings
from django.contrib.staticfiles.storage import ManifestFilesMixin, StaticFilesStorage
from django.contrib.staticfiles.storage import (
ManifestFilesMixin,
StaticFilesStorage,
)
from django.contrib.staticfiles.utils import matches_patterns
from django.core.files.base import ContentFile

from pipeline.storage import PipelineMixin
from storages.backends.s3boto3 import S3Boto3Storage

Expand Down
2 changes: 0 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python3

import sys
import os
import time

extensions = [
Expand Down
11 changes: 9 additions & 2 deletions downloads/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
from django.contrib import admin

from .models import OS, Release, ReleaseFile
from cms.admin import ContentManageableModelAdmin, ContentManageableStackedInline
from cms.admin import (
ContentManageableModelAdmin,
ContentManageableStackedInline,
)
from .models import (
OS,
Release,
ReleaseFile,
)


@admin.register(OS)
Expand Down
Loading
0