Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line for this snippet: <|code_start|> self.assertEqual(expected, result) cookie = response.headers['Set-Cookie'] self.assertTrue(cookie) headers = {'Cookie': cookie} # Get our characters. response = self.fetch('/characters', headers=headers) resu...
if __name__ == '__main__':
Next line prediction: <|code_start|> sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() # Call it the first time f...
return Application(handlers, cookie_secret=settings.COOKIE_SECRET)
Predict the next line after this snippet: <|code_start|> sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() # Call...
return Application(handlers, cookie_secret=settings.COOKIE_SECRET)
Given snippet: <|code_start|> sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() # Call it the first time for test...
return Application(handlers, cookie_secret=settings.COOKIE_SECRET)
Given snippet: <|code_start|>#!/usr/bin/env python2.7 '''Test the full client access sequence. It is pretty much the anti-pattern of testing. ''' sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "s...
handlers = []
Using the snippet: <|code_start|> self.objects[o.id]['me_obj'] = o self.objects[o.id]['body'].position = o.loc.x, o.loc.y else: # This object is not in our physics scene yet self.insert_space_object(o) self.last_update = datetime.datetim...
if __name__ == "__main__":
Next line prediction: <|code_start|> def update_scene(self): '''Update the internal scene with any changes to the zone's objects. This is like get_objects() from the client, only directly grabbing from the server.''' # Get all the objects since our last update. for o in Object.objects...
me_obj.loc.x = newx
Continue the code snippet: <|code_start|># This program is distributed in the hope 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 Affero General Public License for more details. # # You should have received a...
self.charselect = CharacterSelect()
Based on the snippet: <|code_start|># pb = QPushButton("Push!") # stylesheet = ''' # QPushButton { # border: 2px solid #8f8f91; # border-radius: 6px; # background-color: qlineargradient(x1: 0, y1:...
self.loading = self.scene.addText("Loading...")
Based on the snippet: <|code_start|># border: 2px solid #8f8f91; # border-radius: 6px; # background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, # stop: 0 #f6f7fa, stop: ...
self.last_update = datetime.datetime.now()
Predict the next line for this snippet: <|code_start|> # Zone crashed, remove it from the process list. s.twiddler.removeProcessFromGroup(processgroup, zoneid) except(xmlrpclib.Fault), exc: if "STILL_RUNNING" in exc.faultString: # Process st...
if float(version) >= 0.3:
Based on the snippet: <|code_start|> return retval def start_zone(port=1300, zonename="defaultzone", instancetype="playerinstance", owner="Groxnor", processgroup='zones', autorestart=False): s = xmlrpclib.ServerProxy('http://localhost:9001') try: version = s.twiddler.getAPIVersion() except(...
else:
Based on the snippet: <|code_start|># ##### END AGPL LICENSE BLOCK ##### def _add_process(twiddlerproxy, processgroup, zoneid, settings, port): '''Adds a zone process to supervisor and does some checks to only start it if it isn't already running, and restart it if it's not.''' s = twiddlerproxy tr...
if "STILL_RUNNING" in exc.faultString:
Here is a snippet: <|code_start|># published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A ...
else:
Predict the next line for this snippet: <|code_start|> sys.path.append(".") test_db = SqliteExtDatabase(':memory:', fields={'json':'json'}) class TestCharacterZoneHandler(AsyncHTTPTestCase): def get_app(self): return Application([('/(.*)/zone', CharacterZoneHandler)], cookie_secret=settings.COOKIE_S...
with test_database(test_db, (User, Character)):
Predict the next line for this snippet: <|code_start|> mock_set_secure_cookie = Mock() with patch.object(settings, 'ADMINISTRATORS', MockAdmin): with patch.object(self.auth_handler, 'set_secure_cookie', mock_set_secure_cookie): self.auth_handler.set_admin(user) mock_...
def test_set_current_user_with_none(self):
Given the code snippet: <|code_start|> req = Mock() self.auth_handler = AuthHandler(app, req) patch('authserver.UserController').start() def test_authenticate(self): # Mock out the User object first = Mock(return_value=Mock()) MockUser = Mock() MockUser.query...
with patch.object(authserver, 'User', MockUser):
Next line prediction: <|code_start|>#!/usr/bin/env python2.7 sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() #...
class TestPingHandler(AsyncHTTPTestCase):
Based on the snippet: <|code_start|>#!/usr/bin/env python2.7 sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() #...
set_up_db()
Given the code snippet: <|code_start|>#!/usr/bin/env python2.7 sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() ...
response = self.fetch('/').body
Using the snippet: <|code_start|> sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() # Call it the first time for te...
delete_user(username, password)
Here is a snippet: <|code_start|>#!/usr/bin/env python2.7 sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() # Ca...
set_up_db()
Given snippet: <|code_start|>#!/usr/bin/env python2.7 sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all() create_all() # Call i...
expected = 'pong'
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python2.7 sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" # metadata.bind.echo = True setup_all()...
class TestPingHandler(AsyncHTTPTestCase):
Given snippet: <|code_start|># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICEN...
except ImportError:
Here is a snippet: <|code_start|> sys.path.append(".") class TestZoneScriptRunner(unittest.TestCase): def test___init__(self): zoneid = "zoneid" with patch('scriptserver.Object'): with patch.object(ZoneScriptRunner, 'load_scripts') as mock_load_scripts: zone_script_runn...
def test_load_scripts(self):
Given snippet: <|code_start|> It's mostly just used for detecting if an object is really a script or not. ''' def __init__(self, mongo_engine_object=None): self.me_obj = mongo_engine_object print "Initted with %s" % self.me_obj def create(self): '''Create this Script's ScriptedOb...
rolls = []
Predict the next line after this snippet: <|code_start|> def parse(s): result = re.search(r'^((?P<rolls>\d+)#)?(?P<dice>\d*)d(?P<sides>\d+)(?P<mod>[+-]\d+)?$', s) return (result.group('rolls') or 0, result.group('dice') or 1, result.group('sides') or 2, result.group('mod'...
class Script(object):
Here is a snippet: <|code_start|> return (result.group('rolls') or 0, result.group('dice') or 1, result.group('sides') or 2, result.group('mod') or 0) class Script(object): '''This is a placeholder class used for doing object script things. It's mostly just used for detec...
rolls, num, sides, mod = parse(dicestring)
Here is a snippet: <|code_start|># # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''CharServer A server for retrieving information about characters. For example, getting which zon...
return {'zone':'playerinstance-GhibliHills-%s' % (charname,)}
Based on the snippet: <|code_start|># # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''CharServer A server for retrieving information about characters. For example, getting which ...
return {'zone':'playerinstance-GhibliHills-%s' % (charname,)}
Using the snippet: <|code_start|># # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''CharServer A server for retrieving information about characters. For example, getting which zon...
return {'zone':'playerinstance-GhibliHills-%s' % (charname,)}
Predict the next line for this snippet: <|code_start|># # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''CharServer A server for retrieving information about characters. For examp...
return {'zone':'playerinstance-GhibliHills-%s' % (charname,)}
Continue the code snippet: <|code_start|># # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''CharServer A server for retrieving information about characters. For example, getting w...
return {'zone':'playerinstance-GhibliHills-%s' % (charname,)}
Based on the snippet: <|code_start|># # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''CharServer A server for retrieving information about characters. For example, getting which ...
return {'zone':'playerinstance-GhibliHills-%s' % (charname,)}
Predict the next line after this snippet: <|code_start|># # Copyright (C) 2011, 2012 Charles Nelson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, o...
def __init__(self):
Predict the next line after this snippet: <|code_start|> class Chicken(Script): def __init__(self, *args, **kwargs): # Overriding so people remember to do this on their scripts. super(Chicken, self).__init__(*args, **kwargs) self.idle_chat = ('BAWK', 'BUCAW', 'BUCK BUCK BUCK', 'BROOOOCK',...
obj.rot = (randrot(), randrot(), randrot())
Given the following code snippet before the placeholder: <|code_start|> # Try to ping the authserver # If connecting fails, wait longer each time retry(ping_authserver) # Since the server is up, authenticate. if login(USERNAME, PASSWORD) and COOKIES: print "authenticated" chars = get_c...
if set_status():
Next line prediction: <|code_start|># When was our last object update fetched. LASTOBJUPDATE = None class ConnectionError(exceptions.Exception): def __init__(self, param): self.param = param return def __str__(self): return repr(self.param) def retry(func, *args, **kwargs): sleepti...
class InvalidResponse(Exception):
Given the following code snippet before the placeholder: <|code_start|> zone = CURRENTZONE if character is None: character = CURRENTCHAR data = {'character': character, 'status': status} r = requests.post(''.join((zone, '/setstatus')), cookies=COOKIES, data=data) content = json_or_except...
if zone is None:
Next line prediction: <|code_start|> content = json_or_exception(r) return content # We could also query any details about the character like inventory # or money or current stats at this point # We pick a character we want to play and query the charserver for its current zone # charserver returns the zone ...
print zone
Predict the next line after this snippet: <|code_start|># A global for storing the current zone URL we're in. CURRENTZONE = "" # A global for storing the current character. CURRENTCHAR = "" # A global websocket connection for movement updates MOVEMENTWEBSOCKET = None # When was our last object update fetched. LASTOB...
print "Connecting failed:", exc
Continue the code snippet: <|code_start|> def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" setup_all() create_all() def set_user_cookie(app, request, username): r = RequestHandler(app, reque...
super(TestObjectsHandler, self).tearDown()
Next line prediction: <|code_start|># along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### sys.path.append(".") def set_up_db(): '''Connects to an in-memory SQLite database, with the purpose of emptying it and recreating it.''' metadata.bind = "s...
def setUp(self):
Predict the next line after this snippet: <|code_start|> with the purpose of emptying it and recreating it.''' metadata.bind = "sqlite:///:memory:" setup_all() create_all() def set_user_cookie(app, request, username): r = RequestHandler(app, request) r.set_secure_cookie('user', username) aut...
me.connect(self.zoneid)
Here is a snippet: <|code_start|> authcookie = r._new_cookies[0] cookiestring = authcookie.items()[0][1] request.cookies.update({'user': cookiestring}) return request class TestObjectsHandler(AsyncHTTPTestCase): def get_app(self): return Application([('/login', AuthHandler), ('/objects', Ob...
def sign_in(self):
Next line prediction: <|code_start|># GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### sys.path.append(".") def set_up_db()...
def get_app(self):
Predict the next line after this snippet: <|code_start|> Returns the zone URL for the new zone server.''' # Make sure the instance type is allowed # Make sure the name exists # Make sure owner is real zoneid = '-'.join((instance_type, name, owner)) # If it's in the datab...
serverurl = start_zone(zonename=name, instancetype=instance_type, owner=owner)
Here is a snippet: <|code_start|> self.write(self.get_url(zoneid)) except UserWarning, exc: if "timed out." in exc: raise tornado.web.HTTPError(504, exc) def get_url(self, zoneid): '''Gets the zone URL from the database based on its id. ZoneServer port...
serverurl = zone.url
Predict the next line for this snippet: <|code_start|># along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''MasterZoneServer A server providing URLs to ZoneServers. ''' NEXTCLEANUP = time.time()+(5*60) JOBS = [] logging.getLogger('connectionpool').setL...
raise tornado.web.HTTPError(504, exc)
Based on the snippet: <|code_start|> if START_ZONE_WITH == DOCKER: logs = z.logs() logging.info(logs) print(logs) for line in z.logs().split("\n"): if line.strip() == "": co...
zone.save()
Given snippet: <|code_start|> # Server is not already up if not serverurl: # Try to start a zone server if START_ZONE_WITH == SUPERVISORD: logging.info("Starting process with supervisord.") try: serverurl = start_zone(zonename=n...
status = 0
Given snippet: <|code_start|> try: serverurl = start_zone(zonename=name, instancetype=instance_type, owner=owner) except UserWarning, exc: if "Zone already exists in process list." in exc: print exc lo...
numrequests += 1
Given snippet: <|code_start|> print exc logging.info("Zone is already up.") pass else: raise elif START_ZONE_WITH == SUBPROCESS: logging.info("Starting process with subprocess....
logs = z.logs()
Continue the code snippet: <|code_start|> serverurl = zone.url try: status = requests.get(serverurl).status_code if status == 200: logging.info("Server was already up and in the db: %s" % serverurl) except (requests.ConnectionError, ...
logging.info("Starting process with docker.")
Given the code snippet: <|code_start|># GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # ##### END AGPL LICENSE BLOCK ##### '''MasterZoneServer A server providing ...
self.write(self.get_url(zoneid))
Based on the snippet: <|code_start|> self.write(self.get_url(zoneid)) except UserWarning, exc: if "timed out." in exc: raise tornado.web.HTTPError(504, exc) def get_url(self, zoneid): '''Gets the zone URL from the database based on its id. ZoneServer p...
serverurl = zone.url
Using the snippet: <|code_start|> # Check that the authed user owns that zoneid in the database. try: self.write(self.get_url(zoneid)) except UserWarning, exc: if "timed out." in exc: raise tornado.web.HTTPError(504, exc) def get_url(self, zoneid): ...
if zone:
Here is a snippet: <|code_start|> print "Starting zone %s (%s) took %f seconds and %d requests." % (zoneid, serverurl, time.time()-starttime, numrequests) # If successful, write our URL to the database and return it # Store useful information in the database. logging.info(serverurl) ...
handlers.append((r"/(.*)", ZoneHandler))
Continue the code snippet: <|code_start|> return serverurl def cleanup(self): # Every 5 minutes... global NEXTCLEANUP if NEXTCLEANUP < time.time(): NEXTCLEANUP = time.time()+(5*60) # If pid not in database # Kill the process by pid if __name__...
server.start()
Predict the next line after this snippet: <|code_start|> class ChatBot(Script): idle_chat = ["Try clicking on me.", "Maybe Right Click>Activate?"] activation = ['Nice! You activated me.'] @classmethod def create(cls): obj = Object() obj.name = "Linnea" obj.resource = 'girl' <|c...
obj.loc_x, obj.loc_y, obj.loc_z = 0, 0, 0
Next line prediction: <|code_start|> ''' def post(self): username = self.get_argument("username", "") password = self.get_argument("password", "") auth = self.authenticate(username, password) if auth: self.set_current_user(username) self.set_admin(usern...
def set_current_user(self, user):
Based on the snippet: <|code_start|> .. http:post:: /logout Creates a User in the AuthenticationServer's database. **Example request**: .. sourcecode:: http GET /logout HTTP/1.1 **Example response**: .. sourcecode:: http HTTP/1.1 200 OK ...
self.write(json.dumps(self.get_characters(self.get_current_user())))
Using the snippet: <|code_start|> def post(self): username = self.get_argument("username", "") password = self.get_argument("password", "") auth = self.authenticate(username, password) if auth: self.set_current_user(username) self.set_admin(username) ...
if user:
Given the code snippet: <|code_start|> HTTP/1.1 200 OK Set-Cookie: user="VXNlcm5hbWU=|1341639882|ec1af42349272b09f4f7ebb1be4da826500d1f6c"; expires=Mon, 06 Aug 2012 05:44:42 GMT; Path=/ Login successful. :param username: The name of the user to log in as. :param pas...
return False
Next line prediction: <|code_start|> logger = logging.getLogger(__name__) class IncidentUpdateCreateForm(forms.ModelForm): class Meta: model = IncidentUpdate fields = ['status', 'description'] class IncidentCreateForm(forms.ModelForm): class Meta: model = Incident <|code_end|> . Use ...
fields = ['name']
Given snippet: <|code_start|> i.save() f = form2.save(commit=False) f.incident = i f.user = request.user f.save() if settings.SLACK_CHANNEL and settings.SLACK_TOKEN: if len(f.description) > 50: description = f.d...
request_context.push({'form': form, 'form2': form2})
Based on the snippet: <|code_start|> logger = logging.getLogger(__name__) def send_to_slack(message, channel='engineering', username='statusbot', emoji=':statusbot:', override_debug=False): slack.api_token = settings.SLACK_TOKEN if settings.DEBUG and not override_debug: logger.info('Diverting from %s ...
logger.info('Sending to channel %s as %s: %s' % (channel, username, message))
Based on the snippet: <|code_start|> class HomeView(TemplateView): http_method_names = ['get', ] template_name = 'status/home.html' @method_decorator(public) def dispatch(self, *args, **kwargs): return super(HomeView, self).dispatch(*args, **kwargs) def get_context_data(self, **kwargs): ...
status_level = 'danger'
Given the following code snippet before the placeholder: <|code_start|> class IncidentArchiveMonthView(MonthArchiveView): make_object_list = True queryset = Incident.objects.all() date_field = 'updated' month_format = '%m' @method_decorator(public) def dispatch(self, *args, **kwargs): r...
if hasattr(settings, 'STATUS_LOGO_URL'):
Given the following code snippet before the placeholder: <|code_start|> app = Flask(__name__) app.secret_key = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') app.config['DEBUG'] = 'DEBUG' in os.environ app.wsgi_app = ProxyFix(app.wsgi_app) if 'SSLIFY' in os.environ: ...
module_name = os.path.splitext(os.path.split(filename)[1])[0]
Predict the next line after this snippet: <|code_start|> class ContentTypeManager(models.Manager): def get_queryset(self): super_ = super(ContentTypeManager, self) qs = super_.get_queryset() if not settings.PAGES_PAGE_USE_EXT_CONTENT_TYPES: return qs.filter(is_extended=False) ...
else:
Next line prediction: <|code_start|> register = template.Library() @register.simple_tag(takes_context=True) def page_video_by_id(context, oid): obj = get_page_object_by_id(context, 'video', oid) if obj is None: return None return obj @register.assignment_tag(takes_context=True) <|code_end|> . U...
def get_page_video_by_id(context, oid):
Using the snippet: <|code_start|> class PageContentInline(admin.StackedInline): model = PageContent # max_num = 1 extra = 1 class PageContentAdmin(admin.ModelAdmin): <|code_end|> , determine the next line of code. You have imports: from django.contrib import admin from pages.models import PageContent ...
list_display = ['__str__']
Predict the next line for this snippet: <|code_start|>from __future__ import unicode_literals class EvolutionsApp2TestModel(models.Model): char_field = models.CharField(max_length=10) fkey = models.ForeignKey(EvolutionsAppTestModel, on_delete=models.CASCADE, ...
int_field = models.IntegerField(default=100)
Given the code snippet: <|code_start|>from __future__ import unicode_literals django_version = django.VERSION[:2] if django_version >= (2, 0): drop_index_sql = 'DROP INDEX IF EXISTS' else: drop_index_sql = 'DROP INDEX' if django_version < (2, 0) or django_version >= (3, 1): DESC = ' DESC' else: <|cod...
DESC = 'DESC'
Given snippet: <|code_start|>from __future__ import unicode_literals MUTATIONS = [ ChangeMeta('Permission', 'unique_together', <|code_end|> , continue by predicting the next line. Consider current file imports: from django_evolution.mutations import ChangeMeta and context: # Path: django_evolution/mutations.p...
[('content_type', 'codename')]),
Given the following code snippet before the placeholder: <|code_start|>from __future__ import unicode_literals django_version = django.VERSION[:2] if django_version < (2, 0) or django_version >= (3, 1): DESC = ' DESC' else: DESC = 'DESC' <|code_end|> , predict the next line using imports from the curren...
def add_field(connection):
Given the following code snippet before the placeholder: <|code_start|>from __future__ import unicode_literals django_version = django.VERSION[:2] if django_version < (2, 0) or django_version >= (3, 1): DESC = ' DESC' else: <|code_end|> , predict the next line using imports from the current file: import djan...
DESC = 'DESC'
Given snippet: <|code_start|>from __future__ import unicode_literals django_version = django.VERSION[:2] sqlite_version = Database.sqlite_version_info[:2] <|code_end|> , continue by predicting the next line. Consider current file imports: import re import django from django.db.backends.sqlite3.base import Databa...
if django_version < (2, 0) or django_version >= (3, 1):
Given the code snippet: <|code_start|>from __future__ import unicode_literals django_version = django.VERSION[:2] sqlite_version = Database.sqlite_version_info[:2] <|code_end|> , generate the next line using the imports in this file: import re import django from django.db.backends.sqlite3.base import Database fr...
if django_version < (2, 0) or django_version >= (3, 1):
Continue the code snippet: <|code_start|> if app_label: q = q & Q(app_label=app_label) evolutions = list(Evolution.objects.filter(q).values('pk')) if len(evolutions) == 0: if app_label: raise CommandError( ...
guidance.
Here is a snippet: <|code_start|> for evolution_label in evolution_labels: q = Q(label=evolution_label) if app_label: q = q & Q(app_label=app_label) evolutions = list(Evolution.objects.filter(q).values('pk')) if len(evolutions) == 0: ...
You have requested to delete %s evolution(s). This may cause permanent
Given the following code snippet before the placeholder: <|code_start|> q = q & Q(app_label=app_label) evolutions = list(Evolution.objects.filter(q).values('pk')) if len(evolutions) == 0: if app_label: raise CommandError( ...
Are you sure you want to wipe these evolutions from the database?
Using the snippet: <|code_start|>from __future__ import unicode_literals MUTATIONS = [ ChangeMeta('ContentType', 'unique_together', [('app_label', 'model')]), <|code_end|> , determine the next line of code. You have imports: from django_evolution.mutations import ChangeMeta and context (class names, function n...
]
Here is a snippet: <|code_start|> "AP selection phase. This option is part of Lure10 attack."), action='store_true') parser.add_argument( "-lE", "--lure10-exploit", help=("Fool the Windows Location Service of nearby Windows users " "to believe it is within ...
parser.add_argument("-cM", "--channel-monitor",
Based on the snippet: <|code_start|> parser.add_argument( "--payload-path", help=("Payload path for scenarios serving a payload")) parser.add_argument("-cM", "--channel-monitor", help="Monitor if target access point changes the channel.", action="st...
"-pE",
Predict the next line for this snippet: <|code_start|> parser.add_argument( "-p", "--phishingscenario", help=("Choose the phishing scenario to run." + "This option will skip the scenario selection phase. " + "Example: -p firmware_upgrade")) parser.add_argument(...
"-lE",
Using the snippet: <|code_start|> "--lure10-exploit", help=("Fool the Windows Location Service of nearby Windows users " "to believe it is within an area that was previously captured " "with --lure10-capture. Part of the Lure10 attack.")) parser.add_argument( "--lo...
help="Monitor if the button on a WPS-PBC Registrar is pressed.",
Given the following code snippet before the placeholder: <|code_start|> "-kN", "--keepnetworkmanager", action='store_true', help=("Do not kill NetworkManager")) parser.add_argument( "-nE", "--noextensions", help=("Do not load any extensions."), action='...
help=("Deauth all the BSSIDs in the WLAN with that ESSID."))
Next line prediction: <|code_start|> "-nD", "--nodeauth", help=("Skip the deauthentication phase."), action='store_true') parser.add_argument( "-dC", "--deauth-channels", nargs="+", type=int, help=("Channels to deauth. " + "Exampl...
help=("Add WPA/WPA2 protection on the rogue Access Point. " +
Using the snippet: <|code_start|> parser.add_argument( "-nD", "--nodeauth", help=("Skip the deauthentication phase."), action='store_true') parser.add_argument( "-dC", "--deauth-channels", nargs="+", type=int, help=("Channels to deauth. " +...
"--presharedkey",
Given snippet: <|code_start|>logger = logging.getLogger(__name__) def parse_args(): # Create the arguments parser = argparse.ArgumentParser() # Interface selection parser.add_argument( "-i", "--interface", help=("Manually choose an interface that supports both AP and monitor "...
"Example: -iI ppp0"))
Given snippet: <|code_start|> parser.add_argument( "--logging", help="Log activity to file", action="store_true") parser.add_argument( "-dK", "--disable-karma", help="Disables KARMA attack", action="store_true") parser.add_argument( "-lP", ...
)
Predict the next line after this snippet: <|code_start|> parser.add_argument( "-aI", "--apinterface", type=opmode.validate_ap_interface, help=("Manually choose an interface that supports AP mode for " + "spawning the rogue AP. " + "Example: -aI wlan0")) parser.add_a...
help=("Do not change any MAC address"),
Given snippet: <|code_start|> help=("Skip the deauthentication phase."), action='store_true') parser.add_argument( "-dC", "--deauth-channels", nargs="+", type=int, help=("Channels to deauth. " + "Example: --deauth-channels 1,3,7")) parser.add...
parser.add_argument(
Given the following code snippet before the placeholder: <|code_start|> "--credential-log-path", help="Determine the full path of the file that will store any captured credentials", default=None) parser.add_argument( "--payload-path", help=("Payload path for scenarios serving ...
help="Determine the full path of a custom dnmasq.conf file",
Using the snippet: <|code_start|> "--quitonsuccess", help=("Stop the script after successfully retrieving one pair of " "credentials"), action='store_true') parser.add_argument( "-lC", "--lure10-capture", help=("Capture the BSSIDs of the APs that are disc...
parser.add_argument(
Using the snippet: <|code_start|> logger = logging.getLogger(__name__) def parse_args(): # Create the arguments parser = argparse.ArgumentParser() # Interface selection parser.add_argument( "-i", "--interface", help=("Manually choose an interface that supports both AP and...
help=("Manually choose an interface that supports AP mode for " +
Given the following code snippet before the placeholder: <|code_start|> "credentials"), action='store_true') parser.add_argument( "-lC", "--lure10-capture", help=("Capture the BSSIDs of the APs that are discovered during " "AP selection phase. This option i...
"--credential-log-path",