partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | InboxPage.view_context | View the context surrounding the selected comment. | rtv/inbox_page.py | def view_context(self):
"""
View the context surrounding the selected comment.
"""
url = self.get_selected_item().get('context')
if url:
self.selected_page = self.open_submission_page(url) | def view_context(self):
"""
View the context surrounding the selected comment.
"""
url = self.get_selected_item().get('context')
if url:
self.selected_page = self.open_submission_page(url) | [
"View",
"the",
"context",
"surrounding",
"the",
"selected",
"comment",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/inbox_page.py#L120-L126 | [
"def",
"view_context",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"get_selected_item",
"(",
")",
".",
"get",
"(",
"'context'",
")",
"if",
"url",
":",
"self",
".",
"selected_page",
"=",
"self",
".",
"open_submission_page",
"(",
"url",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | InboxPage.open_submission | Open the full submission and comment tree for the selected comment. | rtv/inbox_page.py | def open_submission(self):
"""
Open the full submission and comment tree for the selected comment.
"""
url = self.get_selected_item().get('submission_permalink')
if url:
self.selected_page = self.open_submission_page(url) | def open_submission(self):
"""
Open the full submission and comment tree for the selected comment.
"""
url = self.get_selected_item().get('submission_permalink')
if url:
self.selected_page = self.open_submission_page(url) | [
"Open",
"the",
"full",
"submission",
"and",
"comment",
"tree",
"for",
"the",
"selected",
"comment",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/inbox_page.py#L130-L136 | [
"def",
"open_submission",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"get_selected_item",
"(",
")",
".",
"get",
"(",
"'submission_permalink'",
")",
"if",
"url",
":",
"self",
".",
"selected_page",
"=",
"self",
".",
"open_submission_page",
"(",
"url",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | logged_in | Decorator for Page methods that require the user to be authenticated. | rtv/page.py | def logged_in(f):
"""
Decorator for Page methods that require the user to be authenticated.
"""
@wraps(f)
def wrapped_method(self, *args, **kwargs):
if not self.reddit.is_oauth_session():
self.term.show_notification('Not logged in')
return None
return f(self,... | def logged_in(f):
"""
Decorator for Page methods that require the user to be authenticated.
"""
@wraps(f)
def wrapped_method(self, *args, **kwargs):
if not self.reddit.is_oauth_session():
self.term.show_notification('Not logged in')
return None
return f(self,... | [
"Decorator",
"for",
"Page",
"methods",
"that",
"require",
"the",
"user",
"to",
"be",
"authenticated",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L23-L34 | [
"def",
"logged_in",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapped_method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"reddit",
".",
"is_oauth_session",
"(",
")",
":",
"self",
".... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.loop | Main control loop runs the following steps:
1. Re-draw the screen
2. Wait for user to press a key (includes terminal resizing)
3. Trigger the method registered to the input key
4. Check if there are any nested pages that need to be looped over
The loop will run u... | rtv/page.py | def loop(self):
"""
Main control loop runs the following steps:
1. Re-draw the screen
2. Wait for user to press a key (includes terminal resizing)
3. Trigger the method registered to the input key
4. Check if there are any nested pages that need to be loop... | def loop(self):
"""
Main control loop runs the following steps:
1. Re-draw the screen
2. Wait for user to press a key (includes terminal resizing)
3. Trigger the method registered to the input key
4. Check if there are any nested pages that need to be loop... | [
"Main",
"control",
"loop",
"runs",
"the",
"following",
"steps",
":",
"1",
".",
"Re",
"-",
"draw",
"the",
"screen",
"2",
".",
"Wait",
"for",
"user",
"to",
"press",
"a",
"key",
"(",
"includes",
"terminal",
"resizing",
")",
"3",
".",
"Trigger",
"the",
"... | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L72-L99 | [
"def",
"loop",
"(",
"self",
")",
":",
"self",
".",
"active",
"=",
"True",
"# This needs to be called once before the main loop, in case a subpage",
"# was pre-selected before the loop started. This happens in __main__.py",
"# with ``page.open_submission(url=url)``",
"while",
"self",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.previous_theme | Cycle to preview the previous theme from the internal list of themes. | rtv/page.py | def previous_theme(self):
"""
Cycle to preview the previous theme from the internal list of themes.
"""
theme = self.term.theme_list.previous(self.term.theme)
while not self.term.check_theme(theme):
theme = self.term.theme_list.previous(theme)
self.term.set_t... | def previous_theme(self):
"""
Cycle to preview the previous theme from the internal list of themes.
"""
theme = self.term.theme_list.previous(self.term.theme)
while not self.term.check_theme(theme):
theme = self.term.theme_list.previous(theme)
self.term.set_t... | [
"Cycle",
"to",
"preview",
"the",
"previous",
"theme",
"from",
"the",
"internal",
"list",
"of",
"themes",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L159-L170 | [
"def",
"previous_theme",
"(",
"self",
")",
":",
"theme",
"=",
"self",
".",
"term",
".",
"theme_list",
".",
"previous",
"(",
"self",
".",
"term",
".",
"theme",
")",
"while",
"not",
"self",
".",
"term",
".",
"check_theme",
"(",
"theme",
")",
":",
"them... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.next_theme | Cycle to preview the next theme from the internal list of themes. | rtv/page.py | def next_theme(self):
"""
Cycle to preview the next theme from the internal list of themes.
"""
theme = self.term.theme_list.next(self.term.theme)
while not self.term.check_theme(theme):
theme = self.term.theme_list.next(theme)
self.term.set_theme(theme)
... | def next_theme(self):
"""
Cycle to preview the next theme from the internal list of themes.
"""
theme = self.term.theme_list.next(self.term.theme)
while not self.term.check_theme(theme):
theme = self.term.theme_list.next(theme)
self.term.set_theme(theme)
... | [
"Cycle",
"to",
"preview",
"the",
"next",
"theme",
"from",
"the",
"internal",
"list",
"of",
"themes",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L173-L184 | [
"def",
"next_theme",
"(",
"self",
")",
":",
"theme",
"=",
"self",
".",
"term",
".",
"theme_list",
".",
"next",
"(",
"self",
".",
"term",
".",
"theme",
")",
"while",
"not",
"self",
".",
"term",
".",
"check_theme",
"(",
"theme",
")",
":",
"theme",
"=... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.move_page_top | Move the cursor to the first item on the page. | rtv/page.py | def move_page_top(self):
"""
Move the cursor to the first item on the page.
"""
self.nav.page_index = self.content.range[0]
self.nav.cursor_index = 0
self.nav.inverted = False | def move_page_top(self):
"""
Move the cursor to the first item on the page.
"""
self.nav.page_index = self.content.range[0]
self.nav.cursor_index = 0
self.nav.inverted = False | [
"Move",
"the",
"cursor",
"to",
"the",
"first",
"item",
"on",
"the",
"page",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L226-L232 | [
"def",
"move_page_top",
"(",
"self",
")",
":",
"self",
".",
"nav",
".",
"page_index",
"=",
"self",
".",
"content",
".",
"range",
"[",
"0",
"]",
"self",
".",
"nav",
".",
"cursor_index",
"=",
"0",
"self",
".",
"nav",
".",
"inverted",
"=",
"False"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.move_page_bottom | Move the cursor to the last item on the page. | rtv/page.py | def move_page_bottom(self):
"""
Move the cursor to the last item on the page.
"""
self.nav.page_index = self.content.range[1]
self.nav.cursor_index = 0
self.nav.inverted = True | def move_page_bottom(self):
"""
Move the cursor to the last item on the page.
"""
self.nav.page_index = self.content.range[1]
self.nav.cursor_index = 0
self.nav.inverted = True | [
"Move",
"the",
"cursor",
"to",
"the",
"last",
"item",
"on",
"the",
"page",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L235-L241 | [
"def",
"move_page_bottom",
"(",
"self",
")",
":",
"self",
".",
"nav",
".",
"page_index",
"=",
"self",
".",
"content",
".",
"range",
"[",
"1",
"]",
"self",
".",
"nav",
".",
"cursor_index",
"=",
"0",
"self",
".",
"nav",
".",
"inverted",
"=",
"True"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.upvote | Upvote the currently selected item. | rtv/page.py | def upvote(self):
"""
Upvote the currently selected item.
"""
data = self.get_selected_item()
if 'likes' not in data:
self.term.flash()
elif getattr(data['object'], 'archived'):
self.term.show_notification("Voting disabled for archived post", style... | def upvote(self):
"""
Upvote the currently selected item.
"""
data = self.get_selected_item()
if 'likes' not in data:
self.term.flash()
elif getattr(data['object'], 'archived'):
self.term.show_notification("Voting disabled for archived post", style... | [
"Upvote",
"the",
"currently",
"selected",
"item",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L245-L263 | [
"def",
"upvote",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_selected_item",
"(",
")",
"if",
"'likes'",
"not",
"in",
"data",
":",
"self",
".",
"term",
".",
"flash",
"(",
")",
"elif",
"getattr",
"(",
"data",
"[",
"'object'",
"]",
",",
"'ar... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.downvote | Downvote the currently selected item. | rtv/page.py | def downvote(self):
"""
Downvote the currently selected item.
"""
data = self.get_selected_item()
if 'likes' not in data:
self.term.flash()
elif getattr(data['object'], 'archived'):
self.term.show_notification("Voting disabled for archived post", s... | def downvote(self):
"""
Downvote the currently selected item.
"""
data = self.get_selected_item()
if 'likes' not in data:
self.term.flash()
elif getattr(data['object'], 'archived'):
self.term.show_notification("Voting disabled for archived post", s... | [
"Downvote",
"the",
"currently",
"selected",
"item",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L267-L285 | [
"def",
"downvote",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_selected_item",
"(",
")",
"if",
"'likes'",
"not",
"in",
"data",
":",
"self",
".",
"term",
".",
"flash",
"(",
")",
"elif",
"getattr",
"(",
"data",
"[",
"'object'",
"]",
",",
"'... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.save | Mark the currently selected item as saved through the reddit API. | rtv/page.py | def save(self):
"""
Mark the currently selected item as saved through the reddit API.
"""
data = self.get_selected_item()
if 'saved' not in data:
self.term.flash()
elif not data['saved']:
with self.term.loader('Saving'):
data['objec... | def save(self):
"""
Mark the currently selected item as saved through the reddit API.
"""
data = self.get_selected_item()
if 'saved' not in data:
self.term.flash()
elif not data['saved']:
with self.term.loader('Saving'):
data['objec... | [
"Mark",
"the",
"currently",
"selected",
"item",
"as",
"saved",
"through",
"the",
"reddit",
"API",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L289-L305 | [
"def",
"save",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_selected_item",
"(",
")",
"if",
"'saved'",
"not",
"in",
"data",
":",
"self",
".",
"term",
".",
"flash",
"(",
")",
"elif",
"not",
"data",
"[",
"'saved'",
"]",
":",
"with",
"self",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.login | Prompt to log into the user's account, or log out of the current
account. | rtv/page.py | def login(self):
"""
Prompt to log into the user's account, or log out of the current
account.
"""
if self.reddit.is_oauth_session():
ch = self.term.show_notification('Log out? (y/n)')
if ch in (ord('y'), ord('Y')):
self.oauth.clear_oauth_d... | def login(self):
"""
Prompt to log into the user's account, or log out of the current
account.
"""
if self.reddit.is_oauth_session():
ch = self.term.show_notification('Log out? (y/n)')
if ch in (ord('y'), ord('Y')):
self.oauth.clear_oauth_d... | [
"Prompt",
"to",
"log",
"into",
"the",
"user",
"s",
"account",
"or",
"log",
"out",
"of",
"the",
"current",
"account",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L308-L319 | [
"def",
"login",
"(",
"self",
")",
":",
"if",
"self",
".",
"reddit",
".",
"is_oauth_session",
"(",
")",
":",
"ch",
"=",
"self",
".",
"term",
".",
"show_notification",
"(",
"'Log out? (y/n)'",
")",
"if",
"ch",
"in",
"(",
"ord",
"(",
"'y'",
")",
",",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.reply | Reply to the selected item. This is a utility method and should not
be bound to a key directly.
Item type:
Submission - add a top level comment
Comment - add a comment reply
Message - reply to a private message | rtv/page.py | def reply(self):
"""
Reply to the selected item. This is a utility method and should not
be bound to a key directly.
Item type:
Submission - add a top level comment
Comment - add a comment reply
Message - reply to a private message
"""
... | def reply(self):
"""
Reply to the selected item. This is a utility method and should not
be bound to a key directly.
Item type:
Submission - add a top level comment
Comment - add a comment reply
Message - reply to a private message
"""
... | [
"Reply",
"to",
"the",
"selected",
"item",
".",
"This",
"is",
"a",
"utility",
"method",
"and",
"should",
"not",
"be",
"bound",
"to",
"a",
"key",
"directly",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L321-L371 | [
"def",
"reply",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_selected_item",
"(",
")",
"if",
"data",
"[",
"'type'",
"]",
"==",
"'Submission'",
":",
"body",
"=",
"data",
"[",
"'text'",
"]",
"description",
"=",
"'submission'",
"reply",
"=",
"dat... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.delete_item | Delete a submission or comment. | rtv/page.py | def delete_item(self):
"""
Delete a submission or comment.
"""
data = self.get_selected_item()
if data.get('author') != self.reddit.user.name:
self.term.flash()
return
prompt = 'Are you sure you want to delete this? (y/n): '
if not self.te... | def delete_item(self):
"""
Delete a submission or comment.
"""
data = self.get_selected_item()
if data.get('author') != self.reddit.user.name:
self.term.flash()
return
prompt = 'Are you sure you want to delete this? (y/n): '
if not self.te... | [
"Delete",
"a",
"submission",
"or",
"comment",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L375-L395 | [
"def",
"delete_item",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_selected_item",
"(",
")",
"if",
"data",
".",
"get",
"(",
"'author'",
")",
"!=",
"self",
".",
"reddit",
".",
"user",
".",
"name",
":",
"self",
".",
"term",
".",
"flash",
"("... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.edit | Edit a submission or comment. | rtv/page.py | def edit(self):
"""
Edit a submission or comment.
"""
data = self.get_selected_item()
if data.get('author') != self.reddit.user.name:
self.term.flash()
return
if data['type'] == 'Submission':
content = data['text']
info = d... | def edit(self):
"""
Edit a submission or comment.
"""
data = self.get_selected_item()
if data.get('author') != self.reddit.user.name:
self.term.flash()
return
if data['type'] == 'Submission':
content = data['text']
info = d... | [
"Edit",
"a",
"submission",
"or",
"comment",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L399-L432 | [
"def",
"edit",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_selected_item",
"(",
")",
"if",
"data",
".",
"get",
"(",
"'author'",
")",
"!=",
"self",
".",
"reddit",
".",
"user",
".",
"name",
":",
"self",
".",
"term",
".",
"flash",
"(",
")"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.send_private_message | Send a new private message to another user. | rtv/page.py | def send_private_message(self):
"""
Send a new private message to another user.
"""
message_info = docs.MESSAGE_FILE
with self.term.open_editor(message_info) as text:
if not text:
self.term.show_notification('Canceled')
return
... | def send_private_message(self):
"""
Send a new private message to another user.
"""
message_info = docs.MESSAGE_FILE
with self.term.open_editor(message_info) as text:
if not text:
self.term.show_notification('Canceled')
return
... | [
"Send",
"a",
"new",
"private",
"message",
"to",
"another",
"user",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L436-L479 | [
"def",
"send_private_message",
"(",
"self",
")",
":",
"message_info",
"=",
"docs",
".",
"MESSAGE_FILE",
"with",
"self",
".",
"term",
".",
"open_editor",
"(",
"message_info",
")",
"as",
"text",
":",
"if",
"not",
"text",
":",
"self",
".",
"term",
".",
"sho... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.prompt_and_select_link | Prompt the user to select a link from a list to open.
Return the link that was selected, or ``None`` if no link was selected. | rtv/page.py | def prompt_and_select_link(self):
"""
Prompt the user to select a link from a list to open.
Return the link that was selected, or ``None`` if no link was selected.
"""
data = self.get_selected_item()
url_full = data.get('url_full')
permalink = data.get('permalink... | def prompt_and_select_link(self):
"""
Prompt the user to select a link from a list to open.
Return the link that was selected, or ``None`` if no link was selected.
"""
data = self.get_selected_item()
url_full = data.get('url_full')
permalink = data.get('permalink... | [
"Prompt",
"the",
"user",
"to",
"select",
"a",
"link",
"from",
"a",
"list",
"to",
"open",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L481-L512 | [
"def",
"prompt_and_select_link",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_selected_item",
"(",
")",
"url_full",
"=",
"data",
".",
"get",
"(",
"'url_full'",
")",
"permalink",
"=",
"data",
".",
"get",
"(",
"'permalink'",
")",
"if",
"url_full",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.copy_to_clipboard | Attempt to copy the selected URL to the user's clipboard | rtv/page.py | def copy_to_clipboard(self, url):
"""
Attempt to copy the selected URL to the user's clipboard
"""
if url is None:
self.term.flash()
return
try:
clipboard_copy(url)
except (ProgramError, OSError) as e:
_logger.exception(e)
... | def copy_to_clipboard(self, url):
"""
Attempt to copy the selected URL to the user's clipboard
"""
if url is None:
self.term.flash()
return
try:
clipboard_copy(url)
except (ProgramError, OSError) as e:
_logger.exception(e)
... | [
"Attempt",
"to",
"copy",
"the",
"selected",
"URL",
"to",
"the",
"user",
"s",
"clipboard"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L530-L546 | [
"def",
"copy_to_clipboard",
"(",
"self",
",",
"url",
")",
":",
"if",
"url",
"is",
"None",
":",
"self",
".",
"term",
".",
"flash",
"(",
")",
"return",
"try",
":",
"clipboard_copy",
"(",
"url",
")",
"except",
"(",
"ProgramError",
",",
"OSError",
")",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.prompt | Open a prompt to navigate to a different subreddit or comment" | rtv/page.py | def prompt(self):
"""
Open a prompt to navigate to a different subreddit or comment"
"""
name = self.term.prompt_input('Enter page: /')
if name:
# Check if opening a submission url or a subreddit url
# Example patterns for submissions:
# co... | def prompt(self):
"""
Open a prompt to navigate to a different subreddit or comment"
"""
name = self.term.prompt_input('Enter page: /')
if name:
# Check if opening a submission url or a subreddit url
# Example patterns for submissions:
# co... | [
"Open",
"a",
"prompt",
"to",
"navigate",
"to",
"a",
"different",
"subreddit",
"or",
"comment"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L565-L584 | [
"def",
"prompt",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"term",
".",
"prompt_input",
"(",
"'Enter page: /'",
")",
"if",
"name",
":",
"# Check if opening a submission url or a subreddit url",
"# Example patterns for submissions:",
"# comments/571dw3",
"# ... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.open_inbox_page | Open an instance of the inbox page for the logged in user. | rtv/page.py | def open_inbox_page(self, content_type):
"""
Open an instance of the inbox page for the logged in user.
"""
from .inbox_page import InboxPage
with self.term.loader('Loading inbox'):
page = InboxPage(self.reddit, self.term, self.config, self.oauth,
... | def open_inbox_page(self, content_type):
"""
Open an instance of the inbox page for the logged in user.
"""
from .inbox_page import InboxPage
with self.term.loader('Loading inbox'):
page = InboxPage(self.reddit, self.term, self.config, self.oauth,
... | [
"Open",
"an",
"instance",
"of",
"the",
"inbox",
"page",
"for",
"the",
"logged",
"in",
"user",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L594-L604 | [
"def",
"open_inbox_page",
"(",
"self",
",",
"content_type",
")",
":",
"from",
".",
"inbox_page",
"import",
"InboxPage",
"with",
"self",
".",
"term",
".",
"loader",
"(",
"'Loading inbox'",
")",
":",
"page",
"=",
"InboxPage",
"(",
"self",
".",
"reddit",
",",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.open_subscription_page | Open an instance of the subscriptions page with the selected content. | rtv/page.py | def open_subscription_page(self, content_type):
"""
Open an instance of the subscriptions page with the selected content.
"""
from .subscription_page import SubscriptionPage
with self.term.loader('Loading {0}s'.format(content_type)):
page = SubscriptionPage(self.redd... | def open_subscription_page(self, content_type):
"""
Open an instance of the subscriptions page with the selected content.
"""
from .subscription_page import SubscriptionPage
with self.term.loader('Loading {0}s'.format(content_type)):
page = SubscriptionPage(self.redd... | [
"Open",
"an",
"instance",
"of",
"the",
"subscriptions",
"page",
"with",
"the",
"selected",
"content",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L606-L616 | [
"def",
"open_subscription_page",
"(",
"self",
",",
"content_type",
")",
":",
"from",
".",
"subscription_page",
"import",
"SubscriptionPage",
"with",
"self",
".",
"term",
".",
"loader",
"(",
"'Loading {0}s'",
".",
"format",
"(",
"content_type",
")",
")",
":",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.open_submission_page | Open an instance of the submission page for the given submission URL. | rtv/page.py | def open_submission_page(self, url=None, submission=None):
"""
Open an instance of the submission page for the given submission URL.
"""
from .submission_page import SubmissionPage
with self.term.loader('Loading submission'):
page = SubmissionPage(self.reddit, self.t... | def open_submission_page(self, url=None, submission=None):
"""
Open an instance of the submission page for the given submission URL.
"""
from .submission_page import SubmissionPage
with self.term.loader('Loading submission'):
page = SubmissionPage(self.reddit, self.t... | [
"Open",
"an",
"instance",
"of",
"the",
"submission",
"page",
"for",
"the",
"given",
"submission",
"URL",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L618-L628 | [
"def",
"open_submission_page",
"(",
"self",
",",
"url",
"=",
"None",
",",
"submission",
"=",
"None",
")",
":",
"from",
".",
"submission_page",
"import",
"SubmissionPage",
"with",
"self",
".",
"term",
".",
"loader",
"(",
"'Loading submission'",
")",
":",
"pag... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.open_subreddit_page | Open an instance of the subreddit page for the given subreddit name. | rtv/page.py | def open_subreddit_page(self, name):
"""
Open an instance of the subreddit page for the given subreddit name.
"""
from .subreddit_page import SubredditPage
with self.term.loader('Loading subreddit'):
page = SubredditPage(self.reddit, self.term, self.config,
... | def open_subreddit_page(self, name):
"""
Open an instance of the subreddit page for the given subreddit name.
"""
from .subreddit_page import SubredditPage
with self.term.loader('Loading subreddit'):
page = SubredditPage(self.reddit, self.term, self.config,
... | [
"Open",
"an",
"instance",
"of",
"the",
"subreddit",
"page",
"for",
"the",
"given",
"subreddit",
"name",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L630-L640 | [
"def",
"open_subreddit_page",
"(",
"self",
",",
"name",
")",
":",
"from",
".",
"subreddit_page",
"import",
"SubredditPage",
"with",
"self",
".",
"term",
".",
"loader",
"(",
"'Loading subreddit'",
")",
":",
"page",
"=",
"SubredditPage",
"(",
"self",
".",
"red... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page.draw | Clear the terminal screen and redraw all of the sub-windows | rtv/page.py | def draw(self):
"""
Clear the terminal screen and redraw all of the sub-windows
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
if n_rows < self.term.MIN_HEIGHT or n_cols < self.term.MIN_WIDTH:
# TODO: Will crash when you try to navigate if the terminal is too
... | def draw(self):
"""
Clear the terminal screen and redraw all of the sub-windows
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
if n_rows < self.term.MIN_HEIGHT or n_cols < self.term.MIN_WIDTH:
# TODO: Will crash when you try to navigate if the terminal is too
... | [
"Clear",
"the",
"terminal",
"screen",
"and",
"redraw",
"all",
"of",
"the",
"sub",
"-",
"windows"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L650-L666 | [
"def",
"draw",
"(",
"self",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"getmaxyx",
"(",
")",
"if",
"n_rows",
"<",
"self",
".",
"term",
".",
"MIN_HEIGHT",
"or",
"n_cols",
"<",
"self",
".",
"term",
".",
"MIN_WIDT... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page._draw_header | Draw the title bar at the top of the screen | rtv/page.py | def _draw_header(self):
"""
Draw the title bar at the top of the screen
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
# Note: 2 argument form of derwin breaks PDcurses on Windows 7!
window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
window.erase()
... | def _draw_header(self):
"""
Draw the title bar at the top of the screen
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
# Note: 2 argument form of derwin breaks PDcurses on Windows 7!
window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
window.erase()
... | [
"Draw",
"the",
"title",
"bar",
"at",
"the",
"top",
"of",
"the",
"screen"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L668-L747 | [
"def",
"_draw_header",
"(",
"self",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"getmaxyx",
"(",
")",
"# Note: 2 argument form of derwin breaks PDcurses on Windows 7!",
"window",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page._draw_banner | Draw the banner with sorting options at the top of the page | rtv/page.py | def _draw_banner(self):
"""
Draw the banner with sorting options at the top of the page
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
window.erase()
window.bkgd(str(' '), self.term.attr('OrderBar'))
... | def _draw_banner(self):
"""
Draw the banner with sorting options at the top of the page
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
window.erase()
window.bkgd(str(' '), self.term.attr('OrderBar'))
... | [
"Draw",
"the",
"banner",
"with",
"sorting",
"options",
"at",
"the",
"top",
"of",
"the",
"page"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L749-L771 | [
"def",
"_draw_banner",
"(",
"self",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"getmaxyx",
"(",
")",
"window",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"derwin",
"(",
"1",
",",
"n_cols",
",",
"self",
".",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page._draw_content | Loop through submissions and fill up the content page. | rtv/page.py | def _draw_content(self):
"""
Loop through submissions and fill up the content page.
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
window = self.term.stdscr.derwin(n_rows - self._row - 1, n_cols, self._row, 0)
window.erase()
win_n_rows, win_n_cols = window.getma... | def _draw_content(self):
"""
Loop through submissions and fill up the content page.
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
window = self.term.stdscr.derwin(n_rows - self._row - 1, n_cols, self._row, 0)
window.erase()
win_n_rows, win_n_cols = window.getma... | [
"Loop",
"through",
"submissions",
"and",
"fill",
"up",
"the",
"content",
"page",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L773-L846 | [
"def",
"_draw_content",
"(",
"self",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"getmaxyx",
"(",
")",
"window",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"derwin",
"(",
"n_rows",
"-",
"self",
".",
"_row",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Page._draw_footer | Draw the key binds help bar at the bottom of the screen | rtv/page.py | def _draw_footer(self):
"""
Draw the key binds help bar at the bottom of the screen
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
window.erase()
window.bkgd(str(' '), self.term.attr('HelpBar'))
... | def _draw_footer(self):
"""
Draw the key binds help bar at the bottom of the screen
"""
n_rows, n_cols = self.term.stdscr.getmaxyx()
window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
window.erase()
window.bkgd(str(' '), self.term.attr('HelpBar'))
... | [
"Draw",
"the",
"key",
"binds",
"help",
"bar",
"at",
"the",
"bottom",
"of",
"the",
"screen"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L848-L859 | [
"def",
"_draw_footer",
"(",
"self",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"getmaxyx",
"(",
")",
"window",
"=",
"self",
".",
"term",
".",
"stdscr",
".",
"derwin",
"(",
"1",
",",
"n_cols",
",",
"self",
".",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | OAuthHandler.do_GET | Accepts GET requests to http://localhost:6500/, and stores the query
params in the global dict. If shutdown_on_request is true, stop the
server after the first successful request.
The http request may contain the following query params:
- state : unique identifier, should match what... | rtv/oauth.py | def do_GET(self):
"""
Accepts GET requests to http://localhost:6500/, and stores the query
params in the global dict. If shutdown_on_request is true, stop the
server after the first successful request.
The http request may contain the following query params:
- state ... | def do_GET(self):
"""
Accepts GET requests to http://localhost:6500/, and stores the query
params in the global dict. If shutdown_on_request is true, stop the
server after the first successful request.
The http request may contain the following query params:
- state ... | [
"Accepts",
"GET",
"requests",
"to",
"http",
":",
"//",
"localhost",
":",
"6500",
"/",
"and",
"stores",
"the",
"query",
"params",
"in",
"the",
"global",
"dict",
".",
"If",
"shutdown_on_request",
"is",
"true",
"stop",
"the",
"server",
"after",
"the",
"first"... | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/oauth.py#L46-L82 | [
"def",
"do_GET",
"(",
"self",
")",
":",
"parsed_path",
"=",
"urlparse",
"(",
"self",
".",
"path",
")",
"if",
"parsed_path",
".",
"path",
"!=",
"'/'",
":",
"self",
".",
"send_error",
"(",
"404",
")",
"qs",
"=",
"parse_qs",
"(",
"parsed_path",
".",
"qu... | ccef2af042566ad384977028cf0bde01bc524dda |
train | OAuthHandler.build_body | Params:
template_file (text): Path to an index.html template
Returns:
body (bytes): THe utf-8 encoded document body | rtv/oauth.py | def build_body(self, template_file=INDEX):
"""
Params:
template_file (text): Path to an index.html template
Returns:
body (bytes): THe utf-8 encoded document body
"""
if self.params['error'] == 'access_denied':
message = docs.OAUTH_ACCESS_DEN... | def build_body(self, template_file=INDEX):
"""
Params:
template_file (text): Path to an index.html template
Returns:
body (bytes): THe utf-8 encoded document body
"""
if self.params['error'] == 'access_denied':
message = docs.OAUTH_ACCESS_DEN... | [
"Params",
":",
"template_file",
"(",
"text",
")",
":",
"Path",
"to",
"an",
"index",
".",
"html",
"template"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/oauth.py#L90-L113 | [
"def",
"build_body",
"(",
"self",
",",
"template_file",
"=",
"INDEX",
")",
":",
"if",
"self",
".",
"params",
"[",
"'error'",
"]",
"==",
"'access_denied'",
":",
"message",
"=",
"docs",
".",
"OAUTH_ACCESS_DENIED",
"elif",
"self",
".",
"params",
"[",
"'error'... | ccef2af042566ad384977028cf0bde01bc524dda |
train | main | Main entry point | rtv/__main__.py | def main():
"""Main entry point"""
# Squelch SSL warnings
logging.captureWarnings(True)
if six.PY3:
# These ones get triggered even when capturing warnings is turned on
warnings.simplefilter('ignore', ResourceWarning) # pylint:disable=E0602
# Set the terminal title
if os.geten... | def main():
"""Main entry point"""
# Squelch SSL warnings
logging.captureWarnings(True)
if six.PY3:
# These ones get triggered even when capturing warnings is turned on
warnings.simplefilter('ignore', ResourceWarning) # pylint:disable=E0602
# Set the terminal title
if os.geten... | [
"Main",
"entry",
"point"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/__main__.py#L60-L277 | [
"def",
"main",
"(",
")",
":",
"# Squelch SSL warnings",
"logging",
".",
"captureWarnings",
"(",
"True",
")",
"if",
"six",
".",
"PY3",
":",
"# These ones get triggered even when capturing warnings is turned on",
"warnings",
".",
"simplefilter",
"(",
"'ignore'",
",",
"R... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.display | Use a number of methods to guess if the default webbrowser will open in
the background as opposed to opening directly in the terminal. | rtv/terminal.py | def display(self):
"""
Use a number of methods to guess if the default webbrowser will open in
the background as opposed to opening directly in the terminal.
"""
if self._display is None:
if sys.platform == 'darwin':
# OS X won't set $DISPLAY unless x... | def display(self):
"""
Use a number of methods to guess if the default webbrowser will open in
the background as opposed to opening directly in the terminal.
"""
if self._display is None:
if sys.platform == 'darwin':
# OS X won't set $DISPLAY unless x... | [
"Use",
"a",
"number",
"of",
"methods",
"to",
"guess",
"if",
"the",
"default",
"webbrowser",
"will",
"open",
"in",
"the",
"background",
"as",
"opposed",
"to",
"opening",
"directly",
"in",
"the",
"terminal",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L93-L121 | [
"def",
"display",
"(",
"self",
")",
":",
"if",
"self",
".",
"_display",
"is",
"None",
":",
"if",
"sys",
".",
"platform",
"==",
"'darwin'",
":",
"# OS X won't set $DISPLAY unless xQuartz is installed.",
"# If you're using OS X and you want to access a terminal",
"# browser... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.addch | Curses addch() method that fixes a major bug in python 3.4.
See http://bugs.python.org/issue21088 | rtv/terminal.py | def addch(window, y, x, ch, attr):
"""
Curses addch() method that fixes a major bug in python 3.4.
See http://bugs.python.org/issue21088
"""
if sys.version_info[:3] == (3, 4, 0):
y, x = x, y
window.addch(y, x, ch, attr) | def addch(window, y, x, ch, attr):
"""
Curses addch() method that fixes a major bug in python 3.4.
See http://bugs.python.org/issue21088
"""
if sys.version_info[:3] == (3, 4, 0):
y, x = x, y
window.addch(y, x, ch, attr) | [
"Curses",
"addch",
"()",
"method",
"that",
"fixes",
"a",
"major",
"bug",
"in",
"python",
"3",
".",
"4",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L144-L154 | [
"def",
"addch",
"(",
"window",
",",
"y",
",",
"x",
",",
"ch",
",",
"attr",
")",
":",
"if",
"sys",
".",
"version_info",
"[",
":",
"3",
"]",
"==",
"(",
"3",
",",
"4",
",",
"0",
")",
":",
"y",
",",
"x",
"=",
"x",
",",
"y",
"window",
".",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.get_arrow | Curses does define constants for symbols (e.g. curses.ACS_BULLET).
However, they rely on using the curses.addch() function, which has been
found to be buggy and a general PITA to work with. By defining them as
unicode points they can be added via the more reliable curses.addstr().
http:/... | rtv/terminal.py | def get_arrow(self, likes):
"""
Curses does define constants for symbols (e.g. curses.ACS_BULLET).
However, they rely on using the curses.addch() function, which has been
found to be buggy and a general PITA to work with. By defining them as
unicode points they can be added via t... | def get_arrow(self, likes):
"""
Curses does define constants for symbols (e.g. curses.ACS_BULLET).
However, they rely on using the curses.addch() function, which has been
found to be buggy and a general PITA to work with. By defining them as
unicode points they can be added via t... | [
"Curses",
"does",
"define",
"constants",
"for",
"symbols",
"(",
"e",
".",
"g",
".",
"curses",
".",
"ACS_BULLET",
")",
".",
"However",
"they",
"rely",
"on",
"using",
"the",
"curses",
".",
"addch",
"()",
"function",
"which",
"has",
"been",
"found",
"to",
... | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L189-L203 | [
"def",
"get_arrow",
"(",
"self",
",",
"likes",
")",
":",
"if",
"likes",
"is",
"None",
":",
"return",
"self",
".",
"neutral_arrow",
",",
"self",
".",
"attr",
"(",
"'NeutralVote'",
")",
"elif",
"likes",
":",
"return",
"self",
".",
"up_arrow",
",",
"self"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.clean | Required reading!
http://nedbatchelder.com/text/unipain.html
Python 2 input string will be a unicode type (unicode code points).
Curses will accept unicode if all of the points are in the ascii range.
However, if any of the code points are not valid ascii curses will
throw a... | rtv/terminal.py | def clean(self, string, n_cols=None):
"""
Required reading!
http://nedbatchelder.com/text/unipain.html
Python 2 input string will be a unicode type (unicode code points).
Curses will accept unicode if all of the points are in the ascii range.
However, if any of the c... | def clean(self, string, n_cols=None):
"""
Required reading!
http://nedbatchelder.com/text/unipain.html
Python 2 input string will be a unicode type (unicode code points).
Curses will accept unicode if all of the points are in the ascii range.
However, if any of the c... | [
"Required",
"reading!",
"http",
":",
"//",
"nedbatchelder",
".",
"com",
"/",
"text",
"/",
"unipain",
".",
"html"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L205-L250 | [
"def",
"clean",
"(",
"self",
",",
"string",
",",
"n_cols",
"=",
"None",
")",
":",
"if",
"n_cols",
"is",
"not",
"None",
"and",
"n_cols",
"<=",
"0",
":",
"return",
"''",
"if",
"isinstance",
"(",
"string",
",",
"six",
".",
"text_type",
")",
":",
"stri... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.add_line | Unicode aware version of curses's built-in addnstr method.
Safely draws a line of text on the window starting at position
(row, col). Checks the boundaries of the window and cuts off the text
if it exceeds the length of the window. | rtv/terminal.py | def add_line(self, window, text, row=None, col=None, attr=None):
"""
Unicode aware version of curses's built-in addnstr method.
Safely draws a line of text on the window starting at position
(row, col). Checks the boundaries of the window and cuts off the text
if it exceeds the ... | def add_line(self, window, text, row=None, col=None, attr=None):
"""
Unicode aware version of curses's built-in addnstr method.
Safely draws a line of text on the window starting at position
(row, col). Checks the boundaries of the window and cuts off the text
if it exceeds the ... | [
"Unicode",
"aware",
"version",
"of",
"curses",
"s",
"built",
"-",
"in",
"addnstr",
"method",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L252-L285 | [
"def",
"add_line",
"(",
"self",
",",
"window",
",",
"text",
",",
"row",
"=",
"None",
",",
"col",
"=",
"None",
",",
"attr",
"=",
"None",
")",
":",
"# The following arg combos must be supported to conform with addnstr",
"# (window, text)",
"# (window, text, attr)",
"#... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.add_space | Shortcut for adding a single space to a window at the current position | rtv/terminal.py | def add_space(window):
"""
Shortcut for adding a single space to a window at the current position
"""
row, col = window.getyx()
_, max_cols = window.getmaxyx()
n_cols = max_cols - col - 1
if n_cols <= 0:
# Trying to draw outside of the screen bounds
... | def add_space(window):
"""
Shortcut for adding a single space to a window at the current position
"""
row, col = window.getyx()
_, max_cols = window.getmaxyx()
n_cols = max_cols - col - 1
if n_cols <= 0:
# Trying to draw outside of the screen bounds
... | [
"Shortcut",
"for",
"adding",
"a",
"single",
"space",
"to",
"a",
"window",
"at",
"the",
"current",
"position"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L288-L300 | [
"def",
"add_space",
"(",
"window",
")",
":",
"row",
",",
"col",
"=",
"window",
".",
"getyx",
"(",
")",
"_",
",",
"max_cols",
"=",
"window",
".",
"getmaxyx",
"(",
")",
"n_cols",
"=",
"max_cols",
"-",
"col",
"-",
"1",
"if",
"n_cols",
"<=",
"0",
":"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.show_notification | Overlay a message box on the center of the screen and wait for input.
Params:
message (list or string): List of strings, one per line.
timeout (float): Optional, maximum length of time that the message
will be shown before disappearing.
style (str): The theme... | rtv/terminal.py | def show_notification(self, message, timeout=None, style='Info'):
"""
Overlay a message box on the center of the screen and wait for input.
Params:
message (list or string): List of strings, one per line.
timeout (float): Optional, maximum length of time that the message... | def show_notification(self, message, timeout=None, style='Info'):
"""
Overlay a message box on the center of the screen and wait for input.
Params:
message (list or string): List of strings, one per line.
timeout (float): Optional, maximum length of time that the message... | [
"Overlay",
"a",
"message",
"box",
"on",
"the",
"center",
"of",
"the",
"screen",
"and",
"wait",
"for",
"input",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L302-L355 | [
"def",
"show_notification",
"(",
"self",
",",
"message",
",",
"timeout",
"=",
"None",
",",
"style",
"=",
"'Info'",
")",
":",
"assert",
"style",
"in",
"(",
"'Info'",
",",
"'Warning'",
",",
"'Error'",
",",
"'Success'",
")",
"if",
"isinstance",
"(",
"messag... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.prompt_user_to_select_link | Prompt the user to select a link from a list to open.
Return the link that was selected, or ``None`` if no link was selected. | rtv/terminal.py | def prompt_user_to_select_link(self, links):
"""
Prompt the user to select a link from a list to open.
Return the link that was selected, or ``None`` if no link was selected.
"""
link_pages = self.get_link_pages(links)
n = 0
while n in range(len(link_pages)):
... | def prompt_user_to_select_link(self, links):
"""
Prompt the user to select a link from a list to open.
Return the link that was selected, or ``None`` if no link was selected.
"""
link_pages = self.get_link_pages(links)
n = 0
while n in range(len(link_pages)):
... | [
"Prompt",
"the",
"user",
"to",
"select",
"a",
"link",
"from",
"a",
"list",
"to",
"open",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L357-L395 | [
"def",
"prompt_user_to_select_link",
"(",
"self",
",",
"links",
")",
":",
"link_pages",
"=",
"self",
".",
"get_link_pages",
"(",
"links",
")",
"n",
"=",
"0",
"while",
"n",
"in",
"range",
"(",
"len",
"(",
"link_pages",
")",
")",
":",
"link_page",
"=",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.get_link_pages | Given a list of links, separate them into pages that can be displayed
to the user and navigated using the 1-9 and 0 number keys. | rtv/terminal.py | def get_link_pages(links):
"""
Given a list of links, separate them into pages that can be displayed
to the user and navigated using the 1-9 and 0 number keys.
"""
link_pages = []
i = 0
while i < len(links):
link_page = []
while i < len(lin... | def get_link_pages(links):
"""
Given a list of links, separate them into pages that can be displayed
to the user and navigated using the 1-9 and 0 number keys.
"""
link_pages = []
i = 0
while i < len(links):
link_page = []
while i < len(lin... | [
"Given",
"a",
"list",
"of",
"links",
"separate",
"them",
"into",
"pages",
"that",
"can",
"be",
"displayed",
"to",
"the",
"user",
"and",
"navigated",
"using",
"the",
"1",
"-",
"9",
"and",
"0",
"number",
"keys",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L398-L411 | [
"def",
"get_link_pages",
"(",
"links",
")",
":",
"link_pages",
"=",
"[",
"]",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"links",
")",
":",
"link_page",
"=",
"[",
"]",
"while",
"i",
"<",
"len",
"(",
"links",
")",
"and",
"len",
"(",
"link_page"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.get_link_page_text | Construct the dialog box to display a list of links to the user. | rtv/terminal.py | def get_link_page_text(link_page):
"""
Construct the dialog box to display a list of links to the user.
"""
text = ''
for i, link in enumerate(link_page):
capped_link_text = (link['text'] if len(link['text']) <= 20
else link['text'][:19... | def get_link_page_text(link_page):
"""
Construct the dialog box to display a list of links to the user.
"""
text = ''
for i, link in enumerate(link_page):
capped_link_text = (link['text'] if len(link['text']) <= 20
else link['text'][:19... | [
"Construct",
"the",
"dialog",
"box",
"to",
"display",
"a",
"list",
"of",
"links",
"to",
"the",
"user",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L414-L423 | [
"def",
"get_link_page_text",
"(",
"link_page",
")",
":",
"text",
"=",
"''",
"for",
"i",
",",
"link",
"in",
"enumerate",
"(",
"link_page",
")",
":",
"capped_link_text",
"=",
"(",
"link",
"[",
"'text'",
"]",
"if",
"len",
"(",
"link",
"[",
"'text'",
"]",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.open_link | Open a media link using the definitions from the user's mailcap file.
Most urls are parsed using their file extension, but special cases
exist for websites that are prevalent on reddit such as Imgur and
Gfycat. If there are no valid mailcap definitions, RTV will fall back
to using the d... | rtv/terminal.py | def open_link(self, url):
"""
Open a media link using the definitions from the user's mailcap file.
Most urls are parsed using their file extension, but special cases
exist for websites that are prevalent on reddit such as Imgur and
Gfycat. If there are no valid mailcap definiti... | def open_link(self, url):
"""
Open a media link using the definitions from the user's mailcap file.
Most urls are parsed using their file extension, but special cases
exist for websites that are prevalent on reddit such as Imgur and
Gfycat. If there are no valid mailcap definiti... | [
"Open",
"a",
"media",
"link",
"using",
"the",
"definitions",
"from",
"the",
"user",
"s",
"mailcap",
"file",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L425-L506 | [
"def",
"open_link",
"(",
"self",
",",
"url",
")",
":",
"if",
"not",
"self",
".",
"config",
"[",
"'enable_media'",
"]",
":",
"self",
".",
"open_browser",
"(",
"url",
")",
"return",
"try",
":",
"with",
"self",
".",
"loader",
"(",
"'Checking link'",
",",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.get_mailcap_entry | Search through the mime handlers list and attempt to find the
appropriate command to open the provided url with.
Will raise a MailcapEntryNotFound exception if no valid command exists.
Params:
url (text): URL that will be checked
Returns:
command (text): The st... | rtv/terminal.py | def get_mailcap_entry(self, url):
"""
Search through the mime handlers list and attempt to find the
appropriate command to open the provided url with.
Will raise a MailcapEntryNotFound exception if no valid command exists.
Params:
url (text): URL that will be checke... | def get_mailcap_entry(self, url):
"""
Search through the mime handlers list and attempt to find the
appropriate command to open the provided url with.
Will raise a MailcapEntryNotFound exception if no valid command exists.
Params:
url (text): URL that will be checke... | [
"Search",
"through",
"the",
"mime",
"handlers",
"list",
"and",
"attempt",
"to",
"find",
"the",
"appropriate",
"command",
"to",
"open",
"the",
"provided",
"url",
"with",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L508-L554 | [
"def",
"get_mailcap_entry",
"(",
"self",
",",
"url",
")",
":",
"for",
"parser",
"in",
"mime_parsers",
".",
"parsers",
":",
"if",
"parser",
".",
"pattern",
".",
"match",
"(",
"url",
")",
":",
"# modified_url may be the same as the original url, but it",
"# could al... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.open_browser | Open the given url using the default webbrowser. The preferred browser
can specified with the $BROWSER environment variable. If not specified,
python webbrowser will try to determine the default to use based on
your system.
For browsers requiring an X display, we open a new subprocess a... | rtv/terminal.py | def open_browser(self, url):
"""
Open the given url using the default webbrowser. The preferred browser
can specified with the $BROWSER environment variable. If not specified,
python webbrowser will try to determine the default to use based on
your system.
For browsers r... | def open_browser(self, url):
"""
Open the given url using the default webbrowser. The preferred browser
can specified with the $BROWSER environment variable. If not specified,
python webbrowser will try to determine the default to use based on
your system.
For browsers r... | [
"Open",
"the",
"given",
"url",
"using",
"the",
"default",
"webbrowser",
".",
"The",
"preferred",
"browser",
"can",
"specified",
"with",
"the",
"$BROWSER",
"environment",
"variable",
".",
"If",
"not",
"specified",
"python",
"webbrowser",
"will",
"try",
"to",
"d... | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L556-L638 | [
"def",
"open_browser",
"(",
"self",
",",
"url",
")",
":",
"if",
"self",
".",
"display",
":",
"with",
"self",
".",
"loader",
"(",
"'Opening page in a new window'",
")",
":",
"def",
"open_url_silent",
"(",
"url",
")",
":",
"# This used to be done using subprocess.... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.open_pager | View a long block of text using an external pager / viewer. The setting
of the RTV_PAGER variable will be used if set, otherwise the system's
default pager is chosen, finally defaulting to 'less' if both RTV_PAGER
and PAGER is unset in the calling environment.
The data string will be p... | rtv/terminal.py | def open_pager(self, data, wrap=None):
"""
View a long block of text using an external pager / viewer. The setting
of the RTV_PAGER variable will be used if set, otherwise the system's
default pager is chosen, finally defaulting to 'less' if both RTV_PAGER
and PAGER is unset in ... | def open_pager(self, data, wrap=None):
"""
View a long block of text using an external pager / viewer. The setting
of the RTV_PAGER variable will be used if set, otherwise the system's
default pager is chosen, finally defaulting to 'less' if both RTV_PAGER
and PAGER is unset in ... | [
"View",
"a",
"long",
"block",
"of",
"text",
"using",
"an",
"external",
"pager",
"/",
"viewer",
".",
"The",
"setting",
"of",
"the",
"RTV_PAGER",
"variable",
"will",
"be",
"used",
"if",
"set",
"otherwise",
"the",
"system",
"s",
"default",
"pager",
"is",
"c... | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L640-L669 | [
"def",
"open_pager",
"(",
"self",
",",
"data",
",",
"wrap",
"=",
"None",
")",
":",
"pager",
"=",
"os",
".",
"getenv",
"(",
"'RTV_PAGER'",
")",
"if",
"pager",
"is",
"None",
":",
"pager",
"=",
"os",
".",
"getenv",
"(",
"'PAGER'",
")",
"or",
"'less'",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.open_editor | Open a file for editing using the system's default editor.
After the file has been altered, the text will be read back and the
HTML comment tag <!--INSRUCTIONS --> will be stripped. If an error
occurs inside of the context manager, the file will be preserved so
users can recover their d... | rtv/terminal.py | def open_editor(self, data=''):
"""
Open a file for editing using the system's default editor.
After the file has been altered, the text will be read back and the
HTML comment tag <!--INSRUCTIONS --> will be stripped. If an error
occurs inside of the context manager, the file wi... | def open_editor(self, data=''):
"""
Open a file for editing using the system's default editor.
After the file has been altered, the text will be read back and the
HTML comment tag <!--INSRUCTIONS --> will be stripped. If an error
occurs inside of the context manager, the file wi... | [
"Open",
"a",
"file",
"for",
"editing",
"using",
"the",
"system",
"s",
"default",
"editor",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L672-L734 | [
"def",
"open_editor",
"(",
"self",
",",
"data",
"=",
"''",
")",
":",
"with",
"NamedTemporaryFile",
"(",
"prefix",
"=",
"'rtv_'",
",",
"suffix",
"=",
"'.txt'",
",",
"delete",
"=",
"False",
")",
"as",
"fp",
":",
"# Create a tempory file and grab the name, but cl... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.open_urlview | Pipe a block of text to urlview, which displays a list of urls
contained in the text and allows the user to open them with their
web browser. | rtv/terminal.py | def open_urlview(self, data):
"""
Pipe a block of text to urlview, which displays a list of urls
contained in the text and allows the user to open them with their
web browser.
"""
urlview = os.getenv('RTV_URLVIEWER') or 'urlview'
command = shlex.split(urlview)
... | def open_urlview(self, data):
"""
Pipe a block of text to urlview, which displays a list of urls
contained in the text and allows the user to open them with their
web browser.
"""
urlview = os.getenv('RTV_URLVIEWER') or 'urlview'
command = shlex.split(urlview)
... | [
"Pipe",
"a",
"block",
"of",
"text",
"to",
"urlview",
"which",
"displays",
"a",
"list",
"of",
"urls",
"contained",
"in",
"the",
"text",
"and",
"allows",
"the",
"user",
"to",
"open",
"them",
"with",
"their",
"web",
"browser",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L736-L766 | [
"def",
"open_urlview",
"(",
"self",
",",
"data",
")",
":",
"urlview",
"=",
"os",
".",
"getenv",
"(",
"'RTV_URLVIEWER'",
")",
"or",
"'urlview'",
"command",
"=",
"shlex",
".",
"split",
"(",
"urlview",
")",
"try",
":",
"with",
"self",
".",
"suspend",
"(",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.text_input | Transform a window into a text box that will accept user input and loop
until an escape sequence is entered.
If the escape key (27) is pressed, cancel the textbox and return None.
Otherwise, the textbox will wait until it is full (^j, or a new line is
entered on the bottom line) or the ... | rtv/terminal.py | def text_input(self, window, allow_resize=False):
"""
Transform a window into a text box that will accept user input and loop
until an escape sequence is entered.
If the escape key (27) is pressed, cancel the textbox and return None.
Otherwise, the textbox will wait until it is ... | def text_input(self, window, allow_resize=False):
"""
Transform a window into a text box that will accept user input and loop
until an escape sequence is entered.
If the escape key (27) is pressed, cancel the textbox and return None.
Otherwise, the textbox will wait until it is ... | [
"Transform",
"a",
"window",
"into",
"a",
"text",
"box",
"that",
"will",
"accept",
"user",
"input",
"and",
"loop",
"until",
"an",
"escape",
"sequence",
"is",
"entered",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L768-L810 | [
"def",
"text_input",
"(",
"self",
",",
"window",
",",
"allow_resize",
"=",
"False",
")",
":",
"window",
".",
"clear",
"(",
")",
"# Set cursor mode to 1 because 2 doesn't display on some terminals",
"self",
".",
"curs_set",
"(",
"1",
")",
"# Keep insert_mode off to avo... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.prompt_input | Display a text prompt at the bottom of the screen.
Params:
prompt (string): Text prompt that will be displayed
key (bool): If true, grab a single keystroke instead of a full
string. This can be faster than pressing enter for
single key pro... | rtv/terminal.py | def prompt_input(self, prompt, key=False):
"""
Display a text prompt at the bottom of the screen.
Params:
prompt (string): Text prompt that will be displayed
key (bool): If true, grab a single keystroke instead of a full
string. This can be faster... | def prompt_input(self, prompt, key=False):
"""
Display a text prompt at the bottom of the screen.
Params:
prompt (string): Text prompt that will be displayed
key (bool): If true, grab a single keystroke instead of a full
string. This can be faster... | [
"Display",
"a",
"text",
"prompt",
"at",
"the",
"bottom",
"of",
"the",
"screen",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L812-L861 | [
"def",
"prompt_input",
"(",
"self",
",",
"prompt",
",",
"key",
"=",
"False",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"self",
".",
"stdscr",
".",
"getmaxyx",
"(",
")",
"v_offset",
",",
"h_offset",
"=",
"self",
".",
"stdscr",
".",
"getbegyx",
"(",
")",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.prompt_y_or_n | Wrapper around prompt_input for simple yes/no queries. | rtv/terminal.py | def prompt_y_or_n(self, prompt):
"""
Wrapper around prompt_input for simple yes/no queries.
"""
ch = self.prompt_input(prompt, key=True)
if ch in (ord('Y'), ord('y')):
return True
elif ch in (ord('N'), ord('n'), None):
return False
else:
... | def prompt_y_or_n(self, prompt):
"""
Wrapper around prompt_input for simple yes/no queries.
"""
ch = self.prompt_input(prompt, key=True)
if ch in (ord('Y'), ord('y')):
return True
elif ch in (ord('N'), ord('n'), None):
return False
else:
... | [
"Wrapper",
"around",
"prompt_input",
"for",
"simple",
"yes",
"/",
"no",
"queries",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L863-L875 | [
"def",
"prompt_y_or_n",
"(",
"self",
",",
"prompt",
")",
":",
"ch",
"=",
"self",
".",
"prompt_input",
"(",
"prompt",
",",
"key",
"=",
"True",
")",
"if",
"ch",
"in",
"(",
"ord",
"(",
"'Y'",
")",
",",
"ord",
"(",
"'y'",
")",
")",
":",
"return",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.strip_textpad | Attempt to intelligently strip excess whitespace from the output of a
curses textpad. | rtv/terminal.py | def strip_textpad(text):
"""
Attempt to intelligently strip excess whitespace from the output of a
curses textpad.
"""
if text is None:
return text
# Trivial case where the textbox is only one line long.
if '\n' not in text:
return text.r... | def strip_textpad(text):
"""
Attempt to intelligently strip excess whitespace from the output of a
curses textpad.
"""
if text is None:
return text
# Trivial case where the textbox is only one line long.
if '\n' not in text:
return text.r... | [
"Attempt",
"to",
"intelligently",
"strip",
"excess",
"whitespace",
"from",
"the",
"output",
"of",
"a",
"curses",
"textpad",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L878-L910 | [
"def",
"strip_textpad",
"(",
"text",
")",
":",
"if",
"text",
"is",
"None",
":",
"return",
"text",
"# Trivial case where the textbox is only one line long.",
"if",
"'\\n'",
"not",
"in",
"text",
":",
"return",
"text",
".",
"rstrip",
"(",
")",
"# Allow one space at t... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.strip_instructions | Remove instructional HTML comment tags inserted by RTV.
We used to use # to annotate comments, but it conflicted with the
header tag for markdown, which some people use to format their posts. | rtv/terminal.py | def strip_instructions(text):
"""
Remove instructional HTML comment tags inserted by RTV.
We used to use # to annotate comments, but it conflicted with the
header tag for markdown, which some people use to format their posts.
"""
# Pattern can span multiple lines, allows... | def strip_instructions(text):
"""
Remove instructional HTML comment tags inserted by RTV.
We used to use # to annotate comments, but it conflicted with the
header tag for markdown, which some people use to format their posts.
"""
# Pattern can span multiple lines, allows... | [
"Remove",
"instructional",
"HTML",
"comment",
"tags",
"inserted",
"by",
"RTV",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L913-L924 | [
"def",
"strip_instructions",
"(",
"text",
")",
":",
"# Pattern can span multiple lines, allows dot to match newline chars",
"flags",
"=",
"re",
".",
"MULTILINE",
"|",
"re",
".",
"DOTALL",
"pattern",
"=",
"'<!--{token}(.*?){token}-->'",
".",
"format",
"(",
"token",
"=",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.clear_screen | In the beginning this always called touchwin(). However, a bug
was discovered in tmux when TERM was set to `xterm-256color`, where
only part of the screen got redrawn when scrolling. tmux automatically
sets TERM to `screen-256color`, but many people choose to override
this in their tmux.... | rtv/terminal.py | def clear_screen(self):
"""
In the beginning this always called touchwin(). However, a bug
was discovered in tmux when TERM was set to `xterm-256color`, where
only part of the screen got redrawn when scrolling. tmux automatically
sets TERM to `screen-256color`, but many people ch... | def clear_screen(self):
"""
In the beginning this always called touchwin(). However, a bug
was discovered in tmux when TERM was set to `xterm-256color`, where
only part of the screen got redrawn when scrolling. tmux automatically
sets TERM to `screen-256color`, but many people ch... | [
"In",
"the",
"beginning",
"this",
"always",
"called",
"touchwin",
"()",
".",
"However",
"a",
"bug",
"was",
"discovered",
"in",
"tmux",
"when",
"TERM",
"was",
"set",
"to",
"xterm",
"-",
"256color",
"where",
"only",
"part",
"of",
"the",
"screen",
"got",
"r... | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L926-L951 | [
"def",
"clear_screen",
"(",
"self",
")",
":",
"if",
"self",
".",
"_term",
"!=",
"'xterm-256color'",
":",
"self",
".",
"stdscr",
".",
"touchwin",
"(",
")",
"else",
":",
"self",
".",
"stdscr",
".",
"clearok",
"(",
"True",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.check_theme | Check if the given theme is compatible with the terminal | rtv/terminal.py | def check_theme(theme):
"""
Check if the given theme is compatible with the terminal
"""
terminal_colors = curses.COLORS if curses.has_colors() else 0
if theme.required_colors > terminal_colors:
return False
elif theme.required_color_pairs > curses.COLOR_PAIR... | def check_theme(theme):
"""
Check if the given theme is compatible with the terminal
"""
terminal_colors = curses.COLORS if curses.has_colors() else 0
if theme.required_colors > terminal_colors:
return False
elif theme.required_color_pairs > curses.COLOR_PAIR... | [
"Check",
"if",
"the",
"given",
"theme",
"is",
"compatible",
"with",
"the",
"terminal"
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L963-L974 | [
"def",
"check_theme",
"(",
"theme",
")",
":",
"terminal_colors",
"=",
"curses",
".",
"COLORS",
"if",
"curses",
".",
"has_colors",
"(",
")",
"else",
"0",
"if",
"theme",
".",
"required_colors",
">",
"terminal_colors",
":",
"return",
"False",
"elif",
"theme",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Terminal.set_theme | Check that the terminal supports the provided theme, and applies
the theme to the terminal if possible.
If the terminal doesn't support the theme, this falls back to the
default theme. The default theme only requires 8 colors so it
should be compatible with any terminal that supports ba... | rtv/terminal.py | def set_theme(self, theme=None):
"""
Check that the terminal supports the provided theme, and applies
the theme to the terminal if possible.
If the terminal doesn't support the theme, this falls back to the
default theme. The default theme only requires 8 colors so it
sh... | def set_theme(self, theme=None):
"""
Check that the terminal supports the provided theme, and applies
the theme to the terminal if possible.
If the terminal doesn't support the theme, this falls back to the
default theme. The default theme only requires 8 colors so it
sh... | [
"Check",
"that",
"the",
"terminal",
"supports",
"the",
"provided",
"theme",
"and",
"applies",
"the",
"theme",
"to",
"the",
"terminal",
"if",
"possible",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L976-L1012 | [
"def",
"set_theme",
"(",
"self",
",",
"theme",
"=",
"None",
")",
":",
"terminal_colors",
"=",
"curses",
".",
"COLORS",
"if",
"curses",
".",
"has_colors",
"(",
")",
"else",
"0",
"default_theme",
"=",
"Theme",
"(",
"use_color",
"=",
"bool",
"(",
"terminal_... | ccef2af042566ad384977028cf0bde01bc524dda |
train | RedditContentObject.fullname | Return the object's fullname.
A fullname is an object's kind mapping like `t3` followed by an
underscore and the object's base36 id, e.g., `t1_c5s96e0`. | rtv/packages/praw/objects.py | def fullname(self):
"""Return the object's fullname.
A fullname is an object's kind mapping like `t3` followed by an
underscore and the object's base36 id, e.g., `t1_c5s96e0`.
"""
by_object = self.reddit_session.config.by_object
return '{0}_{1}'.format(by_object[self.__... | def fullname(self):
"""Return the object's fullname.
A fullname is an object's kind mapping like `t3` followed by an
underscore and the object's base36 id, e.g., `t1_c5s96e0`.
"""
by_object = self.reddit_session.config.by_object
return '{0}_{1}'.format(by_object[self.__... | [
"Return",
"the",
"object",
"s",
"fullname",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L195-L203 | [
"def",
"fullname",
"(",
"self",
")",
":",
"by_object",
"=",
"self",
".",
"reddit_session",
".",
"config",
".",
"by_object",
"return",
"'{0}_{1}'",
".",
"format",
"(",
"by_object",
"[",
"self",
".",
"__class__",
"]",
",",
"self",
".",
"id",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Moderatable.approve | Approve object.
This reverts a removal, resets the report counter, marks it with a
green check mark (only visible to other moderators) on the website view
and sets the approved_by attribute to the logged in user.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def approve(self):
"""Approve object.
This reverts a removal, resets the report counter, marks it with a
green check mark (only visible to other moderators) on the website view
and sets the approved_by attribute to the logged in user.
:returns: The json response from the server... | def approve(self):
"""Approve object.
This reverts a removal, resets the report counter, marks it with a
green check mark (only visible to other moderators) on the website view
and sets the approved_by attribute to the logged in user.
:returns: The json response from the server... | [
"Approve",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L216-L233 | [
"def",
"approve",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'approve'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
"}",
"response",
"=",
"self",
".",
"reddit_session",
".",
"request_json",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Moderatable.distinguish | Distinguish object as made by mod, admin or special.
Distinguished objects have a different author color. With Reddit
Enhancement Suite it is the background color that changes.
`sticky` argument only used for top-level Comments.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def distinguish(self, as_made_by='mod', sticky=False):
"""Distinguish object as made by mod, admin or special.
Distinguished objects have a different author color. With Reddit
Enhancement Suite it is the background color that changes.
`sticky` argument only used for top-level Comments.... | def distinguish(self, as_made_by='mod', sticky=False):
"""Distinguish object as made by mod, admin or special.
Distinguished objects have a different author color. With Reddit
Enhancement Suite it is the background color that changes.
`sticky` argument only used for top-level Comments.... | [
"Distinguish",
"object",
"as",
"made",
"by",
"mod",
"admin",
"or",
"special",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L236-L252 | [
"def",
"distinguish",
"(",
"self",
",",
"as_made_by",
"=",
"'mod'",
",",
"sticky",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'distinguish'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
",",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Moderatable.ignore_reports | Ignore future reports on this object.
This prevents future reports from causing notifications or appearing
in the various moderation listing. The report count will still
increment. | rtv/packages/praw/objects.py | def ignore_reports(self):
"""Ignore future reports on this object.
This prevents future reports from causing notifications or appearing
in the various moderation listing. The report count will still
increment.
"""
url = self.reddit_session.config['ignore_reports']
... | def ignore_reports(self):
"""Ignore future reports on this object.
This prevents future reports from causing notifications or appearing
in the various moderation listing. The report count will still
increment.
"""
url = self.reddit_session.config['ignore_reports']
... | [
"Ignore",
"future",
"reports",
"on",
"this",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L255-L265 | [
"def",
"ignore_reports",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'ignore_reports'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
"}",
"return",
"self",
".",
"reddit_session",
".",
"request_json... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Moderatable.remove | Remove object. This is the moderator version of delete.
The object is removed from the subreddit listings and placed into the
spam listing. If spam is set to True, then the automatic spam filter
will try to remove objects with similar attributes in the future.
:returns: The json respon... | rtv/packages/praw/objects.py | def remove(self, spam=False):
"""Remove object. This is the moderator version of delete.
The object is removed from the subreddit listings and placed into the
spam listing. If spam is set to True, then the automatic spam filter
will try to remove objects with similar attributes in the f... | def remove(self, spam=False):
"""Remove object. This is the moderator version of delete.
The object is removed from the subreddit listings and placed into the
spam listing. If spam is set to True, then the automatic spam filter
will try to remove objects with similar attributes in the f... | [
"Remove",
"object",
".",
"This",
"is",
"the",
"moderator",
"version",
"of",
"delete",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L268-L286 | [
"def",
"remove",
"(",
"self",
",",
"spam",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'remove'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
",",
"'spam'",
":",
"'True'",
"if",
"spam",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Moderatable.unignore_reports | Remove ignoring of future reports on this object.
Undoes 'ignore_reports'. Future reports will now cause notifications
and appear in the various moderation listings. | rtv/packages/praw/objects.py | def unignore_reports(self):
"""Remove ignoring of future reports on this object.
Undoes 'ignore_reports'. Future reports will now cause notifications
and appear in the various moderation listings.
"""
url = self.reddit_session.config['unignore_reports']
data = {'id': se... | def unignore_reports(self):
"""Remove ignoring of future reports on this object.
Undoes 'ignore_reports'. Future reports will now cause notifications
and appear in the various moderation listings.
"""
url = self.reddit_session.config['unignore_reports']
data = {'id': se... | [
"Remove",
"ignoring",
"of",
"future",
"reports",
"on",
"this",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L297-L306 | [
"def",
"unignore_reports",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'unignore_reports'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
"}",
"return",
"self",
".",
"reddit_session",
".",
"request_... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Editable.delete | Delete this object.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def delete(self):
"""Delete this object.
:returns: The json response from the server.
"""
url = self.reddit_session.config['del']
data = {'id': self.fullname}
response = self.reddit_session.request_json(url, data=data)
self.reddit_session.evict(self.reddit_sessi... | def delete(self):
"""Delete this object.
:returns: The json response from the server.
"""
url = self.reddit_session.config['del']
data = {'id': self.fullname}
response = self.reddit_session.request_json(url, data=data)
self.reddit_session.evict(self.reddit_sessi... | [
"Delete",
"this",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L313-L323 | [
"def",
"delete",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'del'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
"}",
"response",
"=",
"self",
".",
"reddit_session",
".",
"request_json",
"(",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Editable.edit | Replace the body of the object with `text`.
:returns: The updated object. | rtv/packages/praw/objects.py | def edit(self, text):
"""Replace the body of the object with `text`.
:returns: The updated object.
"""
url = self.reddit_session.config['edit']
data = {'thing_id': self.fullname,
'text': text}
response = self.reddit_session.request_json(url, data=data)
... | def edit(self, text):
"""Replace the body of the object with `text`.
:returns: The updated object.
"""
url = self.reddit_session.config['edit']
data = {'thing_id': self.fullname,
'text': text}
response = self.reddit_session.request_json(url, data=data)
... | [
"Replace",
"the",
"body",
"of",
"the",
"object",
"with",
"text",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L326-L337 | [
"def",
"edit",
"(",
"self",
",",
"text",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'edit'",
"]",
"data",
"=",
"{",
"'thing_id'",
":",
"self",
".",
"fullname",
",",
"'text'",
":",
"text",
"}",
"response",
"=",
"self",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Gildable.gild | Gild the Redditor or author of the content.
:param months: Specifies the number of months to gild. This parameter
is Only valid when the instance called upon is of type
Redditor. When not provided, the value defaults to 1.
:returns: True on success, otherwise raises an exception... | rtv/packages/praw/objects.py | def gild(self, months=None):
"""Gild the Redditor or author of the content.
:param months: Specifies the number of months to gild. This parameter
is Only valid when the instance called upon is of type
Redditor. When not provided, the value defaults to 1.
:returns: True o... | def gild(self, months=None):
"""Gild the Redditor or author of the content.
:param months: Specifies the number of months to gild. This parameter
is Only valid when the instance called upon is of type
Redditor. When not provided, the value defaults to 1.
:returns: True o... | [
"Gild",
"the",
"Redditor",
"or",
"author",
"of",
"the",
"content",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L344-L369 | [
"def",
"gild",
"(",
"self",
",",
"months",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"Redditor",
")",
":",
"months",
"=",
"int",
"(",
"months",
")",
"if",
"months",
"is",
"not",
"None",
"else",
"1",
"if",
"months",
"<",
"1",
":... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Hideable.hide | Hide object in the context of the logged in user.
:param _unhide: If True, unhide the item instead. Use
:meth:`~praw.objects.Hideable.unhide` instead of setting this
manually.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def hide(self, _unhide=False):
"""Hide object in the context of the logged in user.
:param _unhide: If True, unhide the item instead. Use
:meth:`~praw.objects.Hideable.unhide` instead of setting this
manually.
:returns: The json response from the server.
"""
... | def hide(self, _unhide=False):
"""Hide object in the context of the logged in user.
:param _unhide: If True, unhide the item instead. Use
:meth:`~praw.objects.Hideable.unhide` instead of setting this
manually.
:returns: The json response from the server.
"""
... | [
"Hide",
"object",
"in",
"the",
"context",
"of",
"the",
"logged",
"in",
"user",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L375-L385 | [
"def",
"hide",
"(",
"self",
",",
"_unhide",
"=",
"False",
")",
":",
"return",
"self",
".",
"reddit_session",
".",
"hide",
"(",
"self",
".",
"fullname",
",",
"_unhide",
"=",
"_unhide",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Inboxable.reply | Reply to object with the specified text.
:returns: A Comment object for the newly created comment (reply). | rtv/packages/praw/objects.py | def reply(self, text):
"""Reply to object with the specified text.
:returns: A Comment object for the newly created comment (reply).
"""
# pylint: disable=W0212
response = self.reddit_session._add_comment(self.fullname, text)
# pylint: enable=W0212
urls = [self.... | def reply(self, text):
"""Reply to object with the specified text.
:returns: A Comment object for the newly created comment (reply).
"""
# pylint: disable=W0212
response = self.reddit_session._add_comment(self.fullname, text)
# pylint: enable=W0212
urls = [self.... | [
"Reply",
"to",
"object",
"with",
"the",
"specified",
"text",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L415-L430 | [
"def",
"reply",
"(",
"self",
",",
"text",
")",
":",
"# pylint: disable=W0212",
"response",
"=",
"self",
".",
"reddit_session",
".",
"_add_comment",
"(",
"self",
".",
"fullname",
",",
"text",
")",
"# pylint: enable=W0212",
"urls",
"=",
"[",
"self",
".",
"redd... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Refreshable.refresh | Re-query to update object with latest values. Return the object.
Any listing, such as the submissions on a subreddits top page, will
automatically be refreshed serverside. Refreshing a submission will
also refresh all its comments.
In the rare case of a comment being deleted or removed... | rtv/packages/praw/objects.py | def refresh(self):
"""Re-query to update object with latest values. Return the object.
Any listing, such as the submissions on a subreddits top page, will
automatically be refreshed serverside. Refreshing a submission will
also refresh all its comments.
In the rare case of a co... | def refresh(self):
"""Re-query to update object with latest values. Return the object.
Any listing, such as the submissions on a subreddits top page, will
automatically be refreshed serverside. Refreshing a submission will
also refresh all its comments.
In the rare case of a co... | [
"Re",
"-",
"query",
"to",
"update",
"object",
"with",
"latest",
"values",
".",
"Return",
"the",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L442-L506 | [
"def",
"refresh",
"(",
"self",
")",
":",
"unique",
"=",
"self",
".",
"reddit_session",
".",
"_unique_count",
"# pylint: disable=W0212",
"self",
".",
"reddit_session",
".",
"_unique_count",
"+=",
"1",
"# pylint: disable=W0212",
"if",
"isinstance",
"(",
"self",
",",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Reportable.report | Report this object to the moderators.
:param reason: The user-supplied reason for reporting a comment
or submission. Default: None (blank reason)
:returns: The json response from the server. | rtv/packages/praw/objects.py | def report(self, reason=None):
"""Report this object to the moderators.
:param reason: The user-supplied reason for reporting a comment
or submission. Default: None (blank reason)
:returns: The json response from the server.
"""
url = self.reddit_session.config['rep... | def report(self, reason=None):
"""Report this object to the moderators.
:param reason: The user-supplied reason for reporting a comment
or submission. Default: None (blank reason)
:returns: The json response from the server.
"""
url = self.reddit_session.config['rep... | [
"Report",
"this",
"object",
"to",
"the",
"moderators",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L513-L532 | [
"def",
"report",
"(",
"self",
",",
"reason",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'report'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
"}",
"if",
"reason",
":",
"data",
"[",
"'rea... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Saveable.save | Save the object.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def save(self, unsave=False):
"""Save the object.
:returns: The json response from the server.
"""
url = self.reddit_session.config['unsave' if unsave else 'save']
data = {'id': self.fullname,
'executed': 'unsaved' if unsave else 'saved'}
response = self... | def save(self, unsave=False):
"""Save the object.
:returns: The json response from the server.
"""
url = self.reddit_session.config['unsave' if unsave else 'save']
data = {'id': self.fullname,
'executed': 'unsaved' if unsave else 'saved'}
response = self... | [
"Save",
"the",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L539-L550 | [
"def",
"save",
"(",
"self",
",",
"unsave",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'unsave'",
"if",
"unsave",
"else",
"'save'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
",",
"'execut... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Voteable.vote | Vote for the given item in the direction specified.
Note: votes must be cast by humans. That is, API clients proxying a
human's action one-for-one are OK, but bots deciding how to vote on
content or amplifying a human's vote are not. See the reddit rules for
more details on what constit... | rtv/packages/praw/objects.py | def vote(self, direction=0):
"""Vote for the given item in the direction specified.
Note: votes must be cast by humans. That is, API clients proxying a
human's action one-for-one are OK, but bots deciding how to vote on
content or amplifying a human's vote are not. See the reddit rules ... | def vote(self, direction=0):
"""Vote for the given item in the direction specified.
Note: votes must be cast by humans. That is, API clients proxying a
human's action one-for-one are OK, but bots deciding how to vote on
content or amplifying a human's vote are not. See the reddit rules ... | [
"Vote",
"for",
"the",
"given",
"item",
"in",
"the",
"direction",
"specified",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L612-L634 | [
"def",
"vote",
"(",
"self",
",",
"direction",
"=",
"0",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'vote'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
",",
"'dir'",
":",
"six",
".",
"text_type",
"(",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Comment._fast_permalink | Return the short permalink to the comment. | rtv/packages/praw/objects.py | def _fast_permalink(self):
"""Return the short permalink to the comment."""
if hasattr(self, 'link_id'): # from /r or /u comments page
sid = self.link_id.split('_')[1]
else: # from user's /message page
sid = self.context.split('/')[4]
return urljoin(self.reddit_... | def _fast_permalink(self):
"""Return the short permalink to the comment."""
if hasattr(self, 'link_id'): # from /r or /u comments page
sid = self.link_id.split('_')[1]
else: # from user's /message page
sid = self.context.split('/')[4]
return urljoin(self.reddit_... | [
"Return",
"the",
"short",
"permalink",
"to",
"the",
"comment",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L660-L667 | [
"def",
"_fast_permalink",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'link_id'",
")",
":",
"# from /r or /u comments page",
"sid",
"=",
"self",
".",
"link_id",
".",
"split",
"(",
"'_'",
")",
"[",
"1",
"]",
"else",
":",
"# from user's /messa... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Comment._update_submission | Submission isn't set on __init__ thus we need to update it. | rtv/packages/praw/objects.py | def _update_submission(self, submission):
"""Submission isn't set on __init__ thus we need to update it."""
submission._comments_by_id[self.name] = self # pylint: disable=W0212
self._submission = submission
if self._replies:
for reply in self._replies:
reply.... | def _update_submission(self, submission):
"""Submission isn't set on __init__ thus we need to update it."""
submission._comments_by_id[self.name] = self # pylint: disable=W0212
self._submission = submission
if self._replies:
for reply in self._replies:
reply.... | [
"Submission",
"isn",
"t",
"set",
"on",
"__init__",
"thus",
"we",
"need",
"to",
"update",
"it",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L669-L675 | [
"def",
"_update_submission",
"(",
"self",
",",
"submission",
")",
":",
"submission",
".",
"_comments_by_id",
"[",
"self",
".",
"name",
"]",
"=",
"self",
"# pylint: disable=W0212",
"self",
".",
"_submission",
"=",
"submission",
"if",
"self",
".",
"_replies",
":... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Comment.is_root | Return True when the comment is a top level comment. | rtv/packages/praw/objects.py | def is_root(self):
"""Return True when the comment is a top level comment."""
sub_prefix = self.reddit_session.config.by_object[Submission]
return self.parent_id.startswith(sub_prefix) | def is_root(self):
"""Return True when the comment is a top level comment."""
sub_prefix = self.reddit_session.config.by_object[Submission]
return self.parent_id.startswith(sub_prefix) | [
"Return",
"True",
"when",
"the",
"comment",
"is",
"a",
"top",
"level",
"comment",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L678-L681 | [
"def",
"is_root",
"(",
"self",
")",
":",
"sub_prefix",
"=",
"self",
".",
"reddit_session",
".",
"config",
".",
"by_object",
"[",
"Submission",
"]",
"return",
"self",
".",
"parent_id",
".",
"startswith",
"(",
"sub_prefix",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Comment.replies | Return a list of the comment replies to this comment.
If the comment is not from a submission, :meth:`replies` will
always be an empty list unless you call :meth:`refresh()
before calling :meth:`replies` due to a limitation in
reddit's API. | rtv/packages/praw/objects.py | def replies(self):
"""Return a list of the comment replies to this comment.
If the comment is not from a submission, :meth:`replies` will
always be an empty list unless you call :meth:`refresh()
before calling :meth:`replies` due to a limitation in
reddit's API.
"""
... | def replies(self):
"""Return a list of the comment replies to this comment.
If the comment is not from a submission, :meth:`replies` will
always be an empty list unless you call :meth:`refresh()
before calling :meth:`replies` due to a limitation in
reddit's API.
"""
... | [
"Return",
"a",
"list",
"of",
"the",
"comment",
"replies",
"to",
"this",
"comment",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L689-L719 | [
"def",
"replies",
"(",
"self",
")",
":",
"if",
"self",
".",
"_replies",
"is",
"None",
"or",
"not",
"self",
".",
"_has_fetched_replies",
":",
"response",
"=",
"self",
".",
"reddit_session",
".",
"request_json",
"(",
"self",
".",
"_fast_permalink",
")",
"if"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Comment.submission | Return the Submission object this comment belongs to. | rtv/packages/praw/objects.py | def submission(self):
"""Return the Submission object this comment belongs to."""
if not self._submission: # Comment not from submission
self._submission = self.reddit_session.get_submission(
url=self._fast_permalink)
return self._submission | def submission(self):
"""Return the Submission object this comment belongs to."""
if not self._submission: # Comment not from submission
self._submission = self.reddit_session.get_submission(
url=self._fast_permalink)
return self._submission | [
"Return",
"the",
"Submission",
"object",
"this",
"comment",
"belongs",
"to",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L722-L727 | [
"def",
"submission",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_submission",
":",
"# Comment not from submission",
"self",
".",
"_submission",
"=",
"self",
".",
"reddit_session",
".",
"get_submission",
"(",
"url",
"=",
"self",
".",
"_fast_permalink",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Message.from_id | Request the url for a Message and return a Message object.
:param reddit_session: The session to make the request with.
:param message_id: The ID of the message to request.
The additional parameters are passed directly into
:meth:`.request_json`. | rtv/packages/praw/objects.py | def from_id(reddit_session, message_id, *args, **kwargs):
"""Request the url for a Message and return a Message object.
:param reddit_session: The session to make the request with.
:param message_id: The ID of the message to request.
The additional parameters are passed directly into
... | def from_id(reddit_session, message_id, *args, **kwargs):
"""Request the url for a Message and return a Message object.
:param reddit_session: The session to make the request with.
:param message_id: The ID of the message to request.
The additional parameters are passed directly into
... | [
"Request",
"the",
"url",
"for",
"a",
"Message",
"and",
"return",
"a",
"Message",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L735-L758 | [
"def",
"from_id",
"(",
"reddit_session",
",",
"message_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Reduce fullname to ID if necessary",
"message_id",
"=",
"message_id",
".",
"split",
"(",
"'_'",
",",
"1",
")",
"[",
"-",
"1",
"]",
"url",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Message.collapse | Collapse a private message or modmail. | rtv/packages/praw/objects.py | def collapse(self):
"""Collapse a private message or modmail."""
url = self.reddit_session.config['collapse_message']
self.reddit_session.request_json(url, data={'id': self.name}) | def collapse(self):
"""Collapse a private message or modmail."""
url = self.reddit_session.config['collapse_message']
self.reddit_session.request_json(url, data={'id': self.name}) | [
"Collapse",
"a",
"private",
"message",
"or",
"modmail",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L775-L778 | [
"def",
"collapse",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'collapse_message'",
"]",
"self",
".",
"reddit_session",
".",
"request_json",
"(",
"url",
",",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"name",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Message.mute_modmail_author | Mute the sender of this modmail message.
:param _unmute: Unmute the user instead. Please use
:meth:`unmute_modmail_author` instead of setting this directly. | rtv/packages/praw/objects.py | def mute_modmail_author(self, _unmute=False):
"""Mute the sender of this modmail message.
:param _unmute: Unmute the user instead. Please use
:meth:`unmute_modmail_author` instead of setting this directly.
"""
path = 'unmute_sender' if _unmute else 'mute_sender'
ret... | def mute_modmail_author(self, _unmute=False):
"""Mute the sender of this modmail message.
:param _unmute: Unmute the user instead. Please use
:meth:`unmute_modmail_author` instead of setting this directly.
"""
path = 'unmute_sender' if _unmute else 'mute_sender'
ret... | [
"Mute",
"the",
"sender",
"of",
"this",
"modmail",
"message",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L781-L790 | [
"def",
"mute_modmail_author",
"(",
"self",
",",
"_unmute",
"=",
"False",
")",
":",
"path",
"=",
"'unmute_sender'",
"if",
"_unmute",
"else",
"'mute_sender'",
"return",
"self",
".",
"reddit_session",
".",
"request_json",
"(",
"self",
".",
"reddit_session",
".",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Message.uncollapse | Uncollapse a private message or modmail. | rtv/packages/praw/objects.py | def uncollapse(self):
"""Uncollapse a private message or modmail."""
url = self.reddit_session.config['uncollapse_message']
self.reddit_session.request_json(url, data={'id': self.name}) | def uncollapse(self):
"""Uncollapse a private message or modmail."""
url = self.reddit_session.config['uncollapse_message']
self.reddit_session.request_json(url, data={'id': self.name}) | [
"Uncollapse",
"a",
"private",
"message",
"or",
"modmail",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L793-L796 | [
"def",
"uncollapse",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'uncollapse_message'",
"]",
"self",
".",
"reddit_session",
".",
"request_json",
"(",
"url",
",",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"name... | ccef2af042566ad384977028cf0bde01bc524dda |
train | MoreComments.comments | Fetch and return the comments for a single MoreComments object. | rtv/packages/praw/objects.py | def comments(self, update=True):
"""Fetch and return the comments for a single MoreComments object."""
if not self._comments:
if self.count == 0: # Handle 'continue this thread' type
return self._continue_comments(update)
# pylint: disable=W0212
child... | def comments(self, update=True):
"""Fetch and return the comments for a single MoreComments object."""
if not self._comments:
if self.count == 0: # Handle 'continue this thread' type
return self._continue_comments(update)
# pylint: disable=W0212
child... | [
"Fetch",
"and",
"return",
"the",
"comments",
"for",
"a",
"single",
"MoreComments",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L840-L867 | [
"def",
"comments",
"(",
"self",
",",
"update",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"_comments",
":",
"if",
"self",
".",
"count",
"==",
"0",
":",
"# Handle 'continue this thread' type",
"return",
"self",
".",
"_continue_comments",
"(",
"update",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Redditor.friend | Friend the user.
:param note: A personal note about the user. Requires reddit Gold.
:param _unfriend: Unfriend the user. Please use :meth:`unfriend`
instead of setting this parameter manually.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def friend(self, note=None, _unfriend=False):
"""Friend the user.
:param note: A personal note about the user. Requires reddit Gold.
:param _unfriend: Unfriend the user. Please use :meth:`unfriend`
instead of setting this parameter manually.
:returns: The json response from... | def friend(self, note=None, _unfriend=False):
"""Friend the user.
:param note: A personal note about the user. Requires reddit Gold.
:param _unfriend: Unfriend the user. Please use :meth:`unfriend`
instead of setting this parameter manually.
:returns: The json response from... | [
"Friend",
"the",
"user",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L911-L941 | [
"def",
"friend",
"(",
"self",
",",
"note",
"=",
"None",
",",
"_unfriend",
"=",
"False",
")",
":",
"self",
".",
"reddit_session",
".",
"evict",
"(",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'friends'",
"]",
")",
"# Requests through password auth us... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Redditor.get_downvoted | Return a listing of the Submissions the user has downvoted.
:returns: get_content generator of Submission items.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` parameter cannot be altered.
As a default, this listing is only accessible by the u... | rtv/packages/praw/objects.py | def get_downvoted(self, *args, **kwargs):
"""Return a listing of the Submissions the user has downvoted.
:returns: get_content generator of Submission items.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` parameter cannot be altered.
A... | def get_downvoted(self, *args, **kwargs):
"""Return a listing of the Submissions the user has downvoted.
:returns: get_content generator of Submission items.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` parameter cannot be altered.
A... | [
"Return",
"a",
"listing",
"of",
"the",
"Submissions",
"the",
"user",
"has",
"downvoted",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L951-L970 | [
"def",
"get_downvoted",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Sending an OAuth authenticated request for a redditor, who isn't the",
"# authenticated user. But who has a public voting record will be",
"# successful.",
"kwargs",
"[",
"'_use_oauth'",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Redditor.get_friend_info | Return information about this friend, including personal notes.
The personal note can be added or overwritten with :meth:friend, but
only if the user has reddit Gold.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def get_friend_info(self):
"""Return information about this friend, including personal notes.
The personal note can be added or overwritten with :meth:friend, but
only if the user has reddit Gold.
:returns: The json response from the server.
"""
url = self.reddit_s... | def get_friend_info(self):
"""Return information about this friend, including personal notes.
The personal note can be added or overwritten with :meth:friend, but
only if the user has reddit Gold.
:returns: The json response from the server.
"""
url = self.reddit_s... | [
"Return",
"information",
"about",
"this",
"friend",
"including",
"personal",
"notes",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L973-L984 | [
"def",
"get_friend_info",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'friend_v1'",
"]",
".",
"format",
"(",
"user",
"=",
"self",
".",
"name",
")",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"name",
"}",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Redditor.get_upvoted | Return a listing of the Submissions the user has upvoted.
:returns: get_content generator of Submission items.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` parameter cannot be altered.
As a default, this listing is only accessible by the use... | rtv/packages/praw/objects.py | def get_upvoted(self, *args, **kwargs):
"""Return a listing of the Submissions the user has upvoted.
:returns: get_content generator of Submission items.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` parameter cannot be altered.
As a ... | def get_upvoted(self, *args, **kwargs):
"""Return a listing of the Submissions the user has upvoted.
:returns: get_content generator of Submission items.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` parameter cannot be altered.
As a ... | [
"Return",
"a",
"listing",
"of",
"the",
"Submissions",
"the",
"user",
"has",
"upvoted",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L994-L1010 | [
"def",
"get_upvoted",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_use_oauth'",
"]",
"=",
"self",
".",
"reddit_session",
".",
"is_oauth_session",
"(",
")",
"return",
"_get_redditor_listing",
"(",
"'upvoted'",
")",
"("... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Redditor.mark_as_read | Mark message(s) as read or unread.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def mark_as_read(self, messages, unread=False):
"""Mark message(s) as read or unread.
:returns: The json response from the server.
"""
ids = []
if isinstance(messages, Inboxable):
ids.append(messages.fullname)
elif hasattr(messages, '__iter__'):
... | def mark_as_read(self, messages, unread=False):
"""Mark message(s) as read or unread.
:returns: The json response from the server.
"""
ids = []
if isinstance(messages, Inboxable):
ids.append(messages.fullname)
elif hasattr(messages, '__iter__'):
... | [
"Mark",
"message",
"(",
"s",
")",
"as",
"read",
"or",
"unread",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1012-L1033 | [
"def",
"mark_as_read",
"(",
"self",
",",
"messages",
",",
"unread",
"=",
"False",
")",
":",
"ids",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"messages",
",",
"Inboxable",
")",
":",
"ids",
".",
"append",
"(",
"messages",
".",
"fullname",
")",
"elif",
"h... | ccef2af042566ad384977028cf0bde01bc524dda |
train | LoggedInRedditor.get_blocked | Return a UserList of Redditors with whom the user has blocked. | rtv/packages/praw/objects.py | def get_blocked(self):
"""Return a UserList of Redditors with whom the user has blocked."""
url = self.reddit_session.config['blocked']
return self.reddit_session.request_json(url) | def get_blocked(self):
"""Return a UserList of Redditors with whom the user has blocked."""
url = self.reddit_session.config['blocked']
return self.reddit_session.request_json(url) | [
"Return",
"a",
"UserList",
"of",
"Redditors",
"with",
"whom",
"the",
"user",
"has",
"blocked",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1050-L1053 | [
"def",
"get_blocked",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'blocked'",
"]",
"return",
"self",
".",
"reddit_session",
".",
"request_json",
"(",
"url",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | LoggedInRedditor.get_cached_moderated_reddits | Return a cached dictionary of the user's moderated reddits.
This list is used internally. Consider using the `get_my_moderation`
function instead. | rtv/packages/praw/objects.py | def get_cached_moderated_reddits(self):
"""Return a cached dictionary of the user's moderated reddits.
This list is used internally. Consider using the `get_my_moderation`
function instead.
"""
if self._mod_subs is None:
self._mod_subs = {'mod': self.reddit_session.... | def get_cached_moderated_reddits(self):
"""Return a cached dictionary of the user's moderated reddits.
This list is used internally. Consider using the `get_my_moderation`
function instead.
"""
if self._mod_subs is None:
self._mod_subs = {'mod': self.reddit_session.... | [
"Return",
"a",
"cached",
"dictionary",
"of",
"the",
"user",
"s",
"moderated",
"reddits",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1055-L1066 | [
"def",
"get_cached_moderated_reddits",
"(",
"self",
")",
":",
"if",
"self",
".",
"_mod_subs",
"is",
"None",
":",
"self",
".",
"_mod_subs",
"=",
"{",
"'mod'",
":",
"self",
".",
"reddit_session",
".",
"get_subreddit",
"(",
"'mod'",
")",
"}",
"for",
"sub",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission._extract_more_comments | Return a list of MoreComments objects removed from tree. | rtv/packages/praw/objects.py | def _extract_more_comments(tree):
"""Return a list of MoreComments objects removed from tree."""
more_comments = []
queue = [(None, x) for x in tree]
while len(queue) > 0:
parent, comm = queue.pop(0)
if isinstance(comm, MoreComments):
heappush(more... | def _extract_more_comments(tree):
"""Return a list of MoreComments objects removed from tree."""
more_comments = []
queue = [(None, x) for x in tree]
while len(queue) > 0:
parent, comm = queue.pop(0)
if isinstance(comm, MoreComments):
heappush(more... | [
"Return",
"a",
"list",
"of",
"MoreComments",
"objects",
"removed",
"from",
"tree",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1099-L1114 | [
"def",
"_extract_more_comments",
"(",
"tree",
")",
":",
"more_comments",
"=",
"[",
"]",
"queue",
"=",
"[",
"(",
"None",
",",
"x",
")",
"for",
"x",
"in",
"tree",
"]",
"while",
"len",
"(",
"queue",
")",
">",
"0",
":",
"parent",
",",
"comm",
"=",
"q... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.from_id | Return an edit-only submission object based on the id. | rtv/packages/praw/objects.py | def from_id(reddit_session, subreddit_id):
"""Return an edit-only submission object based on the id."""
pseudo_data = {'id': subreddit_id,
'permalink': '/comments/{0}'.format(subreddit_id)}
return Submission(reddit_session, pseudo_data) | def from_id(reddit_session, subreddit_id):
"""Return an edit-only submission object based on the id."""
pseudo_data = {'id': subreddit_id,
'permalink': '/comments/{0}'.format(subreddit_id)}
return Submission(reddit_session, pseudo_data) | [
"Return",
"an",
"edit",
"-",
"only",
"submission",
"object",
"based",
"on",
"the",
"id",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1117-L1121 | [
"def",
"from_id",
"(",
"reddit_session",
",",
"subreddit_id",
")",
":",
"pseudo_data",
"=",
"{",
"'id'",
":",
"subreddit_id",
",",
"'permalink'",
":",
"'/comments/{0}'",
".",
"format",
"(",
"subreddit_id",
")",
"}",
"return",
"Submission",
"(",
"reddit_session",... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.from_url | Request the url and return a Submission object.
:param reddit_session: The session to make the request with.
:param url: The url to build the Submission object from.
:param comment_limit: The desired number of comments to fetch. If <= 0
fetch the default number for the session's use... | rtv/packages/praw/objects.py | def from_url(reddit_session, url, comment_limit=0, comment_sort=None,
comments_only=False, params=None):
"""Request the url and return a Submission object.
:param reddit_session: The session to make the request with.
:param url: The url to build the Submission object from.
... | def from_url(reddit_session, url, comment_limit=0, comment_sort=None,
comments_only=False, params=None):
"""Request the url and return a Submission object.
:param reddit_session: The session to make the request with.
:param url: The url to build the Submission object from.
... | [
"Request",
"the",
"url",
"and",
"return",
"a",
"Submission",
"object",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1132-L1168 | [
"def",
"from_url",
"(",
"reddit_session",
",",
"url",
",",
"comment_limit",
"=",
"0",
",",
"comment_sort",
"=",
"None",
",",
"comments_only",
"=",
"False",
",",
"params",
"=",
"None",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"{",
"}"... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.add_comment | Comment on the submission using the specified text.
:returns: A Comment object for the newly created comment. | rtv/packages/praw/objects.py | def add_comment(self, text):
"""Comment on the submission using the specified text.
:returns: A Comment object for the newly created comment.
"""
# pylint: disable=W0212
response = self.reddit_session._add_comment(self.fullname, text)
# pylint: enable=W0212
self... | def add_comment(self, text):
"""Comment on the submission using the specified text.
:returns: A Comment object for the newly created comment.
"""
# pylint: disable=W0212
response = self.reddit_session._add_comment(self.fullname, text)
# pylint: enable=W0212
self... | [
"Comment",
"on",
"the",
"submission",
"using",
"the",
"specified",
"text",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1219-L1229 | [
"def",
"add_comment",
"(",
"self",
",",
"text",
")",
":",
"# pylint: disable=W0212",
"response",
"=",
"self",
".",
"reddit_session",
".",
"_add_comment",
"(",
"self",
".",
"fullname",
",",
"text",
")",
"# pylint: enable=W0212",
"self",
".",
"reddit_session",
"."... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.comments | Return forest of comments, with top-level comments as tree roots.
May contain instances of MoreComment objects. To easily replace these
objects with Comment objects, use the replace_more_comments method then
fetch this attribute. Use comment replies to walk down the tree. To get
an unne... | rtv/packages/praw/objects.py | def comments(self): # pylint: disable=E0202
"""Return forest of comments, with top-level comments as tree roots.
May contain instances of MoreComment objects. To easily replace these
objects with Comment objects, use the replace_more_comments method then
fetch this attribute. Use comme... | def comments(self): # pylint: disable=E0202
"""Return forest of comments, with top-level comments as tree roots.
May contain instances of MoreComment objects. To easily replace these
objects with Comment objects, use the replace_more_comments method then
fetch this attribute. Use comme... | [
"Return",
"forest",
"of",
"comments",
"with",
"top",
"-",
"level",
"comments",
"as",
"tree",
"roots",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1232-L1245 | [
"def",
"comments",
"(",
"self",
")",
":",
"# pylint: disable=E0202",
"if",
"self",
".",
"_comments",
"is",
"None",
":",
"self",
".",
"comments",
"=",
"Submission",
".",
"from_url",
"(",
"# pylint: disable=W0212",
"self",
".",
"reddit_session",
",",
"self",
"."... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.get_duplicates | Return a get_content generator for the submission's duplicates.
:returns: get_content generator iterating over Submission objects.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` and `object_filter` parameters
cannot be altered. | rtv/packages/praw/objects.py | def get_duplicates(self, *args, **kwargs):
"""Return a get_content generator for the submission's duplicates.
:returns: get_content generator iterating over Submission objects.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` and `object_filter` ... | def get_duplicates(self, *args, **kwargs):
"""Return a get_content generator for the submission's duplicates.
:returns: get_content generator iterating over Submission objects.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` and `object_filter` ... | [
"Return",
"a",
"get_content",
"generator",
"for",
"the",
"submission",
"s",
"duplicates",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1253-L1266 | [
"def",
"get_duplicates",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'duplicates'",
"]",
".",
"format",
"(",
"submissionid",
"=",
"self",
".",
"id",
")",
"return",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.get_flair_choices | Return available link flair choices and current flair.
Convenience function for
:meth:`~.AuthenticatedReddit.get_flair_choices` populating both the
`subreddit` and `link` parameters.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def get_flair_choices(self, *args, **kwargs):
"""Return available link flair choices and current flair.
Convenience function for
:meth:`~.AuthenticatedReddit.get_flair_choices` populating both the
`subreddit` and `link` parameters.
:returns: The json response from the server.
... | def get_flair_choices(self, *args, **kwargs):
"""Return available link flair choices and current flair.
Convenience function for
:meth:`~.AuthenticatedReddit.get_flair_choices` populating both the
`subreddit` and `link` parameters.
:returns: The json response from the server.
... | [
"Return",
"available",
"link",
"flair",
"choices",
"and",
"current",
"flair",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1268-L1278 | [
"def",
"get_flair_choices",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"subreddit",
".",
"get_flair_choices",
"(",
"self",
".",
"fullname",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.lock | Lock thread.
Requires that the currently authenticated user has the modposts oauth
scope or has user/password authentication as a mod of the subreddit.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def lock(self):
"""Lock thread.
Requires that the currently authenticated user has the modposts oauth
scope or has user/password authentication as a mod of the subreddit.
:returns: The json response from the server.
"""
url = self.reddit_session.config['lock']
... | def lock(self):
"""Lock thread.
Requires that the currently authenticated user has the modposts oauth
scope or has user/password authentication as a mod of the subreddit.
:returns: The json response from the server.
"""
url = self.reddit_session.config['lock']
... | [
"Lock",
"thread",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1281-L1292 | [
"def",
"lock",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'lock'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
"}",
"return",
"self",
".",
"reddit_session",
".",
"request_json",
"(",
"url",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.mark_as_nsfw | Mark as Not Safe For Work.
Requires that the currently authenticated user is the author of the
submission, has the modposts oauth scope or has user/password
authentication as a mod of the subreddit.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def mark_as_nsfw(self, unmark_nsfw=False):
"""Mark as Not Safe For Work.
Requires that the currently authenticated user is the author of the
submission, has the modposts oauth scope or has user/password
authentication as a mod of the subreddit.
:returns: The json response from ... | def mark_as_nsfw(self, unmark_nsfw=False):
"""Mark as Not Safe For Work.
Requires that the currently authenticated user is the author of the
submission, has the modposts oauth scope or has user/password
authentication as a mod of the subreddit.
:returns: The json response from ... | [
"Mark",
"as",
"Not",
"Safe",
"For",
"Work",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1294-L1318 | [
"def",
"mark_as_nsfw",
"(",
"self",
",",
"unmark_nsfw",
"=",
"False",
")",
":",
"def",
"mark_as_nsfw_helper",
"(",
"self",
")",
":",
"# pylint: disable=W0613",
"# It is necessary to have the 'self' argument as it's needed in",
"# restrict_access to determine what class the decora... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.replace_more_comments | Update the comment tree by replacing instances of MoreComments.
:param limit: The maximum number of MoreComments objects to
replace. Each replacement requires 1 API request. Set to None to
have no limit, or to 0 to make no extra requests. Default: 32
:param threshold: The minimu... | rtv/packages/praw/objects.py | def replace_more_comments(self, limit=32, threshold=1):
"""Update the comment tree by replacing instances of MoreComments.
:param limit: The maximum number of MoreComments objects to
replace. Each replacement requires 1 API request. Set to None to
have no limit, or to 0 to make ... | def replace_more_comments(self, limit=32, threshold=1):
"""Update the comment tree by replacing instances of MoreComments.
:param limit: The maximum number of MoreComments objects to
replace. Each replacement requires 1 API request. Set to None to
have no limit, or to 0 to make ... | [
"Update",
"the",
"comment",
"tree",
"by",
"replacing",
"instances",
"of",
"MoreComments",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1320-L1369 | [
"def",
"replace_more_comments",
"(",
"self",
",",
"limit",
"=",
"32",
",",
"threshold",
"=",
"1",
")",
":",
"if",
"self",
".",
"_replaced_more",
":",
"return",
"[",
"]",
"remaining",
"=",
"limit",
"more_comments",
"=",
"self",
".",
"_extract_more_comments",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.set_flair | Set flair for this submission.
Convenience function that utilizes :meth:`.ModFlairMixin.set_flair`
populating both the `subreddit` and `item` parameters.
:returns: The json response from the server. | rtv/packages/praw/objects.py | def set_flair(self, *args, **kwargs):
"""Set flair for this submission.
Convenience function that utilizes :meth:`.ModFlairMixin.set_flair`
populating both the `subreddit` and `item` parameters.
:returns: The json response from the server.
"""
return self.subreddit.set... | def set_flair(self, *args, **kwargs):
"""Set flair for this submission.
Convenience function that utilizes :meth:`.ModFlairMixin.set_flair`
populating both the `subreddit` and `item` parameters.
:returns: The json response from the server.
"""
return self.subreddit.set... | [
"Set",
"flair",
"for",
"this",
"submission",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1371-L1380 | [
"def",
"set_flair",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"subreddit",
".",
"set_flair",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.set_suggested_sort | Set 'Suggested Sort' for the comments of the submission.
Comments can be sorted in one of (confidence, top, new, hot,
controversial, old, random, qa, blank).
:returns: The json response from the server. | rtv/packages/praw/objects.py | def set_suggested_sort(self, sort='blank'):
"""Set 'Suggested Sort' for the comments of the submission.
Comments can be sorted in one of (confidence, top, new, hot,
controversial, old, random, qa, blank).
:returns: The json response from the server.
"""
url = self.redd... | def set_suggested_sort(self, sort='blank'):
"""Set 'Suggested Sort' for the comments of the submission.
Comments can be sorted in one of (confidence, top, new, hot,
controversial, old, random, qa, blank).
:returns: The json response from the server.
"""
url = self.redd... | [
"Set",
"Suggested",
"Sort",
"for",
"the",
"comments",
"of",
"the",
"submission",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1407-L1418 | [
"def",
"set_suggested_sort",
"(",
"self",
",",
"sort",
"=",
"'blank'",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'suggested_sort'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
",",
"'sort'",
":",
"sort",
... | ccef2af042566ad384977028cf0bde01bc524dda |
train | Submission.sticky | Sticky a post in its subreddit.
If there is already a stickied post in the designated slot it will be
unstickied.
:param bottom: Set this as the top or bottom sticky. If no top sticky
exists, this submission will become the top sticky regardless.
:returns: The json respons... | rtv/packages/praw/objects.py | def sticky(self, bottom=True):
"""Sticky a post in its subreddit.
If there is already a stickied post in the designated slot it will be
unstickied.
:param bottom: Set this as the top or bottom sticky. If no top sticky
exists, this submission will become the top sticky regar... | def sticky(self, bottom=True):
"""Sticky a post in its subreddit.
If there is already a stickied post in the designated slot it will be
unstickied.
:param bottom: Set this as the top or bottom sticky. If no top sticky
exists, this submission will become the top sticky regar... | [
"Sticky",
"a",
"post",
"in",
"its",
"subreddit",
"."
] | michael-lazar/rtv | python | https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L1432-L1448 | [
"def",
"sticky",
"(",
"self",
",",
"bottom",
"=",
"True",
")",
":",
"url",
"=",
"self",
".",
"reddit_session",
".",
"config",
"[",
"'sticky_submission'",
"]",
"data",
"=",
"{",
"'id'",
":",
"self",
".",
"fullname",
",",
"'state'",
":",
"True",
"}",
"... | ccef2af042566ad384977028cf0bde01bc524dda |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.