Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given the following code snippet before the placeholder: <|code_start|> teams = [movesets[:6], movesets[6:12], [movesets[i] for i in (1, 12, 3, 4, 5, 6)], [movesets[i] for i in (3, 5, 6, 8, 9, 13)]] logs = [lg.generate_log(players[:2], teams[:2]), ...
result = 0
Predict the next line for this snippet: <|code_start|> for username in ['Alice', 'Bob']] movesets = [lg.generate_pokemon(species, context)[0] for species in ['alakazammega', 'bisharp', 'cacturne', ...
assert {'ou'} == set(battle_info_sink.battles.keys())
Here is a snippet: <|code_start|> 'flygon', 'gogoat', 'hariyama', 'infernape', 'jumpluff', 'kangaskhan', ...
assert 5 == len(processor.battle_info_sink.pids)
Given snippet: <|code_start|> [movesets[i] for i in (3, 5, 6, 8, 9, 13)]] logs = [lg.generate_log(players[:2], teams[:2]), lg.generate_log(players[2:4], teams[2:]), lg.generate_log((players[1], players[4]), (teams[1], teams[0]))] tmpdir.mkdir('tj') ...
tmpdir.strpath), ref_type='file')
Predict the next line for this snippet: <|code_start|> 'w+')) def check(self, processor, result): assert 3 == result assert 14 == len(processor.moveset_sink.sids) assert 5 == len(processor.battle_info_sink.pids) assert 4 == len(processor.battle_info_s...
'{0}/tj/battle-uu-3.log.json'.format(
Given the following code snippet before the placeholder: <|code_start|>"""Tests for the metrics module""" class TestVictoryChance(object): def test_elo(self): """Glicko formula should reduce to Elo if d1=d2=0 Using http://bzstats.strayer.de/bzinfo/elo/ to test against""" assert .76 == ro...
def test_elo_all_that_matters_is_rating_difference(self):
Based on the snippet: <|code_start|>"""Generate the config file that lists which Pokemon can change formes. While we're at it, generate the species lookup dictionary that handles prettifying species names, labelling forme-concatenations and combining appearance-only formes""" <|code_end|> , predict the immediate ...
def generate_single_forme_species_lookup():
Based on the snippet: <|code_start|>"""Generate the config file that lists which Pokemon can change formes. While we're at it, generate the species lookup dictionary that handles prettifying species names, labelling forme-concatenations and combining appearance-only formes""" <|code_end|> , predict the immediate ...
def generate_single_forme_species_lookup():
Predict the next line after this snippet: <|code_start|> def current_variable_declaration_scope(self): return self.scope_stack[-1][1] def current_scope_is_strict(self): return bool(self.scope_stack) and self.scope_stack[-1][2] def visit_VariableDeclaration(self, node): scope = self....
self.visit(node.statements)
Here is a snippet: <|code_start|> def current_variable_declaration_scope(self): return self.scope_stack[-1][1] def current_scope_is_strict(self): return bool(self.scope_stack) and self.scope_stack[-1][2] def visit_VariableDeclaration(self, node): scope = self.current_variable_declar...
self.visit(node.statements)
Predict the next line after this snippet: <|code_start|> if not code: return False strict = False for node in code: if not isinstance(node, ExpressionStatement): break elif not isinstance(node.expression, StringLiteral): break if node.expression.value[1...
def current_function_declaration_scope(self):
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (C) 2016, Maximilian Köhl <mail@koehlma.de> # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License version 3 as published by # the Free Software Foundation. # # This p...
uvcffi.lib = Mock()
Continue the code snippet: <|code_start|> searchable = True name = String() user = RelatedObjects(backref=True) plugins = Dict() class User(RiakObject): """A user of the service""" bucket_name = 'users' api_key = String() credentials = Dict() messaging_driver = String() messag...
metrics = Dict()
Given snippet: <|code_start|> class Configuration(Resource): def __init__(self): super(Configuration, self).__init__() self.resourceName = 'configuration' self.route('GET', (), self.get) @access.public @autoDescribeRoute( Description('Get the deployment configuration.') ...
},
Continue the code snippet: <|code_start|> @access.public @autoDescribeRoute( Description('Get the deployment configuration.') ) def get(self): notebooks = Setting().get(Features.NOTEBOOKS) if notebooks is None: notebooks = True site = Setting().get(Deploymen...
}
Next line prediction: <|code_start|> @access.public @autoDescribeRoute( Description('Get the deployment configuration.') ) def get(self): notebooks = Setting().get(Features.NOTEBOOKS) if notebooks is None: notebooks = True site = Setting().get(Deployment.SITE...
}
Given snippet: <|code_start|> Request_ = namedtuple('Request', 'request, method, url, args, kwargs, ordering, session, skwargs, error') Response = namedtuple('Response', 'req, res, err') methods = { 'GET': requests.get, 'OPTIONS': requests.options, 'HEAD': requests.head, 'POST': requests.post, ...
'PATCH': requests.patch,
Given the code snippet: <|code_start|> Request_ = namedtuple('Request', 'request, method, url, args, kwargs, ordering, session, skwargs, error') Response = namedtuple('Response', 'req, res, err') methods = { 'GET': requests.get, 'OPTIONS': requests.options, 'HEAD': requests.head, 'POST': requests.p...
'DELETE': requests.delete,
Continue the code snippet: <|code_start|> Request_ = namedtuple('Request', 'request, method, url, args, kwargs, ordering, session, skwargs, error') Response = namedtuple('Response', 'req, res, err') methods = { 'GET': requests.get, 'OPTIONS': requests.options, 'HEAD': requests.head, <|code_end|> . Use ...
'POST': requests.post,
Based on the snippet: <|code_start|> fields = [ "first_name", "last_name", "organization", "keyserver_url", "public_key", "fingerprint", "timezone", "language" ] widgets = { 'keyserver_url...
return super().__init__(*args, **kwargs)
Given snippet: <|code_start|> class UpdateUserInfoForm(ModelForm): class Meta: model = User fields = [ "first_name", "last_name", "organization", "keyserver_url", "public_key", "fingerprint", "timezone", ...
required=False,
Next line prediction: <|code_start|> class MessageInline(admin.TabularInline): model = Message extra = 0 @admin.register(Box) class BoxAdmin(admin.ModelAdmin): list_display = ('name', 'owner', 'created_at', 'expires_at') list_filter = ('status', 'created_at', 'expires_at') search_fields = ['name'...
list_filter = ('status', 'created_at', 'sent_at')
Predict the next line for this snippet: <|code_start|> class MessageInline(admin.TabularInline): model = Message extra = 0 @admin.register(Box) class BoxAdmin(admin.ModelAdmin): list_display = ('name', 'owner', 'created_at', 'expires_at') list_filter = ('status', 'created_at', 'expires_at') searc...
inlines = [MessageInline]
Using the snippet: <|code_start|> class MessageInline(admin.TabularInline): model = Message extra = 0 @admin.register(Box) class BoxAdmin(admin.ModelAdmin): list_display = ('name', 'owner', 'created_at', 'expires_at') list_filter = ('status', 'created_at', 'expires_at') search_fields = ['name', '...
list_filter = ('access', 'created_at',)
Next line prediction: <|code_start|>from __future__ import absolute_import @shared_task def process_email(message_id, form_data, sent_by=None): message = Message.objects.get(id=message_id) box = message.box msg = form_data["message"] file_name = form_data.get("file_name", "") subject = _('New su...
body,
Given the following code snippet before the placeholder: <|code_start|> "description", "expires_at", "max_messages"] def clean_expires_at(self): # Validate the expiration date expires_at = self.cleaned_data.get("expires_at", "") never_expires = self.cleane...
file_name = CharField(required=False)
Using the snippet: <|code_start|> Q(public_key__isnull=True) | Q(public_key__exact='')) logger.info(_('Start validating user keys')) for user in users: logger.info(_('Working on user: {}').format(user.email)) key = user.public_key # Check key fingerprint, *state = key_stat...
[email])
Continue the code snippet: <|code_start|> user.fingerprint = "" user.public_key = "" user.save() elif state[0] == "valid": # Checks if key is about to expire days_to_expire = state[1] if days_to_expire == 7 or days_to_expire == 1: ...
for user in users:
Given snippet: <|code_start|># Every day at 4 AM UTC @periodic_task(run_every=(crontab(minute=0, hour=4)), ignore_result=True) def update_public_keys(): users = User.objects.exclude( Q(keyserver_url__isnull=True) | Q(keyserver_url__exact='')) logger.info(_('Start updating user keys')) for user in us...
"humans/emails/key_invalid.txt")
Using the snippet: <|code_start|> list_display = ('username', 'email', "first_name", "last_name", "is_staff", "has_public_key", "has_keyserver_url") def __init__(self, *args, **kwargs): ...
msg = _('Cannot delete "{}", the notification was already sent')
Continue the code snippet: <|code_start|> @admin.register(User) class UserAdmin(DefaultUserAdmin): list_display = ('username', 'email', "first_name", "last_name", "is_staff", "has_public_key", "h...
self.fieldsets += ((_('Key options'), {
Here is a snippet: <|code_start|>class UserAdmin(DefaultUserAdmin): list_display = ('username', 'email', "first_name", "last_name", "is_staff", "has_public_key", "has_keyserver_url") def __in...
if obj.sent_at:
Given the following code snippet before the placeholder: <|code_start|> @admin.register(User) class UserAdmin(DefaultUserAdmin): list_display = ('username', 'email', "first_name", "last_name", <|code_end|> , predict the next line using imports from the cu...
"is_staff",
Here is a snippet: <|code_start|> urlpatterns = [ url(r'^$', HomeView.as_view(), name="pages_index"), url(r'^about$', AboutView.as_view(), name="pages_about"), url(r'^help$', HelpView.as_view(), name="pages_help") <|code_end|> . Write the next line using the current file imports: from django.conf.urls impo...
]
Given the following code snippet before the placeholder: <|code_start|># 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 this program. If not, see <http://www.gnu.org/licenses...
else:
Given the code snippet: <|code_start|>MDADM = "mdadm" class MdRaid(template.Backend): def __init__(self, *args, **kwargs): super(MdRaid, self).__init__(*args, **kwargs) self.type = 'dm' self._vol = {} self._pool = {} self._dev = {} self.hostname = socket.gethostnam...
self._dev[dev] = self.get_device_data(dev, devsize)
Given the code snippet: <|code_start|> def get_device_data(self, devname, devsize): data = {} data['dev_name'] = devname data['hide'] = False command = [MDADM, '--examine', devname] output = misc.run(command, stderr=False)[1].split("\n") for line in output: ...
item = array[0].strip()
Given the code snippet: <|code_start|> VERSION=main.VERSION DOC_BUILD='doc/_build/' NAME="system-storage-manager" if sys.version < '2.6': print("Python version 2.6 or higher is required " + "for System Storage Manager to run correctly!") sys.exit(1) setup( name=NAME, version=VERSION, aut...
maintainer='Lukas Czerner',
Predict the next line after this snippet: <|code_start|> if item in self.mounts: new['mount'] = self.mounts[item]['mp'] # Subvolume is mounted directly new['direct_mount'] = True else: # If subvolume is not mo...
new['hide'] = False
Given the code snippet: <|code_start|> # Store snapshot info if 'mount' in new and \ re.match(r"snap-\d{4}-\d{2}-\d{2}-T\d{6}", os.path.basename(new['mount'])): new['snap_name'] = "{0}:{1}".format(name, ...
return os.path.basename(dev)
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python # # (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com> # # This program 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, eithe...
class BaseStorageHandleInit(unittest.TestCase):
Based on the snippet: <|code_start|> def format_synopsis(self, parser): return "{0}\n\n".format(self._parse_usage(parser.format_usage())) def write_ssm_usage(self): message = self.format_synopsis(self.ssm_parser.parser) self._write_message(message, SSM_USAGE_INC) def write_create_u...
self._write_message(message, CHECK_USAGE_INC)
Predict the next line after this snippet: <|code_start|># Copyright 2009 Yusuf Simonson # This file is part of Snowball. # # Snowball 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 ...
return password == req.settings['admin_pass']
Here is a snippet: <|code_start|>from __future__ import absolute_import from __future__ import print_function def write_AWIPS_netcdf_grid(outfile, t_start, t, xloc, yloc, lon_for_x, lat_for_y, ctr_lat, ctr_lon, grid, grid_var_name, grid_description, format='i', <|code_end|> . Write the next line using...
refresh_minutes = 1, grid_units = 'dimensionless'):
Given snippet: <|code_start|> y = Re * (np.radians(latavg) - np.radians(lat)) z = altavg - alt # r_sq = x**2.0 + y**2.0 + z**2.0 # sigma_sq = r_sq.sum()/r_sq.shape[0] # sigma = np.std(r_sq) separation = np.abs(np.percentile(alt,73) - np.percentile(alt,27)) flash_init_idx = np.argmin(flas...
energy_estimate = 0.
Continue the code snippet: <|code_start|># geoProj = GeographicSystem() # while True: # lon, lat, alt = (yield) # x,y,z = self.mapProj.fromECEF( # *self.geoProj.toECEF(lon, lat, alt) # ) # target.send((x,y,z)) # ------------------------------------------...
frame_times[frame_start_time] = n_flashes
Next line prediction: <|code_start|># *self.geoProj.toECEF(lon, lat, alt) # ) # target.send((x,y,z)) # -------------------------------------------------------------------------- # -------------------------------------------------------------------------- # --------------------...
for frame_start_time in all_times:
Based on the snippet: <|code_start|> name_to_idx = dict((k, i) for i, k in enumerate(grid_dims)) grid_t_idx = name_to_idx[t.dimensions[0]] grid_x_idx = name_to_idx[x.dimensions[0]] grid_y_idx = name_to_idx[y.dimensions[0]] xedge = centers_to_edges(x) ...
t = data[self.t_name]
Continue the code snippet: <|code_start|> 'frame_id':self.frame_id, 'frame_time':self.t.isoformat(), 'filename':fname} self.logger.info(json.dumps(lass_verts, cls=NumpyAwareJSONEncoder)) # self.logger.info(lass_verts) ...
def gridLassoOverplotDefault(lasso_widget, ax):
Next line prediction: <|code_start|> # from scipy.spatial import * geosys = GeographicSystem() # from IPython.display import HTML # from IPython.display import Javascript # from IPython.display import display # from http://stackoverflow.com/questions/3488934/simplejson-and-numpy-array/24375113#24375113 class NumpyA...
return obj.tolist()
Using the snippet: <|code_start|> kilo_formatter = FuncFormatter(kilo) # # /* DC LMA */ # DClat = 38.8888500 # falls church / western tip of arlington, rough centroid of stations # DClon = -77.1685800 # kounLat = 35.23833 # kounLon = -97.46028 # kounAlt = 377.0 # radarLat=kounLat # radarLon=kounLon # radarAlt=0.0 # #...
def multiples_figaspect(n_rows, n_cols, x_range, y_range, fig_width=None, max_height=None):
Here is a snippet: <|code_start|> width=10, taper_width=2.0, wg_sep=3, port=(1750, 0), direction="WEST", ) tk.add(top, mmi2) (xtop, ytop) = mmi1.portlist["output_top"]["port"] wg2 = pc.Waveguide( [ (xtop, ytop), (xtop + 100, ytop), (xtop + 100, ytop + 200), (xtop ...
(xmmi_top, ytop_out - 200),
Continue the code snippet: <|code_start|> top = gdspy.Cell("top") top.add(gdspy.Rectangle((0, 0), (1000, 1000), layer=100, datatype=0)) wgt = pc.WaveguideTemplate( wg_width=0.45, clad_width=10.0, bend_radius=100, resist="+", fab="ETCH", wg_layer=1, wg_datatype=0, clad_layer=2, clad...
gdspy.LayoutViewer()
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- """ @author: DerekK88 """ X_SIZE, Y_SIZE = 15000, 15000 exclusion_region = 2000.0 # region where no devices are to be fabricated x0, y0 = X_SIZE / 2.0, Y_SIZE / 2.0 # define origin of the die step = 100.0 # standard spaci...
top.add(
Given the following code snippet before the placeholder: <|code_start|># encoding: utf-8 log = __import__('logging').getLogger(__name__) class ContentmentDispatch: __slots__ = [] def __repr__(self): return "{self.__class__.__name__}(0x{id})".format(self=self, id=id(self)) def __call__(self, context, obj,...
del result
Given the following code snippet before the placeholder: <|code_start|># encoding: utf-8 class TestAsset(Asset): data = ListField(IntField(), custom_data=Properties(simple=True)) props = ListField(EmbeddedDocumentField(Properties), custom_data=Properties(simple=False)) # __xml_exporters__ = { # 'props': list_...
def test(cls):
Predict the next line after this snippet: <|code_start|># encoding: utf-8 class TestAsset(Asset): data = ListField(IntField(), custom_data=Properties(simple=True)) props = ListField(EmbeddedDocumentField(Properties), custom_data=Properties(simple=False)) # __xml_exporters__ = { # 'props': list_field, # } <|...
@classmethod
Given the code snippet: <|code_start|># encoding: utf-8 log = __import__('logging').getLogger(__name__) class AssetController: __dispatch__ = 'resource' def __init__(self, context, document, reference=None): self._ctx = context self._doc = document log.info("Loaded asset.", extra=dict(asset=repr(docum...
parent = self._doc
Given the code snippet: <|code_start|># encoding: utf-8 log = __import__('logging').getLogger(__name__) @signal(pre_delete) def remove_children(sender, document, **kw): <|code_end|> , generate the next line using the imports in this file: from itertools import chain from operator import __or__ from functools impo...
document.empty()
Given the following code snippet before the placeholder: <|code_start|> def test_dehumming_improve_snr(): # Test that dehumming removes the added noise rng = np.random.RandomState(0) fs = 250. enf = 50. <|code_end|> , predict the next line using imports from the current file: import numpy as np from ...
clean = rng.randn(512)
Here is a snippet: <|code_start|> def test_dehumming_improve_snr(): # Test that dehumming removes the added noise rng = np.random.RandomState(0) fs = 250. enf = 50. clean = rng.randn(512) noisy = clean.copy() # add ENF noise time = np.arange(512) / float(fs) for harmonic in (1, 2)...
noisy += np.sin(time * 2 * np.pi * enf * harmonic) / harmonic
Next line prediction: <|code_start|> def test_dehumming_improve_snr(): # Test that dehumming removes the added noise rng = np.random.RandomState(0) fs = 250. enf = 50. clean = rng.randn(512) noisy = clean.copy() # add ENF noise <|code_end|> . Use current file imports: (import numpy as np...
time = np.arange(512) / float(fs)
Predict the next line after this snippet: <|code_start|> def twice(a): return 2 * a def test_fake_parallel(): # Test that _FakeParallel does nothing but unrolling the generator generator = (twice(b) for b in range(10)) results = _FakeParallel(n_jobs=1)(generator) reference = [twice(b) for b in r...
def test_fake_delayed():
Given the code snippet: <|code_start|> def twice(a): return 2 * a def test_fake_parallel(): # Test that _FakeParallel does nothing but unrolling the generator generator = (twice(b) for b in range(10)) results = _FakeParallel(n_jobs=1)(generator) reference = [twice(b) for b in range(10)] asse...
def test_fake_delayed():
Given snippet: <|code_start|> def twice(a): return 2 * a def test_fake_parallel(): # Test that _FakeParallel does nothing but unrolling the generator <|code_end|> , continue by predicting the next line. Consider current file imports: import numpy as np from pactools.utils.parallel import _FakeParallel, _fa...
generator = (twice(b) for b in range(10))
Here is a snippet: <|code_start|> low_fq_range = [1., 3., 5., 7.] high_fq_range = [25., 50., 75.] n_low = len(low_fq_range) n_high = len(high_fq_range) n_points = 1024 def simulate_pac_default(n_points=128, fs=200., high_fq=50., low_fq=3., low_fq_width=1., noise_level=0.1, random_state=42, <...
*args, **kwargs):
Continue the code snippet: <|code_start|> low_fq_range = [1., 3., 5., 7.] high_fq_range = [25., 50., 75.] n_low = len(low_fq_range) n_high = len(high_fq_range) n_points = 1024 def simulate_pac_default(n_points=128, fs=200., high_fq=50., low_fq=3., low_fq_width=1., noise_level=0.1, random_sta...
*args, **kwargs):
Predict the next line after this snippet: <|code_start|> def test_progress_bar(): n = 10 app = ProgressBar(title='Testing progressBar', max_value=n - 1, spinner=True) assert_false(app.closed) for k in range(n): app.update_with_increment_value(1) <|code_end|> using the cu...
time.sleep(0.001)
Based on the snippet: <|code_start|> def test_progress_bar(): n = 10 app = ProgressBar(title='Testing progressBar', max_value=n - 1, spinner=True) assert_false(app.closed) for k in range(n): app.update_with_increment_value(1) time.sleep(0.001) assert_true(app....
n = 10
Continue the code snippet: <|code_start|> def test_norm(): # Test that norm and squared_norm are consistent rng = np.random.RandomState(0) for sig in (rng.randn(10), rng.randn(4, 3), [1 + 1j, 3, 6], -9): assert_array_almost_equal(norm(sig) ** 2, squared_norm(sig)) def test_argmax_2d(): # Tes...
def test_is_power2():
Continue the code snippet: <|code_start|> def test_norm(): # Test that norm and squared_norm are consistent rng = np.random.RandomState(0) for sig in (rng.randn(10), rng.randn(4, 3), [1 + 1j, 3, 6], -9): assert_array_almost_equal(norm(sig) ** 2, squared_norm(sig)) def test_argmax_2d(): # Tes...
a = rng.randn(4, 3)
Given snippet: <|code_start|> def test_norm(): # Test that norm and squared_norm are consistent rng = np.random.RandomState(0) for sig in (rng.randn(10), rng.randn(4, 3), [1 + 1j, 3, 6], -9): assert_array_almost_equal(norm(sig) ** 2, squared_norm(sig)) def test_argmax_2d(): # Test that argma...
def test_prime_factors():
Based on the snippet: <|code_start|> def test_norm(): # Test that norm and squared_norm are consistent rng = np.random.RandomState(0) for sig in (rng.randn(10), rng.randn(4, 3), [1 + 1j, 3, 6], -9): assert_array_almost_equal(norm(sig) ** 2, squared_norm(sig)) def test_argmax_2d(): # Test tha...
def test_is_power2():
Continue the code snippet: <|code_start|> def test_norm(): # Test that norm and squared_norm are consistent rng = np.random.RandomState(0) for sig in (rng.randn(10), rng.randn(4, 3), [1 + 1j, 3, 6], -9): assert_array_almost_equal(norm(sig) ** 2, squared_norm(sig)) def test_argmax_2d(): # Tes...
def test_is_power2():
Using the snippet: <|code_start|> def test_norm(): # Test that norm and squared_norm are consistent rng = np.random.RandomState(0) for sig in (rng.randn(10), rng.randn(4, 3), [1 + 1j, 3, 6], -9): assert_array_almost_equal(norm(sig) ** 2, squared_norm(sig)) def test_argmax_2d(): # Test that a...
def test_is_power2():
Using the snippet: <|code_start|> self.assertIsInstance(exception_log, ExceptionLog) try: 0.0 // 0.0 except Exception as e: exception = e self.assertEqual(exception.__class__.__name__, exception_log.type) self.assertEqual(exception.__class__.__module__, e...
self.assertIsNone(result.execution)
Given the code snippet: <|code_start|> @python_2_unicode_compatible class Operator(NodeAccessor): operator = models.CharField(_('Operator'), null=False, max_length=3) operator_table = {} def _check_operator(self): if self.operator not in self.operator_table: raise TypeError('Incor...
abstract = True
Next line prediction: <|code_start|> fftabs.py -t | --title fftabs.py (-f | --focus) ID fftabs.py --count fftabs.py --current fftabs.py (-c | -k | --close) ID... fftabs.py -r | --raw fftabs.py -h | --help fftabs.py -V | --version Options: -a --all List all tabs in a readable format. -u --ur...
A command line program for manipulating Firefox tabs.
Using the snippet: <|code_start|>#!/usr/bin/env python3 """ print the content of the clipboard to the standard output Last update: 2017-01-08 (yyyy-mm-dd) """ fs.check_if_available(cfg.XSEL, "Error: {} is not available!".format(cfg.XSEL)) def print_help(): print(""" Usage: {0} [options] <|code_end|> , deter...
Options:
Here is a snippet: <|code_start|>#!/usr/bin/env python3 """ print the content of the clipboard to the standard output Last update: 2017-01-08 (yyyy-mm-dd) """ fs.check_if_available(cfg.XSEL, "Error: {} is not available!".format(cfg.XSEL)) def print_help(): print(""" Usage: {0} [options] Options: -h, --h...
-2 read from secondary clipboard
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python3 """ A simple script that changes the character encoding of the input file to UTF-8. The result is printed to the screen. Last update: 2017-12-16 (yyyy-mm-dd) """ fs.check_if_available(cfg.FILE, "Error: {} is not available!".format(cfg....
-f force conversion (even if the input is in UTF-8)
Given the code snippet: <|code_start|>#!/usr/bin/env python3 """ A simple script that changes the character encoding of the input file to UTF-8. The result is printed to the screen. Last update: 2017-12-16 (yyyy-mm-dd) """ fs.check_if_available(cfg.FILE, "Error: {} is not available!".format(cfg.FILE)) fs.check_if...
-h, --help this help
Based on the snippet: <|code_start|> return name + 'text' @web.resource def chat(self, room: str): return Chat(room) class Chat(web.Resource): def __init__(self, room): self.room = room @web.endpoint ...
data = json.dumps((args[0], {},) + args[1:]).encode('utf-8')
Given the code snippet: <|code_start|> return list(self._dic[k]) def __contains__(self, k): return k in self._dic def __iter__(self): for k in self._dic: yield k def __len__(self): return len(self._dic) class Request(object): __slots__ = ('__dict__', ...
arguments.update(parse_qsl(self.parsed_uri.query))
Predict the next line after this snippet: <|code_start|> def getlist(self, k): return list(self._dic[k]) def __contains__(self, k): return k in self._dic def __iter__(self): for k in self._dic: yield k def __len__(self): return len(self._dic) class Request...
if hasattr(self, 'uri'):
Using the snippet: <|code_start|> self.query_data({'hello': 'world'})) self.assertEqual([ {'hello': 'world'}, {'hello': 'anyone'}, ], self.query_data({})) @passive def test_update(self): self.c.clean() self.c.insert({'test1': 1}) se...
unittest.main()
Using the snippet: <|code_start|> def setUp(self): super().setUp() self.m = zorro.mongodb.Connection() self.c = self.m['test']['test_collection'] def query_data(self, *args, **kw): lst = list(self.c.query(*args, **kw)) for i in lst: i.pop('_id') return lst class...
with self.assertRaises(self.z.channel.PipeError):
Given the following code snippet before the placeholder: <|code_start|> self.hub.do_spawn(lambda: f.set('hello')) self.assertEquals(f.get(), 'hello') @passive def test_future_user_to(self): f = self.z.Future() self.hub.do_spawn(lambda: (self.z.sleep(0.1), f.set('hello'))) ...
cond = self.z.Condition()
Here is a snippet: <|code_start|> class Core(Test): test_timeout = 0.25 @passive def test_future_cb_simple(self): f = self.z.Future(lambda:123) self.assertEquals(f.get(), 123) @passive def test_future_cb_to(self): f = self.z.Future(lambda:(self.z.sleep(0.1),234)) s...
def test_future_timeo_raised(self):
Predict the next line for this snippet: <|code_start|> self.wfile.flush() def do_FETCH(self): self.send_response(200) self.send_header('Transfer-Encoding', 'chunked') self.end_headers() self.wfile.write(b'5\r\nHELLO\r\n0\r\n\r\n') self.wfile.flush() class Simple(Tes...
def test_fetch(self):
Given the following code snippet before the placeholder: <|code_start|> self.m = zorro.mysql.Mysql() class Simple(Mysql): @passive def test_basic(self): self.m.execute('drop table if exists test') self.m.execute('create table test (id int)') self.assertEqual(self.m.execute( ...
+ ',(?)'*24, *((1,)+(None,)*24)), (0, 25))
Based on the snippet: <|code_start|> ]), ['OK', 11, 1]) @passive def test_keys(self): self.r.execute('DEL', 'test:big') self.assertEqual(self.r.execute('SET', 'test:key1', 'value'), 'OK') self.assertEqual(self.r.execute('SET', 'test:key2', 'value'), 'OK') self.assertE...
old = time.time()
Predict the next line after this snippet: <|code_start|> def test_bulk(self): self.assertEquals(self.r.bulk([ ('MULTI',), ('SET', 'test:key1', '10'), ('INCR', 'test:key1'), ('DEL', 'test:key1'), ('EXEC',), ]), ['OK', 11, 1]) @passiv...
test_timeout = 10
Predict the next line after this snippet: <|code_start|> class Unix(PipelinedReqChannel): BUFSIZE = 1024 def __init__(self, unixsock='/var/run/collectd-unixsock'): self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self._sock.setblocking(0) self._cur_producing = [] ...
res = tuple(self._cur_producing)
Continue the code snippet: <|code_start|> elif e.errno in (errno.EPIPE, errno.ECONNRESET): raise EOFError() else: raise while True: idx = buf.find(b'\n', pos) if idx < 0: break ...
interval=interval, time=time).get()
Next line prediction: <|code_start|> def channel(self): if not self._channel: with self._channel_lock: if not self._channel: self._channel = Unix(unixsock=self.unixsock) return self._channel def putval(self, identifier, values, interval=None, time...
def flush(self, timeout=None, plugin=None, identifier=None):
Predict the next line for this snippet: <|code_start|> self.send_response(200) self.send_header('Transfer-Encoding', 'chunked') self.end_headers() self.wfile.write(b'5\r\nHELLO\r\n0\r\n\r\n') self.wfile.flush() class Simple(Test): def do_request(self): self.z.sleep(...
self.thread.join(1)
Continue the code snippet: <|code_start|> class RequestHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header('Content-Length', '5') self.end_headers() self.wfile.write(b'HELLO') self.wfile.flush() def do_FETCH(self): ...
self.wfile.flush()
Next line prediction: <|code_start|> class TestBson(unittest.TestCase): def test_loads(self): data = b"\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00" self.assertEqual({"hello": "world"}, bson.loads(data)) data = (b"1\x00\x00\x00\x04BSON\x00&\x00\x00\x00\x020\x00\x08\x00\x00" ...
data = {"BSON": ["awesome", 5.05, 1986]}
Continue the code snippet: <|code_start|> __all__ = [ 'Zorrolet', 'Hub', 'gethub', 'Future', 'Condition', 'Lock', ] FUTURE_EXCEPTION = marker_object('FUTURE_EXCEPTION') FUTURE_PENDING = marker_object('FUTURE_PENDING') os_errors = (IOError, OSError) class TimeoutError(Exception): pa...
class WaitingError(Exception):