Example #1
0
 def merge_dates_post(record: lbsn.Post = None) -> Optional[dt.datetime]:
     """Merge post_publish and post_created attributes"""
     post_create_date = HF.null_check_datetime(record.post_create_date)
     post_publish_date = HF.null_check_datetime(record.post_publish_date)
     if post_create_date is None:
         return post_publish_date
     return post_create_date
    def __init__(self, record=None):
        if record is None:
            record = lbsn.Event()

        self.origin_id = record.pkey.origin.origin_id
        self.event_guid = record.pkey.id
        self.name = HF.null_check(record.name)
        self.event_latlng = HF.null_geom_check(record.event_latlng)
        self.event_area = HF.null_check(record.event_area)
        self.event_website = HF.null_check(record.event_website)
        self.event_date = HF.null_check_datetime(record.event_date)
        self.event_date_start = HF.null_check_datetime(record.event_date_start)
        self.event_date_end = HF.null_check_datetime(record.event_date_end)
        self.duration = HF.null_check(record.duration)
        self.place_guid = HF.null_check(record.place_pkey.id)
        self.city_guid = HF.null_check(record.city_pkey.id)
        self.country_guid = HF.null_check(record.country_pkey.id)
        self.user_guid = HF.null_check(record.user_pkey.id)
        self.event_description = HF.null_check(record.event_description)
        self.event_type = HF.null_check(record.event_type)
        self.event_share_count = HF.null_check(record.event_share_count)
        self.event_like_count = HF.null_check(record.event_like_count)
        self.event_comment_count = HF.null_check(record.event_comment_count)
        self.event_views_count = HF.null_check(record.event_views_count)
        self.event_engage_count = HF.null_check(record.event_engage_count)
 def __init__(self, record=None):
     if record is None:
         record = lbsn.User()
     self.origin_id = record.pkey.origin.origin_id
     self.guid = record.pkey.id
     self.user_name = HF.null_check(record.user_name)
     self.user_fullname = HF.null_check(record.user_fullname)
     self.follows = HF.null_check(record.follows)
     self.followed = HF.null_check(record.followed)
     self.group_count = HF.null_check(record.group_count)
     self.biography = HF.null_check(record.biography)
     self.post_count = HF.null_check(record.post_count)
     self.url = HF.null_check(record.url)
     self.is_private = HF.null_check(record.is_private)
     self.is_available = HF.null_check(record.is_available)
     self.user_language = HF.null_check(record.user_language.language_short)
     self.user_location = HF.null_check(record.user_location)
     self.user_location_geom = HF.null_check(record.user_location_geom)
     self.liked_count = HF.null_check(record.liked_count)
     self.active_since = HF.null_check_datetime(record.active_since)
     self.profile_image_url = HF.null_check(record.profile_image_url)
     self.user_timezone = HF.null_check(record.user_timezone)
     self.user_utc_offset = HF.null_check(record.user_utc_offset)
     self.user_groups_member = list(set(record.user_groups_member))
     self.user_groups_follows = list(set(record.user_groups_follows))
 def __init__(self, record=None):
     if record is None:
         record = lbsn.UserGroup()
     self.origin_id = record.pkey.origin.origin_id
     self.guid = record.pkey.id
     self.usergroup_name = HF.null_check(record.usergroup_name)
     self.usergroup_description = HF.null_check(
         record.usergroup_description)
     self.member_count = HF.null_check(record.member_count)
     self.usergroup_createdate = HF.null_check_datetime(
         record.usergroup_createdate)
     self.user_owner = HF.null_check(record.user_owner_pkey.id)
    def __init__(self, record=None):
        if record is None:
            record = lbsn.Post()

        self.origin_id = record.pkey.origin.origin_id
        self.guid = record.pkey.id
        self.post_latlng = HF.null_geom_check(record.post_latlng)
        self.place_guid = HF.null_check(record.place_pkey.id)
        self.city_guid = HF.null_check(record.city_pkey.id)
        self.country_guid = HF.null_check(record.country_pkey.id)
        self.post_geoaccuracy = HF.turn_lower(
            HF.null_check(lbsn.Post().PostGeoaccuracy.Name(
                record.post_geoaccuracy)))
        self.user_guid = HF.null_check(record.user_pkey.id)
        self.post_create_date = HF.null_check_datetime(record.post_create_date)
        self.post_publish_date = HF.null_check_datetime(
            record.post_publish_date)
        self.post_body = HF.null_check(record.post_body)
        self.post_language = HF.null_check(record.post_language.language_short)
        self.user_mentions = list(
            set([pkey.id for pkey in record.user_mentions_pkey]))
        self.hashtags = list(set(record.hashtags))
        self.emoji = list(set(record.emoji))
        self.post_like_count = HF.null_check(record.post_like_count)
        self.post_comment_count = HF.null_check(record.post_comment_count)
        self.post_views_count = HF.null_check(record.post_views_count)
        self.post_title = HF.null_check(record.post_title)
        self.post_thumbnail_url = HF.null_check(record.post_thumbnail_url)
        self.post_url = HF.null_check(record.post_url)
        self.post_type = HF.turn_lower(
            HF.null_check(lbsn.Post().PostType.Name(record.post_type)))
        self.post_filter = HF.null_check(record.post_filter)
        self.post_quote_count = HF.null_check(record.post_quote_count)
        self.post_share_count = HF.null_check(record.post_share_count)
        self.input_source = HF.null_check(record.input_source)
        self.post_content_license = HF.null_check(record.post_content_license)
        # optional:
        self.latitude = 0
        self.longitude = 0
 def __init__(self, record=None):
     if record is None:
         record = lbsn.PostReaction()
     self.origin_id = record.pkey.origin.origin_id
     self.guid = record.pkey.id
     self.reaction_latlng = HF.null_geom_check(record.reaction_latlng)
     self.user_guid = HF.null_check(record.user_pkey.id)
     self.referenced_post = HF.null_check(record.referencedPost_pkey.id)
     self.referenced_postreaction = HF.null_check(
         record.referencedPostreaction_pkey.id)
     self.reaction_type = HF.turn_lower(
         HF.null_check(lbsn.PostReaction().ReactionType.Name(
             record.reaction_type)))
     self.reaction_date = HF.null_check_datetime(record.reaction_date)
     self.reaction_content = HF.null_check(record.reaction_content)
     self.reaction_like_count = HF.null_check(record.reaction_like_count)
     self.user_mentions = list(
         set([pkey.id for pkey in record.user_mentions_pkey]))