0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 21:49:51 +01:00

Sort imports with isort (#1272)

* Add and configure isort

* isort all the things!

* Use local black and isort, and include json in prettier

* Remove erroneous import

* Delete isort.cfg and add isort options to lint-staged

* isort all the things! (with Black-compatibile options)
This commit is contained in:
Michael Matloka 2020-07-28 22:19:33 +02:00 committed by GitHub
parent ebc0e9af38
commit 4ebca38d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 634 additions and 557 deletions

View File

@ -104,11 +104,14 @@
}
},
"lint-staged": {
"*.{js,ts,tsx,css,scss}": "prettier --write",
"*.{js,ts,tsx,json,css,scss}": "prettier --write",
"*.{js,ts,tsx}": "eslint",
"*.py": "black -l 120"
"*.py": [
"./env/bin/black -l 120",
"./env/bin/isort -m 3 --tc --fgw 8 --up -n -l 120"
]
},
"optionalDependencies": {
"fsevents": "^2.1.2"
}
}
}

View File

@ -1,17 +1,18 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from django.utils.translation import ugettext_lazy as _
from posthog.models import (
Event,
User,
Team,
Person,
Element,
Funnel,
Action,
ActionStep,
DashboardItem,
Element,
Event,
FeatureFlag,
Funnel,
Person,
Team,
User,
)
admin.site.register(Team)

View File

@ -1,17 +1,18 @@
from rest_framework import routers
from . import (
event,
person,
action,
funnel,
dashboard,
paths,
cohort,
element,
feature_flag,
annotation,
cohort,
dashboard,
element,
event,
feature_flag,
funnel,
paths,
person,
team,
)
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r"annotation", annotation.AnnotationsViewSet)

View File

@ -1,62 +1,55 @@
from django.db.models.expressions import Subquery
from posthog.models import (
Event,
Team,
Action,
ActionStep,
DashboardItem,
User,
Person,
Filter,
Entity,
Cohort,
CohortPeople,
)
from posthog.utils import (
append_data,
get_compare_period_dates,
TemporaryTokenAuthentication,
)
from posthog.constants import (
TREND_FILTER_TYPE_ACTIONS,
TREND_FILTER_TYPE_EVENTS,
TRENDS_CUMULATIVE,
TRENDS_STICKINESS,
)
from posthog.tasks.calculate_action import calculate_action
from rest_framework import request, serializers, viewsets, authentication
from rest_framework.response import Response
from rest_framework.decorators import action
from django.db.models import (
Q,
Count,
Sum,
Avg,
Min,
Max,
Prefetch,
functions,
QuerySet,
OuterRef,
Exists,
Value,
BooleanField,
FloatField,
)
from django.db.models.expressions import RawSQL
from django.db.models.functions import Cast
from django.db import connection
from django.utils.timezone import now
from typing import Any, List, Dict, Optional, Tuple, Union
from datetime import timedelta
import pandas as pd
import copy
import datetime
import json
import copy
from datetime import timedelta
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
from dateutil.relativedelta import relativedelta
from django.db import connection
from django.db.models import (
Avg,
BooleanField,
Count,
Exists,
FloatField,
Max,
Min,
OuterRef,
Prefetch,
Q,
QuerySet,
Sum,
Value,
functions,
)
from django.db.models.expressions import RawSQL, Subquery
from django.db.models.functions import Cast
from django.utils.timezone import now
from rest_framework import authentication, request, serializers, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS, TRENDS_CUMULATIVE, TRENDS_STICKINESS
from posthog.decorators import TRENDS_ENDPOINT, cached_function
from posthog.models import (
Action,
ActionStep,
Cohort,
CohortPeople,
DashboardItem,
Entity,
Event,
Filter,
Person,
Team,
User,
)
from posthog.tasks.calculate_action import calculate_action
from posthog.utils import TemporaryTokenAuthentication, append_data, get_compare_period_dates
from .person import PersonSerializer
from posthog.decorators import cached_function, TRENDS_ENDPOINT
FREQ_MAP = {"minute": "60S", "hour": "H", "day": "D", "week": "W", "month": "M"}

View File

@ -1,9 +1,11 @@
from django.db.models import QuerySet
from posthog.models import Annotation
from rest_framework import request, serializers, viewsets
from typing import Dict, Any
from posthog.api.user import UserSerializer
from distutils.util import strtobool
from typing import Any, Dict
from django.db.models import QuerySet
from rest_framework import request, serializers, viewsets
from posthog.api.user import UserSerializer
from posthog.models import Annotation
class AnnotationSerializer(serializers.ModelSerializer):

View File

@ -1,19 +1,21 @@
from django.http import HttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.utils import timezone
from posthog.models import Team
from posthog.utils import get_ip_address, cors_response
from typing import Dict, Union, Optional, List, Any
from posthog.tasks.process_event import process_event
from datetime import datetime
from dateutil import parser
from sentry_sdk import push_scope
import lzstring # type: ignore
import re
import json
import secrets
import base64
import gzip
import json
import re
import secrets
from datetime import datetime
from typing import Any, Dict, List, Optional, Union
import lzstring # type: ignore
from dateutil import parser
from django.http import HttpResponse, JsonResponse
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from sentry_sdk import push_scope
from posthog.models import Team
from posthog.tasks.process_event import process_event
from posthog.utils import cors_response, get_ip_address
def _load_data(request) -> Optional[Union[Dict, List]]:

View File

@ -1,9 +1,11 @@
from typing import Any, Dict, Optional
from django.db.models import Count, QuerySet
from rest_framework import request, response, serializers, viewsets
from posthog.models import Cohort
from typing import Dict, Any, Optional
from posthog.api.user import UserSerializer
from posthog.models import Cohort
from posthog.tasks.calculate_cohort import calculate_cohort
from django.db.models import QuerySet, Count
class CohortSerializer(serializers.ModelSerializer):

View File

@ -1,17 +1,19 @@
from rest_framework import request, response, serializers, viewsets, authentication
import secrets
from datetime import datetime
from typing import Any, Dict, List
from django.contrib.auth.models import AnonymousUser
from django.core.cache import cache
from django.db.models import Prefetch, QuerySet
from django.http import HttpRequest
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
from rest_framework import authentication, request, response, serializers, viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import AuthenticationFailed
from posthog.models import Dashboard, DashboardItem, Filter
from typing import Dict, Any, List
from django.db.models import QuerySet, Prefetch
from django.shortcuts import get_object_or_404
from datetime import datetime
from posthog.utils import render_template, generate_cache_key
from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest
from django.core.cache import cache
from django.utils.timezone import now
import secrets
from posthog.utils import generate_cache_key, render_template
class PublicTokenAuthentication(authentication.BaseAuthentication):

View File

@ -1,13 +1,15 @@
from django.conf import settings
from django.http import JsonResponse, HttpRequest
from django.views.decorators.csrf import csrf_exempt
from typing import Optional, List, Any, Dict
from posthog.utils import cors_response
from urllib.parse import urlparse
from posthog.models import FeatureFlag, Team
import json
import base64
import json
import secrets
from typing import Any, Dict, List, Optional
from urllib.parse import urlparse
from django.conf import settings
from django.http import HttpRequest, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from posthog.models import FeatureFlag, Team
from posthog.utils import cors_response
def _load_data(data: str) -> Dict[str, Any]:

View File

@ -1,10 +1,12 @@
from rest_framework import request, response, serializers, viewsets, authentication
from rest_framework.decorators import action
from posthog.models import Element, Team, Event, ElementGroup, Filter
from posthog.utils import TemporaryTokenAuthentication
from django.db.models import QuerySet, Count, Prefetch
import json
from django.db.models import Count, Prefetch, QuerySet
from rest_framework import authentication, request, response, serializers, viewsets
from rest_framework.decorators import action
from posthog.models import Element, ElementGroup, Event, Filter, Team
from posthog.utils import TemporaryTokenAuthentication
class ElementSerializer(serializers.ModelSerializer):
class Meta:

View File

@ -1,35 +1,35 @@
import json
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Tuple
import pandas as pd
from dateutil.relativedelta import relativedelta
from django.db import connection
from django.db.models import F, Prefetch, Q, QuerySet
from django.db.models.expressions import Window
from django.db.models.functions import Lag
from django.utils.timezone import now
from rest_framework import request, response, serializers, viewsets
from rest_framework.decorators import action
from posthog.models import (
Event,
Person,
Element,
Action,
Element,
ElementGroup,
Event,
Filter,
Person,
PersonDistinctId,
Team,
)
from posthog.utils import (
friendly_time,
request_to_date_query,
append_data,
convert_property_value,
get_compare_period_dates,
dict_from_cursor_fetchall,
friendly_time,
get_compare_period_dates,
request_to_date_query,
)
from rest_framework import request, response, serializers, viewsets
from rest_framework.decorators import action
from django.db.models import QuerySet, F, Prefetch, Q
from django.db.models.functions import Lag
from django.db.models.expressions import Window
from django.db import connection
from django.utils.timezone import now
from typing import Any, Dict, List, Optional
from django.utils.timezone import now
import json
import pandas as pd
from typing import Tuple, Optional
class ElementSerializer(serializers.ModelSerializer):

View File

@ -1,11 +1,13 @@
from posthog.models import FeatureFlag
from posthog.api.user import UserSerializer
from rest_framework import request, serializers, viewsets
from django.db.models import QuerySet
from django.db import IntegrityError
from typing import List, Dict, Any
import posthoganalytics
import json
from typing import Any, Dict, List
import posthoganalytics
from django.db import IntegrityError
from django.db.models import QuerySet
from rest_framework import request, serializers, viewsets
from posthog.api.user import UserSerializer
from posthog.models import FeatureFlag
class FeatureFlagSerializer(serializers.HyperlinkedModelSerializer):

View File

@ -1,11 +1,13 @@
from posthog.models import Funnel, DashboardItem
import datetime
import json
from typing import Any, Dict, List
from django.db.models import QuerySet
from rest_framework import request, serializers, viewsets
from rest_framework.response import Response
from django.db.models import QuerySet
from typing import List, Dict, Any
import json
from posthog.decorators import cached_function, FUNNEL_ENDPOINT
import datetime
from posthog.decorators import FUNNEL_ENDPOINT, cached_function
from posthog.models import DashboardItem, Funnel
class FunnelSerializer(serializers.HyperlinkedModelSerializer):

View File

@ -1,18 +1,17 @@
from rest_framework import viewsets, request
from rest_framework.response import Response
from rest_framework.decorators import action
from posthog.models import Event, Filter
from posthog.utils import request_to_date_query, dict_from_cursor_fetchall
from django.db.models import OuterRef
from django.db import connection
import json
from typing import Optional
from django.db import connection
from django.db.models import F, OuterRef, Q
from django.db.models.expressions import Window
from django.db.models.functions import Lag
from django.db.models import F, Q
from django.db import connection
from rest_framework import request, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from posthog.models import Event, Filter
from posthog.utils import dict_from_cursor_fetchall, request_to_date_query
import json
# At the moment, paths don't support users changing distinct_ids midway through.
# See: https://github.com/PostHog/posthog/issues/185

View File

@ -1,15 +1,18 @@
from posthog.models import Event, Team, Person, PersonDistinctId, Cohort, Filter
from posthog.utils import convert_property_value
from rest_framework import serializers, viewsets, response, request
import json
from typing import Union
from django.core.cache import cache
from django.db.models import Count, Func, OuterRef, Prefetch, Q, QuerySet, Subquery
from rest_framework import request, response, serializers, viewsets
from rest_framework.decorators import action
from rest_framework.settings import api_settings
from rest_framework_csv import renderers as csvrenderers # type: ignore
from django.db.models import Q, Prefetch, QuerySet, Subquery, OuterRef, Count, Func
from .event import EventSerializer
from typing import Union
from posthog.models import Cohort, Event, Filter, Person, PersonDistinctId, Team
from posthog.utils import convert_property_value
from .base import CursorPagination as BaseCursorPagination
import json
from django.core.cache import cache
from .event import EventSerializer
class PersonSerializer(serializers.HyperlinkedModelSerializer):

View File

@ -1,6 +1,6 @@
from django.test import TransactionTestCase, TestCase
from posthog.models import User, Team
from django.test import Client
from django.test import Client, TestCase, TransactionTestCase
from posthog.models import Team, User
class BaseTest(TestCase):

View File

@ -1,13 +1,24 @@
from datetime import datetime
from json import dumps as jdumps
from unittest.mock import call, patch
from freezegun import freeze_time
from unittest.mock import patch, call
from datetime import datetime
from posthog.models import Action, ActionStep, Element, Event, Filter, Person, Team, Cohort, Entity
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from .base import BaseTest, TransactionBaseTest
from posthog.api.action import calculate_retention
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from posthog.models import (
Action,
ActionStep,
Cohort,
Element,
Entity,
Event,
Filter,
Person,
Team,
)
from .base import BaseTest, TransactionBaseTest
@patch("posthog.tasks.calculate_action.calculate_action.delay")

View File

@ -1,8 +1,11 @@
from .base import BaseTest
from posthog.models import Annotation, Dashboard, DashboardItem
from datetime import datetime
from freezegun import freeze_time
from posthog.models import Annotation, Dashboard, DashboardItem
from .base import BaseTest
class TestAnnotation(BaseTest):
TESTS_API = True

View File

@ -1,14 +1,16 @@
from .base import BaseTest
import base64
import gzip
import json
from datetime import timedelta
from unittest.mock import call, patch
from urllib.parse import quote
import lzstring # type: ignore
from django.conf import settings
from django.utils import timezone
from freezegun import freeze_time
from unittest.mock import patch, call
from datetime import timedelta
from urllib.parse import quote
import base64
import json
import gzip
import lzstring # type: ignore
from .base import BaseTest
class TestCapture(BaseTest):

View File

@ -1,7 +1,9 @@
from .base import BaseTest
from posthog.models import Cohort, Person
from unittest.mock import patch
from posthog.models import Cohort, Person
from .base import BaseTest
class TestCohort(BaseTest):
TESTS_API = True

View File

@ -1,11 +1,14 @@
from .base import BaseTest, TransactionBaseTest
from posthog.models import Dashboard, Filter, DashboardItem
from posthog.api.action import calculate_trends
from posthog.decorators import TRENDS_ENDPOINT
import json
from django.core.cache import cache
from django.utils.timezone import now
from freezegun import freeze_time
import json
from posthog.api.action import calculate_trends
from posthog.decorators import TRENDS_ENDPOINT
from posthog.models import Dashboard, DashboardItem, Filter
from .base import BaseTest, TransactionBaseTest
class TestDashboard(TransactionBaseTest):

View File

@ -1,9 +1,10 @@
from .base import BaseTest
from posthog.models import Person, FeatureFlag
from unittest.mock import patch
import base64
import json
from unittest.mock import patch
from posthog.models import FeatureFlag, Person
from .base import BaseTest
class TestDecide(BaseTest):

View File

@ -1,10 +1,12 @@
from .base import BaseTest
from posthog.models import Element, ElementGroup, Team, Event
from django.utils.timezone import now
from dateutil.relativedelta import relativedelta
import json
from dateutil.relativedelta import relativedelta
from django.utils.timezone import now
from posthog.models import Element, ElementGroup, Event, Team
from .base import BaseTest
class TestElement(BaseTest):
TESTS_API = True

View File

@ -1,8 +1,11 @@
from .base import BaseTest, TransactionBaseTest
from posthog.models import Event, Person, Element, Action, ActionStep, Team
from freezegun import freeze_time
import json
from freezegun import freeze_time
from posthog.models import Action, ActionStep, Element, Event, Person, Team
from .base import BaseTest, TransactionBaseTest
class TestEvents(TransactionBaseTest):
TESTS_API = True

View File

@ -1,6 +1,7 @@
from .base import BaseTest, TransactionBaseTest
from posthog.models import FeatureFlag
from .base import BaseTest, TransactionBaseTest
class TestFeatureFlagApi(TransactionBaseTest):
TESTS_API = True

View File

@ -1,10 +1,13 @@
from posthog.models import Funnel, Action, ActionStep, Event, Element, Person
from posthog.tasks.update_cache import update_cache_item
from .base import BaseTest
from posthog.utils import generate_cache_key
from django.core.cache import cache
from unittest.mock import patch
from django.core.cache import cache
from posthog.models import Action, ActionStep, Element, Event, Funnel, Person
from posthog.tasks.update_cache import update_cache_item
from posthog.utils import generate_cache_key
from .base import BaseTest
@patch("posthog.celery.update_cache_item_task.delay", update_cache_item)
class TestCreateFunnel(BaseTest):

View File

@ -1,9 +1,11 @@
from .base import BaseTest
from posthog.models import Person, Event, Element
from django.utils.timezone import now
from dateutil.relativedelta import relativedelta
from django.utils.timezone import now
from freezegun import freeze_time
from posthog.models import Element, Event, Person
from .base import BaseTest
class TestPaths(BaseTest):
TESTS_API = True

View File

@ -1,7 +1,9 @@
from .base import BaseTest
from posthog.models import Person, Event, Cohort
import json
from posthog.models import Cohort, Event, Person
from .base import BaseTest
class TestPerson(BaseTest):
TESTS_API = True

View File

@ -1,5 +1,6 @@
from posthog.models import Team, User
from .base import BaseTest
from posthog.models import User, Team
class TestUser(BaseTest):

View File

@ -1,19 +1,20 @@
from django.http import HttpResponse, JsonResponse
from django.views.decorators.http import require_http_methods
from django.contrib.auth.password_validation import validate_password
from django.contrib.auth import update_session_auth_hash
from django.core.exceptions import ValidationError
from django.shortcuts import redirect
from django.conf import settings
from rest_framework import serializers
from posthog.models import Event, User
import requests
import urllib.parse
import secrets
import json
import os
import secrets
import urllib.parse
import posthoganalytics
import requests
from django.conf import settings
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.password_validation import validate_password
from django.core.exceptions import ValidationError
from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect
from django.views.decorators.http import require_http_methods
from rest_framework import serializers
from posthog.models import Event, User
def user(request):

View File

@ -1,7 +1,8 @@
import os
import posthoganalytics
from django.apps import AppConfig
from django.conf import settings
import posthoganalytics
import os
class PostHogConfig(AppConfig):

View File

@ -1,14 +1,14 @@
import os
import time
from datetime import datetime
from typing import Optional
import redis
from celery import Celery, group
from celery.schedules import crontab
from dateutil import parser
from django.conf import settings
from django.db import connection
import redis
import time
from typing import Optional
from datetime import datetime
from dateutil import parser
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "posthog.settings")

View File

@ -1,9 +1,11 @@
import json
from posthog.models import Filter, DashboardItem
from posthog.utils import generate_cache_key
from django.core.cache import cache
import json
from datetime import datetime
from django.core.cache import cache
from posthog.models import DashboardItem, Filter
from posthog.utils import generate_cache_key
from .utils import generate_cache_key
TRENDS_ENDPOINT = "Trends"

View File

@ -1,30 +1,28 @@
import json
import random
import secrets
import uuid
from pathlib import Path
from typing import List
from dateutil.relativedelta import relativedelta
from django.http import HttpResponseNotFound, JsonResponse
from django.utils.timezone import now
from posthog.constants import TREND_FILTER_TYPE_ACTIONS
from posthog.models import (
Person,
PersonDistinctId,
Event,
Element,
Action,
ActionStep,
Funnel,
Team,
Dashboard,
DashboardItem,
Element,
Event,
Funnel,
Person,
PersonDistinctId,
Team,
)
from dateutil.relativedelta import relativedelta
from django.utils.timezone import now
from django.http import HttpResponseNotFound, JsonResponse
from posthog.urls import render_template
from posthog.utils import render_template
from posthog.constants import TREND_FILTER_TYPE_ACTIONS
from typing import List
from pathlib import Path
import uuid
import random
import json
import secrets
def _create_anonymous_users(team: Team, base_url: str) -> None:

View File

@ -1,31 +1,29 @@
import random
import io
import json
import random
import time
import uuid
import psycopg2
from pathlib import Path
from typing import Iterator, List, Optional
from urllib.parse import urlparse
from django.conf import settings
import psycopg2
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.core import serializers
from django.core.management.base import BaseCommand
from django.utils.timezone import now
from django.core import serializers
from dateutil.relativedelta import relativedelta
from pathlib import Path
from typing import List
import time
from typing import Iterator, Optional
import io
from posthog.models import (
Event,
Element,
Team,
Person,
PersonDistinctId,
Funnel,
Action,
ActionStep,
Element,
Event,
Funnel,
FunnelStep,
Person,
PersonDistinctId,
Team,
)

View File

@ -1,7 +1,7 @@
"""Cause git to detect a merge conflict when two branches have migrations."""
from django.db.migrations.loader import MigrationLoader
from django.core.management.commands.makemigrations import Command as MakeMigrationsCommand
from django.db.migrations.loader import MigrationLoader
class Command(MakeMigrationsCommand):

View File

@ -1,14 +1,13 @@
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from dateutil.relativedelta import relativedelta
from django.forms.models import model_to_dict
from django.db import transaction, models
import json
import hashlib
import json
from posthog.models import Event, Element, ElementGroup
from dateutil.relativedelta import relativedelta
from django.core.management.base import BaseCommand, CommandError
from django.db import models, transaction
from django.forms.models import model_to_dict
from django.utils import timezone
from posthog.models import Element, ElementGroup, Event
class Command(BaseCommand):

View File

@ -1,5 +1,6 @@
from django.core.management.base import BaseCommand
import os
from django.core.management.base import BaseCommand
from django.db import connection

View File

@ -1,8 +1,9 @@
from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
from django.http import HttpResponse, HttpRequest
from ipaddress import ip_address, ip_network
from django.conf import settings
from django.contrib.sessions.middleware import SessionMiddleware
from django.core.exceptions import MiddlewareNotUsed
from django.http import HttpRequest, HttpResponse
class AllowIP(object):

View File

@ -1,12 +1,12 @@
# Generated by Django 2.2.7 on 2020-01-23 22:38
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# Generated by Django 2.2.7 on 2020-01-24 18:38
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# Generated by Django 2.2.7 on 2020-01-24 19:02
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,8 +1,8 @@
# Generated by Django 2.2.7 on 2020-01-25 23:30
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# Generated by Django 2.2.7 on 2020-01-26 21:16
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,8 +1,8 @@
# Generated by Django 2.2.7 on 2020-01-27 19:31
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,7 +1,7 @@
# Generated by Django 2.2.7 on 2020-01-27 21:05
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,6 +1,7 @@
# Generated by Django 2.2.7 on 2020-01-29 07:03
from django.db import migrations, models
import posthog.models

View File

@ -1,8 +1,8 @@
# Generated by Django 2.2.7 on 2020-02-06 22:07
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# Generated by Django 2.2.7 on 2020-02-10 02:12
from django.db import migrations, models
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,8 +1,9 @@
# Generated by Django 3.0.3 on 2020-02-10 18:30
from django.db import migrations, models
import secrets
from django.db import migrations, models
def forwards_func(apps, schema_editor):
User = apps.get_model("posthog", "User")

View File

@ -1,8 +1,8 @@
# Generated by Django 3.0.3 on 2020-02-26 02:02
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# Generated by Django 3.0.3 on 2020-02-27 08:04
from django.db import migrations, models, transaction
import django.db.models.deletion
from django.db import migrations, models, transaction
class Migration(migrations.Migration):

View File

@ -1,11 +1,10 @@
# Generated by Django 3.0.3 on 2020-02-27 18:13
import hashlib
import json
from typing import List
from django.db import migrations, transaction, models
from django.db import migrations, models, transaction
from django.forms.models import model_to_dict
import json
import hashlib
def hash_elements(elements) -> str:

View File

@ -1,8 +1,9 @@
# Generated by Django 3.0.3 on 2020-03-07 00:22
from django.db import migrations, models
import secrets
from django.db import migrations, models
def add_signup_tokens(apps, schema_editor):
Team = apps.get_model("posthog", "Team")

View File

@ -1,9 +1,10 @@
# Generated by Django 3.0.3 on 2020-04-03 09:32
from django.db import migrations, models, connection
from django.db.models import Exists, OuterRef, Q, Subquery, F
import re
from typing import List, Dict, Union
from typing import Dict, List, Union
from django.db import connection, migrations, models
from django.db.models import Exists, F, OuterRef, Q, Subquery
attribute_regex = r"([a-zA-Z]*)\[(.*)=[\'|\"](.*)[\'|\"]\]"

View File

@ -1,6 +1,7 @@
# Generated by Django 3.0.5 on 2020-04-09 10:55
from django.db import migrations
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS

View File

@ -1,8 +1,9 @@
# Generated by Django 3.0.3 on 2020-04-13 19:36
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS

View File

@ -1,8 +1,8 @@
# Generated by Django 3.0.5 on 2020-05-07 09:12
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models, transaction
import django.db.models.deletion
def forwards(apps, schema_editor):

View File

@ -1,9 +1,9 @@
# Generated by Django 3.0.5 on 2020-05-07 18:22
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,10 +1,10 @@
# Generated by Django 3.0.6 on 2020-06-18 08:59
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# Generated by Django 3.0.7 on 2020-06-29 13:22
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,7 +1,7 @@
# Generated by Django 3.0.7 on 2020-07-14 16:42
from django.db import migrations, models
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,10 +1,11 @@
# Generated by Django 3.0.6 on 2020-06-25 10:24
from django.db import migrations, models
from posthog.models import Filter
import secrets
from django.db import migrations, models
from posthog.models import Filter
def forwards_func(apps, schema_editor):
Dashboard = apps.get_model("posthog", "Dashboard")

View File

@ -1,8 +1,9 @@
from .action import Action
from .action_step import ActionStep
from .annotation import Annotation
from .cohort import Cohort, CohortPeople
from .dashboard import Dashboard
from .dashboard_item import DashboardItem
from .cohort import Cohort, CohortPeople
from .element import Element
from .element_group import ElementGroup
from .entity import Entity
@ -14,4 +15,3 @@ from .person import Person, PersonDistinctId
from .property import Property
from .team import Team
from .user import User, UserManager
from .annotation import Annotation

View File

@ -1,11 +1,12 @@
import datetime
from django.db import models, connection, transaction
from django.core.exceptions import EmptyResultSet
from django.db import connection, models, transaction
from django.utils import timezone
from .user import User
from sentry_sdk import capture_exception
from .user import User
class Action(models.Model):
class Meta:

View File

@ -1,5 +1,5 @@
from django.db import models, connection, transaction
from django.contrib.postgres.fields import JSONField
from django.db import connection, models, transaction
class ActionStep(models.Model):

View File

@ -1,16 +1,17 @@
from django.db import models, connection, transaction
from django.db.models import Q
import json
from typing import Any, Dict, Optional
from dateutil.relativedelta import relativedelta
from django.contrib.postgres.fields import JSONField
from django.db import connection, models, transaction
from django.db.models import Q
from django.utils import timezone
from .person import Person
from sentry_sdk import capture_exception
from .action import Action
from .event import Event
from .filter import Filter
from dateutil.relativedelta import relativedelta
from sentry_sdk import capture_exception
from typing import Any, Dict, Optional
import json
from .person import Person
class Group(object):

View File

@ -1,5 +1,5 @@
from django.db import models
from django.contrib.postgres.fields import JSONField
from django.db import models
class DashboardItem(models.Model):
@ -16,6 +16,4 @@ class DashboardItem(models.Model):
color: models.CharField = models.CharField(max_length=400, null=True, blank=True)
last_refresh: models.DateTimeField = models.DateTimeField(blank=True, null=True)
refreshing: models.BooleanField = models.BooleanField(default=False)
funnel: models.ForeignKey = models.ForeignKey(
"Funnel", on_delete=models.CASCADE, null=True, blank=True
)
funnel: models.ForeignKey = models.ForeignKey("Funnel", on_delete=models.CASCADE, null=True, blank=True)

View File

@ -1,5 +1,5 @@
from django.contrib.postgres.fields import ArrayField, JSONField
from django.db import models
from django.contrib.postgres.fields import JSONField, ArrayField
class Element(models.Model):

View File

@ -1,10 +1,12 @@
from django.db import models, transaction
from django.forms.models import model_to_dict
from .element import Element
from .team import Team
from typing import List, Dict, Any
import hashlib
import json
from typing import Any, Dict, List
from django.db import models, transaction
from django.forms.models import model_to_dict
from .element import Element
from .team import Team
class ElementGroupManager(models.Manager):

View File

@ -1,5 +1,7 @@
from typing import Any, Dict, List, Optional, Union
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from typing import Union, Dict, Any, Optional, List
from .property import Property, PropertyMixin

View File

@ -1,47 +1,44 @@
from posthog.models.entity import Entity
from django.core.cache import cache
from django.conf import settings
from django.db import models, transaction
from django.db.models import (
Exists,
OuterRef,
Q,
Subquery,
F,
signals,
Prefetch,
QuerySet,
Value,
)
from django.db import connection
from django.db.models.functions import TruncDay
from django.contrib.postgres.fields import JSONField
from django.utils import timezone
from django.forms.models import model_to_dict
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from psycopg2 import sql # type: ignore
from .element_group import ElementGroup
from .element import Element
from .action import Action
from .action_step import ActionStep
from .person import PersonDistinctId, Person
from .team import Team
from .filter import Filter
from .utils import namedtuplefetchall
from posthog.utils import generate_cache_key
from posthog.tasks.slack import post_event_to_slack
from typing import Dict, Union, List, Optional, Any, Tuple
from collections import defaultdict
import copy
import datetime
import re
import random
import re
import string
from collections import defaultdict
from typing import Any, Dict, List, Optional, Tuple, Union
from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.core.cache import cache
from django.db import connection, models, transaction
from django.db.models import (
Exists,
F,
OuterRef,
Prefetch,
Q,
QuerySet,
Subquery,
Value,
signals,
)
from django.db.models.functions import TruncDay
from django.forms.models import model_to_dict
from django.utils import timezone
from psycopg2 import sql # type: ignore
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from posthog.models.entity import Entity
from posthog.tasks.slack import post_event_to_slack
from posthog.utils import generate_cache_key
from .action import Action
from .action_step import ActionStep
from .element import Element
from .element_group import ElementGroup
from .filter import Filter
from .person import Person, PersonDistinctId
from .team import Team
from .utils import namedtuplefetchall
attribute_regex = r"([a-zA-Z]*)\[(.*)=[\'|\"](.*)[\'|\"]\]"

View File

@ -1,10 +1,12 @@
from django.db import models
from django.contrib.postgres.fields import JSONField
from django.utils import timezone
from .person import Person
from .filter import Filter
import hashlib
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils import timezone
from .filter import Filter
from .person import Person
__LONG_SCALE__ = float(0xFFFFFFFFFFFFFFF)

View File

@ -1,15 +1,17 @@
from dateutil.relativedelta import relativedelta
from django.utils import timezone
from django.db.models import Q
from django.http import HttpRequest
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from posthog.utils import relative_date_parse
from typing import Union, Dict, Any, List, Optional
from .entity import Entity
from .property import Property, PropertyMixin
import datetime
import json
from typing import Any, Dict, List, Optional, Union
from dateutil.relativedelta import relativedelta
from django.db.models import Q
from django.http import HttpRequest
from django.utils import timezone
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from posthog.utils import relative_date_parse
from .entity import Entity
from .property import Property, PropertyMixin
class Filter(PropertyMixin):

View File

@ -1,27 +1,21 @@
from collections import defaultdict
import re
from collections import defaultdict
from datetime import timedelta
from typing import Any, Dict, List, Optional
from django.db import models
from django.contrib.postgres.fields import JSONField
from django.db import connection
from django.db.models import (
Min,
IntegerField,
Value,
)
from typing import List, Dict, Any, Optional
from django.db import connection, models
from django.db.models import IntegerField, Min, Value
from django.utils import timezone
from psycopg2 import sql # type: ignore
from .event import Event
from .action import Action
from .filter import Filter
from .entity import Entity
from .utils import namedtuplefetchall
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS
from datetime import timedelta
from django.utils import timezone
from .action import Action
from .entity import Entity
from .event import Event
from .filter import Filter
from .utils import namedtuplefetchall
class Funnel(models.Model):
@ -43,7 +37,15 @@ class Funnel(models.Model):
**{filter_key: step.id},
team_id=team_id,
**({"distinct_id": "1234321"} if index > 0 else {}),
**({"timestamp__gte": timezone.now().replace(year=2000, month=1, day=1, hour=0, minute=0, second=0, microsecond=0)} if index > 0 else {}),
**(
{
"timestamp__gte": timezone.now().replace(
year=2000, month=1, day=1, hour=0, minute=0, second=0, microsecond=0
)
}
if index > 0
else {}
),
)
.filter(filter.properties_to_Q(team_id=team_id))
.filter(step.properties_to_Q(team_id=team_id))

View File

@ -1,7 +1,8 @@
from django.db import models, transaction
from django.contrib.postgres.fields import JSONField
from typing import Any, List
from django.contrib.postgres.fields import JSONField
from django.db import models, transaction
class PersonManager(models.Manager):
def create(self, *args: Any, **kwargs: Any):

View File

@ -1,7 +1,9 @@
from django.db.models import Q, Exists, OuterRef
from .person import Person
import json
from typing import List, Optional, Union, Dict, Any
from typing import Any, Dict, List, Optional, Union
from django.db.models import Exists, OuterRef, Q
from .person import Person
class Property:

View File

@ -1,14 +1,17 @@
import secrets
from datetime import datetime
from typing import Dict, List, Optional
from django.contrib.postgres.fields import ArrayField, JSONField
from django.db import models
from django.contrib.postgres.fields import JSONField, ArrayField
from posthog.constants import TREND_FILTER_TYPE_EVENTS, TRENDS_LINEAR
from .action import Action
from .action_step import ActionStep
from .dashboard import Dashboard
from .dashboard_item import DashboardItem
from .user import User
from posthog.constants import TREND_FILTER_TYPE_EVENTS, TRENDS_LINEAR
from typing import Optional, List, Dict
from datetime import datetime
import secrets
TEAM_CACHE: Dict[str, "Team"] = {}

View File

@ -1,11 +1,10 @@
from django.conf import settings
from django.db import models
from django.contrib.auth.models import AbstractUser, BaseUserManager
from typing import Union, Optional, List
from django.utils.translation import ugettext_lazy as _
import secrets
from typing import List, Optional, Union
from django.conf import settings
from django.contrib.auth.models import AbstractUser, BaseUserManager
from django.db import models
from django.utils.translation import ugettext_lazy as _
from rest_framework.fields import BooleanField

View File

@ -13,14 +13,13 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
import ast
import os
import sys
from typing import List, Optional
from distutils.util import strtobool
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from typing import List, Optional
import dj_database_url
import sentry_sdk
from django.core.exceptions import ImproperlyConfigured
from sentry_sdk.integrations.django import DjangoIntegration
VERSION = "1.11.0"

View File

@ -1,9 +1,10 @@
from celery import shared_task
from posthog.models import Action
from posthog.celery import app
import logging
import time
from celery import shared_task
from posthog.celery import app
from posthog.models import Action
logger = logging.getLogger(__name__)

View File

@ -1,12 +1,14 @@
from celery import shared_task
from posthog.models import Cohort
from posthog.celery import app
from django.utils import timezone
from django.db.models import Q
from dateutil.relativedelta import relativedelta
import logging
import time
from celery import shared_task
from dateutil.relativedelta import relativedelta
from django.db.models import Q
from django.utils import timezone
from posthog.celery import app
from posthog.models import Cohort
logger = logging.getLogger(__name__)

View File

@ -1,17 +1,15 @@
from numbers import Number
from celery import shared_task
from django.core import serializers
from posthog.models import Person, Element, Event, Team, PersonDistinctId
import datetime
from typing import Union, Dict, Optional
from numbers import Number
from typing import Dict, Optional, Union
from celery import shared_task
from dateutil import parser
from dateutil.relativedelta import relativedelta
from django.core import serializers
from django.db import IntegrityError
from sentry_sdk import capture_exception
from posthog.models import Person, Element, Event, Team, PersonDistinctId
from posthog.models import Element, Event, Person, PersonDistinctId, Team
def _alias(previous_distinct_id: str, distinct_id: str, team_id: int, retry_if_failed: bool = True,) -> None:

View File

@ -1,7 +1,7 @@
import requests
from celery import shared_task
from django.apps import apps
from django.conf import settings
import requests
@shared_task

View File

@ -1,20 +1,22 @@
from datetime import timedelta
from unittest.mock import call, patch
from django.test import TransactionTestCase
from django.utils.timezone import now
from datetime import timedelta
from freezegun import freeze_time
from posthog.api.test.base import BaseTest
from posthog.models import (
Event,
Action,
ActionStep,
Person,
Element,
ElementGroup,
Event,
Person,
Team,
User,
Element,
)
from posthog.tasks.process_event import process_event
from unittest.mock import patch, call
class ProcessEvent(BaseTest):

View File

@ -1,12 +1,14 @@
from posthog.tasks.update_cache import update_cache_item, update_cached_items
from posthog.api.test.base import BaseTest
from posthog.models import Filter, DashboardItem, Dashboard, Funnel
from posthog.utils import generate_cache_key
from django.core.cache import cache
from freezegun import freeze_time
from unittest.mock import patch, MagicMock
from django.utils.timezone import now
import json
from unittest.mock import MagicMock, patch
from django.core.cache import cache
from django.utils.timezone import now
from freezegun import freeze_time
from posthog.api.test.base import BaseTest
from posthog.models import Dashboard, DashboardItem, Filter, Funnel
from posthog.tasks.update_cache import update_cache_item, update_cached_items
from posthog.utils import generate_cache_key
class TestUpdateCache(BaseTest):

View File

@ -1,19 +1,20 @@
from celery import shared_task, group
import datetime
import json
import logging
from typing import Any, Dict, List, Optional, Union
from celery import group, shared_task
from dateutil.relativedelta import relativedelta
from django.core.cache import cache
from django.db.models import Prefetch, Q
from django.utils import timezone
from posthog.api.action import calculate_trends, get_actions
from posthog.api.funnel import FunnelSerializer
from posthog.models import Filter, Action, Funnel, Entity, DashboardItem, ActionStep
from posthog.celery import app, update_cache_item_task
from posthog.decorators import FUNNEL_ENDPOINT, TRENDS_ENDPOINT
from posthog.models import Action, ActionStep, DashboardItem, Entity, Filter, Funnel
from posthog.utils import generate_cache_key
from posthog.celery import update_cache_item_task
from django.db.models import Prefetch, Q
from django.core.cache import cache
from django.utils import timezone
from dateutil.relativedelta import relativedelta
import logging
from typing import List, Dict, Any, Union, Optional
import json
import datetime
from posthog.celery import app
logger = logging.getLogger(__name__)

View File

@ -1,5 +1,5 @@
from posthog.models import Event, Element, Action, ActionStep, Person, Team, Cohort
from posthog.api.test.base import BaseTest
from posthog.models import Action, ActionStep, Cohort, Element, Event, Person, Team
class TestCohort(BaseTest):

View File

@ -1,6 +1,7 @@
from django.test import TestCase, Client
from posthog.models import User, DashboardItem, Action, Person, Event, Funnel, Team
from django.test import Client, TestCase
from posthog.api.test.base import BaseTest
from posthog.models import Action, DashboardItem, Event, Funnel, Person, Team, User
class TestDemo(BaseTest):

View File

@ -1,15 +1,8 @@
from posthog.models import (
Event,
Element,
Action,
ActionStep,
Person,
Team,
ElementGroup,
)
from posthog.models.event import Selector, SelectorPart
from unittest.mock import call, patch
from posthog.api.test.base import BaseTest
from unittest.mock import patch, call
from posthog.models import Action, ActionStep, Element, ElementGroup, Event, Person, Team
from posthog.models.event import Selector, SelectorPart
class TestFilterByActions(BaseTest):

View File

@ -1,10 +1,12 @@
from posthog.api.test.base import BaseTest
from posthog.models import Filter, Property, Event, Person, Element
from django.db.models import Q
from dateutil.relativedelta import relativedelta
from django.utils import timezone
import json
from dateutil.relativedelta import relativedelta
from django.db.models import Q
from django.utils import timezone
from posthog.api.test.base import BaseTest
from posthog.models import Element, Event, Filter, Person, Property
class TestFilter(BaseTest):
def test_old_style_properties(self):
@ -167,6 +169,7 @@ class TestPropertiesToQ(BaseTest):
self.assertEqual(events[0], event1)
self.assertEqual(len(events), 1)
class TestDateFilterQ(BaseTest):
def test_filter_by_all(self):
filter = Filter(
@ -178,7 +181,7 @@ class TestDateFilterQ(BaseTest):
"type": "person",
}
],
"date_from": "all"
"date_from": "all",
}
)
date_filter_query = filter.date_filter_Q

View File

@ -1,4 +1,4 @@
from django.test import TestCase, Client
from django.test import Client, TestCase
class TestSignup(TestCase):

View File

@ -1,9 +1,10 @@
from django.apps import apps
from django.test import TestCase
from django.db.migrations.executor import MigrationExecutor
from django.db import connection
from typing import Optional
from django.apps import apps
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
from django.test import TestCase
class TestMigrations(TestCase):
@property

View File

@ -1,8 +1,9 @@
from django.test import TestCase, Client
from posthog.models import User, Dashboard, DashboardItem, Action, Person, Event, Team
from social_django.strategy import DjangoStrategy
from social_django.models import DjangoStorage
from django.test import Client, TestCase
from social_core.utils import module_member
from social_django.models import DjangoStorage
from social_django.strategy import DjangoStrategy
from posthog.models import Action, Dashboard, DashboardItem, Event, Person, Team, User
from posthog.urls import social_create_user

View File

@ -1,9 +1,10 @@
from django.test import TestCase
from posthog.models import Event
from posthog.api.test.base import BaseTest
from posthog.utils import relative_date_parse
from freezegun import freeze_time
from posthog.api.test.base import BaseTest
from posthog.models import Event
from posthog.utils import relative_date_parse
class TestRelativeDateParse(TestCase):
@freeze_time("2020-01-31T12:22:23")

View File

@ -1,27 +1,28 @@
from typing import cast, Optional
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic.base import TemplateView
from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect
from django.contrib.auth import authenticate, login, views as auth_views, decorators
from django.conf import settings
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.template.loader import render_to_string
from django.template.exceptions import TemplateDoesNotExist
import json
import os
from typing import Optional, cast
from urllib.parse import urlparse
from .api import router, capture, user, decide, dashboard
from .models import Team, User, Event
import posthoganalytics
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import authenticate, decorators, login
from django.contrib.auth import views as auth_views
from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect
from django.template.exceptions import TemplateDoesNotExist
from django.template.loader import render_to_string
from django.urls import include, path, re_path
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.views.generic.base import TemplateView
from rest_framework import permissions
from posthog.demo import delete_demo_data, demo
from .api import capture, dashboard, decide, router, user
from .models import Event, Team, User
from .utils import render_template
from .views import health, stats
from posthog.demo import demo, delete_demo_data
import json
import posthoganalytics
import os
from rest_framework import permissions
def home(request, **kwargs):

View File

@ -1,23 +1,22 @@
import datetime
import hashlib
import json
import os
import re
from typing import Any, Dict, List, Optional, Tuple, Union
from urllib.parse import urlparse, urlsplit
import pytz
from dateutil import parser
from dateutil.relativedelta import relativedelta
from django.utils.timezone import now
from django.apps import apps
from django.conf import settings
from django.db.models import Q
from typing import Dict, Any, List, Union, Tuple
from django.http import HttpRequest, HttpResponse, JsonResponse
from django.template.loader import get_template
from django.http import HttpResponse, JsonResponse, HttpRequest
from dateutil import parser
from typing import Tuple, Optional
from rest_framework import request, authentication
from django.utils.timezone import now
from rest_framework import authentication, request
from rest_framework.exceptions import AuthenticationFailed
from urllib.parse import urlsplit, urlparse
from django.apps import apps
import datetime
import json
import re
import os
import pytz
import hashlib
def relative_date_parse(input: str) -> datetime.datetime:

View File

@ -1,9 +1,10 @@
from typing import Dict, Union
from django.http import HttpResponse
from django.conf import settings
import json
import redis
import time
from typing import Dict, Union
import redis
from django.conf import settings
from django.http import HttpResponse
if settings.REDIS_URL:
redis_instance = redis.from_url(settings.REDIS_URL, db=0)

View File

@ -19,4 +19,5 @@ djangorestframework-stubs
django-stubs
freezegun
packaging
black
black
isort

View File

@ -26,10 +26,10 @@ flake8-logging-format==0.6.0 # via -r requirements/dev.in
flake8-print==3.1.4 # via -r requirements/dev.in
flake8==3.7.9 # via -r requirements/dev.in, flake8-bugbear, flake8-colors, flake8-commas, flake8-comprehensions, flake8-print
freezegun==0.3.15 # via -r requirements/dev.in
importlib-metadata==1.6.0 # via flake8-comprehensions
ipdb==0.13.2 # via -r requirements/dev.in
ipython-genutils==0.2.0 # via traitlets
ipython==7.14.0 # via ipdb
isort==5.1.4 # via -r requirements/dev.in
jedi==0.17.0 # via ipython
mccabe==0.6.1 # via flake8
mypy-extensions==0.4.3 # via -r requirements/dev.in, mypy
@ -57,7 +57,6 @@ traitlets==4.3.3 # via ipython
typed-ast==1.4.1 # via black, mypy
typing-extensions==3.7.4.2 # via django-stubs, djangorestframework-stubs, mypy
wcwidth==0.1.9 # via prompt-toolkit
zipp==3.1.0 # via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# pip