# Path: minent/utils.py
# def normalize(text):
# def signature(text):
# def htmlize(text):
# def normalize_query(terms):
# def memoized(fget):
#     def fget_memoized(self):
#     def __init__(self, wall_clock=True):
#     def __enter__(self):
#     def __exit__(self, type, value, tb):
#     def __str__(self):
# def timeit(func, wall_clock=True):
#     def timer_wrapper(*args, **kwargs):
# def humanizedelta(*args, **kwargs):
# class Timer(object):
# 
# Path: stream/managers.py
# class StreamItemManager(models.Manager):
# 
#     def user_stream(self, user, privacy=False):
#         """
#         Returns a queryset containing a specific user's feed. If privacy
#         is set to True, then only returns public items for the user's feed.
#         """
#         queryset = self.filter(actor=user)
#         if privacy:
#             queryset = queryset.filter(public=True)
# 
#         return queryset.order_by('timestamp')


from django.db import models
from model_utils import Choices
from django.utils.timesince import timesince
from minent.utils import nullable, notnullable
from stream.managers import StreamItemManager
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.utils import timezone as datetime

    For example:

        <bbengfort> <logged in> <1 minute ago>
        <mcox> <asked> <question> <2 hours ago>
        <dperlis> <annotated> <topic> on <question> <a day ago>

    Much of this data type is created automatically (e.g. not interacted
    with by users except through views). A secondary table is used to
    store the activity stream to ensure that it can be quickly loaded,
    even though many of the items in question already have a relationship
    to some user!
    """

    ## Potential actions (verbs) for the activity stream
    ## DB storage is the infinitive, display is past tense
    VERBS = Choices(
            ('join', 'joined'),
            ('view', 'viewed'),
            ('upvote', 'up voted'),
            ('downvote', 'down voted'),
            ('ask', 'asked'),
            ('answer', 'answered'),
        )

    ## Relationship to the user (the actor)
    actor     = models.ForeignKey( 'auth.User', related_name='activity_stream' ) # The actor causing the event

    ## Generic relationship to a target
    target_content_type = models.ForeignKey( ContentType, related_name="targets", **nullable )

# Path: minent/utils.py
# def normalize(text):
# def signature(text):
# def htmlize(text):
# def normalize_query(terms):
# def memoized(fget):
#     def fget_memoized(self):
#     def __init__(self, wall_clock=True):
#     def __enter__(self):
#     def __exit__(self, type, value, tb):
#     def __str__(self):
# def timeit(func, wall_clock=True):
#     def timer_wrapper(*args, **kwargs):
# def humanizedelta(*args, **kwargs):
# class Timer(object):
# 
# Path: stream/managers.py
# class StreamItemManager(models.Manager):
# 
#     def user_stream(self, user, privacy=False):
#         """
#         Returns a queryset containing a specific user's feed. If privacy
#         is set to True, then only returns public items for the user's feed.
#         """
#         queryset = self.filter(actor=user)
#         if privacy:
#             queryset = queryset.filter(public=True)
# 
#         return queryset.order_by('timestamp')


# Path: stream/models.py
from django.db import models
from model_utils import Choices
from django.utils.timesince import timesince
from minent.utils import nullable, notnullable
from stream.managers import StreamItemManager
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.utils import timezone as datetime


    For example:

        <bbengfort> <logged in> <1 minute ago>
        <mcox> <asked> <question> <2 hours ago>
        <dperlis> <annotated> <topic> on <question> <a day ago>

    Much of this data type is created automatically (e.g. not interacted
    with by users except through views). A secondary table is used to
    store the activity stream to ensure that it can be quickly loaded,
    even though many of the items in question already have a relationship
    to some user!
    """

    ## Potential actions (verbs) for the activity stream
    ## DB storage is the infinitive, display is past tense
    VERBS = Choices(
            ('join', 'joined'),
            ('view', 'viewed'),
            ('upvote', 'up voted'),
            ('downvote', 'down voted'),
            ('ask', 'asked'),
            ('answer', 'answered'),
        )

    ## Relationship to the user (the actor)
    actor     = models.ForeignKey( 'auth.User', related_name='activity_stream' ) # The actor causing the event

    ## Generic relationship to a target
    target_content_type = models.ForeignKey( ContentType, related_name="targets", **nullable )

    target_object_id    = models.PositiveIntegerField( **nullable )