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 sys
import time import time
import digitalocean import digitalocean
import subprocess
def test_ssh(drop): def test_ssh(drop):

View file

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

View file

@ -2,9 +2,10 @@
# Retooled by Samuel Clay, August 2011 # Retooled by Samuel Clay, August 2011
# Modified by Luke Hagan, 2011-11-05 # Modified by Luke Hagan, 2011-11-05
import urllib.request, urllib.parse
import http.cookiejar import http.cookiejar
import json import json
import urllib.parse
import urllib.request
__author__ = "Dananjaya Ramanayake <dananjaya86@gmail.com>, Samuel Clay <samuel@newsblur.com>" __author__ = "Dananjaya Ramanayake <dananjaya86@gmail.com>, Samuel Clay <samuel@newsblur.com>"
__version__ = "1.0" __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 import math
from django.db.models.aggregates import Sum
from apps.analyzer.models import Category, FeatureCategory
class Classifier: class Classifier:
def __init__(self, user, feed, phrases): 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 datetime
import re
import math 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): def entry_features(self, entry):

View file

@ -1,12 +1,14 @@
import re import re
import requests import requests
from django import forms 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 import authenticate
from django.contrib.auth.models import User 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 apps.social.models import MSocialProfile
from vendor.zebra.forms import StripePaymentForm
class PopularityQueryForm(forms.Form): 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 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 nltk import FreqDist
from apps.rss_feeds.models import MStory
def lgammln(xx): def lgammln(xx):
""" """

View file

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

View file

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

View file

@ -1,14 +1,15 @@
from django.test.client import Client from itertools import groupby
from apps.rss_feeds.models import MStory
from django.test import TestCase
from django.core import management
# from apps.analyzer.classifier import FisherClassifier # from apps.analyzer.classifier import FisherClassifier
import nltk import nltk
from itertools import groupby from django.core import management
from apps.analyzer.tokenizer import Tokenizer from django.test import TestCase
from vendor.reverend.thomas import Bayes from django.test.client import Client
from apps.analyzer.phrase_filter import PhraseFilter 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): 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. See the README for a usage example.
""" """
import sys
import os import os
import sys
class tfidf: class tfidf:

View file

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

View file

@ -1,19 +1,24 @@
import redis 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.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 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.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 apps.social.models import MSocialSubscription
from utils import json_functions as json from utils import json_functions as json
from utils.user_functions import get_user from utils import log as logging
from utils.user_functions import ajax_login_required from utils.user_functions import ajax_login_required, get_user
def index(requst): def index(requst):

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +1,9 @@
from newsblur_web.celeryapp import app
from django.contrib.auth.models import User 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.reader.models import UserSubscription
from apps.social.models import MActivity from apps.social.models import MActivity
from newsblur_web.celeryapp import app
from utils import log as logging 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 json
import os
from django.contrib.auth.models import User
from django.core.management import call_command 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): class Test_Import(TestCase):

View file

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

View file

@ -1,27 +1,28 @@
import base64
import datetime import datetime
import pickle import pickle
import base64
from utils import log as logging
from oauth2client.client import OAuth2WebServerFlow, FlowExchangeError
from bson.errors import InvalidStringData
import uuid 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.auth.models import User
from django.contrib.sites.models import Site
# from django.db import IntegrityError # from django.db import IntegrityError
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.urls import reverse from django.urls import reverse
from django.contrib.auth import login as login_user
from mongoengine.errors import ValidationError 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.forms import SignupForm
from apps.reader.models import UserSubscription 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 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.feed_functions import TimeoutError
from utils.user_functions import ajax_login_required, get_user
@ajax_login_required @ajax_login_required

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,12 @@
from django.views import View
from django.shortcuts import render 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): class Classifiers(View):

View file

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

View file

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

View file

@ -1,8 +1,8 @@
from django.views import View
from django.shortcuts import render 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.reader.models import UserSubscription
from apps.rss_feeds.models import Feed
from apps.social.models import MSocialProfile, MSocialSubscription from apps.social.models import MSocialProfile, MSocialSubscription
from apps.statistics.models import MStatistics from apps.statistics.models import MStatistics

View file

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

View file

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

View file

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

View file

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

View file

@ -1,21 +1,22 @@
import datetime import datetime
import re import re
import redis import redis
from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives 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.template.loader import render_to_string
from django.urls import reverse
from django.utils.html import linebreaks 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 import log as logging
from utils.story_functions import linkify
from utils.scrubber import Scrubber from utils.scrubber import Scrubber
from utils.story_functions import linkify
class EmailNewsletter: class EmailNewsletter:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,12 +1,13 @@
import redis import redis
from django.conf import settings from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required 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.notifications.models import MUserFeedNotification, MUserNotificationTokens
from apps.rss_feeds.models import Feed 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 import log as logging
from utils.user_functions import ajax_login_required, get_user
from utils.view_functions import required_params
@ajax_login_required @ajax_login_required

View file

@ -1,7 +1,8 @@
from django.conf.urls import url from django.conf.urls import url
from apps.oauth import views
from oauth2_provider import views as op_views from oauth2_provider import views as op_views
from apps.oauth import views
urlpatterns = [ urlpatterns = [
url(r"^twitter_connect/?$", views.twitter_connect, name="twitter-connect"), url(r"^twitter_connect/?$", views.twitter_connect, name="twitter-connect"),
url(r"^facebook_connect/?$", views.facebook_connect, name="facebook-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 datetime
import urllib.error
import urllib.parse
import urllib.request
import lxml.html import lxml.html
import tweepy import tweepy
from django.conf import settings
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.urls import reverse
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.http import HttpResponseForbidden, HttpResponseRedirect from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.conf import settings from django.urls import reverse
from mongoengine.queryset import NotUniqueError from mongoengine.queryset import NotUniqueError, OperationError
from mongoengine.queryset import OperationError
from apps.social.models import MSocialServices, MSocialSubscription, MSharedStory from apps.analyzer.models import (
from apps.social.tasks import SyncTwitterFriends, SyncFacebookFriends MClassifierAuthor,
from apps.reader.models import UserSubscription, UserSubscriptionFolders, RUserStory MClassifierFeed,
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag MClassifierTag,
from apps.analyzer.models import compute_story_score MClassifierTitle,
from apps.rss_feeds.models import Feed, MStory, MStarredStoryCounts, MStarredStory 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.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 log as logging
from utils import urlnorm
from utils.user_functions import ajax_login_required, oauth_login_required from utils.user_functions import ajax_login_required, oauth_login_required
from utils.view_functions import render_to from utils.view_functions import render_to
from utils import urlnorm
from utils import json_functions as json
from vendor import facebook from vendor import facebook

View file

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

View file

@ -1,12 +1,19 @@
import re import re
import requests import requests
from django import forms 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 import authenticate
from django.contrib.auth.models import User 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 apps.social.models import MSocialProfile
from vendor.zebra.forms import StripePaymentForm
PLANS = [ PLANS = [
("newsblur-premium-36", mark_safe("$36 / year <span class='NB-small'>($3/month)</span>")), ("newsblur-premium-36", mark_safe("$36 / year <span class='NB-small'>($3/month)</span>")),

View file

@ -1,4 +1,5 @@
import time import time
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db import connections from django.db import connections
from django.db.utils import OperationalError 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.contrib.auth.models import User
from django.core.management.base import BaseCommand
class Command(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.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User 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 utils import log as logging
from apps.profile.models import Profile, PaymentHistory
class Command(BaseCommand): class Command(BaseCommand):

View file

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

View file

@ -1,15 +1,17 @@
import datetime import datetime
import re
import random import random
import re
import time import time
import redis import redis
from utils import log as logging
from django.http import HttpResponse
from django.conf import settings from django.conf import settings
from django.db import connection 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 apps.statistics.rstats import round_time
from utils import json_functions as json from utils import json_functions as json
from utils import log as logging
class LastSeenMiddleware(object): class LastSeenMiddleware(object):

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,45 +1,45 @@
import time
import datetime import datetime
from wsgiref.util import application_uri
import dateutil
import stripe
import hashlib import hashlib
import re import re
import redis import time
import uuid import uuid
import paypalrestsdk from wsgiref.util import application_uri
import dateutil
import mongoengine as mongo import mongoengine as mongo
from django.db import models import paypalrestsdk
from django.db import IntegrityError import redis
from django.db.utils import DatabaseError import stripe
from django.db.models.signals import post_save
from django.db.models import Sum, Avg, Count
from django.db.models import Q
from django.conf import settings from django.conf import settings
from django.contrib.auth import authenticate from django.contrib.auth import authenticate
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives from django.core.mail import EmailMultiAlternatives, mail_admins
from django.core.mail import mail_admins from django.db import IntegrityError, models
from django.urls import reverse 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 django.template.loader import render_to_string
from apps.rss_feeds.models import Feed, MStory, MStarredStory from django.urls import reverse
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 paypal.standard.ipn.models import PayPalIPN from paypal.standard.ipn.models import PayPalIPN
from zebra.signals import zebra_webhook_customer_subscription_created from paypal.standard.ipn.signals import invalid_ipn_received, valid_ipn_received
from zebra.signals import zebra_webhook_customer_subscription_updated from zebra.signals import (
from zebra.signals import zebra_webhook_charge_succeeded zebra_webhook_charge_refunded,
from zebra.signals import zebra_webhook_charge_refunded zebra_webhook_charge_succeeded,
from zebra.signals import zebra_webhook_checkout_session_completed 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): class Profile(models.Model):
@ -167,8 +167,13 @@ class Profile(models.Model):
except: except:
logging.user(self.user, "~BR~SK~FWError cancelling premium renewal for: %s" % self.user.username) 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 (
from apps.social.models import MActivity, MInteraction MActivity,
MInteraction,
MSharedStory,
MSocialProfile,
MSocialSubscription,
)
try: try:
social_profile = MSocialProfile.objects.get(user_id=self.user.pk) 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) 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): 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: if not self.user.email:
return return

View file

@ -1,9 +1,10 @@
import datetime import datetime
from newsblur_web.celeryapp import app
from apps.profile.models import Profile, RNewUserQueue from apps.profile.models import Profile, RNewUserQueue
from utils import log as logging
from apps.reader.models import UserSubscription, UserSubscriptionFolders 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") @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.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 mongoengine.connection import connect, disconnect
from utils import json_functions as json
class Test_Profile(TestCase): class Test_Profile(TestCase):
fixtures = [ fixtures = [

View file

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

View file

@ -1,41 +1,60 @@
import re
import stripe
import requests
import datetime import datetime
import json as python_json
import re
import dateutil import dateutil
from django.contrib.auth.decorators import login_required import requests
from django.views.decorators.http import require_POST import stripe
from django.views.decorators.csrf import csrf_protect, csrf_exempt from django.conf import settings
from django.contrib.auth import logout as logout_user from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth import login as login_user 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.db.models.aggregates import Sum
from django.http import HttpResponse, HttpResponseRedirect 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.shortcuts import render
from django.core.mail import mail_admins from django.urls import reverse
from django.conf import settings from django.views.decorators.csrf import csrf_exempt, csrf_protect
from apps.profile.models import Profile, PaymentHistory, RNewUserQueue, MRedeemedCode, MGiftCode, PaypalIds from django.views.decorators.http import require_POST
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 paypal.standard.forms import PayPalPaymentsForm from paypal.standard.forms import PayPalPaymentsForm
from paypal.standard.ipn.views import ipn as paypal_standard_ipn 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") INTEGER_FIELD_PREFS = ("feed_pane_size", "days_of_unread")
SINGLE_FIELD_PREFS = ( SINGLE_FIELD_PREFS = (
"timezone", "timezone",

View file

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

View file

@ -1,19 +1,19 @@
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE # Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
import hashlib
import re
from datetime import datetime, timedelta from datetime import datetime, timedelta
import feedparser import feedparser
import requests import requests
import re
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
import hashlib
from apps.push import signals from apps.push import signals
from apps.rss_feeds.models import Feed from apps.rss_feeds.models import Feed
from utils import log as logging 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 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 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from datetime import datetime, timedelta
import urllib import urllib
from datetime import datetime, timedelta
from django.urls import reverse
from django.test import TestCase from django.test import TestCase
from django.urls import reverse
from apps.push.models import PushSubscription, PushSubscriptionManager 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): class MockResponse(object):

View file

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

View file

@ -1,10 +1,10 @@
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE # Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
import feedparser
import random
import datetime 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.http.request import UnreadablePostError
from django.shortcuts import get_object_or_404 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 django.contrib import admin
from apps.reader.models import Feature, UserSubscription, UserSubscriptionFolders
admin.site.register(UserSubscription) admin.site.register(UserSubscription)
admin.site.register(UserSubscriptionFolders) admin.site.register(UserSubscriptionFolders)
admin.site.register(Feature) admin.site.register(Feature)

View file

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

View file

@ -1,17 +1,24 @@
import datetime import datetime
from django import forms 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 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.profile.tasks import EmailNewUser
from apps.reader.models import Feature
from apps.social.models import MActivity from apps.social.models import MActivity
from apps.profile.models import blank_authenticate, RNewUserQueue
from utils import log as logging from utils import log as logging
from dns.resolver import query, NXDOMAIN, NoNameservers, NoAnswer
from dns.resolver import NoResolverConfiguration
class LoginForm(forms.Form): class LoginForm(forms.Form):

View file

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

View file

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

View file

@ -1,34 +1,37 @@
import datetime import datetime
import time
import re import re
import redis import time
import pymongo
import celery
import mongoengine as mongo
from operator import itemgetter from operator import itemgetter
from pprint import pprint from pprint import pprint
from utils import log as logging
from utils import json_functions as json import celery
from django.db import models, IntegrityError import mongoengine as mongo
from django.db.models import Q import pymongo
from django.db.models import Count import redis
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.cache import cache 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 django.template.defaultfilters import slugify
from mongoengine.queryset import OperationError from mongoengine.queryset import NotUniqueError, 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 apps.analyzer.models import ( from apps.analyzer.models import (
apply_classifier_titles, MClassifierAuthor,
apply_classifier_feeds, MClassifierFeed,
MClassifierTag,
MClassifierTitle,
apply_classifier_authors, apply_classifier_authors,
apply_classifier_feeds,
apply_classifier_tags, apply_classifier_tags,
apply_classifier_titles,
) )
from apps.analyzer.tfidf import tfidf 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 from utils.feed_functions import add_object_to_folder, chunks

View file

@ -1,10 +1,12 @@
import datetime 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.conf import settings
from django.contrib.auth.models import User
from apps.reader.models import UserSubscription from apps.reader.models import UserSubscription
from apps.social.models import MSocialSubscription from apps.social.models import MSocialSubscription
from newsblur_web.celeryapp import app
from utils import log as logging
@app.task(name="freshen-homepage") @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.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 mongoengine.connection import connect, disconnect
from utils import json_functions as json
class Test_Reader(TestCase): class Test_Reader(TestCase):
fixtures = [ fixtures = [

View file

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

View file

@ -1,8 +1,8 @@
# Generated by Django 2.0 on 2020-06-16 06:52 # Generated by Django 2.0 on 2020-06-16 06:52
import django.db.models.deletion
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): 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 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): class RecommendedFeed(models.Model):
feed = models.ForeignKey(Feed, related_name="recommendations", on_delete=models.CASCADE) feed = models.ForeignKey(Feed, related_name="recommendations", on_delete=models.CASCADE)

View file

@ -1,9 +1,10 @@
import datetime 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() register = template.Library()

View file

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

View file

@ -1,13 +1,15 @@
import re
import datetime import datetime
from utils import log as logging import re
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404 from django.shortcuts import get_object_or_404, render
from apps.recommendations.models import RecommendedFeed
from apps.reader.models import UserSubscription from apps.reader.models import UserSubscription
from apps.recommendations.models import RecommendedFeed
from apps.rss_feeds.models import Feed, MFeedIcon from apps.rss_feeds.models import Feed, MFeedIcon
from utils import json_functions as json 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): def load_recommended_feed(request):

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed 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 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): class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):

View file

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

View file

@ -1,4 +1,5 @@
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed from apps.rss_feeds.models import Feed
from utils.management_functions import daemonize 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.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from apps.statistics.models import MStatistics from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription 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 import feed_fetcher
from utils.management_functions import daemonize from utils.management_functions import daemonize
import django
import socket
import datetime
class Command(BaseCommand): 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 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): class Command(BaseCommand):
def add_arguments(self, parser): 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 import gc
from django.core.management.base import BaseCommand
from apps.rss_feeds.models import Feed
class Command(BaseCommand): class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):

View file

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

View file

@ -1,7 +1,7 @@
# Generated by Django 3.1.4 on 2021-01-06 19:27 # Generated by Django 3.1.4 on 2021-01-06 19:27
from django.db import migrations
from django.conf import settings from django.conf import settings
from django.db import migrations
def remove_mongo_types(apps, schema_editor): 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 # Generated by Django 3.1.10 on 2022-05-17 13:35
from django.db import migrations
from django.conf import settings from django.conf import settings
from django.db import migrations
def set_mongo_feature_compatibility_version(apps, schema_editor): def set_mongo_feature_compatibility_version(apps, schema_editor):

View file

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

View file

@ -1,13 +1,14 @@
import redis 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 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 mongoengine.connection import connect, disconnect
from apps.rss_feeds.models import Feed, MStory
from utils import json_functions as json
class Test_Feed(TestCase): class Test_Feed(TestCase):
fixtures = ["initial_data.json"] 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 requests
import urllib3 import urllib3
import zlib from bs4 import BeautifulSoup
from vendor import readability from django.conf import settings
from simplejson.decoder import JSONDecodeError from django.contrib.sites.models import Site
from requests.packages.urllib3.exceptions import LocationParseError from django.utils.encoding import smart_bytes, smart_str
from socket import error as SocketError
from mongoengine.queryset import NotUniqueError
from lxml.etree import ParserError from lxml.etree import ParserError
from vendor.readability.readability import Unparseable from mongoengine.queryset import NotUniqueError
from utils import log as logging
from utils.feed_functions import timelimit, TimeoutError
from OpenSSL.SSL import Error as OpenSSLError from OpenSSL.SSL import Error as OpenSSLError
from pyasn1.error import PyAsn1Error from pyasn1.error import PyAsn1Error
from django.utils.encoding import smart_str from requests.packages.urllib3.exceptions import LocationParseError
from django.conf import settings from simplejson.decoder import JSONDecodeError
from django.utils.encoding import smart_bytes
from django.contrib.sites.models import Site from utils import log as logging
from bs4 import BeautifulSoup from utils.feed_functions import TimeoutError, timelimit
from urllib.parse import urljoin from vendor import readability
from vendor.readability.readability import Unparseable
BROKEN_URLS = [ BROKEN_URLS = [
"gamespot.com", "gamespot.com",

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