Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Next line prediction: <|code_start|> 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 discovered during "
... | "-cP", |
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*-
# pylint: skip-file
logger = logging.getLogger(__name__)
def parse_args():
# Create the arguments
parser = argparse.ArgumentParser()
# Interface selection
parser.add_argument(
"-i",
... | "deauthenticating the victims. " + "Example: -eI wlan1")) |
Continue the code snippet: <|code_start|>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 " +
"modes for... | "--protectinterface", |
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 monito... | "-iI", |
Predict the next line after this snippet: <|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. " +
... | help=("Add WPA/WPA2 protection on the rogue Access Point. " + |
Continue the code snippet: <|code_start|> help=("Add WPA/WPA2 protection on the rogue Access Point. " +
"Example: -pK s3cr3tp4ssw0rd"))
parser.add_argument(
"-hC",
"--handshake-capture",
help=("Capture of the WPA/WPA2 handshakes for verifying passphrase. " +
... | parser.add_argument( |
Predict the next line for this snippet: <|code_start|> 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 a payload"))
parser.add_argument("-cM", "--cha... | default='/tmp/dnsmasq.conf') |
Next line prediction: <|code_start|> "--mac-ap-interface",
help=("Specify the MAC address of the AP interface"))
parser.add_argument(
"-iEM",
"--mac-extensions-interface",
help=("Specify the MAC address of the extensions interface"))
parser.add_argument(
"-iNM",
... | type=int, |
Predict the next line for this snippet: <|code_start|>
class TestConditionals(object):
"""
"""
def test_not_num1(self):
ret = codetest("""
return not 1
""")
assert ret.getval() == 1
def test_not_num2(self):
ret = codetest("""
<|code_end|>
with ... | return not 2 |
Given the following code snippet before the placeholder: <|code_start|> tests for the lua if then else and various comparisons
"""
def test_simple_repeat(self):
ret = codetest("""
x = 0
repeat
x = x + 1
until x == 10
... | j = 5 |
Given the following code snippet before the placeholder: <|code_start|> x = 0
for i=1,10,1 do
x = x + 1
for i=11,15,1 do
x = x + 2
end
end
return x
""")
... | return x |
Given the code snippet: <|code_start|>
def test_addition(self):
f = test_file(src="""
-- short add
x = 10
y = 5
z = y + y + x
print(z)
print(z+y)
--a = 100+y
lx = 1234567890.55
ly = 99999999
... | end |
Predict the next line after this snippet: <|code_start|>
class TestPattern2(object):
def test_single_char_no_match(self):
expr = StateChar('c', StateMatch())
result = find2(expr, 'xyz', 0)
assert list(result) == [(-1, -1)]
def test_single_char_one_match(self):
expr = StateChar... | def test_two_chars_no_matches(self): |
Given the following code snippet before the placeholder: <|code_start|> def test_match_evil(self):
expr = compile_re('(a|b)*a(a|b){5}a(a|b)*')
result = find2(expr, 'aaaababababba', 0)
assert list(result) == [(1, 13)]
def test_match_evil_no_match(self):
expr = compile_re('(a|b)*a(... | assert expr.out.out.start == ord('c') |
Given snippet: <|code_start|> # %a*
node = node.out
assert isinstance(node, StateSplit)
assert isinstance(node.out, StateCharRange)
assert node.out.start == ord('A')
assert node.out.stop == ord('z')
assert node.out.out == node
# match
node = node.o... | def test_build_group_star(self): |
Predict the next line for this snippet: <|code_start|> def test_two_chars_one_match(self):
expr = StateChar('a', StateChar('b', StateMatch()))
result = find2(expr, 'ccvvvbbajbajbabb', 0)
assert list(result) == [(14, 15)]
def tests_find_two_chars_matches(self):
expr = StateChar('a... | def test_three_chars_negative_offset_no_match(self): |
Next line prediction: <|code_start|> def test_single_char_one_match(self):
expr = StateChar('c', StateMatch())
result = find2(expr, 'asdasdxcz', 0)
assert list(result) == [(8, 8)]
def test_single_char_more_matches(self):
expr = StateChar('c', StateMatch())
result = find2(... | def test_three_chars_one_match(self): |
Given the code snippet: <|code_start|> assert list(result) == [(2, 5), (9, 12)]
def test_chained_grouped_or_match(self):
expr = compile_re('x(aa|bb)(cc|dd)x')
result = find2(expr, 'axaaddaxbbccxxaacx', 0)
assert list(result) == [(8, 13)]
def test_chained_grouped_or_no_match(self... | assert list(result) == [(1, 8), (9, 10)] |
Predict the next line after this snippet: <|code_start|> assert isinstance(node.out, StateMatch)
def test_build_group_or(self):
expr = compile_re('(aa|bb)', False)
# |
assert isinstance(expr, StateSplit)
# aa
node = expr.out
assert isinstance(node, StateChar... | assert expr.start == ord('x') |
Using the snippet: <|code_start|> def test_mulvn_float_int(self):
ret = codetest("""
x = 90000
return x * 0.5
""")
assert ret.getval() == 45000
def test_mulvn_int_float(self):
ret = codetest("""
x = 0.5
retur... | x = 90000 |
Here is a snippet: <|code_start|>
class TestDivision(object):
def test_divvn(self):
ret = codetest("""
x = 4
return x / 2
""")
assert ret.getval() == 2
def test_divnv(self):
ret = codetest("""
<|code_end|>
. Write the next line using the ... | x = 4 |
Next line prediction: <|code_start|>
class TestReturn(object):
"""
"""
def test_return_more_ints(self):
ret = codetest("""
function foo(i)
if i > 0 then
return i, foo(i-1)
<|code_end|>
. Use current file imports:
(from .helpers import cod... | else |
Continue the code snippet: <|code_start|> assert ret.n_val == 30
def test_tonumber_int(self):
ret = codetest("""
x = tonumber("100")
return x + 19
""")
assert ret.n_val == 119
def test_tonumber_float(self):
ret = codetest("... | return type(x) |
Next line prediction: <|code_start|>
class TestBuiltin(object):
def test_print_str(self, capsys):
codetest("""
<|code_end|>
. Use current file imports:
(import pytest
from ..helpers import codetest, test_file)
and context including class names, function names, or small code snippets from other files:
#... | print("hallo") |
Next line prediction: <|code_start|>
ENTRY_POINT = create_entry_point()
class TestMain(object):
def test_with_bytecode_file(self):
f = luabytecode_file("x = 1")
assert ENTRY_POINT(['', f.name]) == 0
<|code_end|>
. Use current file imports:
(import os
from luna.main import create_entry_point
fr... | def test_with_lua_file(self): |
Given the following code snippet before the placeholder: <|code_start|>
ENTRY_POINT = create_entry_point()
class TestMain(object):
def test_with_bytecode_file(self):
f = luabytecode_file("x = 1")
assert ENTRY_POINT(['', f.name]) == 0
def test_with_lua_file(self):
f = test_file("x = ... | assert ENTRY_POINT(['', tmpdir.dirname+'/'+'foo.l']) == 1 |
Given snippet: <|code_start|>
ENTRY_POINT = create_entry_point()
class TestMain(object):
def test_with_bytecode_file(self):
f = luabytecode_file("x = 1")
assert ENTRY_POINT(['', f.name]) == 0
def test_with_lua_file(self):
f = test_file("x = 1", suffix=".l")
assert ENTRY_POIN... | assert ENTRY_POINT(['', f.name]) == 1 |
Predict the next line after this snippet: <|code_start|>
class Interpreter(object):
def __init__(self, flags, root_frame):
self.flags = flags
self.root_frame = root_frame
def run(self):
<|code_end|>
using the current file's imports:
from luna.objspace import ObjectSpace
from luna.helpers imp... | returnvalue = None |
Using the snippet: <|code_start|>
class Interpreter(object):
def __init__(self, flags, root_frame):
self.flags = flags
self.root_frame = root_frame
def run(self):
<|code_end|>
, determine the next line of code. You have imports:
from luna.objspace import ObjectSpace
from luna.helpers import d... | returnvalue = None |
Given the following code snippet before the placeholder: <|code_start|> """)
out, _ = capsys.readouterr()
assert out == "13 13\n"
def test_find_simple_pattern_big_negative_offset_match(self, capsys):
codetest("""
x, y = string.find("Hello Lua user", "e", -100)
... | x, y = string.find('123a23a 9Z', '%a%a') |
Given snippet: <|code_start|>
class ModuleDef(object):
def __init__(self, name):
self.name = name
self.methods = W_Table()
def function(self, name):
def adder(func):
self.methods.set(W_Str(name), LuaBuiltinFrame(func))
return adder
def add_constant(self, name, ... | class BuiltinDef(object): |
Predict the next line after this snippet: <|code_start|>
class ModuleDef(object):
def __init__(self, name):
self.name = name
self.methods = W_Table()
def function(self, name):
def adder(func):
self.methods.set(W_Str(name), LuaBuiltinFrame(func))
return adder
<|code... | def add_constant(self, name, w_const): |
Based on the snippet: <|code_start|>
class ModuleDef(object):
def __init__(self, name):
self.name = name
self.methods = W_Table()
def function(self, name):
def adder(func):
self.methods.set(W_Str(name), LuaBuiltinFrame(func))
<|code_end|>
, predict the immediate next line w... | return adder |
Predict the next line for this snippet: <|code_start|>
class ObjectSpace(object):
def __init__(self):
self.globals = {}
self.modules = {}
self.registers = [W_Object()] * 10
self.globals.update(Builtin.methods)
self.add_module(TableModule)
self.add_module(MathModule)... | self.globals[moduledef.name] = moduledef.methods |
Based on the snippet: <|code_start|>
def test_nested_function_tailcall(self):
"""
Tests CALLMT with user defined function
"""
ret = codetest("""
function f(x)
y = x+1
return y
end
return f(f(5))
... | return y |
Here is a snippet: <|code_start|> z = x + y
return z
""")
assert ret.getval() == 262144
def test_addvv_float(self):
ret = codetest("""
x = 6.5
y = 1.2
return x + y
""")
assert ret.... | return 10 + x |
Using the snippet: <|code_start|>
class TestSubtraction(object):
def test_subvn(self):
ret = codetest("""
<|code_end|>
, determine the next line of code. You have imports:
from .helpers import codetest
and context (class names, function names, or code) available:
# Path: luna/tests/helpers.py
# def code... | x = 6500 |
Using the snippet: <|code_start|>
class TestMath(object):
def test_huge(self, capsys):
ret = codetest("""
return math.huge
""")
assert ret.n_val == sys.maxint
def test_floor_1(self, capsys):
ret = codetest("""
return math.floor(1.9)
... | return math.floor(1.0) |
Predict the next line for this snippet: <|code_start|>
class TestIf(object):
"""
tests for the lua if then else and various comparisons
"""
def test_isnen_false_with_eq(self):
ret = codetest("""
x = 99
if x == 99 then
return 2
... | return 2; |
Next line prediction: <|code_start|> return x
""")
assert ret.s_val == ""
def test_cat_strs(self):
ret = codetest("""
return "hal".."lo"
""")
assert ret.s_val == "hallo"
def test_cat_ints(self):
ret = codete... | return nil ~= "foo" |
Given snippet: <|code_start|>
def test_set_get_num_key_str(self):
ret = codetest("""
x = {}
x[1] = "str"
return x[1]
""")
assert ret.getval() == "str"
def test_set_get_var_str_key_num(self):
ret = codetest("""
... | return x[1] + x[3] |
Based on the snippet: <|code_start|>from __future__ import print_function
class Command(BaseCommand):
args = '<english title or slug>'
help = 'Create a new rst blog post'
option_list = (
make_option(
'--draft', '-d', dest='draft', default=False, action='store_true',
he... | 'draft': draft, |
Continue the code snippet: <|code_start|>from __future__ import absolute_import
register = Library()
# tag cloud from django-taggit-templatetags:
# https://github.com/feuervogel/django-taggit-templatetags
T_MAX = getattr(settings, 'TAGCLOUD_MAX', 6.0)
T_MIN = getattr(settings, 'TAGCLOUD_MIN', 1.0)
def get_queryse... | return qs |
Predict the next line after this snippet: <|code_start|>
# tag cloud from django-taggit-templatetags:
# https://github.com/feuervogel/django-taggit-templatetags
T_MAX = getattr(settings, 'TAGCLOUD_MAX', 6.0)
T_MIN = getattr(settings, 'TAGCLOUD_MIN', 1.0)
def get_queryset(language):
qs = I18NTag.objects.filter(la... | def __init__(self, language, asvar): |
Predict the next line for this snippet: <|code_start|> def shutdown(self):
print("\nShutting down")
self._shutdown = True
self.httpd_server.shutdown()
self.httpd_thread.join()
def filesystem_watcher(self):
lock = threading.Lock()
ignore_re = None
to_igno... | call_command('generate') |
Predict the next line for this snippet: <|code_start|> def get_translations(self):
"Query set for the translations"
self_slug = getattr(self, self.SLUG_FIELD_FOR_TRANSLATIONS)
self_lang = getattr(self, self.LANG_FIELD_FOR_TRANSLATIONS)
slug = {self.SLUG_FIELD_FOR_TRANSLATIONS + '__e... | yield DummyTranslation(self.request, code, name, self.path) |
Here is a snippet: <|code_start|>from __future__ import absolute_import
class TranslationsMixin(object):
"Helper for getting transalations"
<|code_end|>
. Write the next line using the current file imports:
from django.conf import settings
from .utils import path_to_lang, LANGS_DICT
and context from other file... | SLUG_FIELD_FOR_TRANSLATIONS = 'slug' # Overide in models if needed |
Given snippet: <|code_start|>
PAGE_TYPES = (
('rst', 'reStructured Text'),
('html', 'Django template'),
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from django.db import models
from django.conf import settings
from statirator.core.utils import i18n_permalink
from statir... | ) |
Here is a snippet: <|code_start|>from __future__ import absolute_import
class PagesSiteMap(Sitemap):
def items(self):
"Return the items starting with defualt language and it's index page"
<|code_end|>
. Write the next line using the current file imports:
from django.contrib.sitemaps import Sitemap
fr... | default = settings.LANGUAGE_CODE |
Using the snippet: <|code_start|>from __future__ import print_function
class Command(BaseCommand):
help = "Walk the resources, builds the db, and generates the static site"
def handle(self, *args, **options):
self.syncdb()
self.create_sites()
self.read_resources()
self.gen_... | def syncdb(self): |
Continue the code snippet: <|code_start|>from __future__ import print_function, absolute_import
def update_post(slug, lang_code, defaults):
with translation.override(lang_code):
page, created = Page.objects.get_or_create(
slug=slug,
language=lang_code,
defaults=defaul... | print('Processing {0}'.format(page)) |
Based on the snippet: <|code_start|>from __future__ import print_function, absolute_import
def update_post(slug, lang_code, defaults):
with translation.override(lang_code):
page, created = Page.objects.get_or_create(
slug=slug,
language=lang_code,
defaults=defaults)
... | for field, val in defaults.iteritems(): |
Using the snippet: <|code_start|> t = Template(page.content)
req = RequestFactory().get(page.get_absolute_url(), LANGUAGE_CODE=lang_code)
page.title = render_block_to_string(
t, 'title', context_instance=RequestContext(req))
page.description = render_block_to_string(
... | READERS = [html_reader] |
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*-
TEST_DOC = """
:slug: some-post-title-slugified
:draft: 1
:datetime: 2012-09-12 16:03:15
This will be ignored in main meta section
.. --
=================
English title
=================
:lang: en
:tags: Tag1, Tag2
The content of the E... | כותרת עברית |
Next line prediction: <|code_start|># -*- coding: utf-8 -*-
TEST_DOC = """
:slug: some-post-title-slugified
:draft: 1
:datetime: 2012-09-12 16:03:15
This will be ignored in main meta section
.. --
=================
English title
=================
:lang: en
:tags: Tag1, Tag2
The content of the English post
And a... | :lang: he |
Predict the next line after this snippet: <|code_start|>from __future__ import absolute_import
class PagesRenderer(StaticSiteRenderer):
def get_paths(self):
paths = []
for lang_code, lang_name in settings.LANGUAGES:
activate(lang_code)
items = Page.objects.filter(langu... | return paths |
Given the code snippet: <|code_start|>
# we need to make sure the pages slug won't catch the /en/ etc for index pages
# in various languages
langs_re = '|'.join(x[0] for x in settings.LANGUAGES)
sitemaps = {
'pages': psitemap.PagesSiteMap,
'blog': bsitemap.BlogSiteMap,
}
urlpatterns = patterns(
'',
u... | ) |
Using the snippet: <|code_start|>
# we need to make sure the pages slug won't catch the /en/ etc for index pages
# in various languages
langs_re = '|'.join(x[0] for x in settings.LANGUAGES)
sitemaps = {
'pages': psitemap.PagesSiteMap,
'blog': bsitemap.BlogSiteMap,
}
urlpatterns = patterns(
'',
url(r'... | ) |
Given snippet: <|code_start|>sitemaps = {
'pages': psitemap.PagesSiteMap,
'blog': bsitemap.BlogSiteMap,
}
urlpatterns = patterns(
'',
url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)/$',
views.PostView.as_view(), name='blog_post'),
url(r'^archive/$', views.ArchiveView.as_view(), nam... | urlpatterns += patterns('django.contrib.sitemaps.views', |
Predict the next line for this snippet: <|code_start|>
# we need to make sure the pages slug won't catch the /en/ etc for index pages
# in various languages
langs_re = '|'.join(x[0] for x in settings.LANGUAGES)
sitemaps = {
'pages': psitemap.PagesSiteMap,
'blog': bsitemap.BlogSiteMap,
}
urlpatterns = pattern... | urlpatterns += i18n_patterns( |
Predict the next line for this snippet: <|code_start|>from __future__ import absolute_import
class BlogSiteMap(Sitemap):
def items(self):
"Return the items starting with defualt language and it's index page"
<|code_end|>
with the help of current file imports:
from django.contrib.sitemaps import Site... | default = settings.LANGUAGE_CODE |
Next line prediction: <|code_start|>from __future__ import absolute_import
class BlogSiteMap(Sitemap):
def items(self):
"Return the items starting with defualt language and it's index page"
default = settings.LANGUAGE_CODE
langs = [default] + [x[0] for x in settings.LANGUAGES if x[0] !... | items.append(dummy) |
Continue the code snippet: <|code_start|>
pygame.display.flip()
display.wait(self.FEEDBACK_DURATION)
# Display blank screen (ITI)
display.blank_screen(self.screen, self.background, self.ITI)
def display_sequence(self, sequence):
for i, number in enumerate(sequence):
... | "Try your best to memorize them", |
Predict the next line after this snippet: <|code_start|> project_name = self.projectNameValue.text()
researcher = self.researcherValue.text()
dir_path = self.dirValue.text()
# Check all fields have been filled
if project_name != "" and researcher != "" and dir_path != "":
... | self, "Error", "Project name already exists" |
Given snippet: <|code_start|> return user_sequence
def check_answer(self, user_string, actual_string):
if user_string[::-1] == actual_string:
return True
else:
return False
def run(self):
# Instructions
self.screen.blit(self.background, (0, 0))
... | self.font, |
Based on the snippet: <|code_start|> # Display fixation in the center
display.image(self.screen, self.img_fixation, "center", "center")
# Display cue above and below fixation
display.image(
self.screen,
self.img_cue,
"center... | elif cue_location == "bottom": |
Based on the snippet: <|code_start|>class BatteryWindow(QtWidgets.QMainWindow, battery_window_qt.Ui_CognitiveBattery):
def __init__(self, base_dir, project_dir, res_width, res_height):
super(BatteryWindow, self).__init__()
# Setup the main window UI
self.setupUi(self)
# Set app ico... | self.set_default_settings() |
Next line prediction: <|code_start|> self.setupUi(self)
# Set app icon
self.setWindowIcon(QtGui.QIcon(os.path.join("images", "icon_sml.png")))
self.github_icon = os.path.join("images", "github_icon.png")
self.actionDocumentation.setIcon(QtGui.QIcon(self.github_icon))
sel... | self.move(self.settings.value("pos")) |
Here is a snippet: <|code_start|>
class BatteryWindow(QtWidgets.QMainWindow, battery_window_qt.Ui_CognitiveBattery):
def __init__(self, base_dir, project_dir, res_width, res_height):
super(BatteryWindow, self).__init__()
# Setup the main window UI
self.setupUi(self)
# Set app ico... | self.actionBrowse_Issues.setIcon(QtGui.QIcon(self.github_icon)) |
Here is a snippet: <|code_start|> # Initialize task settings
self.task_fullscreen = None
self.task_borderless = None
self.task_width = None
self.task_height = None
# Keep reference to the about and settings window objects
self.about = None
self.update = No... | self.actionRequest_Feature.triggered.connect(self.show_new_issue) |
Given the code snippet: <|code_start|>
# Initialize pygame screen
self.pygame_screen = None
# Define URLs
self.links = values.get_links()
# Make data folder if it doesnt exist
self.dataPath = os.path.join(self.project_dir, "data")
if not os.path.isdir(self.dataP... | self.upButton.clicked.connect(self.move_up) |
Continue the code snippet: <|code_start|> # Setup the main window UI
self.setupUi(self)
# Set app icon
self.setWindowIcon(QtGui.QIcon(os.path.join("images", "icon_sml.png")))
self.github_icon = os.path.join("images", "github_icon.png")
self.actionDocumentation.setIcon(Qt... | self.resize(self.settings.value("size")) |
Based on the snippet: <|code_start|>
# Initialize pygame screen
self.pygame_screen = None
# Define URLs
self.links = values.get_links()
# Make data folder if it doesnt exist
self.dataPath = os.path.join(self.project_dir, "data")
if not os.path.isdir(self.dataPat... | self.upButton.clicked.connect(self.move_up) |
Given snippet: <|code_start|> self.github_icon = os.path.join("images", "github_icon.png")
self.actionDocumentation.setIcon(QtGui.QIcon(self.github_icon))
self.actionLicense.setIcon(QtGui.QIcon(self.github_icon))
self.actionContribute.setIcon(QtGui.QIcon(self.github_icon))
self.ac... | self.task_borderless = None |
Given snippet: <|code_start|> self.actionReport_Bug.setIcon(QtGui.QIcon(self.github_icon))
self.actionRequest_Feature.setIcon(QtGui.QIcon(self.github_icon))
# Get passed values
self.base_dir = base_dir
self.project_dir = project_dir
self.res_width = res_width
self... | self.about = None |
Given the following code snippet before the placeholder: <|code_start|> self.actionLicense.setIcon(QtGui.QIcon(self.github_icon))
self.actionContribute.setIcon(QtGui.QIcon(self.github_icon))
self.actionBrowse_Issues.setIcon(QtGui.QIcon(self.github_icon))
self.actionReport_Bug.setIcon(QtGu... | self.task_height = None |
Given the code snippet: <|code_start|>
class BatteryWindow(QtWidgets.QMainWindow, battery_window_qt.Ui_CognitiveBattery):
def __init__(self, base_dir, project_dir, res_width, res_height):
super(BatteryWindow, self).__init__()
# Setup the main window UI
self.setupUi(self)
# Set ap... | self.settings = QtCore.QSettings(self.settings_file, QtCore.QSettings.IniFormat) |
Predict the next line for this snippet: <|code_start|>
class BatteryWindow(QtWidgets.QMainWindow, battery_window_qt.Ui_CognitiveBattery):
def __init__(self, base_dir, project_dir, res_width, res_height):
super(BatteryWindow, self).__init__()
# Setup the main window UI
self.setupUi(self)
... | self.project_dir = project_dir |
Using the snippet: <|code_start|> # Use the 29mm mask image (as described by Robertson 1997)
self.img_mask = pygame.image.load(os.path.join(self.image_path, "mask_29.png"))
# Create trial sequence
self.number_set = list(range(1, 10)) * 25 # Numbers 1-9
random.shuffle(self.number... | ) |
Given the code snippet: <|code_start|>
# Open web browser to the documentation page
def show_documentation(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.links["github"]))
# Open web browser to the license page
def show_license(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(s... | self.about.show() |
Given the following code snippet before the placeholder: <|code_start|> self.researcherValue.setText(researcher)
self.createdValue.setText(created_time)
self.dirValue.setText(project_path)
if os.path.isdir(project_path):
self.dirValue.setStyleSheet("QLabel... | researcher = self.researcherValue.text() |
Here is a snippet: <|code_start|> created_time = datetime.fromtimestamp(created_unix).strftime(
"%d/%m/%Y @ %H:%M"
)
project_path = self.project_list[researcher][project_name]["path"]
self.projectName.setText(project_name)
self.researcherValue.... | ) |
Given the following code snippet before the placeholder: <|code_start|>
self.res_width = res_width
self.res_height = res_height
self.base_dir = base_dir
# Define URLs
self.links = values.get_links()
# Check if project file exists
if not os.path.isfile(os.path.jo... | self.actionAbout.triggered.connect(self.show_about) |
Based on the snippet: <|code_start|> # If update dialog exists, bring it to the front
else:
self.update.activateWindow()
self.update.raise_()
def project_click(self, item):
if item.parent():
researcher = item.parent().text(0)
project_name = ite... | self.createdLabel.show() |
Using the snippet: <|code_start|> json.dump(projects, f, indent=4)
def refresh_projects(self):
# Load most recent saved project list from file
with open(os.path.join(self.base_dir, "projects.txt"), "r") as f:
projects = json.load(f)
# Clear existing tree widget
... | self.projectName.setText("") |
Next line prediction: <|code_start|> # Only save some options if fullscreen is not selected
if not self.task_fullscreen:
self.settings.setValue(
"borderless",
str(self.settings_task_borderless_checkbox.isChecked()).lower(),
)... | "setsMain", self.settings_flanker_main_sets_value.text() |
Predict the next line for this snippet: <|code_start|>from __future__ import division, print_function
if __name__ == "__main__":
# Get application directory
base_dir = os.path.dirname(os.path.realpath(__file__))
# Create project manager window
app = QtWidgets.QApplication(sys.argv)
screen_resol... | ) |
Here is a snippet: <|code_start|> self.screen,
self.font,
"In example above, you should press the RIGHT key.",
100,
self.screen_y / 2 + 120,
self.colour_font,
)
display.text(
self.screen,
... | self.screen, |
Using the snippet: <|code_start|>
class AboutDialog(QtWidgets.QDialog, about_dialog_qt.Ui_Dialog):
def __init__(self, parent=None):
super(AboutDialog, self).__init__(parent)
# Setup the about dialog box
self.setupUi(self)
# Set version number
self.versionValue.setText(val... | self.icon.setPixmap(pixmap) |
Predict the next line for this snippet: <|code_start|>
# Bind button events
self.btn_update.clicked.connect(self.show_releases)
self.btn_close.clicked.connect(self.close)
# Check for updates
self.check_version()
def check_version(self):
try:
url = urllib... | self.info.setText("New version available...") |
Next line prediction: <|code_start|>
class UpdateDialog(QtWidgets.QDialog, update_dialog_qt.Ui_Dialog):
def __init__(self, parent=None):
super(UpdateDialog, self).__init__(parent)
# Setup the update dialog box
self.setupUi(self)
# Set version number
self.current_version =... | self.setAttribute(QtCore.Qt.WA_DeleteOnClose) |
Based on the snippet: <|code_start|>
def decode(vocab, value):
if isinstance(value, int):
try:
return vocab.strings[value]
except KeyError:
<|code_end|>
, predict the immediate next line with the help of imports:
from configargparse import ArgParser
from ucca.textutil import get_vocab... | pass |
Based on the snippet: <|code_start|>
def main():
argparser = ArgParser(description="Load TUPA model and save again to a different file.")
argparser.add_argument("models", nargs="+", help="model file basename(s) to load")
argparser.add_argument("-s", "--suffix", default=".1", help="filename suffix to appen... | model.save() |
Using the snippet: <|code_start|>
matplotlib.use("Agg")
np.seterr("raise")
REPLACEMENTS = (
("axes_", ""),
<|code_end|>
, determine the next line of code. You have imports:
from collections import OrderedDict
from configargparse import ArgParser
from scipy.misc import imresize
from matplotlib.ticker import MaxN... | ("_", " "), |
Next line prediction: <|code_start|>class DefaultOrderedDict(OrderedDict, Labels):
# Source: http://stackoverflow.com/a/6190500/223267
def __init__(self, default_factory=None, *args, size=None, **kwargs):
if default_factory is not None and not callable(default_factory):
raise TypeError("defa... | def __copy__(self): |
Based on the snippet: <|code_start|> add(group, "--rnn", choices=["None"] + list(RNNS), default=DEFAULT_RNN, help="type of recurrent neural network")
add(group, "--gated", type=int, nargs="?", default=2, help="gated input to BiRNN and MLP")
NN_ARG_NAMES.update(get_group_arg_names(group))
return ap
clas... | for key, value in kwargs.items(): |
Given the code snippet: <|code_start|>#
# latex_use_parts = False
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# It ... | man_pages = [ |
Next line prediction: <|code_start|> # noinspection PyBroadException
def run(self):
# Install requirements
self.announce("Installing dependencies...")
run(["pip", "--no-cache-dir", "install"] + install_requires, check=True)
# Install actual package
_install.run(self)
se... | "viz": ["scipy", "pillow", "matplotlib"], |
Based on the snippet: <|code_start|>
class EmptyFeatureExtractor(FeatureExtractor):
def __init__(self):
super().__init__()
<|code_end|>
, predict the immediate next line with the help of imports:
from .feature_extractor import FeatureExtractor
and context (classes, functions, sometimes code) from other... | def extract_features(self, state): |
Given snippet: <|code_start|>
MLP_PARAM_PATTERN = re.compile(r"[Wb]\d+")
class MultilayerPerceptron(SubModel):
def __init__(self, config, args, model, layers=None, layer_dim=None, output_dim=None, num_labels=None, params=None,
**kwargs):
super().__init__(params=params, **kwargs)
... | self.model = model |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.