Delete metadata.jsonl
Browse files- metadata.jsonl +0 -11
metadata.jsonl
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
{"file_name": "train/a79a0f40-8cc6-409e-a605-f6a8ec51ad05.png", "code": "def create_bookmark(session: Session, activity: CreateActivity) -> Bookmark:\r\n with session() as db:\r\n bookmark: Bookmark = Bookmark(\r\n author_id=activity.user_id,\r\n post_id=activity.post_id\r\n )\r\n db.add(bookmark)\r\n db.commit()\r\n db.refresh(bookmark)\r\n return bookmark"}
|
2 |
-
{"file_name": "train/414a0a56-7e67-4a57-9932-a64130144473.png", "code": "def create_bookmark(session: Session, activity: CreateActivity) -> Bookmark:\r\n with session() as db:\r\n bookmark: Bookmark = Bookmark(\r\n author_id=activity.user_id,\r\n post_id=activity.post_id\r\n )\r\n db.add(bookmark)\r\n db.commit()\r\n db.refresh(bookmark)\r\n return bookmark"}
|
3 |
-
{"file_name": "train/fec40a7e-20ad-46bb-bd28-32a99d6f81f0.png", "code": "def create_bookmark(session: Session, activity: CreateActivity) -> Bookmark:\r\n with session() as db:\r\n bookmark: Bookmark = Bookmark(\r\n author_id=activity.user_id,\r\n post_id=activity.post_id\r\n )\r\n db.add(bookmark)\r\n db.commit()\r\n db.refresh(bookmark)\r\n return bookmark\r\n\r\ndef delete_bookmark(session: Session, activity: CreateActivity) -> Bookmark:\r\n with session() as db:\r\n bookmark: Bookmark = db.query(Bookmark).filter(Bookmark.author_id==activity.user_id, Bookmark.post_id==activity.post_id).first()\r\n db.delete(bookmark)\r\n db.commit()\r\n return bookmark\r\n\r\ndef has_bookmarked(session: Session, activity: CreateActivity) -> Bookmark:\r\n with session() as db:\r\n bookmark: Bookmark = db.query(Bookmark).filter(Bookmark.author_id==activity.user_id, Bookmark.post_id==activity.post_id).first()\r\n if bookmark:\r\n return True\r\n return False"}
|
4 |
-
{"file_name": "train/449fb948-ec15-4214-af87-09ff62747a79.png", "code": "def list_user_bookmarks(session: Session, user_data: GetUser) -> list[Bookmark]:\r\n with session() as db:\r\n user: User = db.query(User).filter(User.id == user_data.user_id).first()\r\n bookmarks: list[Bookmark] = user.bookmarks\r\n return bookmarks\r\n\r\ndef list_post_bookmarks(session: Session, post_data: GetPost):\r\n with session() as db:\r\n post = db.query(Post).filter(Post.id == post_data.post_id).first()\r\n bookmarks: list[Bookmark] = post.bookmarks\r\n return bookmarks"}
|
5 |
-
{"file_name": "train/70a5a1b5-7323-4400-91c5-cea10940230a.png", "code": "from ..schemas.activity import CreateComment, CreateActivity\r\nfrom sqlalchemy.orm import Session\r\nfrom ..models.comment import Comment\r\nfrom ..models.user import User\r\nfrom ..models.post import Post\r\nfrom ..schemas.user import GetUser\r\nfrom ..schemas.post import GetPost\r\nfrom uuid import uuid4"}
|
6 |
-
{"file_name": "train/ebb03413-0b0e-4ea8-b201-3f73b838173a.png", "code": "def create_comment(session: Session, comment_data: CreateComment) -> Comment:\r\n with session() as db:\r\n comment: Comment = Comment(\r\n author_id=comment_data.user_id,\r\n post_id=comment_data.post_id,\r\n id='Comment_' + str(uuid4()),\r\n comment_text=comment_data.comment\r\n )\r\n db.add(comment)\r\n db.commit()\r\n db.refresh(comment)\r\n return comment"}
|
7 |
-
{"file_name": "train/6dd94e18-7a4a-4fad-8f0b-4157898888ad.png", "code": "from ..schemas.activity import CreateComment, CreateActivity\r\nfrom sqlalchemy.orm import Session\r\nfrom ..models.comment import Comment\r\nfrom ..models.user import User\r\nfrom ..models.post import Post\r\nfrom ..schemas.user import GetUser\r\nfrom ..schemas.post import GetPost\r\nfrom uuid import uuid4\r\n\r\n\r\ndef create_comment(session: Session, comment_data: CreateComment) -> Comment:\r\n with session() as db:\r\n comment: Comment = Comment(\r\n author_id=comment_data.user_id,\r\n post_id=comment_data.post_id,\r\n id='Comment_' + str(uuid4()),\r\n comment_text=comment_data.comment\r\n )\r\n db.add(comment)\r\n db.commit()\r\n db.refresh(comment)\r\n return comment"}
|
8 |
-
{"file_name": "train/5e30d9b0-f329-47c4-a96e-4017671a0caf.png", "code": "def has_commented(session: Session, activity: CreateActivity) -> Comment:\r\n with session() as db:\r\n comment: Comment = db.query(Comment).filter(Comment.author_id==activity.user_id, Comment.post_id==activity.post_id).first()\r\n if comment:\r\n return True\r\n return False\r\n\r\ndef list_user_comments(session: Session, user_data: GetUser) -> list[Comment]:\r\n with session() as db:\r\n user: User = db.query(User).filter(User.id == user_data.user_id).first()\r\n comments: list[Comment] = user.comments\r\n return comments\r\n\r\ndef list_user_post_comments(session: Session, activity: CreateActivity) -> list[Comment]:\r\n with session() as db:\r\n comments: list[Comment] = db.query(Comment).filter(Comment.author_id == activity.user_id, Comment.post_id==activity.post_id).all()\r\n return comments"}
|
9 |
-
{"file_name": "train/d2682701-0ba1-4554-a754-c77a4b944ee9.png", "code": "def list_post_comments(session: Session, post_data: GetPost, offset: int = 0, limit: int = 5):\r\n with session() as db:\r\n post: Post = db.query(Post).filter(Post.id == post_data.post_id).first()\r\n comments: list[Comment] = post.comments\r\n for comment in comments:\r\n comment.author\r\n print(offset,limit)\r\n return comments[offset:limit]\r\n \r\ndef get_key_comment(session: Session, post_data: GetPost):\r\n from random import choice\r\n with session() as db:\r\n post: Post = db.query(Post).filter(Post.id == post_data.post_id).first()\r\n comments: list[Comment] = post.comments\r\n for comment in comments:\r\n comment.author\r\n return choice(comments) if comments else None"}
|
10 |
-
{"file_name": "train/3bebb3af-d341-43a1-a585-493036274e55.png", "code": "from ..schemas.activity import CreateActivity\r\nfrom sqlalchemy.orm import Session\r\nfrom ..models.like import Like\r\nfrom ..models.user import User\r\nfrom ..models.post import Post\r\nfrom ..schemas.user import GetUser\r\nfrom ..schemas.post import GetPost"}
|
11 |
-
{"file_name": "train/ed8ad3b9-7161-4983-a7da-1cf1bc2bfc9c.png", "code": "def create_like(session: Session, activity: CreateActivity) -> Like:\r\n with session() as db:\r\n like: Like = Like(\r\n author_id=activity.user_id,\r\n post_id=activity.post_id\r\n )\r\n db.add(like)\r\n db.commit()\r\n db.refresh(like)\r\n return like"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|