Black formatting and isort

This commit is contained in:
Samuel Clay 2024-04-24 09:50:42 -04:00
parent d1dafe7606
commit 7165aa1bf6
374 changed files with 1403 additions and 879 deletions

View file

@ -1,7 +1,8 @@
import subprocess
import sys
import time
import digitalocean
import subprocess
def test_ssh(drop):

View file

@ -1,9 +1,10 @@
#!/usr/bin/env python
import os
import time
import sys
import subprocess
import sys
import time
import digitalocean
OLD = False

View file

@ -2,9 +2,10 @@
# Retooled by Samuel Clay, August 2011
# Modified by Luke Hagan, 2011-11-05
import urllib.request, urllib.parse
import http.cookiejar
import json
import urllib.parse
import urllib.request
__author__ = "Dananjaya Ramanayake <dananjaya86@gmail.com>, Samuel Clay <samuel@newsblur.com>"
__version__ = "1.0"

View file

@ -1,7 +1,9 @@
from apps.analyzer.models import Category, FeatureCategory
from django.db.models.aggregates import Sum
import math
from django.db.models.aggregates import Sum
from apps.analyzer.models import Category, FeatureCategory
class Classifier:
def __init__(self, user, feed, phrases):

View file

@ -1,10 +1,12 @@
from django.contrib.auth.models import User
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from apps.analyzer.models import Category, FeatureCategory
import datetime
import re
import math
import re
from django.contrib.auth.models import User
from apps.analyzer.models import Category, FeatureCategory
from apps.reader.models import UserSubscription
from apps.rss_feeds.models import Feed
def entry_features(self, entry):

View file

@ -1,12 +1,14 @@
import re
import requests
from django import forms
from vendor.zebra.forms import StripePaymentForm
from django.utils.safestring import mark_safe
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from apps.profile.models import change_password, blank_authenticate, MGiftCode
from django.utils.safestring import mark_safe
from apps.profile.models import MGiftCode, blank_authenticate, change_password
from apps.social.models import MSocialProfile
from vendor.zebra.forms import StripePaymentForm
class PopularityQueryForm(forms.Form):

View file

@ -1,12 +1,14 @@
from bs4 import BeautifulSoup
from glob import glob
from collections import defaultdict
from math import log, exp
from random import random
import zlib
from apps.rss_feeds.models import MStory
from collections import defaultdict
from glob import glob
from math import exp, log
from random import random
from bs4 import BeautifulSoup
from nltk import FreqDist
from apps.rss_feeds.models import MStory
def lgammln(xx):
"""

View file

@ -1,8 +1,8 @@
# Generated by Django 2.0 on 2020-06-16 06:52
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -1,13 +1,15 @@
import datetime
import mongoengine as mongo
from collections import defaultdict
from django.db import models
from django.contrib.auth.models import User
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
import mongoengine as mongo
from django.conf import settings
from apps.rss_feeds.models import Feed
from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from django.db import models
from django.template.loader import render_to_string
from apps.analyzer.tasks import EmailPopularityQuery
from apps.rss_feeds.models import Feed
from utils import log as logging

View file

@ -1,14 +1,15 @@
from django.test.client import Client
from apps.rss_feeds.models import MStory
from django.test import TestCase
from django.core import management
from itertools import groupby
# from apps.analyzer.classifier import FisherClassifier
import nltk
from itertools import groupby
from apps.analyzer.tokenizer import Tokenizer
from vendor.reverend.thomas import Bayes
from django.core import management
from django.test import TestCase
from django.test.client import Client
from apps.analyzer.phrase_filter import PhraseFilter
from apps.analyzer.tokenizer import Tokenizer
from apps.rss_feeds.models import MStory
from vendor.reverend.thomas import Bayes
class QuadgramCollocationFinder(nltk.collocations.AbstractCollocationFinder):

View file

@ -6,8 +6,8 @@ Add your documents as two-element lists `[docname, [list_of_words_in_the_documen
See the README for a usage example.
"""
import sys
import os
import sys
class tfidf:

View file

@ -1,4 +1,5 @@
from django.conf.urls import url
from apps.analyzer import views
urlpatterns = [

View file

@ -1,19 +1,24 @@
import redis
from utils import log as logging
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_POST
from django.conf import settings
from django.shortcuts import render
from django.shortcuts import get_object_or_404, render
from django.views.decorators.http import require_POST
from mongoengine.queryset import NotUniqueError
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
from apps.analyzer.models import get_classifiers_for_user, MPopularityQuery
from apps.analyzer.forms import PopularityQueryForm
from apps.analyzer.models import (
MClassifierAuthor,
MClassifierFeed,
MClassifierTag,
MClassifierTitle,
MPopularityQuery,
get_classifiers_for_user,
)
from apps.reader.models import UserSubscription
from apps.rss_feeds.models import Feed
from apps.social.models import MSocialSubscription
from utils import json_functions as json
from utils.user_functions import get_user
from utils.user_functions import ajax_login_required
from utils import log as logging
from utils.user_functions import ajax_login_required, get_user
def index(requst):

View file

@ -1,4 +1,5 @@
from django.conf.urls import url
from apps.api import views
urlpatterns = [

View file

@ -1,10 +1,12 @@
import mongoengine as mongo
from itertools import groupby
from apps.rss_feeds.models import Feed
import mongoengine as mongo
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.models import Feed
from utils import json_functions as json
from utils.feed_functions import add_object_to_folder
from utils import log as logging
from utils.feed_functions import add_object_to_folder
class MCategory(mongo.Document):

View file

@ -1,4 +1,5 @@
from django.conf.urls import url
from apps.categories import views
urlpatterns = [

View file

@ -1,9 +1,10 @@
# Generated by Django 2.0 on 2020-06-16 06:52
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -1,20 +1,22 @@
import datetime
import mongoengine as mongo
import pickle
import base64
from oauth2client.client import Error as OAuthError
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from lxml import etree
from django.db import models
import datetime
import pickle
from xml.etree.ElementTree import Comment, Element, SubElement, tostring
import mongoengine as mongo
from django.contrib.auth.models import User
from django.db import models
from lxml import etree
from mongoengine.queryset import OperationError
from oauth2client.client import Error as OAuthError
import vendor.opml as opml
from apps.rss_feeds.models import Feed, DuplicateFeed
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from utils import json_functions as json, urlnorm
from apps.rss_feeds.models import DuplicateFeed, Feed
from utils import json_functions as json
from utils import log as logging
from utils.feed_functions import timelimit
from utils.feed_functions import add_object_to_folder
from utils import urlnorm
from utils.feed_functions import add_object_to_folder, timelimit
class OAuthToken(models.Model):

View file

@ -1,8 +1,9 @@
from newsblur_web.celeryapp import app
from django.contrib.auth.models import User
from apps.feed_import.models import UploadedOPML, OPMLImporter
from apps.feed_import.models import OPMLImporter, UploadedOPML
from apps.reader.models import UserSubscription
from apps.social.models import MActivity
from newsblur_web.celeryapp import app
from utils import log as logging

View file

@ -1,13 +1,15 @@
import os
from django.test.client import Client
from django.test import TestCase
from django.contrib.auth.models import User
from django.urls import reverse
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.models import merge_feeds, DuplicateFeed, Feed
from utils import json_functions as json_functions
import json
import os
from django.contrib.auth.models import User
from django.core.management import call_command
from django.test import TestCase
from django.test.client import Client
from django.urls import reverse
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.models import DuplicateFeed, Feed, merge_feeds
from utils import json_functions as json_functions
class Test_Import(TestCase):

View file

@ -1,4 +1,5 @@
from django.conf.urls import url
from apps.feed_import import views
urlpatterns = [

View file

@ -1,27 +1,28 @@
import base64
import datetime
import pickle
import base64
from utils import log as logging
from oauth2client.client import OAuth2WebServerFlow, FlowExchangeError
from bson.errors import InvalidStringData
import uuid
from django.contrib.sites.models import Site
from bson.errors import InvalidStringData
from django.conf import settings
from django.contrib.auth import login as login_user
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
# from django.db import IntegrityError
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.urls import reverse
from django.contrib.auth import login as login_user
from mongoengine.errors import ValidationError
from oauth2client.client import FlowExchangeError, OAuth2WebServerFlow
from apps.feed_import.models import OAuthToken, OPMLExporter, OPMLImporter, UploadedOPML
from apps.feed_import.tasks import ProcessOPML
from apps.reader.forms import SignupForm
from apps.reader.models import UserSubscription
from apps.feed_import.models import OAuthToken
from apps.feed_import.models import OPMLImporter, OPMLExporter, UploadedOPML
from apps.feed_import.tasks import ProcessOPML
from utils import json_functions as json
from utils.user_functions import ajax_login_required, get_user
from utils import log as logging
from utils.feed_functions import TimeoutError
from utils.user_functions import ajax_login_required, get_user
@ajax_login_required

View file

@ -1,4 +1,5 @@
from django.conf.urls import url
from apps.mobile import views
urlpatterns = [

View file

@ -1,8 +1,10 @@
import os
import base64
import os
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render
from apps.profile.models import Profile
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from utils import json_functions as json

View file

@ -1,4 +1,5 @@
from django.conf.urls import url
from apps.monitor.views import (
AppServers,
AppTimes,
@ -7,6 +8,7 @@ from apps.monitor.views import (
Errors,
FeedCounts,
Feeds,
FeedSizes,
LoadTimes,
Stories,
TasksCodes,
@ -15,7 +17,6 @@ from apps.monitor.views import (
TasksTimes,
Updates,
Users,
FeedSizes,
)
urlpatterns = [

View file

@ -1,7 +1,8 @@
import datetime
from django.conf import settings
from django.views import View
from django.shortcuts import render
from django.views import View
class AppServers(View):

View file

@ -1,7 +1,8 @@
from django.views import View
from django.shortcuts import render
import datetime
from django.conf import settings
from django.shortcuts import render
from django.views import View
class AppTimes(View):

View file

@ -1,6 +1,12 @@
from django.views import View
from django.shortcuts import render
from apps.analyzer.models import MClassifierFeed, MClassifierAuthor, MClassifierTag, MClassifierTitle
from django.views import View
from apps.analyzer.models import (
MClassifierAuthor,
MClassifierFeed,
MClassifierTag,
MClassifierTitle,
)
class Classifiers(View):

View file

@ -1,9 +1,10 @@
import redis
from django.conf import settings
from django.shortcuts import render
from django.views import View
import redis
from apps.rss_feeds.models import Feed, DuplicateFeed
from apps.push.models import PushSubscription
from apps.rss_feeds.models import DuplicateFeed, Feed
from apps.statistics.models import MStatistics

View file

@ -1,10 +1,11 @@
import redis
from django.conf import settings
from django.db.models import Sum
from django.shortcuts import render
from django.views import View
from django.db.models import Sum
import redis
from apps.rss_feeds.models import Feed, DuplicateFeed
from apps.push.models import PushSubscription
from apps.rss_feeds.models import DuplicateFeed, Feed
from apps.statistics.models import MStatistics

View file

@ -1,8 +1,8 @@
from django.views import View
from django.shortcuts import render
from django.views import View
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from apps.rss_feeds.models import Feed
from apps.social.models import MSocialProfile, MSocialSubscription
from apps.statistics.models import MStatistics

View file

@ -1,7 +1,7 @@
from django.views import View
from django.shortcuts import render
from apps.rss_feeds.models import MStory, MStarredStory
from apps.rss_feeds.models import MStory, MStarredStory
from django.views import View
from apps.rss_feeds.models import MStarredStory, MStory
class Stories(View):

View file

@ -1,4 +1,5 @@
import datetime
from django.conf import settings
from django.shortcuts import render
from django.views import View

View file

@ -1,5 +1,4 @@
import redis
from django.conf import settings
from django.shortcuts import render
from django.views import View

View file

@ -1,8 +1,8 @@
import os
import socket
from django.views import View
from django.shortcuts import render
from django.views import View
"""
RedisActiveConnections

View file

@ -1,21 +1,22 @@
import datetime
import re
import redis
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives
from django.urls import reverse
from django.conf import settings
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.html import linebreaks
from apps.rss_feeds.models import Feed, MStory, MFetchHistory
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.profile.models import Profile, MSentEmail
from apps.notifications.tasks import QueueNotifications
from apps.notifications.models import MUserFeedNotification
from apps.notifications.models import MUserFeedNotification
from apps.notifications.tasks import QueueNotifications
from apps.profile.models import MSentEmail, Profile
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.models import Feed, MFetchHistory, MStory
from utils import log as logging
from utils.story_functions import linkify
from utils.scrubber import Scrubber
from utils.story_functions import linkify
class EmailNewsletter:

View file

@ -1,4 +1,5 @@
from django.conf.urls import url
from apps.newsletters import views
urlpatterns = [

View file

@ -1,9 +1,11 @@
from pprint import pprint
from django.http import HttpResponse, Http404
from django.conf import settings
from utils import log as logging
from django.http import Http404, HttpResponse
from apps.newsletters.models import EmailNewsletter
from apps.rss_feeds.models import Feed, MStory
from utils import log as logging
def newsletter_receive(request):

View file

@ -1,34 +1,36 @@
import datetime
import enum
import html
import redis
import re
import urllib.parse
import mongoengine as mongo
import redis
from apns2.client import APNsClient
from apns2.errors import BadDeviceToken, DeviceTokenNotForTopic, Unregistered
from apns2.payload import Payload
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
# from django.utils.html import strip_tags
from apps.rss_feeds.models import MStory, Feed
from apps.reader.models import UserSubscription
from apps.analyzer.models import (
MClassifierTitle,
MClassifierAuthor,
MClassifierFeed,
MClassifierTag,
MClassifierTitle,
compute_story_score,
)
from apps.analyzer.models import compute_story_score
from utils.view_functions import is_true
from utils.story_functions import truncate_chars
from apps.reader.models import UserSubscription
# from django.utils.html import strip_tags
from apps.rss_feeds.models import Feed, MStory
from utils import log as logging
from utils import mongoengine_fields
from apns2.errors import BadDeviceToken, Unregistered, DeviceTokenNotForTopic
from apns2.client import APNsClient
from apns2.payload import Payload
from bs4 import BeautifulSoup
import urllib.parse
from utils.story_functions import truncate_chars
from utils.view_functions import is_true
class NotificationFrequency(enum.Enum):

View file

@ -1,6 +1,7 @@
from newsblur_web.celeryapp import app
from django.contrib.auth.models import User
from apps.notifications.models import MUserFeedNotification
from newsblur_web.celeryapp import app
from utils import log as logging

View file

@ -1,7 +1,8 @@
from django.conf.urls import url
from apps.notifications import views
from oauth2_provider import views as op_views
from apps.notifications import views
urlpatterns = [
url(r"^$", views.notifications_by_feed, name="notifications-by-feed"),
url(r"^feed/?$", views.set_notifications_for_feed, name="set-notifications-for-feed"),

View file

@ -1,12 +1,13 @@
import redis
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from utils import json_functions as json
from utils.user_functions import get_user, ajax_login_required
from apps.notifications.models import MUserFeedNotification, MUserNotificationTokens
from apps.rss_feeds.models import Feed
from utils.view_functions import required_params
from utils import json_functions as json
from utils import log as logging
from utils.user_functions import ajax_login_required, get_user
from utils.view_functions import required_params
@ajax_login_required

View file

@ -1,7 +1,8 @@
from django.conf.urls import url
from apps.oauth import views
from oauth2_provider import views as op_views
from apps.oauth import views
urlpatterns = [
url(r"^twitter_connect/?$", views.twitter_connect, name="twitter-connect"),
url(r"^facebook_connect/?$", views.facebook_connect, name="facebook-connect"),

View file

@ -1,27 +1,35 @@
import urllib.request, urllib.parse, urllib.error
import datetime
import urllib.error
import urllib.parse
import urllib.request
import lxml.html
import tweepy
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.urls import reverse
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.conf import settings
from mongoengine.queryset import NotUniqueError
from mongoengine.queryset import OperationError
from apps.social.models import MSocialServices, MSocialSubscription, MSharedStory
from apps.social.tasks import SyncTwitterFriends, SyncFacebookFriends
from apps.reader.models import UserSubscription, UserSubscriptionFolders, RUserStory
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
from apps.analyzer.models import compute_story_score
from apps.rss_feeds.models import Feed, MStory, MStarredStoryCounts, MStarredStory
from django.urls import reverse
from mongoengine.queryset import NotUniqueError, OperationError
from apps.analyzer.models import (
MClassifierAuthor,
MClassifierFeed,
MClassifierTag,
MClassifierTitle,
compute_story_score,
)
from apps.reader.models import RUserStory, UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.models import Feed, MStarredStory, MStarredStoryCounts, MStory
from apps.rss_feeds.text_importer import TextImporter
from apps.social.models import MSharedStory, MSocialServices, MSocialSubscription
from apps.social.tasks import SyncFacebookFriends, SyncTwitterFriends
from utils import json_functions as json
from utils import log as logging
from utils import urlnorm
from utils.user_functions import ajax_login_required, oauth_login_required
from utils.view_functions import render_to
from utils import urlnorm
from utils import json_functions as json
from vendor import facebook

View file

@ -1,6 +1,7 @@
import factory
from factory.django import DjangoModelFactory
from django.contrib.auth.models import User
from factory.django import DjangoModelFactory
from apps.profile.models import Profile

View file

@ -1,12 +1,19 @@
import re
import requests
from django import forms
from vendor.zebra.forms import StripePaymentForm
from django.utils.safestring import mark_safe
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from apps.profile.models import change_password, blank_authenticate, MGiftCode, MCustomStyling
from django.utils.safestring import mark_safe
from apps.profile.models import (
MCustomStyling,
MGiftCode,
blank_authenticate,
change_password,
)
from apps.social.models import MSocialProfile
from vendor.zebra.forms import StripePaymentForm
PLANS = [
("newsblur-premium-36", mark_safe("$36 / year <span class='NB-small'>($3/month)</span>")),

View file

@ -1,4 +1,5 @@
import time
from django.core.management.base import BaseCommand
from django.db import connections
from django.db.utils import OperationalError

View file

@ -1,5 +1,5 @@
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
class Command(BaseCommand):

View file

@ -1,11 +1,13 @@
import stripe, datetime, time
import datetime
import time
import stripe
from django.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from apps.profile.models import PaymentHistory, Profile
from utils import log as logging
from apps.profile.models import Profile, PaymentHistory
class Command(BaseCommand):

View file

@ -1,10 +1,12 @@
import stripe, datetime, time
from django.conf import settings
import datetime
import time
import stripe
from django.conf import settings
from django.core.management.base import BaseCommand
from utils import log as logging
from apps.profile.models import Profile
from utils import log as logging
class Command(BaseCommand):

View file

@ -1,15 +1,17 @@
import datetime
import re
import random
import re
import time
import redis
from utils import log as logging
from django.http import HttpResponse
from django.conf import settings
from django.db import connection
from django.template import Template, Context
from django.http import HttpResponse
from django.template import Context, Template
from apps.statistics.rstats import round_time
from utils import json_functions as json
from utils import log as logging
class LastSeenMiddleware(object):

View file

@ -1,9 +1,11 @@
# Generated by Django 2.0 on 2020-06-16 06:52
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import vendor.timezones.fields

View file

@ -1,8 +1,8 @@
# Generated by Django 2.0 on 2020-06-20 08:03
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -1,6 +1,7 @@
# Generated by Django 3.0.10 on 2020-10-05 09:32
from django.db import migrations
import vendor.timezones.fields

View file

@ -1,6 +1,7 @@
# Generated by Django 3.1.10 on 2022-01-10 21:06
from django.db import migrations, models
import vendor.timezones.fields

View file

@ -1,6 +1,7 @@
# Generated by Django 3.1.10 on 2022-01-25 21:08
from django.db import migrations, models
import vendor.timezones.fields

View file

@ -1,8 +1,8 @@
# Generated by Django 3.1.10 on 2022-02-08 23:15
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -1,6 +1,7 @@
# Generated by Django 3.1.10 on 2022-04-08 19:08
from django.db import migrations, models
import vendor.timezones.fields

View file

@ -1,6 +1,7 @@
# Generated by Django 3.1.10 on 2022-05-11 17:10
from django.db import migrations
import vendor.timezones.fields

View file

@ -1,45 +1,45 @@
import time
import datetime
from wsgiref.util import application_uri
import dateutil
import stripe
import hashlib
import re
import redis
import time
import uuid
import paypalrestsdk
from wsgiref.util import application_uri
import dateutil
import mongoengine as mongo
from django.db import models
from django.db import IntegrityError
from django.db.utils import DatabaseError
from django.db.models.signals import post_save
from django.db.models import Sum, Avg, Count
from django.db.models import Q
import paypalrestsdk
import redis
import stripe
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives
from django.core.mail import mail_admins
from django.urls import reverse
from django.core.mail import EmailMultiAlternatives, mail_admins
from django.db import IntegrityError, models
from django.db.models import Avg, Count, Q, Sum
from django.db.models.signals import post_save
from django.db.utils import DatabaseError
from django.template.loader import render_to_string
from apps.rss_feeds.models import Feed, MStory, MStarredStory
from apps.rss_feeds.tasks import SchedulePremiumSetup
from apps.feed_import.models import OPMLExporter
from apps.reader.models import UserSubscription
from apps.reader.models import RUserStory
from utils import log as logging
from utils import json_functions as json
from utils.user_functions import generate_secret_token
from utils.feed_functions import chunks
from vendor.timezones.fields import TimeZoneField
from paypal.standard.ipn.signals import valid_ipn_received, invalid_ipn_received
from django.urls import reverse
from paypal.standard.ipn.models import PayPalIPN
from zebra.signals import zebra_webhook_customer_subscription_created
from zebra.signals import zebra_webhook_customer_subscription_updated
from zebra.signals import zebra_webhook_charge_succeeded
from zebra.signals import zebra_webhook_charge_refunded
from zebra.signals import zebra_webhook_checkout_session_completed
from paypal.standard.ipn.signals import invalid_ipn_received, valid_ipn_received
from zebra.signals import (
zebra_webhook_charge_refunded,
zebra_webhook_charge_succeeded,
zebra_webhook_checkout_session_completed,
zebra_webhook_customer_subscription_created,
zebra_webhook_customer_subscription_updated,
)
from apps.feed_import.models import OPMLExporter
from apps.reader.models import RUserStory, UserSubscription
from apps.rss_feeds.models import Feed, MStarredStory, MStory
from apps.rss_feeds.tasks import SchedulePremiumSetup
from utils import json_functions as json
from utils import log as logging
from utils.feed_functions import chunks
from utils.user_functions import generate_secret_token
from vendor.timezones.fields import TimeZoneField
class Profile(models.Model):
@ -167,8 +167,13 @@ class Profile(models.Model):
except:
logging.user(self.user, "~BR~SK~FWError cancelling premium renewal for: %s" % self.user.username)
from apps.social.models import MSocialProfile, MSharedStory, MSocialSubscription
from apps.social.models import MActivity, MInteraction
from apps.social.models import (
MActivity,
MInteraction,
MSharedStory,
MSocialProfile,
MSocialSubscription,
)
try:
social_profile = MSocialProfile.objects.get(user_id=self.user.pk)
@ -1420,7 +1425,7 @@ class Profile(models.Model):
logging.user(self.user, "~BB~FM~SBSending OPML backup email to: %s" % self.user.email)
def send_first_share_to_blurblog_email(self, force=False):
from apps.social.models import MSocialProfile, MSharedStory
from apps.social.models import MSharedStory, MSocialProfile
if not self.user.email:
return

View file

@ -1,9 +1,10 @@
import datetime
from newsblur_web.celeryapp import app
from apps.profile.models import Profile, RNewUserQueue
from utils import log as logging
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.social.models import MSocialServices, MActivity, MInteraction
from apps.social.models import MActivity, MInteraction, MSocialServices
from newsblur_web.celeryapp import app
from utils import log as logging
@app.task(name="email-new-user")

View file

@ -1,10 +1,11 @@
from utils import json_functions as json
from django.test.client import Client
from django.test import TestCase
from django.urls import reverse
from django.conf import settings
from django.test import TestCase
from django.test.client import Client
from django.urls import reverse
from mongoengine.connection import connect, disconnect
from utils import json_functions as json
class Test_Profile(TestCase):
fixtures = [

View file

@ -1,4 +1,5 @@
from django.conf.urls import *
from apps.profile import views
urlpatterns = [

View file

@ -1,41 +1,60 @@
import re
import stripe
import requests
import datetime
import json as python_json
import re
import dateutil
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.contrib.auth import logout as logout_user
import requests
import stripe
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth import login as login_user
from django.contrib.auth import logout as logout_user
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.mail import mail_admins
from django.db.models.aggregates import Sum
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.contrib.admin.views.decorators import staff_member_required
from django.urls import reverse
from django.shortcuts import render
from django.core.mail import mail_admins
from django.conf import settings
from apps.profile.models import Profile, PaymentHistory, RNewUserQueue, MRedeemedCode, MGiftCode, PaypalIds
from apps.reader.models import UserSubscription, UserSubscriptionFolders, RUserStory
from apps.profile.forms import StripePlusPaymentForm, PLANS, DeleteAccountForm
from apps.profile.forms import ForgotPasswordForm, ForgotPasswordReturnForm, AccountSettingsForm
from apps.profile.forms import RedeemCodeForm
from apps.reader.forms import SignupForm, LoginForm
from apps.rss_feeds.models import MStarredStory, MStarredStoryCounts
from apps.social.models import MSocialServices, MActivity, MSocialProfile
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
from utils import json_functions as json
import json as python_json
from utils.user_functions import ajax_login_required
from utils.view_functions import render_to, is_true
from utils.user_functions import get_user
from utils import log as logging
from vendor.paypalapi.exceptions import PayPalAPIResponseError
from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.views.decorators.http import require_POST
from paypal.standard.forms import PayPalPaymentsForm
from paypal.standard.ipn.views import ipn as paypal_standard_ipn
from apps.analyzer.models import (
MClassifierAuthor,
MClassifierFeed,
MClassifierTag,
MClassifierTitle,
)
from apps.profile.forms import (
PLANS,
AccountSettingsForm,
DeleteAccountForm,
ForgotPasswordForm,
ForgotPasswordReturnForm,
RedeemCodeForm,
StripePlusPaymentForm,
)
from apps.profile.models import (
MGiftCode,
MRedeemedCode,
PaymentHistory,
PaypalIds,
Profile,
RNewUserQueue,
)
from apps.reader.forms import LoginForm, SignupForm
from apps.reader.models import RUserStory, UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.models import MStarredStory, MStarredStoryCounts
from apps.social.models import MActivity, MSocialProfile, MSocialServices
from utils import json_functions as json
from utils import log as logging
from utils.user_functions import ajax_login_required, get_user
from utils.view_functions import is_true, render_to
from vendor.paypalapi.exceptions import PayPalAPIResponseError
INTEGER_FIELD_PREFS = ("feed_pane_size", "days_of_unread")
SINGLE_FIELD_PREFS = (
"timezone",

View file

@ -1,8 +1,9 @@
# Generated by Django 2.0 on 2020-06-16 06:52
import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,19 +1,19 @@
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
import hashlib
import re
from datetime import datetime, timedelta
import feedparser
import requests
import re
from django.conf import settings
from django.db import models
from django.urls import reverse
import hashlib
from apps.push import signals
from apps.rss_feeds.models import Feed
from utils import log as logging
from utils.feed_functions import timelimit, TimeoutError
from utils.feed_functions import TimeoutError, timelimit
DEFAULT_LEASE_SECONDS = 10 * 24 * 60 * 60 # 10 days

View file

@ -23,14 +23,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from datetime import datetime, timedelta
import urllib
from datetime import datetime, timedelta
from django.urls import reverse
from django.test import TestCase
from django.urls import reverse
from apps.push.models import PushSubscription, PushSubscriptionManager
from apps.push.signals import pre_subscribe, verified, updated
from apps.push.signals import pre_subscribe, updated, verified
class MockResponse(object):

View file

@ -1,4 +1,5 @@
from django.conf.urls import *
from apps.push import views
urlpatterns = [

View file

@ -1,10 +1,10 @@
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
import feedparser
import random
import datetime
import random
from django.http import HttpResponse, Http404
import feedparser
from django.http import Http404, HttpResponse
from django.http.request import UnreadablePostError
from django.shortcuts import get_object_or_404

View file

@ -1,6 +1,7 @@
from apps.reader.models import UserSubscription, UserSubscriptionFolders, Feature
from django.contrib import admin
from apps.reader.models import Feature, UserSubscription, UserSubscriptionFolders
admin.site.register(UserSubscription)
admin.site.register(UserSubscriptionFolders)
admin.site.register(Feature)

View file

@ -1,10 +1,11 @@
import factory
from factory.fuzzy import FuzzyAttribute
from factory.django import DjangoModelFactory
from factory.fuzzy import FuzzyAttribute
from faker import Faker
from apps.rss_feeds.factories import FeedFactory
from apps.reader.models import Feature, UserSubscription, UserSubscriptionFolders
from apps.profile.factories import UserFactory
from apps.reader.models import Feature, UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.factories import FeedFactory
fake = Faker()

View file

@ -1,17 +1,24 @@
import datetime
from django import forms
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.db.models import Q
from django.conf import settings
from apps.reader.models import Feature
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.db.models import Q
from django.utils.translation import gettext_lazy as _
from dns.resolver import (
NXDOMAIN,
NoAnswer,
NoNameservers,
NoResolverConfiguration,
query,
)
from apps.profile.models import RNewUserQueue, blank_authenticate
from apps.profile.tasks import EmailNewUser
from apps.reader.models import Feature
from apps.social.models import MActivity
from apps.profile.models import blank_authenticate, RNewUserQueue
from utils import log as logging
from dns.resolver import query, NXDOMAIN, NoNameservers, NoAnswer
from dns.resolver import NoResolverConfiguration
class LoginForm(forms.Form):

View file

@ -1,6 +1,8 @@
import sys
from django.db import models
from django.contrib.auth.models import User
from django.db import models
from apps.rss_feeds.models import DuplicateFeed
from utils import log as logging

View file

@ -1,10 +1,12 @@
# Generated by Django 2.0 on 2020-06-16 06:52
import apps.reader.models
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import apps.reader.models
class Migration(migrations.Migration):

View file

@ -1,34 +1,37 @@
import datetime
import time
import re
import redis
import pymongo
import celery
import mongoengine as mongo
import time
from operator import itemgetter
from pprint import pprint
from utils import log as logging
from utils import json_functions as json
from django.db import models, IntegrityError
from django.db.models import Q
from django.db.models import Count
import celery
import mongoengine as mongo
import pymongo
import redis
from django.conf import settings
from django.contrib.auth.models import User
from django.core.cache import cache
from django.db import IntegrityError, models
from django.db.models import Count, Q
from django.template.defaultfilters import slugify
from mongoengine.queryset import OperationError
from mongoengine.queryset import NotUniqueError
from apps.reader.managers import UserSubscriptionManager
from apps.rss_feeds.models import Feed, MStory, DuplicateFeed
from apps.rss_feeds.tasks import NewFeeds
from apps.analyzer.models import MClassifierFeed, MClassifierAuthor, MClassifierTag, MClassifierTitle
from mongoengine.queryset import NotUniqueError, OperationError
from apps.analyzer.models import (
apply_classifier_titles,
apply_classifier_feeds,
MClassifierAuthor,
MClassifierFeed,
MClassifierTag,
MClassifierTitle,
apply_classifier_authors,
apply_classifier_feeds,
apply_classifier_tags,
apply_classifier_titles,
)
from apps.analyzer.tfidf import tfidf
from apps.reader.managers import UserSubscriptionManager
from apps.rss_feeds.models import DuplicateFeed, Feed, MStory
from apps.rss_feeds.tasks import NewFeeds
from utils import json_functions as json
from utils import log as logging
from utils.feed_functions import add_object_to_folder, chunks

View file

@ -1,10 +1,12 @@
import datetime
from newsblur_web.celeryapp import app
from utils import log as logging
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth.models import User
from apps.reader.models import UserSubscription
from apps.social.models import MSocialSubscription
from newsblur_web.celeryapp import app
from utils import log as logging
@app.task(name="freshen-homepage")

View file

@ -1,10 +1,11 @@
from utils import json_functions as json
from django.test.client import Client
from django.test import TestCase
from django.urls import reverse
from django.conf import settings
from django.test import TestCase
from django.test.client import Client
from django.urls import reverse
from mongoengine.connection import connect, disconnect
from utils import json_functions as json
class Test_Reader(TestCase):
fixtures = [

View file

@ -1,4 +1,5 @@
from django.conf.urls import *
from apps.reader import views
urlpatterns = [

View file

@ -1,8 +1,8 @@
# Generated by Django 2.0 on 2020-06-16 06:52
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -1,11 +1,13 @@
import mongoengine as mongo
from django.db import models
from django.contrib.auth.models import User
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from utils import json_functions as json
from collections import defaultdict
import mongoengine as mongo
from django.contrib.auth.models import User
from django.db import models
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.rss_feeds.models import Feed
from utils import json_functions as json
class RecommendedFeed(models.Model):
feed = models.ForeignKey(Feed, related_name="recommendations", on_delete=models.CASCADE)

View file

@ -1,9 +1,10 @@
import datetime
from django import template
from apps.reader.models import UserSubscription
from utils.user_functions import get_user
from apps.rss_feeds.models import MFeedIcon
from django import template
from apps.reader.models import UserSubscription
from apps.rss_feeds.models import MFeedIcon
from utils.user_functions import get_user
register = template.Library()

View file

@ -1,4 +1,5 @@
from django.conf.urls import *
from apps.recommendations import views
urlpatterns = [

View file

@ -1,13 +1,15 @@
import re
import datetime
from utils import log as logging
import re
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from apps.recommendations.models import RecommendedFeed
from django.shortcuts import get_object_or_404, render
from apps.reader.models import UserSubscription
from apps.recommendations.models import RecommendedFeed
from apps.rss_feeds.models import Feed, MFeedIcon
from utils import json_functions as json
from utils.user_functions import get_user, ajax_login_required, admin_only
from utils import log as logging
from utils.user_functions import admin_only, ajax_login_required, get_user
def load_recommended_feed(request):

View file

@ -1,4 +1,5 @@
from apps.rss_feeds.models import Feed
from django.contrib import admin
from apps.rss_feeds.models import Feed
admin.site.register(Feed)

View file

@ -1,9 +1,10 @@
from faker import Faker
import factory
from django.conf import settings
from factory.django import DjangoModelFactory
from factory.fuzzy import FuzzyAttribute
from faker import Faker
from apps.rss_feeds.models import DuplicateFeed, Feed
from django.conf import settings
NEWSBLUR_DIR = settings.NEWSBLUR_DIR
fake = Faker()

View file

@ -1,11 +1,13 @@
from django.core.management.base import BaseCommand
from apps.reader.models import UserSubscription
import datetime
import errno
import os
import re
from django.conf import settings
from django.contrib.auth.models import User
import os
import errno
import re
import datetime
from django.core.management.base import BaseCommand
from apps.reader.models import UserSubscription
class Command(BaseCommand):

View file

@ -1,4 +1,5 @@
from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed

View file

@ -1,4 +1,5 @@
from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed

View file

@ -1,8 +1,10 @@
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from apps.reader.models import UserSubscription
import datetime
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from apps.reader.models import UserSubscription
class Command(BaseCommand):
def add_arguments(self, parser):

View file

@ -1,12 +1,14 @@
from django.core.management.base import BaseCommand
from apps.reader.models import UserSubscription
import datetime
import errno
import os
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from apps.reader.models import UserSubscription
from apps.rss_feeds.models import Feed
import os
import errno
import re
import datetime
class Command(BaseCommand):

View file

@ -1,4 +1,5 @@
from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed
from utils.management_functions import daemonize

View file

@ -1,15 +1,17 @@
from django.core.management.base import BaseCommand
import datetime
import socket
from optparse import make_option
import django
from django.conf import settings
from django.contrib.auth.models import User
from apps.statistics.models import MStatistics
from apps.rss_feeds.models import Feed
from django.core.management.base import BaseCommand
from apps.reader.models import UserSubscription
from optparse import make_option
from apps.rss_feeds.models import Feed
from apps.statistics.models import MStatistics
from utils import feed_fetcher
from utils.management_functions import daemonize
import django
import socket
import datetime
class Command(BaseCommand):

View file

@ -1,8 +1,10 @@
from django.core.management.base import BaseCommand
from django.conf import settings
from apps.rss_feeds.tasks import TaskFeeds, TaskBrokenFeeds
import datetime
from django.conf import settings
from django.core.management.base import BaseCommand
from apps.rss_feeds.tasks import TaskBrokenFeeds, TaskFeeds
class Command(BaseCommand):
def add_arguments(self, parser):

View file

@ -1,7 +1,9 @@
from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed
import gc
from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed
class Command(BaseCommand):
def add_arguments(self, parser):

View file

@ -1,7 +1,8 @@
# Generated by Django 2.0 on 2020-06-16 06:52
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
import utils.fields

View file

@ -1,7 +1,7 @@
# Generated by Django 3.1.4 on 2021-01-06 19:27
from django.db import migrations
from django.conf import settings
from django.db import migrations
def remove_mongo_types(apps, schema_editor):

View file

@ -1,7 +1,7 @@
# Generated by Django 3.1.10 on 2022-05-17 13:35
from django.db import migrations
from django.conf import settings
from django.db import migrations
def set_mongo_feature_compatibility_version(apps, schema_editor):

View file

@ -1,56 +1,63 @@
import difflib
import bson
import requests
import base64
import datetime
import time
import difflib
import hashlib
import html
import math
import random
import re
import math
import mongoengine as mongo
import zlib
import hashlib
import redis
import base64
import pymongo
import html
import time
import urllib.parse
import zlib
from collections import defaultdict
from operator import itemgetter
from bson.objectid import ObjectId
from bs4 import BeautifulSoup
# from nltk.collocations import TrigramCollocationFinder, BigramCollocationFinder, TrigramAssocMeasures, BigramAssocMeasures
from django.db import models
from django.db import IntegrityError
import bson
import mongoengine as mongo
import pymongo
import redis
import requests
from bs4 import BeautifulSoup
from bson.objectid import ObjectId
from django.conf import settings
from django.db.models.query import QuerySet
from django.db.utils import DatabaseError
from django.urls import reverse
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
# from nltk.collocations import TrigramCollocationFinder, BigramCollocationFinder, TrigramAssocMeasures, BigramAssocMeasures
from django.db import IntegrityError, models
from django.db.models.query import QuerySet
from django.db.utils import DatabaseError
from django.template.defaultfilters import slugify
from django.utils.encoding import smart_bytes, smart_str
from django.utils.encoding import DjangoUnicodeDecodeError
from mongoengine.queryset import OperationError, Q, NotUniqueError
from django.urls import reverse
from django.utils.encoding import DjangoUnicodeDecodeError, smart_bytes, smart_str
from mongoengine.errors import ValidationError
from vendor.timezones.utilities import localtime_for_timezone
from apps.rss_feeds.tasks import UpdateFeeds, PushFeeds, ScheduleCountTagsForUser
from mongoengine.queryset import NotUniqueError, OperationError, Q
from apps.rss_feeds.tasks import PushFeeds, ScheduleCountTagsForUser, UpdateFeeds
from apps.rss_feeds.text_importer import TextImporter
from apps.search.models import SearchStory, SearchFeed
from apps.search.models import SearchFeed, SearchStory
from apps.statistics.rstats import RStats
from utils import feedfinder_forman, feedfinder_pilgrim
from utils import json_functions as json
from utils import feedfinder_forman
from utils import feedfinder_pilgrim
from utils import urlnorm
from utils import log as logging
from utils import urlnorm
from utils.feed_functions import (
TimeoutError,
levenshtein_distance,
relative_timesince,
seconds_timesince,
timelimit,
)
from utils.fields import AutoOneToOneField
from utils.feed_functions import levenshtein_distance
from utils.feed_functions import timelimit, TimeoutError
from utils.feed_functions import relative_timesince
from utils.feed_functions import seconds_timesince
from utils.story_functions import strip_tags, htmldiff, strip_comments, strip_comments__lxml
from utils.story_functions import prep_for_search
from utils.story_functions import create_imageproxy_signed_url
from utils.story_functions import (
create_imageproxy_signed_url,
htmldiff,
prep_for_search,
strip_comments,
strip_comments__lxml,
strip_tags,
)
from vendor.timezones.utilities import localtime_for_timezone
ENTRY_NEW, ENTRY_UPDATED, ENTRY_SAME, ENTRY_ERR = list(range(4))
@ -1223,7 +1230,12 @@ class Feed(models.Model):
self.save(update_fields=["average_stories_per_month"])
def save_classifier_counts(self):
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
from apps.analyzer.models import (
MClassifierAuthor,
MClassifierFeed,
MClassifierTag,
MClassifierTitle,
)
def calculate_scores(cls, facet):
map_f = """

View file

@ -1,13 +1,14 @@
import redis
from utils import json_functions as json
from django.test.client import Client
from django.test import TestCase
from django.core import management
from django.urls import reverse
from django.conf import settings
from apps.rss_feeds.models import Feed, MStory
from django.core import management
from django.test import TestCase
from django.test.client import Client
from django.urls import reverse
from mongoengine.connection import connect, disconnect
from apps.rss_feeds.models import Feed, MStory
from utils import json_functions as json
class Test_Feed(TestCase):
fixtures = ["initial_data.json"]

View file

@ -1,23 +1,24 @@
import zlib
from socket import error as SocketError
from urllib.parse import urljoin
import requests
import urllib3
import zlib
from vendor import readability
from simplejson.decoder import JSONDecodeError
from requests.packages.urllib3.exceptions import LocationParseError
from socket import error as SocketError
from mongoengine.queryset import NotUniqueError
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.sites.models import Site
from django.utils.encoding import smart_bytes, smart_str
from lxml.etree import ParserError
from vendor.readability.readability import Unparseable
from utils import log as logging
from utils.feed_functions import timelimit, TimeoutError
from mongoengine.queryset import NotUniqueError
from OpenSSL.SSL import Error as OpenSSLError
from pyasn1.error import PyAsn1Error
from django.utils.encoding import smart_str
from django.conf import settings
from django.utils.encoding import smart_bytes
from django.contrib.sites.models import Site
from bs4 import BeautifulSoup
from urllib.parse import urljoin
from requests.packages.urllib3.exceptions import LocationParseError
from simplejson.decoder import JSONDecodeError
from utils import log as logging
from utils.feed_functions import TimeoutError, timelimit
from vendor import readability
from vendor.readability.readability import Unparseable
BROKEN_URLS = [
"gamespot.com",

Some files were not shown because too many files have changed in this diff Show more