Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given snippet: <|code_start|># that it will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with the ...
panda_ptz_camera = PandaPTZCamera(buffer, panda_camera, camera_model)
Given snippet: <|code_start|> self.pedestrian_count = 0 self.characters = {} def buildPedestrian(self, character_name, texture, scale, hpr, pos): """Builds a Panda3D actor by using the specified model and texture""" if not character_name in self.characters: return ...
panda_pedestrian = PandaPedestrian(actor, texture, self.parent.taskMgr, joint)
Using the snippet: <|code_start|> __all__ = [ 'Employee' ] def current_date(): return timezone.now().date() <|code_end|> , determine the next line of code. You have imports: from django.conf import settings from django.db import models from django.utils import timezone from django.utils.translation import...
class Employee(ContactMixin, models.Model):
Predict the next line after this snippet: <|code_start|> urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api-token-auth/$', obtain_jwt_token), url(r'^api-token-refresh/$', refresh_jwt_token), url(r'^api-token-verify/$', verify_jwt_token), <|code_end|> using the current file's imports: from ...
url(r'^graphql/$', DRFAuthenticatedGraphQLView.as_view(graphiql=True)),
Given the code snippet: <|code_start|> class BookModelTest(TestCase): def setUp(self): self.book = mommy.make(Book) def test_string_representation(self): self.assertEqual(str(self.book), self.book.name) def test_verbose_name_plural(self): self.assertEqual(str(Book._meta.verbose...
self.holder = mommy.make(Holder)
Based on the snippet: <|code_start|> class ContactMixin(object): """ Would be used for adding contacts functionality to Employee model. """ def get_contacts(self, is_primary=False): """ Returns dict with all contacts. Example: >> obj.get_contacts() << {'email': ...
subclasses = BaseContact.__subclasses__()
Continue the code snippet: <|code_start|>x = Dense(1)(x) x = Activation('linear')(x) critic = Model(inputs=[action_input, observation_input], outputs=x) print(critic.summary()) # Set up the agent for training memory = SequentialMemory(limit=100000, window_length=1) random_process = OrnsteinUhlenbeckProcess(theta=.15, ...
client = Client(remote_base)
Continue the code snippet: <|code_start|># Derived from keras-rl # Command line parameters parser = argparse.ArgumentParser(description='Train or test neural net motor controller') parser.add_argument('--train', dest='train', action='store_true', default=True) parser.add_argument('--test', dest='train', action='...
env = Arm2DVecEnv(args.visualize)
Given snippet: <|code_start|> metadata = { 'render.modes': ['human'], 'video.frames_per_second' : None } def get_reward(self): raise NotImplementedError def is_done(self): return False def __init__(self, visualize = True, integrator_accuracy = 5e-5): self.vi...
self.action_space = convert_to_gym(self.action_space)
Using the snippet: <|code_start|> def flatten(listOfLists): "Flatten one level of nesting" return chain.from_iterable(listOfLists) <|code_end|> , determine the next line of code. You have imports: import opensim import math import numpy as np import os import random import string from itertools import chain f...
class RunEnv(OsimEnv):
Based on the snippet: <|code_start|>x = Dense(1)(x) x = Activation('linear')(x) critic = Model(inputs=[action_input, observation_input], outputs=x) print(critic.summary()) # Set up the agent for training memory = SequentialMemory(limit=100000, window_length=1) random_process = OrnsteinUhlenbeckProcess(theta=.15, mu=0....
client = Client(remote_base)
Predict the next line after this snippet: <|code_start|> def _blocking_request(self, _request): """ request: -command_type -payload -response_channel response: (on response_channel) - RESULT * Send the payloa...
if _response['type'] == messages.OSIM_RL.ERROR:
Continue the code snippet: <|code_start|> self.report = report self.max_steps = max_steps self.initalize_seed_map(seed_map) def initalize_seed_map(self, seed_map_string): if seed_map_string: assert type(seed_map_string) == type("") seed_map = seed_map_string.s...
_response['type'] = messages.OSIM_RL.ERROR
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python """ NOTE: For testing your submission scripts, you first need to ensure that redis-server is running in the background and you can locally run the grading service by running this script : https://github.com/crowdAI/osim-rl/blob/master/osim/r...
client = Client()
Using the snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestBufferover(object): @staticmethod def domain() -> str: return 'uber.com' async de...
search = bufferoverun.SearchBufferover(TestBufferover.domain())
Continue the code snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestGetLinks(object): async def test_splitter(self): results = [ 'https:/...
search = linkedinsearch.SearchLinkedin("facebook.com", '100')
Using the snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestGetLinks(object): async def test_splitter(self): results = [ 'https://www.lin...
filtered_results = await splitter(results)
Given the code snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestAnubis: @staticmethod def domain() -> str: return 'apple.com' async def test...
search = anubis.SearchAnubis(word=TestAnubis.domain())
Given the code snippet: <|code_start|> if isinstance(val, list): if len(val) == 0: # Make sure not indexing an empty list. continue val = val[0] # First value should be dict. if isinstance(val, dict): # Sanity check. ...
rawres = myparser.Parser(self.totalresults, self.word)
Here is a snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 class TestMyParser(object): @pytest.mark.asyncio async def test_emails(self): word = 'domain.com' results = '@domain.com***a@domain***banotherdomain.com***c@domain.com***d@sub.domain.com***' <|code_end|> . Write the next ...
parse = myparser.Parser(results, word)
Predict the next line after this snippet: <|code_start|> if len(parts) == 2: hostnames.add(parts[1]) rdns_new = rdns_new[:-1] if rdns_new[-1] == '.' else rdns_new hostnames.add(rdns_new) else: ...
rawres = myparser.Parser(content, self.word)
Given snippet: <|code_start|> for response in responses: self.total_results += response async def do_search_api(self): url = 'https://api.cognitive.microsoft.com/bing/v7.0/search?' params = { 'q': self.word, 'count': str(self.limit), 'offset': ...
rawres = myparser.Parser(self.total_results, self.word)
Continue the code snippet: <|code_start|> class SearchBaidu: def __init__(self, word, limit): self.word = word self.total_results = "" self.server = 'www.baidu.com' self.hostname = 'www.baidu.com' self.limit = limit self.proxy = False async def do_search(self):...
rawres = myparser.Parser(self.total_results, self.word)
Based on the snippet: <|code_start|> for response in responses: try: json_response = json.loads(response) except JSONDecodeError: # sometimes error 502 from server continue try: response_items = json_response['d...
parser = myparser.Parser(self.total_results, self.word)
Next line prediction: <|code_start|> csrftoken = '' if self.proxy is False: async with session.get(url, headers=headers) as resp: cookies = str(resp.cookies) cookies = cookies.split('csrftoken=') csrftoken += cookies[1][:...
rawres = myparser.Parser(self.totalresults, self.word)
Given the code snippet: <|code_start|> data = { "term": self.word, "buckets": [], "lookuplevel": 0, "maxresults": self.limit, "timeout": 5, "datefrom": "", "dateto": "", "sort": 2, ...
intelx_parser = intelxparser.Parser()
Given the code snippet: <|code_start|> class SearchVirustotal: def __init__(self, word): self.word = word self.results = "" self.totalresults = "" self.quantity = '100' self.counter = 0 self.proxy = False async def do_search(self): base_url = f'https://...
rawres = myparser.Parser(self.results, self.word)
Predict the next line for this snippet: <|code_start|> self.quantity = '100' self.limit = 300 self.trello_urls = [] self.hostnames = [] self.counter = 0 self.proxy = False async def do_search(self): base_url = f'https://{self.server}/search?num=300&start=xx&hl...
rawres = myparser.Parser(self.totalresults, self.word)
Given the code snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestCertspotter(object): @staticmethod def domain() -> str: return 'metasploit.com' ...
search = certspottersearch.SearchCertspoter(TestCertspotter.domain())
Next line prediction: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestOtx(object): @staticmethod def domain() -> str: return 'metasploit.com' async ...
search = otxsearch.SearchOtx(TestOtx.domain())
Based on the snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestOmnisint(object): @staticmethod def domain() -> str: return 'uber.com' @pytest...
search = omnisint.SearchOmnisint(TestOmnisint.domain())
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestThreatminer(object): @staticmethod def domain() -> str: return 't...
search = threatminer.SearchThreatminer(TestThreatminer.domain())
Given snippet: <|code_start|> self.word = word.replace(' ', '%20') self.results = "" self.totalresults = "" self.server = 'www.google.com' self.quantity = '100' self.limit = int(limit) self.counter = 0 self.proxy = False async def do_search(self): ...
rawres = myparser.Parser(self.totalresults, self.word)
Here is a snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestN45ht(object): @staticmethod def domain() -> str: return 'uber.com' async def tes...
search = n45htsearch.SearchN45ht(TestN45ht.domain())
Predict the next line for this snippet: <|code_start|> self.totalresults = "" self.server = 'www.google.com' self.quantity = '100' self.limit = int(limit) self.counter = 0 self.proxy = False async def do_search(self): base_url = f'https://{self.server}/search?...
rawres = myparser.Parser(self.totalresults, self.word)
Continue the code snippet: <|code_start|> ##################################################################### # DNS FORCE ##################################################################### class DnsForce: def __init__(self, domain, dnsserver, verbose=False): self.domain = domain self.subdo ...
checker = hostchecker.Checker(
Given snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestSearchQwant(object): @staticmethod def domain() -> str: return 'example.com' def tes...
search = qwantsearch.SearchQwant(TestSearchQwant.domain(), 0, 200)
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python3 # coding=utf-8 pytestmark = pytest.mark.asyncio github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True class TestSublist3r(object): @staticmethod def domain() -> str: return 't...
search = sublist3r.SearchSublist3r(TestSublist3r.domain())
Next line prediction: <|code_start|> if result.next_page is not None: return result.next_page else: return result.last_page async def process(self, proxy=False): self.proxy = proxy try: while self.counter <= self.limit and self.page is not None: ...
rawres = myparser.Parser(self.total_results, self.word)
Given the code snippet: <|code_start|> self.proxy = False async def authenticate(self) -> None: # Method to authenticate API key before sending requests. headers = {'APIKEY': self.key} url = f'{self.api}ping' auth_responses = await AsyncFetcher.fetch_all([url], headers=header...
parser = securitytrailsparser.Parser(word=self.word, text=self.totalresults)
Given the following code snippet before the placeholder: <|code_start|> return except Exception as e: print(e) # google blocked, no useful result return await asyncio.sleep(get_delay()) self.totalresults += self.results ...
rawres = myparser.Parser(self.totalresults, self.word)
Continue the code snippet: <|code_start|> text-align: center; display: block; } </style> </head> <body> <br/> <a href="https://github.com/laramies/theHarvester" target="_blank"> <span class="img-container"> ...
sources = __main__.Core.get_supportedengines()
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python3 # Note: This script runs theHarvester if sys.version_info.major < 3 or sys.version_info.minor < 7: print('\033[93m[!] Make sure you have Python 3.7+ installed, quitting.\n\n \033[0m') sys.exit(1) if __name__ == '__ma...
asyncio.run(__main__.entry_point())
Based on the snippet: <|code_start|> class SearchYahoo: def __init__(self, word, limit): self.word = word self.total_results = "" self.server = 'search.yahoo.com' self.limit = limit self.proxy = False async def do_search(self): base_url = f'https://{self.server...
rawres = myparser.Parser(self.total_results, self.word)
Here is a snippet: <|code_start|> class UtilsIPTestsV4(unittest.TestCase): def setUp(self): print def test_aton_with_valid_ip(self): <|code_end|> . Write the next line using the current file imports: from mock import patch from luna.utils import ip import unittest and context from other files: # ...
self.assertEqual(ip.aton('10.0.0.1'), 167772161)
Given snippet: <|code_start|> class UtilsFreelistTests(unittest.TestCase): def setUp(self): print self.flist0 = [] self.flist1 = [{'start': 1, 'end': 254}] self.flist2 = [{'start': 10, 'end': 18}, {'start': 20, 'end': 254}] self.flist3 = [{'start': 254, 'end': 254}] ...
flist, next_free = freelist.next_free(self.flist1)
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python ''' Written by Dmitry Chirikov <dmitry@chirikov.ru> This file is part of Luna, cluster provisioning tool https://github.com/dchirikov/luna This file is part of Luna. Luna is free software: you can redistribute it and/or modify it under the ...
mclient = pymongo.MongoClient(**get_con_options())
Given snippet: <|code_start|>#!/usr/bin/env python ''' Written by Dmitry Chirikov <dmitry@chirikov.ru> This file is part of Luna, cluster provisioning tool https://github.com/dchirikov/luna This file is part of Luna. Luna is free software: you can redistribute it and/or modify it under the terms of the GNU General Pu...
mdb = mclient[db_name]
Predict the next line after this snippet: <|code_start|> Luna is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Luna is distributed in the hop...
mongo_db = mongo_client[db_name]
Based on the snippet: <|code_start|> class Test(unittest.TestCase): redis_host = '127.0.0.1' # redis_port = 8379 redis_port = 6379 redis_db = 0 redis_password = '' def setUp(self): # Redis instance r = redis.StrictRedis(host=self.redis_host, port=self.redis_port, ...
self.rq = RpqQueue(r, 'test_queue')
Given the code snippet: <|code_start|> class Test(unittest.TestCase): redis_host = '127.0.0.1' # redis_port = 8379 redis_port = 6379 redis_db = 0 redis_password = '' lua_path = 'src/redis-priority-queue.lua' def setUp(self): # Redis instance self.r = redis.StrictRedis( ...
self.rl = RpqLua(self.r)
Continue the code snippet: <|code_start|>#!/usr/bin/env python3 class RpqQueue: def __init__(self, redis, queueName): """ Registers RpqLua queue from a Redis connection """ # RpqLua instance <|code_end|> . Use current file imports: from .RpqLua import RpqLua and context (c...
self.queue = RpqLua(redis)
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/python # # Copyright 2016 Pinterest, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
p = Periodical('f', 0, 0, f)
Continue the code snippet: <|code_start|># you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed ...
self.decider = Decider()
Predict the next line after this snippet: <|code_start|># You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITI...
return isinstance(exception, RetriableRPCException)
Given snippet: <|code_start|>#!/usr/bin/python # # Copyright 2016 Pinterest, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
__metaclass__ = decorators.SingletonMetaclass
Here is a snippet: <|code_start|> # Currently the polling is by default to run every 30 seconds. # The class is a singleton, we can come up a way to allow customizing # the frequency in the future if necessary. _POLLING_WAIT_IN_SECONDS = 30 def timeout_after(secs): """Decorator to timeout a function. It rai...
sc=dummy_statsd):
Here is a snippet: <|code_start|> file_content = f.read() try: self._invoke_callback( on_change, watch_type, file_content, self.Stat(version=last_update_time)) except Exception:...
watch_type, file_path_stat_name, hostname),
Based on the snippet: <|code_start|> backoff_in_secs: how much to backoff between retries. retry backoff will be exponentially backoff. max_wait_in_secs: max wait in seconds between retries. """ num_tries = 0 assert file_path assert on_change ...
file_path_stat_name = _escape_path_for_stats_name(file_path)
Next line prediction: <|code_start|> log = logging.getLogger(__name__) # Currently the polling is by default to run every 30 seconds. # The class is a singleton, we can come up a way to allow customizing # the frequency in the future if necessary. _POLLING_WAIT_IN_SECONDS = 30 def timeout_after(secs): """Deco...
__metaclass__ = SingletonMetaclass
Predict the next line for this snippet: <|code_start|> function yields, e.g. performing blocking operations through gevent. """ def timeout_enforced(f): @wraps(f) def g(*args, **kwargs): return gevent.with_timeout(secs, f, *args, **kwargs) return g return timeout_enfo...
Periodical(
Given snippet: <|code_start|># You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either exp...
__metaclass__ = SingletonMetaclass
Given the following code snippet before the placeholder: <|code_start|># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. try: except ImportError: LARGE_SERVERSET_EXAMPLE_FILE_PATH = 'kingpi...
expected_tmp_filepath = '/tmp/zk_update_largefile_' + zk_util.get_md5_digest(
Using the snippet: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for...
(transformed_command, tmp_filepath) = transform_command_with_value(
Based on the snippet: <|code_start|> is_player = True is_permanent = False is_creature = False is_land = False is_spell = False def __init__(self, deck, name='player', startingLife=20, maxHandSize=7, game=None): self.name = name self.game = game self.time...
self.mana = mana.ManaPool(self)
Using the snippet: <|code_start|> class Player(): is_player = True is_permanent = False is_creature = False is_land = False is_spell = False def __init__(self, deck, name='player', startingLife=20, maxHandSize=7, game=None): self.name = name self.game = game ...
self.library = zone.Library(self, deck)
Given snippet: <|code_start|> elif len(color) > 1: color = self.make_choice( "What color would you like to add? {}".format(color)) assert color i...
_play = play.Play(card.play_func,
Predict the next line after this snippet: <|code_start|> self.mana.add_str('WWWWWUUUUUBBBBBRRRRRGGGGG11111') elif answer == 'debug': pdb.set_trace() pass elif answer[:2] == '__': # for dev purposes exec(ans...
gamesteps.Phase.PRECOMBAT_MAIN,
Predict the next line after this snippet: <|code_start|> """Pass player-init triggers to relevant permanents e.g. onControllerLifeGain """ if isinstance(condition, str): condition = triggers.triggerConditions[condition] if condition == triggers.triggerConditions.onUp...
card = cards.card_from_name(card)
Next line prediction: <|code_start|> return chosen def add_static_effect(self, name, value, source, toggle_func, exempt_source=False): """ toggle_func: condition func on which permanents the static effect affects -- lambda eff: True e.g. lambda eff: eff.source.is_creature applies to all cr...
condition = triggers.triggerConditions[condition]
Next line prediction: <|code_start|> if not answer: # '' to auto discard print("Auto discarding\n") else: answer = answer.split(" ") try: for ind in answer: ind = int(ind) if ind ...
token.create_token(attributes, self, num, keyword_abilities, activated_abilities)
Here is a snippet: <|code_start|> self.is_attacking = [] self.is_blocking = [] self.counters = defaultdict(lambda: 0) class Effect(): """ name: name of effct (dict key to self.effects) expiration: either a float representing timestamp (usually eot), or a function (lam...
class Permanent(gameobject.GameObject):
Given the following code snippet before the placeholder: <|code_start|> class Effect(): """ name: name of effct (dict key to self.effects) expiration: either a float representing timestamp (usually eot), or a function (lambda eff: ...) that when evaluated to True signals expiration toggle_...
self.zone = self.controller.battlefield
Predict the next line after this snippet: <|code_start|> if card.static_effects == []: card.static_effects = [] card.static_effects.append((apply_to, name, value, toggle_func)) def indentation_lv(s): """ Must be tab indented """ lv = 0 for i in s: if i == '\t': lv += ...
abilities = []
Predict the next line after this snippet: <|code_start|> def add_aura_effect(cardname, effects, target_criterias=['creature']): add_targets(cardname, target_criterias) add_play_func_with_targets(cardname, lambda self, targets, l: permanent.make_aura(self, targets[0])) # add aura enchant effects card = ...
if card.triggers == {}:
Based on the snippet: <|code_start|> 10 Oreskos Swiftclaw """ with open(filename, 'r') as f: file = f.read().split("\n") deck = [] for line in file: try: i = line.index(" ") num = int(line[:i]) for j in range(num): # add NU...
costs = utils.parse_ability_costs(cost)
Given the code snippet: <|code_start|> if not name_to_id(cardname): return card = card_from_name(cardname, get_instance=False) def play_func(self): legality = self.target_legality() if any(legality): outcome(self, self.targets_chosen, legality) if not self.is_...
add_play_func_with_targets(cardname, lambda self, targets, l: permanent.make_aura(self, targets[0]))
Using the snippet: <|code_start|> class c383180(card.Card): "Ajani Steadfast" def __init__(self): <|code_end|> , determine the next line of code. You have imports: from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import mana and context (class ...
super(c383180, self).__init__(gameobject.Characteristics(**{'mana_cost': '3W', 'text': '+1: Until end of turn, up to one target creature gets +1/+1 and gains first strike, vigilance, and lifelink.\n−2: Put a +1/+1 counter on each creature you control and a loyalty counter on each other planeswalker you control....
Here is a snippet: <|code_start|> class c383180(card.Card): "Ajani Steadfast" def __init__(self): <|code_end|> . Write the next line using the current file imports: from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import mana and context from o...
super(c383180, self).__init__(gameobject.Characteristics(**{'mana_cost': '3W', 'text': '+1: Until end of turn, up to one target creature gets +1/+1 and gains first strike, vigilance, and lifelink.\n−2: Put a +1/+1 counter on each creature you control and a loyalty counter on each other planeswalker you control....
Next line prediction: <|code_start|> class c383180(card.Card): "Ajani Steadfast" def __init__(self): <|code_end|> . Use current file imports: (from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import mana) and context including class names, func...
super(c383180, self).__init__(gameobject.Characteristics(**{'mana_cost': '3W', 'text': '+1: Until end of turn, up to one target creature gets +1/+1 and gains first strike, vigilance, and lifelink.\n−2: Put a +1/+1 counter on each creature you control and a loyalty counter on each other planeswalker you control....
Here is a snippet: <|code_start|> def can_activate(self): """ choose targets, pays ability's costs, attempt to activate """ cost = self.cost _card = self.card targets_chosen = self.choose_targets() return targets_chosen and (lambda self: eval(cost))(_card) class TriggeredA...
return play.Play(lambda: self.resolve(),
Next line prediction: <|code_start|> ID = 'c' + str(card["multiverseid"]) else: continue # ID = 'c' + str(card["id"]) name = card["name"] characteristics = {'name': name} characteristics['text'] = card["text"] if "text" in ca...
for ability in static_abilities.StaticAbilities._member_names_:
Given the following code snippet before the placeholder: <|code_start|> p, t = map(int, pt.split('/')) types = [cardtype.CardType.CREATURE] if 'artifact' in c_type: types.append(cardtype.CardType.ARTIFACT) c_type.remove('artifact') else: ...
characteristics = gameobject.Characteristics(name='Token: %s' % name,
Given snippet: <|code_start|> p, t = None, None color, *c_type = attributes.split(' ') types = [cardtype.CardType[c_type.pop().upper()]] color = {'colorless': 'C', 'white': 'W', 'blue': 'U', 'black': 'B', 're...
abilities=[static_abilities.StaticAbilities[a] for a in keyword_abilities])
Given snippet: <|code_start|> class c270446(card.Card): "Sphinx of the Steel Wind" def __init__(self): <|code_end|> , continue by predicting the next line. Consider current file imports: from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import ma...
super(c270446, self).__init__(gameobject.Characteristics(**{'name': 'Sphinx of the Steel Wind', 'text': 'Flying, first strike, vigilance, lifelink, protection from red and from green', 'color': ['W', 'U', 'B'], 'mana_cost': '5WUB', 'power': 6, 'toughness': 6, 'subtype': ['Sphinx']}, supertype=[], types=[cardtyp...
Given the code snippet: <|code_start|> class c270446(card.Card): "Sphinx of the Steel Wind" def __init__(self): <|code_end|> , generate the next line using the imports in this file: from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import mana a...
super(c270446, self).__init__(gameobject.Characteristics(**{'name': 'Sphinx of the Steel Wind', 'text': 'Flying, first strike, vigilance, lifelink, protection from red and from green', 'color': ['W', 'U', 'B'], 'mana_cost': '5WUB', 'power': 6, 'toughness': 6, 'subtype': ['Sphinx']}, supertype=[], types=[cardtyp...
Given snippet: <|code_start|> class c270446(card.Card): "Sphinx of the Steel Wind" def __init__(self): <|code_end|> , continue by predicting the next line. Consider current file imports: from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import ma...
super(c270446, self).__init__(gameobject.Characteristics(**{'name': 'Sphinx of the Steel Wind', 'text': 'Flying, first strike, vigilance, lifelink, protection from red and from green', 'color': ['W', 'U', 'B'], 'mana_cost': '5WUB', 'power': 6, 'toughness': 6, 'subtype': ['Sphinx']}, supertype=[], types=[cardtyp...
Given the following code snippet before the placeholder: <|code_start|># from copy import deepcopy # test cases will fail if this is run # inside setUpClass, b/c cards get set up multiple times cards.setup_cards() class TestGameBase(unittest.TestCase): @classmethod def setUpClass(cls): cls.f = open('...
self.GAME = game.Game(decks, test=True)
Predict the next line after this snippet: <|code_start|> with mock.patch('builtins.input', side_effect=[ '__self.discard(-1)', '__self.add_card_to_hand("Devouring Deep")', '', '', '', '', '__self.mana.add(mana.Mana.BLUE, 3)', 'p Devo...
@mock.patch.object(permanent.Permanent, 'take_damage')
Given snippet: <|code_start|> class c27255(card.Card): "Lightning Bolt" def __init__(self): <|code_end|> , continue by predicting the next line. Consider current file imports: from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import mana and con...
super(c27255, self).__init__(gameobject.Characteristics(**{'text': 'Lightning Bolt deals 3 damage to target creature or player.', 'mana_cost': 'R', 'name': 'Lightning Bolt', 'color': ['R']}, supertype=[], types=[cardtype.CardType.INSTANT], abilities=[]))
Given snippet: <|code_start|> class c27255(card.Card): "Lightning Bolt" def __init__(self): <|code_end|> , continue by predicting the next line. Consider current file imports: from MTG import card from MTG import gameobject from MTG import cardtype from MTG import static_abilities from MTG import mana and con...
super(c27255, self).__init__(gameobject.Characteristics(**{'text': 'Lightning Bolt deals 3 damage to target creature or player.', 'mana_cost': 'R', 'name': 'Lightning Bolt', 'color': ['R']}, supertype=[], types=[cardtype.CardType.INSTANT], abilities=[]))
Given snippet: <|code_start|> super(c221309, self).__init__(gameobject.Characteristics(**{'text': 'W', 'mana_cost': '', 'name': 'Plains', 'color': [], 'subtype': ['Plains']}, supertype=[cardtype.SuperType.BASIC], types=[cardtype.CardType.LAND], abilities=[])) class c221300(card.Card): "Island" def __ini...
super(c79145, self).__init__(gameobject.Characteristics(**{'power': 2, 'mana_cost': '4W', 'color': ['W'], 'text': 'Flying\nSoulshift 4 (When this creature dies, you may return target Spirit card with converted mana cost 4 or less from your graveyard to your hand.)', 'toughness': 3, 'name': 'Hundred-Talon Kami',...
Based on the snippet: <|code_start|> def is_spell(self): # TODO: what about abilities? return self.zone.zone_type == 'STACK' if self.zone else False @property def name(self): return self.characteristics.name @property def raw_manacost(self): return self.characteristi...
return cardtype.CardType.LAND in self.characteristics.types
Predict the next line after this snippet: <|code_start|> def is_artifact(self): return cardtype.CardType.ARTIFACT in self.characteristics.types @property def is_enchantment(self): return cardtype.CardType.ENCHANTMENT in self.characteristics.types @property def is_aura(self): ...
return static_abilities.StaticAbilities[ability] in self.characteristics.abilities
Predict the next line after this snippet: <|code_start|> def has_color(self, color): return color in self.characteristics.color def is_color(self, color): """ color is a list""" return color == self.characteristics.color @property def is_monocolored(self): return len(se...
targets_chosen = utils.choose_targets(self)
Predict the next line after this snippet: <|code_start|> class Attributes(): def __init__(self): # attributes goes here self.num_creatures_can_block = 1 <|code_end|> using the current file's imports: import traceback from MTG import gameobject from MTG import permanent and any relevant contex...
class Card(gameobject.GameObject):
Based on the snippet: <|code_start|> class Attributes(): def __init__(self): # attributes goes here self.num_creatures_can_block = 1 class Card(gameobject.GameObject): triggers = {} activated_abilities = [] static_effects = [] continuous_effects = '' status = None def _...
permanent.make_permanent(self)
Given the code snippet: <|code_start|># mana payment class TestManaPayment(unittest.TestCase): @classmethod def setUpClass(cls): <|code_end|> , generate the next line using the imports in this file: import mock import unittest from collections import defaultdict from MTG import mana from MTG import player ...
cls.m = mana.ManaPool()
Given snippet: <|code_start|># mana payment class TestManaPayment(unittest.TestCase): @classmethod def setUpClass(cls): cls.m = mana.ManaPool() <|code_end|> , continue by predicting the next line. Consider current file imports: import mock import unittest from collections import defaultdict from MTG...
cls.m.controller = player.Player([])
Here is a snippet: <|code_start|> class Play(gameobject.GameObject): """ Represents an ability or spell on the stack. Spells: card = original card Abilities: source = card that owns this ability """ # TODO: unify this with gameObject init (particularly with targetting) def __init__(self, a...
super().__init__(zone=controller.stack if controller else None,