Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Predict the next line for this snippet: <|code_start|> response = self._request_get("channel")
return Channel.construct_from(response)
def get_by_id(self, channel_id):
response = self._request_get("channels/{}".format(channel_id))
return Channel.construct_from(response)
@oauth_r... | def get_followers( |
Predict the next line for this snippet: <|code_start|> "channels/{}/subscriptions/{}".format(channel_id, user_id)
)
return Subscription.construct_from(response)
def get_videos(
self,
channel_id,
limit=10,
offset=0,
broadcast_type=BROADCAST_TYPE_HIG... | params = { |
Given snippet: <|code_start|>
@oauth_required
def get_subscribers(self, channel_id, limit=25, offset=0, direction=DIRECTION_ASC):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
if direction not ... | language=None, |
Predict the next line after this snippet: <|code_start|> "Sort is not valid. Valid values are {}".format(VIDEO_SORTS)
)
params = {
"limit": limit,
"offset": offset,
"broadcast_type": broadcast_type,
"sort": sort,
}
if la... | response = self._request_get("channels/{}/community".format(channel_id)) |
Given snippet: <|code_start|> return [User.construct_from(x) for x in response["users"]]
def get_followers(
self, channel_id, limit=25, offset=0, cursor=None, direction=DIRECTION_DESC
):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of object... | "Maximum number of objects returned in one request is 100" |
Based on the snippet: <|code_start|> )
if broadcast_type not in BROADCAST_TYPES:
raise TwitchAttributeException(
"Broadcast type is not valid. Valid values are {}".format(
BROADCAST_TYPES
)
)
if sort not in VIDEO_SO... | response = self._request_post( |
Given snippet: <|code_start|>
class Channels(TwitchAPI):
@oauth_required
def get(self):
response = self._request_get("channel")
return Channel.construct_from(response)
def get_by_id(self, channel_id):
response = self._request_get("channels/{}".format(channel_id))
return Cha... | data["game"] = game |
Continue the code snippet: <|code_start|> return Subscription.construct_from(response)
def get_videos(
self,
channel_id,
limit=10,
offset=0,
broadcast_type=BROADCAST_TYPE_HIGHLIGHT,
language=None,
sort=VIDEO_SORT_TIME,
):
if limit > 100:
... | "offset": offset, |
Given snippet: <|code_start|> raise TwitchAttributeException(
"Broadcast type is not valid. Valid values are {}".format(
BROADCAST_TYPES
)
)
if sort not in VIDEO_SORTS:
raise TwitchAttributeException(
"Sort i... | return response |
Given the following code snippet before the placeholder: <|code_start|>
class Channels(TwitchAPI):
@oauth_required
def get(self):
response = self._request_get("channel")
return Channel.construct_from(response)
def get_by_id(self, channel_id):
response = self._request_get("channels/... | data["channel_feed_enabled"] = channel_feed_enabled |
Given snippet: <|code_start|>
def get_videos(
self,
channel_id,
limit=10,
offset=0,
broadcast_type=BROADCAST_TYPE_HIGHLIGHT,
language=None,
sort=VIDEO_SORT_TIME,
):
if limit > 100:
raise TwitchAttributeException(
"Maximu... | "broadcast_type": broadcast_type, |
Using the snippet: <|code_start|> client = TwitchClient("client id")
videos = client.videos.get_top()
assert len(responses.calls) == 1
assert len(videos) == 1
assert isinstance(videos[0], Video)
video = videos[0]
assert isinstance(video, Video)
assert video.id == example_video_response[... | body=json.dumps(example_followed_response), |
Given the code snippet: <|code_start|>
example_video_response = {
"_id": "v106400740",
"description": "Protect your chat with AutoMod!",
"fps": {"1080p": 23.9767661758746},
}
<|code_end|>
, generate the next line using the imports in this file:
import json
import pytest
import responses
from twitch.clie... | example_top_response = {"vods": [example_video_response]} |
Predict the next line after this snippet: <|code_start|> content_type="application/json",
)
client = TwitchClient("client id", "oauth token")
videos = client.videos.get_followed_videos()
assert len(responses.calls) == 1
assert len(videos) == 1
assert isinstance(videos[0], Video)
vi... | responses.add( |
Predict the next line after this snippet: <|code_start|>example_top_response = {"vods": [example_video_response]}
example_followed_response = {"videos": [example_video_response]}
example_download_vod_token_response = {"sig": "sig", "token": "token"}
@responses.activate
def test_get_by_id():
video_id = "v1064007... | def test_get_top(): |
Given snippet: <|code_start|> "description": "Protect your chat with AutoMod!",
"fps": {"1080p": 23.9767661758746},
}
example_top_response = {"vods": [example_video_response]}
example_followed_response = {"videos": [example_video_response]}
example_download_vod_token_response = {"sig": "sig", "token": "token"... | assert video.fps["1080p"] == example_video_response["fps"]["1080p"] |
Given snippet: <|code_start|>
class Teams(TwitchAPI):
def get(self, team_name):
response = self._request_get("teams/{}".format(team_name))
return Team.construct_from(response)
def get_all(self, limit=10, offset=0):
if limit > 100:
raise TwitchAttributeException(
... | ) |
Here is a snippet: <|code_start|>
class Teams(TwitchAPI):
def get(self, team_name):
response = self._request_get("teams/{}".format(team_name))
return Team.construct_from(response)
def get_all(self, limit=10, offset=0):
if limit > 100:
raise TwitchAttributeException(
... | ) |
Given snippet: <|code_start|>
class Teams(TwitchAPI):
def get(self, team_name):
response = self._request_get("teams/{}".format(team_name))
return Team.construct_from(response)
def get_all(self, limit=10, offset=0):
if limit > 100:
raise TwitchAttributeException(
... | response = self._request_get("teams", params=params) |
Predict the next line for this snippet: <|code_start|> )
params = {"limit": limit, "cursor": cursor}
response = self._request_get(
"communities/{}/bans".format(community_id), params=params
)
return [User.construct_from(x) for x in response["banned_users"]]
@o... | def create_cover_image(self, community_id, cover_image): |
Based on the snippet: <|code_start|> "cover_image": cover_image,
}
self._request_post(
"communities/{}/images/cover".format(community_id), data=data
)
@oauth_required
def delete_cover_image(self, community_id):
self._request_delete("communities/{}/images/c... | def report_violation(self, community_id, channel_id): |
Given snippet: <|code_start|>
def get_by_id(self, community_id):
response = self._request_get("communities/{}".format(community_id))
return Community.construct_from(response)
def update(
self, community_id, summary=None, description=None, rules=None, email=None
):
data = {
... | ) |
Given snippet: <|code_start|> def get_moderators(self, community_id):
response = self._request_get("communities/{}/moderators".format(community_id))
return [User.construct_from(x) for x in response["moderators"]]
@oauth_required
def add_moderator(self, community_id, user_id):
self._r... | if limit > 100: |
Given the following code snippet before the placeholder: <|code_start|> self._request_put("communities/{}".format(community_id), data=data)
def get_top(self, limit=10, cursor=None):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one... | self._request_delete("communities/{}/bans/{}".format(community_id, user_id)) |
Given the following code snippet before the placeholder: <|code_start|>
class Games(TwitchAPI):
def get_top(self, limit=10, offset=0):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
<|code_end|>
, predict the next line ... | ) |
Predict the next line after this snippet: <|code_start|>
class Games(TwitchAPI):
def get_top(self, limit=10, offset=0):
if limit > 100:
raise TwitchAttributeException(
<|code_end|>
using the current file's imports:
from twitch.api.base import TwitchAPI
from twitch.exceptions import TwitchAttr... | "Maximum number of objects returned in one request is 100" |
Based on the snippet: <|code_start|>
class Games(TwitchAPI):
def get_top(self, limit=10, offset=0):
if limit > 100:
raise TwitchAttributeException(
<|code_end|>
, predict the immediate next line with the help of imports:
from twitch.api.base import TwitchAPI
from twitch.exceptions import Twitc... | "Maximum number of objects returned in one request is 100" |
Given the following code snippet before the placeholder: <|code_start|>
class Search(TwitchAPI):
def channels(self, query, limit=25, offset=0):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
param... | params = { |
Here is a snippet: <|code_start|>
class Search(TwitchAPI):
def channels(self, query, limit=25, offset=0):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
<|code_end|>
. Write the next line using the current file imports:... | ) |
Given the code snippet: <|code_start|>
class Search(TwitchAPI):
def channels(self, query, limit=25, offset=0):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
params = {"query": query, "limit": lim... | if limit > 100: |
Given snippet: <|code_start|>
class Search(TwitchAPI):
def channels(self, query, limit=25, offset=0):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
params = {"query": query, "limit": limit, "offs... | "live": live, |
Using the snippet: <|code_start|>
class Search(TwitchAPI):
def channels(self, query, limit=25, offset=0):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
params = {"query": query, "limit": limit, "... | "live": live, |
Based on the snippet: <|code_start|>}
example_block = {
"_id": 34105660,
"updated_at": "2016-12-15T18:58:11Z",
"user": example_user,
}
@responses.activate
def test_get():
responses.add(
responses.GET,
"{}user".format(BASE_URL),
body=json.dumps(example_user),
status=200... | def test_get_by_id(): |
Using the snippet: <|code_start|>def test_get_by_id():
user_id = 1234
responses.add(
responses.GET,
"{}users/{}".format(BASE_URL, user_id),
body=json.dumps(example_user),
status=200,
content_type="application/json",
)
client = TwitchClient("client id")
user ... | ) |
Continue the code snippet: <|code_start|> client = TwitchClient("client id")
follows = client.users.get_all_follows(
user_id, direction="desc", sort_by="last_broadcast"
)
assert len(responses.calls) == 2
assert len(follows) == 2
follow = follows[0]
assert isinstance(follow, Follow)
... | responses.GET, |
Predict the next line after this snippet: <|code_start|>
example_user = {
"_id": "44322889",
"name": "dallas",
}
example_channel = {
"_id": 121059319,
"name": "moonmoon_ow",
}
example_follow = {
"created_at": "2016-09-16T20:37:39Z",
"notifications": False,
"channel": example_channel,
}
... | @responses.activate |
Continue the code snippet: <|code_start|> channel_id = 12345
response = {
"_id": "c660cb408bc3b542f5bdbba52f3e638e652756b4",
"created_at": "2016-12-12T15:52:52Z",
"channel": example_channel,
}
responses.add(
responses.GET,
"{}users/{}/subscriptions/{}".format(BASE_... | responses.add( |
Continue the code snippet: <|code_start|> assert len(responses.calls) == 1
assert isinstance(follow, Follow)
assert follow.notifications == example_follow["notifications"]
assert isinstance(follow.channel, Channel)
assert follow.channel.id == example_channel["_id"]
assert follow.channel.name == e... | responses.add( |
Predict the next line after this snippet: <|code_start|> assert len(responses.calls) == 1
assert len(follows) == 1
follow = follows[0]
assert isinstance(follow, Follow)
assert follow.notifications == example_follow["notifications"]
assert isinstance(follow.channel, Channel)
assert follow.chan... | status=200, |
Predict the next line for this snippet: <|code_start|> assert subscription.channel.name == example_channel["name"]
@responses.activate
def test_get_follows():
user_id = 1234
response = {"_total": 27, "follows": [example_follow]}
responses.add(
responses.GET,
"{}users/{}/follows/channels... | @pytest.mark.parametrize( |
Next line prediction: <|code_start|>
class Collections(TwitchAPI):
def get_metadata(self, collection_id):
response = self._request_get("collections/{}".format(collection_id))
return Collection.construct_from(response)
<|code_end|>
. Use current file imports:
(from twitch.api.base import TwitchAPI... | def get(self, collection_id, include_all_items=False): |
Predict the next line for this snippet: <|code_start|>
class Collections(TwitchAPI):
def get_metadata(self, collection_id):
response = self._request_get("collections/{}".format(collection_id))
return Collection.construct_from(response)
def get(self, collection_id, include_all_items=False):
... | params["containing_item"] = containing_item |
Based on the snippet: <|code_start|> return [Item.construct_from(x) for x in response["items"]]
def get_by_channel(self, channel_id, limit=10, cursor=None, containing_item=None):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one re... | } |
Predict the next line after this snippet: <|code_start|>
class Collections(TwitchAPI):
def get_metadata(self, collection_id):
response = self._request_get("collections/{}".format(collection_id))
return Collection.construct_from(response)
def get(self, collection_id, include_all_items=False):
... | response = self._request_get("channels/{}/collections".format(channel_id)) |
Given the code snippet: <|code_start|>
class Collections(TwitchAPI):
def get_metadata(self, collection_id):
response = self._request_get("collections/{}".format(collection_id))
return Collection.construct_from(response)
def get(self, collection_id, include_all_items=False):
params = {"... | "cursor": cursor, |
Given the following code snippet before the placeholder: <|code_start|>
class Chat(TwitchAPI):
def get_badges_by_channel(self, channel_id):
response = self._request_get("chat/{}/badges".format(channel_id))
return response
def get_emoticons_by_set(self, emotesets=None):
params = {
<|cod... | "emotesets": emotesets, |
Continue the code snippet: <|code_start|> trending=False,
):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
if period not in PERIODS:
raise TwitchAttributeException(
... | ) |
Given the following code snippet before the placeholder: <|code_start|> game=None,
language=None,
limit=10,
period="week",
trending=False,
):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request ... | def followed(self, limit=10, cursor=None, trending=False): |
Next line prediction: <|code_start|> def get_by_slug(self, slug):
response = self._request_get("clips/{}".format(slug))
return Clip.construct_from(response)
def get_top(
self,
channel=None,
cursor=None,
game=None,
language=None,
limit=10,
p... | "period": period, |
Here is a snippet: <|code_start|> if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
if period not in PERIODS:
raise TwitchAttributeException(
"Period is not valid. Valid values ... | params = {"limit": limit, "cursor": cursor, "trending": trending} |
Given the code snippet: <|code_start|> if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
if period not in PERIODS:
raise TwitchAttributeException(
"Period is not valid. Valid va... | params = {"limit": limit, "cursor": cursor, "trending": trending} |
Given the code snippet: <|code_start|>def test_convert_to_twitch_object_output_returns_list_for_list_input():
data = ["squarepants", "patrick", "star"]
result = convert_to_twitch_object("spongebob", data)
assert isinstance(result, list)
def test_convert_to_twitch_object_output_returns_list_of_objects_for_... | assert isinstance(result, expected_type) |
Given the code snippet: <|code_start|> assert obj.spongebob == value
del obj.spongebob
assert "spongebob" not in obj
assert "spongebob" not in obj.__dict__
def test_prefixed_attributes_are_stored_on_the_object(self):
obj = TwitchObject()
value = "spongebob"
... | def test_setitem_removes_underscore_prefix(self): |
Using the snippet: <|code_start|> assert "_spongebob" not in obj
assert "_spongebob" in obj.__dict__
assert obj._spongebob == value
del obj._spongebob
assert "spongebob" not in obj
assert "spongebob" not in obj.__dict__
def test_setitem_sets_item_to_dict(self):
... | obj.refresh_from({"spongebob": "squarepants", "patrick": "star", "_id": 1234}) |
Based on the snippet: <|code_start|>
del obj._spongebob
assert "spongebob" not in obj
assert "spongebob" not in obj.__dict__
def test_setitem_sets_item_to_dict(self):
obj = TwitchObject()
value = "squarepants"
obj["spongebob"] = value
assert obj["spongebob"]... | assert obj["patrick"] == "star" |
Next line prediction: <|code_start|>def test_convert_to_twitch_object_output_returns_string_for_string_input():
data = "squarepants"
result = convert_to_twitch_object("spongebob", data)
assert result == data
def test_convert_to_twitch_object_output_returns_list_for_list_input():
data = ["squarepants",... | ], |
Given snippet: <|code_start|> assert "spongebob" not in obj.__dict__
def test_prefixed_attributes_are_stored_on_the_object(self):
obj = TwitchObject()
value = "spongebob"
obj._spongebob = value
obj._spongebob
getattr(obj, "_spongebob")
assert "spongebob" not ... | assert "_spongebob" not in obj |
Given the following code snippet before the placeholder: <|code_start|> "name,data,expected_type",
[
("channel", {"spongebob": "squarepants"}, Channel),
("videos", {"spongebob": "squarepants"}, Video),
("user", {"spongebob": "squarepants"}, User),
("game", {"spongebob": "squarepan... | ], |
Predict the next line after this snippet: <|code_start|> name, data, expected_type
):
result = convert_to_twitch_object(name, data)
assert isinstance(result, expected_type)
assert result == data
@pytest.mark.parametrize(
"name,data,expected",
[
("created_at", "2016-11-29T15:52:27Z", dat... | value = "spongebob" |
Based on the snippet: <|code_start|>def test_datetimes_are_converted_correctly_to_datetime_objects(name, data, expected):
result = convert_to_twitch_object(name, data)
if result is not None:
assert isinstance(result, datetime)
assert result == expected
class TestTwitchObject(object):
def test_... | getattr(obj, "_spongebob") |
Next line prediction: <|code_start|> (
"updated_at",
"2017-03-06T18:40:51.855Z",
datetime(2017, 3, 6, 18, 40, 51, 855000),
),
("published_at", "2017-02-14T22:27:54Z", datetime(2017, 2, 14, 22, 27, 54)),
("published_at", None, None),
],
)
def test_da... | assert "spongebob" not in obj |
Given the following code snippet before the placeholder: <|code_start|>
def test_convert_to_twitch_object_output_returns_string_for_string_input():
data = "squarepants"
result = convert_to_twitch_object("spongebob", data)
<|code_end|>
, predict the next line using imports from the current file:
from datetim... | assert result == data |
Based on the snippet: <|code_start|> assert isinstance(result, datetime)
assert result == expected
class TestTwitchObject(object):
def test_attributes_are_stored_and_fetched_from_dict(self):
obj = TwitchObject()
value = "spongebob"
obj.spongebob = value
assert "spongebo... | assert "_spongebob" in obj.__dict__ |
Based on the snippet: <|code_start|>def test_convert_to_twitch_object_output_returns_list_for_list_input():
data = ["squarepants", "patrick", "star"]
result = convert_to_twitch_object("spongebob", data)
assert isinstance(result, list)
def test_convert_to_twitch_object_output_returns_list_of_objects_for_li... | assert isinstance(result, expected_type) |
Given snippet: <|code_start|> "name,data,expected_type",
[
("channel", {"spongebob": "squarepants"}, Channel),
("videos", {"spongebob": "squarepants"}, Video),
("user", {"spongebob": "squarepants"}, User),
("game", {"spongebob": "squarepants"}, Game),
("stream", {"spongebo... | ], |
Given the following code snippet before the placeholder: <|code_start|> (
"updated_at",
"2017-03-06T18:40:51.855Z",
datetime(2017, 3, 6, 18, 40, 51, 855000),
),
("published_at", "2017-02-14T22:27:54Z", datetime(2017, 2, 14, 22, 27, 54)),
("published_at"... | assert "spongebob" not in obj |
Using the snippet: <|code_start|>@pytest.mark.parametrize(
"name,data,expected_type",
[
("channel", {"spongebob": "squarepants"}, Channel),
("videos", {"spongebob": "squarepants"}, Video),
("user", {"spongebob": "squarepants"}, User),
("game", {"spongebob": "squarepants"}, Game),... | ("published_at", None, None), |
Next line prediction: <|code_start|>def test_datetimes_are_converted_correctly_to_datetime_objects(name, data, expected):
result = convert_to_twitch_object(name, data)
if result is not None:
assert isinstance(result, datetime)
assert result == expected
class TestTwitchObject(object):
def test_... | getattr(obj, "_spongebob") |
Given the code snippet: <|code_start|>
example_response = {"ingests": [{"_id": 24, "name": "EU: Amsterdam, NL"}]}
@responses.activate
def test_get_top():
responses.add(
responses.GET,
"{}ingests".format(BASE_URL),
body=json.dumps(example_response),
status=200,
content_typ... | assert ingest.id == example_response["ingests"][0]["_id"] |
Based on the snippet: <|code_start|>
example_response = {"ingests": [{"_id": 24, "name": "EU: Amsterdam, NL"}]}
@responses.activate
def test_get_top():
responses.add(
responses.GET,
"{}ingests".format(BASE_URL),
body=json.dumps(example_response),
status=200,
<|code_end|>
, predic... | content_type="application/json", |
Given snippet: <|code_start|> kwargs = {param: value}
with pytest.raises(TwitchAttributeException):
client.search.channels("mah query", **kwargs)
@responses.activate
def test_channels_does_not_raise_if_no_channels_were_found():
response = {"channels": None}
responses.add(
responses.GET,... | body=json.dumps(response), |
Continue the code snippet: <|code_start|>def test_channels_raises_if_wrong_params_are_passed_in(param, value):
client = TwitchClient("client id")
kwargs = {param: value}
with pytest.raises(TwitchAttributeException):
client.search.channels("mah query", **kwargs)
@responses.activate
def test_channel... | responses.GET, |
Continue the code snippet: <|code_start|> content_type="application/json",
)
client = TwitchClient("client id")
channels = client.search.channels("mah bad query")
assert len(responses.calls) == 1
assert len(channels) == 0
@responses.activate
def test_games():
response = {"_total": 21... | assert game.id == example_game["_id"] |
Given the following code snippet before the placeholder: <|code_start|> client = TwitchClient("client id")
channels = client.search.channels("mah query")
assert len(responses.calls) == 1
assert len(channels) == 1
channel = channels[0]
assert isinstance(channel, Channel)
assert channel.id ==... | ) |
Predict the next line for this snippet: <|code_start|> "game": "BATMAN - The Telltale Series",
"channel": example_channel,
}
@responses.activate
def test_channels():
response = {"_total": 2147, "channels": [example_channel]}
responses.add(
responses.GET,
"{}search/channels".format(BASE_... | def test_channels_raises_if_wrong_params_are_passed_in(param, value): |
Given the code snippet: <|code_start|> assert stream.id == example_stream["_id"]
assert stream.game == example_stream["game"]
assert isinstance(stream.channel, Channel)
assert stream.channel.id == example_channel["_id"]
assert stream.channel.name == example_channel["name"]
@responses.activate
@pyt... | streams = client.search.streams("mah bad query") |
Next line prediction: <|code_start|> content_type="application/octet-stream",
)
api = TwitchAPI(client_id="client")
response = api._request_get("", json=False)
assert response.content == b"binary"
@responses.activate
@pytest.mark.parametrize("status", [(500), (400)])
def test_request_get_rais... | responses.PUT, |
Here is a snippet: <|code_start|> )
api = TwitchAPI(client_id="client")
response = api._request_delete("")
assert response == dummy_data
@responses.activate
def test_request_delete_sends_headers_with_the_request():
responses.add(
responses.DELETE, BASE_URL, status=204, content_type="applic... | api._request_delete("") |
Given the code snippet: <|code_start|>
def _get_config():
config = ConfigParser()
config.read(os.path.expanduser(CONFIG_FILE_PATH))
return config
def credentials_from_config_file():
client_id = None
oauth_token = None
config = _get_config()
if "Credentials" in config.sections():
... | config = _get_config() |
Based on the snippet: <|code_start|>class Videos(TwitchAPI):
def get_by_id(self, video_id):
response = self._request_get("videos/{}".format(video_id))
return Video.construct_from(response)
def get_top(
self,
limit=10,
offset=0,
game=None,
period=PERIOD_WE... | "limit": limit, |
Here is a snippet: <|code_start|> if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
if period not in PERIODS:
raise TwitchAttributeException(
"Period is not valid. Valid values a... | ): |
Using the snippet: <|code_start|>
class Videos(TwitchAPI):
def get_by_id(self, video_id):
response = self._request_get("videos/{}".format(video_id))
return Video.construct_from(response)
def get_top(
self,
limit=10,
offset=0,
game=None,
period=PERIOD_WEE... | "Maximum number of objects returned in one request is 100" |
Given snippet: <|code_start|>
class Videos(TwitchAPI):
def get_by_id(self, video_id):
response = self._request_get("videos/{}".format(video_id))
return Video.construct_from(response)
def get_top(
self,
limit=10,
offset=0,
game=None,
period=PERIOD_WEEK,
... | ): |
Using the snippet: <|code_start|>
class Videos(TwitchAPI):
def get_by_id(self, video_id):
response = self._request_get("videos/{}".format(video_id))
return Video.construct_from(response)
def get_top(
self,
limit=10,
offset=0,
game=None,
period=PERIOD_WEE... | ) |
Given the code snippet: <|code_start|>
class Videos(TwitchAPI):
def get_by_id(self, video_id):
response = self._request_get("videos/{}".format(video_id))
return Video.construct_from(response)
def get_top(
self,
<|code_end|>
, generate the next line using the imports in this file:
from... | limit=10, |
Based on the snippet: <|code_start|> raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
if period not in PERIODS:
raise TwitchAttributeException(
"Period is not valid. Valid values are {}".format(PERIODS... | if limit > 100: |
Next line prediction: <|code_start|> def get_by_id(self, video_id):
response = self._request_get("videos/{}".format(video_id))
return Video.construct_from(response)
def get_top(
self,
limit=10,
offset=0,
game=None,
period=PERIOD_WEEK,
broadcast_typ... | "offset": offset, |
Given the following code snippet before the placeholder: <|code_start|>
class Videos(TwitchAPI):
def get_by_id(self, video_id):
response = self._request_get("videos/{}".format(video_id))
return Video.construct_from(response)
def get_top(
self,
limit=10,
offset=0,
... | "Broadcast type is not valid. Valid values are {}".format( |
Given the following code snippet before the placeholder: <|code_start|>
class Streams(TwitchAPI):
def get_stream_by_user(self, channel_id, stream_type=STREAM_TYPE_LIVE):
if stream_type not in STREAM_TYPES:
raise TwitchAttributeException(
"Stream type is not valid. Valid values a... | } |
Given the code snippet: <|code_start|>
class Streams(TwitchAPI):
def get_stream_by_user(self, channel_id, stream_type=STREAM_TYPE_LIVE):
if stream_type not in STREAM_TYPES:
raise TwitchAttributeException(
"Stream type is not valid. Valid values are {}".format(STREAM_TYPES)
... | channel=None, |
Next line prediction: <|code_start|>
class Streams(TwitchAPI):
def get_stream_by_user(self, channel_id, stream_type=STREAM_TYPE_LIVE):
if stream_type not in STREAM_TYPES:
raise TwitchAttributeException(
"Stream type is not valid. Valid values are {}".format(STREAM_TYPES)
... | "Maximum number of objects returned in one request is 100" |
Predict the next line after this snippet: <|code_start|> offset=0,
):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
params = {"stream_type": stream_type, "limit": limit, "offset": offset}
... | params = {"limit": limit, "offset": offset} |
Predict the next line for this snippet: <|code_start|>
params = {
"stream_type": stream_type,
}
response = self._request_get("streams/{}".format(channel_id), params=params)
if not response["stream"]:
return None
return Stream.construct_from(response["stre... | params["language"] = language |
Using the snippet: <|code_start|>
class Streams(TwitchAPI):
def get_stream_by_user(self, channel_id, stream_type=STREAM_TYPE_LIVE):
if stream_type not in STREAM_TYPES:
raise TwitchAttributeException(
"Stream type is not valid. Valid values are {}".format(STREAM_TYPES)
... | limit=25, |
Here is a snippet: <|code_start|> language=None,
stream_type=STREAM_TYPE_LIVE,
limit=25,
offset=0,
):
if limit > 100:
raise TwitchAttributeException(
"Maximum number of objects returned in one request is 100"
)
params = {"stream... | "Maximum number of objects returned in one request is 100" |
Predict the next line for this snippet: <|code_start|> "name": ["--apply-changes"],
"default": False,
"switch": True,
"help": "apply {} after a successful rebase".format(CHANGES_PATCH),
},
{
"name": ["--disable-inapplicable-patches"],
"default": False,
"swi... | }, |
Given snippet: <|code_start|> # behavior control
{
"name": ["--bugzilla-id"],
"metavar": "BUG_ID",
"default": None,
"help": "do a rebase based on Upstream Release Monitoring bugzilla"
},
{
"name": ["--non-interactive"],
"default": False,
"switch": T... | "switch": True, |
Given the following code snippet before the placeholder: <|code_start|> "name": ["--srpm-builder-options"],
"default": None,
"metavar": "SRPM_BUILDER_OPTIONS",
"help": "enable arbitrary local srpm builder option(s), enclose %(metavar)s in quotes "
"to pass more than one",
... | "name": ["-D", "--define"], |
Given snippet: <|code_start|># GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Authors: Petr Hráček <phrace... | "name": ["--color"], |
Predict the next line after this snippet: <|code_start|> },
{
"name": ["--spec-hook-blacklist"],
"choices": plugin_manager.spec_hooks.get_all_plugins(),
"available_choices": plugin_manager.spec_hooks.get_supported_plugins(),
"nargs": "?",
"const": [""],
"default": ... | "default": False, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.