-
-
Notifications
You must be signed in to change notification settings - Fork 660
ruff #2882
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
Open
JacobCoffee
wants to merge
15
commits into
main
Choose a base branch
from
ruff
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ruff #2882
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a4fb2ff
ruff
JacobCoffee bd431e9
cant use not specific patch vers
JacobCoffee 7217b21
apply ruff linting and formatting to entire codebase with base rulesett
JacobCoffee 5c01da3
enable ruff ALL rules
JacobCoffee d0abbb1
clarify
JacobCoffee 800768e
fix ruff breakage
JacobCoffee c6afad2
do not allow relative imports
JacobCoffee aab58f7
no need to do f401?
JacobCoffee 2f294df
run ci
JacobCoffee a4bf621
fix ruff issues
JacobCoffee 2c4f075
Fix review comments: restore null=True, fix None url, re-add listener…
JacobCoffee c8d7a98
Restore null=True on all string fields to avoid unintended schema cha…
JacobCoffee 4ad9e02
fix ci issues
JacobCoffee 35da788
use 5.2
JacobCoffee bce078f
fix DTZ001 lint and restore users signal handler
JacobCoffee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Banner management for displaying site-wide announcements.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| """Admin configuration for the banners app.""" | ||
hugovk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| from django.contrib import admin | ||
|
|
||
| from banners.models import Banner | ||
|
|
||
|
|
||
| @admin.register(Banner) | ||
| class BannerAdmin(admin.ModelAdmin): | ||
| """Admin interface for managing site-wide banners.""" | ||
|
|
||
| list_display = ("title", "active", "psf_pages_only") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| """Django app configuration for the banners app.""" | ||
|
|
||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class BannersAppConfig(AppConfig): | ||
| """App configuration for the banners app.""" | ||
|
|
||
| name = 'banners' | ||
| name = "banners" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,17 @@ | ||
| """Models for site-wide announcement banners.""" | ||
|
|
||
| from django.db import models | ||
|
|
||
|
|
||
| class Banner(models.Model): | ||
| """A dismissible announcement banner displayed across the site.""" | ||
|
|
||
| title = models.CharField( | ||
| max_length=1024, help_text="Text to display in the banner's button" | ||
| ) | ||
| message = models.CharField( | ||
| max_length=2048, help_text="Message to display in the banner" | ||
| ) | ||
| title = models.CharField(max_length=1024, help_text="Text to display in the banner's button") | ||
| message = models.CharField(max_length=2048, help_text="Message to display in the banner") | ||
| link = models.CharField(max_length=1024, help_text="Link the button will go to") | ||
| active = models.BooleanField( | ||
| null=False, default=False, help_text="Make the banner active on the site" | ||
| ) | ||
| psf_pages_only = models.BooleanField( | ||
| null=False, default=True, help_text="Display the banner on /psf pages only" | ||
| ) | ||
| active = models.BooleanField(null=False, default=False, help_text="Make the banner active on the site") | ||
| psf_pages_only = models.BooleanField(null=False, default=True, help_text="Display the banner on /psf pages only") | ||
|
|
||
| def __str__(self): | ||
| """Return the banner title.""" | ||
| return self.title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Template tags for the banners app.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Blog aggregation and display for python.org.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,32 @@ | ||
| """Admin configuration for the blogs app.""" | ||
|
|
||
| from django.contrib import admin | ||
| from django.core.management import call_command | ||
|
|
||
| from .models import BlogEntry, Feed, FeedAggregate | ||
| from blogs.models import BlogEntry, Feed, FeedAggregate | ||
|
|
||
|
|
||
| @admin.register(BlogEntry) | ||
| class BlogEntryAdmin(admin.ModelAdmin): | ||
| list_display = ['title', 'pub_date'] | ||
| date_hierarchy = 'pub_date' | ||
| actions = ['sync_new_entries'] | ||
| """Admin interface for blog entries imported from RSS feeds.""" | ||
|
|
||
| list_display = ["title", "pub_date"] | ||
| date_hierarchy = "pub_date" | ||
| actions = ["sync_new_entries"] | ||
|
|
||
| @admin.action( | ||
| description="Sync new blog entries" | ||
| ) | ||
| @admin.action(description="Sync new blog entries") | ||
| def sync_new_entries(self, request, queryset): | ||
| call_command('update_blogs') | ||
| """Trigger the update_blogs management command to sync new entries.""" | ||
| call_command("update_blogs") | ||
| self.message_user(request, "Blog entries updated.") | ||
|
|
||
|
|
||
|
|
||
| @admin.register(FeedAggregate) | ||
| class FeedAggregateAdmin(admin.ModelAdmin): | ||
| list_display = ['name', 'slug', 'description'] | ||
| prepopulated_fields = {'slug': ('name',)} | ||
| """Admin interface for managing feed aggregates.""" | ||
|
|
||
| list_display = ["name", "slug", "description"] | ||
| prepopulated_fields = {"slug": ("name",)} | ||
|
|
||
|
|
||
| admin.site.register(Feed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| """Django app configuration for the blogs app.""" | ||
|
|
||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class BlogsAppConfig(AppConfig): | ||
| """App configuration for the blogs app.""" | ||
|
|
||
| name = 'blogs' | ||
| name = "blogs" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,20 @@ | ||
| """Factory functions for creating blog test and seed data.""" | ||
|
|
||
| from django.conf import settings | ||
|
|
||
| from .models import Feed | ||
| from blogs.models import Feed | ||
|
|
||
|
|
||
| def initial_data(): | ||
| """Create and return the default Python Insider blog feed.""" | ||
| feed, _ = Feed.objects.get_or_create( | ||
| id=1, | ||
| defaults={ | ||
| 'name': 'Python Insider', | ||
| 'website_url': settings.PYTHON_BLOG_URL, | ||
| 'feed_url': settings.PYTHON_BLOG_FEED_URL, | ||
| } | ||
| "name": "Python Insider", | ||
| "website_url": settings.PYTHON_BLOG_URL, | ||
| "feed_url": settings.PYTHON_BLOG_FEED_URL, | ||
| }, | ||
| ) | ||
| return { | ||
| 'feeds': [feed], | ||
| "feeds": [feed], | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Management commands for the blogs app.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.