Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Continue the code snippet: <|code_start|> class TestH5Utils(unittest.TestCase): @withfile def test_hdfopen(self, F): attr = 'test' v1, v2 = 5, 6 for group in [None, 'g']: with hdfopen(F, group, replace=True) as f: f.attrs[attr] = v1 assert os.p...
clear_h5_group(f)
Predict the next line for this snippet: <|code_start|> def read_ml_analyzed(path): """read from the legacy matlab files""" mat = loadmat(path, squeeze_me=True) # ignore variables other than the following cols = ['filelist_all', 'looktime', 'minproctime', 'ml_analyzed', 'runtime'] # convert to data...
s = SCHEMA_VERSION_1
Using the snippet: <|code_start|> ml_analyzed, look_time, run_time = ma(row) if ml_analyzed <= 0: row = adc.iloc[-2] run_time = row[s.ADC_TIME] nz = adc[s.RUN_TIME].to_numpy().nonzero()[0] mode_inhibit_time = stats.mode(np.diff(adc[s.INHIBIT_TIME].iloc[nz]))[0][0] last...
elif s is SCHEMA_VERSION_2:
Given snippet: <|code_start|> class TestHdr(unittest.TestCase): def test_hdr(self): for b in list_test_bins(): h = b.headers <|code_end|> , continue by predicting the next line. Consider current file imports: import unittest from ifcb.data.files import DataDirectory from .fileset_info import list_test_bins, TES...
eh = TEST_FILES[b.lid]['headers']
Based on the snippet: <|code_start|> Also supports an "adc" property that is a Pandas DataFrame containing ADC data. Subclasses are required to provide this. The default dictlike implementation uses that property. Context manager support is provided for implementations that must open files or other...
return SCHEMA[self.pid.schema_version]
Given the code snippet: <|code_start|> def _get_ml_analyzed(self): return compute_ml_analyzed(self) @property def ml_analyzed(self): ma, _, _ = self._get_ml_analyzed() return ma @property def look_time(self): _, lt, _ = self._get_ml_analyzed() return lt @pr...
return self.header(TEMPERATURE)
Based on the snippet: <|code_start|> def ml_analyzed(self): ma, _, _ = self._get_ml_analyzed() return ma @property def look_time(self): _, lt, _ = self._get_ml_analyzed() return lt @property def run_time(self): _, _, rt = self._get_ml_analyzed() return ...
return self.header(HUMIDITY)
Given the following code snippet before the placeholder: <|code_start|> """ return self.pid.timestamp @property def schema(self): return SCHEMA[self.pid.schema_version] # context manager default implementation def __enter__(self): return self def __exit__(self, *args):...
return compute_ml_analyzed(self)
Using the snippet: <|code_start|> class TestListUtils(unittest.TestCase): def setUp(self): self.data_dir = data_dir() def test_list_data_dirs(self): <|code_end|> , determine the next line of code. You have imports: import unittest import os import sys import numpy as np from ifcb.data import files fr...
for dd in files.list_data_dirs(self.data_dir):
Given snippet: <|code_start|> TARGET_ML_ANALYZED = { 'IFCB5_2012_028_081515': (0.003391470833333334, 0.8139530000000001, 1.251953), 'D20130526T095207_IFCB013': (5.080841170833334, 1219.401881, 1231.024861) } class TestMlAnalyzed(unittest.TestCase): def test_ml_analyzed(self): <|code_end|> , continue by ...
for b in list_test_bins():
Next line prediction: <|code_start|> TARGET_ML_ANALYZED = { 'IFCB5_2012_028_081515': (0.003391470833333334, 0.8139530000000001, 1.251953), 'D20130526T095207_IFCB013': (5.080841170833334, 1219.401881, 1231.024861) } class TestMlAnalyzed(unittest.TestCase): def test_ml_analyzed(self): for b in lis...
result = compute_ml_analyzed(b)
Predict the next line after this snippet: <|code_start|> SL_BIN_LID = 'IFCB5_2012_028_081515' SL_MEDIAN = np.array([[205, 205, 205, 205, 205], [207, 204, 207, 205, 204], [206, 206, 211, 204, 205], [205, 205, 205, 205, 205], [205, 205, 205, 205, 205]]) SL_MEAN = np.array([[202, 202, 202, 20...
b = get_fileset_bin(SL_BIN_LID)
Continue the code snippet: <|code_start|> [ 27, 27, 27, 27, 27]]) SQ = np.array([[206, 205, 204, 206, 204], [205, 204, 208, 205, 203], [204, 203, 215, 204, 204], [206, 204, 159, 207, 205], [206, 204, 205, 206, 205]]) @unittest.skip('deprecated feature') class TestSquare(unittest....
sl = square_letterboxed(self.img, size=5)
Based on the snippet: <|code_start|>SL_MEDIAN = np.array([[205, 205, 205, 205, 205], [207, 204, 207, 205, 204], [206, 206, 211, 204, 205], [205, 205, 205, 205, 205], [205, 205, 205, 205, 205]]) SL_MEAN = np.array([[202, 202, 202, 202, 202], [207, 204, 207, 205, 204], [206, 206...
sq = square(self.img, size=5)
Given the code snippet: <|code_start|> [207, 204, 207, 205, 204], [206, 206, 211, 204, 205], [202, 202, 202, 202, 202], [202, 202, 202, 202, 202]]) SL_27 = np.array([[ 27, 27, 27, 27, 27], [207, 204, 207, 205, 204], [206, 206, 211, 204, 205], [ 27, 27, 27, 27, 27...
assert sq.shape[0] == SQUARE_DEFAULT_SIZE
Given the following code snippet before the placeholder: <|code_start|> class TestMatBin(unittest.TestCase): @withfile def test_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: <|code_end|> , predict the next line using imports from the current file: import unittest ...
bin2mat(out_bin, path)
Predict the next line for this snippet: <|code_start|> class TestMatBin(unittest.TestCase): @withfile def test_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: bin2mat(out_bin, path) <|code_end|> with the help of current file imports: import unittest...
with MatBin(path) as in_bin:
Continue the code snippet: <|code_start|> class TestMatBin(unittest.TestCase): @withfile def test_roundtrip(self, path): <|code_end|> . Use current file imports: import unittest from ifcb.data.matlab import bin2mat, MatBin from ifcb.tests.utils import withfile from .fileset_info import list_test_bins from ....
for out_bin in list_test_bins():
Using the snippet: <|code_start|> class TestMatBin(unittest.TestCase): @withfile def test_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: bin2mat(out_bin, path) with MatBin(path) as in_bin: <|code_end|> , determine the next line of cod...
assert_bin_equals(in_bin, out_bin)
Given snippet: <|code_start|> :param height: the height of the image in pixels :returns array-like: an 8-bit 2d image """ length = width * height inroi.seek(byte_offset) pixel_values = inroi.read(length) return np.frombuffer(pixel_values, dtype=np.uint8).reshape((width,height)) class RoiFil...
self.adc = AdcFile(adc)
Given the code snippet: <|code_start|>""" Support for reading images from IFCB ``.roi`` files. """ def read_image(inroi, byte_offset, width, height): """ Read an image from raw 8-bit binary data. :param inroi: an open file in binary read mode :param byte_offset: the position in the file to seek to ...
class RoiFile(BaseDictlike):
Given the code snippet: <|code_start|> PACKED = { 'IFCB5_2012_028_081515': { 'y': [0, 0, 137, 182, 182], 'x': [0, 238, 0, 0, 105], 'roi_number': [2, 3, 6, 5, 1] }, 'D20130526T095207_IFCB013': { 'y': [0, 89, 171, 237, 295, 337, 403, 453, 494, 237, 171, 337, 379, 527, 453, 5...
for b in list_test_bins():
Predict the next line after this snippet: <|code_start|> PACKED = { 'IFCB5_2012_028_081515': { 'y': [0, 0, 137, 182, 182], 'x': [0, 238, 0, 0, 105], 'roi_number': [2, 3, 6, 5, 1] }, 'D20130526T095207_IFCB013': { 'y': [0, 89, 171, 237, 295, 337, 403, 453, 494, 237, 171, 337...
m = Mosaic(b, shape=(720, 1280), scale=1)
Next line prediction: <|code_start|> def _shapes(self): hs, ws, ix = [], [], [] with self.bin: ii = InfilledImages(self.bin) for target_number in ii: h, w = ii.shape(target_number) hs.append(math.floor(h * self.scale)) ws.append(...
if self.bin.schema == SCHEMA_VERSION_1:
Given snippet: <|code_start|> class Mosaic(object): def __init__(self, the_bin, shape=(600, 800), scale=0.33, bg_color=200, coordinates=None): self.bin = the_bin self.shape = shape self.bg_color = bg_color self.scale = scale self.coordinates = coordinates @lru_cache()...
ii = InfilledImages(self.bin)
Given the code snippet: <|code_start|> ALPHA = 'IFCBDTXYZ' CHARS = '0123456789_' + ALPHA class DestroyPid(object): def __init__(self, pid): self.pid = pid def insert_character(self): for d in CHARS: for i in range(len(self.pid)+1): yield self.pid[:i] + d + self.pid[i...
assert ids.unparse(Pid(pid).parsed) == pid
Given the code snippet: <|code_start|>GOOD_V1 = 'IFCB1_2000_001_123456' GOOD_V2 = 'D20000101T123456_IFCB001' GOOD = [GOOD_V1, GOOD_V2] ALPHA = 'IFCBDTXYZ' CHARS = '0123456789_' + ALPHA class DestroyPid(object): def __init__(self, pid): self.pid = pid def insert_character(self): for d in CHARS...
assert Pid(GOOD_V1).schema_version == 1, 'expected schema version 1'
Here is a snippet: <|code_start|> class TestFormatConversionAPI(unittest.TestCase): @withfile def test_hdf_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: out_bin.to_hdf(path) with open_hdf(path) as in_bin: assert_bi...
b = open_raw(adc_path)
Using the snippet: <|code_start|> class TestFormatConversionAPI(unittest.TestCase): @withfile def test_hdf_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: out_bin.to_hdf(path) <|code_end|> , determine the next line of code. You have imports: import u...
with open_hdf(path) as in_bin:
Given the code snippet: <|code_start|> class TestFormatConversionAPI(unittest.TestCase): @withfile def test_hdf_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: out_bin.to_hdf(path) with open_hdf(path) as in_bin: ass...
with open_zip(path) as in_bin:
Given the following code snippet before the placeholder: <|code_start|> class TestFormatConversionAPI(unittest.TestCase): @withfile def test_hdf_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: out_bin.to_hdf(path) with open_hdf(path) a...
with open_mat(path) as in_bin:
Predict the next line for this snippet: <|code_start|> class TestFormatConversionAPI(unittest.TestCase): @withfile def test_hdf_roundtrip(self, path): <|code_end|> with the help of current file imports: import unittest from ifcb.data.io import open_raw, open_hdf, open_zip, open_mat from ifcb.tests.utils im...
for out_bin in list_test_bins():
Given the following code snippet before the placeholder: <|code_start|> class TestFormatConversionAPI(unittest.TestCase): @withfile def test_hdf_roundtrip(self, path): for out_bin in list_test_bins(): with out_bin: out_bin.to_hdf(path) with open_hdf(path) a...
assert_bin_equals(in_bin, out_bin)
Continue the code snippet: <|code_start|> TARGET_METRICS = { 'IFCB5_2012_028_081515': { 'ml_analyzed': 0.0033914708, 'run_time': 1.251953, 'look_time': 0.813953, 'inhibit_time': 0.438, 'trigger_rate': 4.792512178971575, TEMPERATURE: 11.4799732421875, HUMIDI...
for met in list_test_bins():
Continue the code snippet: <|code_start|> TARGET_METRICS = { 'IFCB5_2012_028_081515': { 'ml_analyzed': 0.0033914708, 'run_time': 1.251953, 'look_time': 0.813953, 'inhibit_time': 0.438, 'trigger_rate': 4.792512178971575, <|code_end|> . Use current file imports: import unit...
TEMPERATURE: 11.4799732421875,
Given snippet: <|code_start|> TARGET_METRICS = { 'IFCB5_2012_028_081515': { 'ml_analyzed': 0.0033914708, 'run_time': 1.251953, 'look_time': 0.813953, 'inhibit_time': 0.438, 'trigger_rate': 4.792512178971575, TEMPERATURE: 11.4799732421875, <|code_end|> , continue by...
HUMIDITY: 32.167437512207,
Continue the code snippet: <|code_start|>""" Support for stitching IFCB revision 1 images. Note that this does not apply to data from commercial IFCB instruments. """ ### Stitching <|code_end|> . Use current file imports: from functools import lru_cache from scipy import ndimage as ndi from .utils import BaseDict...
class Stitcher(BaseDictlike):
Given snippet: <|code_start|> type = request.GET.get('type', None) filter = request.GET.get('filter', None) data["page_size"] = settings.DME_PAGE_SIZE try: if type: and_query = Q(type=type) except Exception as e: pass if filter: ...
data["total_entries"] = Element.objects.filter(query).count()
Using the snippet: <|code_start|> def get(self, request, *args, **kwargs): #NOTE: Code below must match GalleryList.get_queryset #TODO - move to helper so you don't maintain same code twice data = {} query = None and_query = None or_query = None filter = reques...
data["total_entries"] = Gallery.objects.filter(query).count()
Continue the code snippet: <|code_start|>from __future__ import unicode_literals #from django.db import connection class Example(models.Model): """ Example model that uses MediaField and RichTextField """ name = models.CharField(null=True,blank=True) <|code_end|> . Use current file imports: impor...
lead_media = MediaField()
Based on the snippet: <|code_start|>from __future__ import unicode_literals #from django.db import connection class Example(models.Model): """ Example model that uses MediaField and RichTextField """ name = models.CharField(null=True,blank=True) lead_media = MediaField() image = MediaField...
body = RichTextField()
Given the code snippet: <|code_start|> Condition: Post has no image file or video url Result: Fail with 400 error since no image or video_url is provided """ url = reverse("api-media-elements") c = Client() c.login(username="admin",password="password") response = c...
count1 = Element.objects.filter(type="image",name="test_image_upload_with_no_resize",image_url__icontains="Oxfam-Cambodia").count()
Next line prediction: <|code_start|> c = Client() c.login(username="admin",password="password") response = c.post(url, {},HTTP_X_REQUESTED_WITH='XMLHttpRequest') self.assertEqual(response.status_code, 400) @override_settings(DME_RESIZE=False) def test_image_upload_with_no_resize(...
count2 = ResizedImage.objects.filter(image__type="image",image__name="test_image_upload_with_no_resize",image__image_url__icontains="Oxfam-Cambodia").count()
Based on the snippet: <|code_start|> class MediaFormField(forms.Field): def __init__(self, name=None, required=False, widget=MediaWidget, label=None, initial=None, help_text="", max_length=None, *args, **kwargs): super(MediaFormField, self).__init__(required=required, widget=MediaWidget, label=label, initia...
def __init__(self, name=None, required=False, widget=RichTextWidget, label=None, initial=None, help_text="", max_length=None, *args, **kwargs):
Based on the snippet: <|code_start|> def parse_media(string_or_obj): """Takes a JSON string, converts it into a Media object.""" data = {} kwargs = {} kwargs["id"] = None kwargs["type"] = None kwargs["caption"] = None kwargs["credit"] = None try: if type(string_or_obj) is dict:...
elif type(string_or_obj) is Element:
Given the following code snippet before the placeholder: <|code_start|> def parse_media(string_or_obj): """Takes a JSON string, converts it into a Media object.""" data = {} kwargs = {} kwargs["id"] = None kwargs["type"] = None kwargs["caption"] = None kwargs["credit"] = None try: ...
elif type(string_or_obj) is Gallery:
Given the following code snippet before the placeholder: <|code_start|> del kwargs["blank"] return name, path, args, kwargs def db_type(self, connection): return "longtext" def from_db_value(self, value, expression, connection, context): if value is None: return valu...
defaults["form_class"] = RichTextFormField
Predict the next line after this snippet: <|code_start|># # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT S...
class DashboardApp(App):
Using the snippet: <|code_start|># BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF...
render('dashboard',
Next line prediction: <|code_start|> return value def __init__(self, filename, legend=None, description=None, lang=None, *args, **kwargs): self.config = FileConfig(filename, [('content', self.Handler())]) self.legend = legend self.description = description ...
return RegexHandler(pattern, writer, inserter=php_inserter,
Given the following code snippet before the placeholder: <|code_start|> def load(self): self.config.read() for field in self: if field.id in self.config: field.process_data(self.config[field.id]) def save(self): self.config.read() for field in self: ...
self.config = FileConfig(filename, [('content', self.Handler())])
Predict the next line for this snippet: <|code_start|> return value def __init__(self, filename, legend=None, description=None, lang=None, *args, **kwargs): self.config = FileConfig(filename, [('content', self.Handler())]) self.legend = legend self.description = ...
return RegexHandler(pattern, writer, inserter=php_inserter,
Here is a snippet: <|code_start|># LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. __all__ = [ 'settings' ] SETTINGS_FILE = os.getenv('YUBIADMIN_SETTINGS', '/etc/yubico/admi...
settings = parse(default_settings)
Predict the next line after this snippet: <|code_start|> 'apt-get -y dist-upgrade -o ' 'Dpkg::Options::="--force-confdef" -o ' 'Dpkg::Options::="--force-confold" | ' 'tee %s...
class SystemApp(App):
Continue the code snippet: <|code_start|> return self.disabled @property def dash_panels(self): if needs_restart(): yield panel('System', 'System restart required', level='danger') updates = len(get_updates()) if updates > 0: yield panel( ...
return render('/sys/general', alerts=alerts, updates=get_updates())
Based on the snippet: <|code_start|># 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # dis...
s, o = run("apt-get upgrade -s | awk -F'[][() ]+' '/^Inst/{print $2}'")
Given snippet: <|code_start|> while True: line = self.proc.stdout.readline() if line: yield line else: yield '</pre><br /><strong>Update complete!</strong>' yield '<script type="text/javascript">reload();</script>' ...
yield panel('System', 'System restart required', level='danger')
Using the snippet: <|code_start|># Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the following # conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following d...
class YubikeyKsm(App):
Predict the next line after this snippet: <|code_start|># INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRAC...
dbform = DBConfigForm('/etc/yubico/ksm/config-db.php',
Next line prediction: <|code_start|># but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, s...
shader_manager = GlShaderManager()
Predict the next line after this snippet: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # #######################################################################...
position_shader_program_interface = GlShaderProgramInterface(uniform_blocks=('viewport',),
Given snippet: <|code_start|> def unmap_x_in(self, x): """ Return x + inf """ return x + self.inf ############################################## # Fixme: length -> size ? def length(self): """ Return sup - inf """ return self.sup - self.inf ###...
def middle(self):
Here is a snippet: <|code_start|> # Fixme: scale! positions, normals = unit_cube() colour2 = (1, 0, 0, 1) colour4 = (1, 0, 0, 1) colour8 = (1, 0, 0, 1) colour6 = (1, 0, 0, 1) colour1 = (0, 1, 0, 1) colour3 = (0, 1, 0, 1) colour7 = (0, 1, 0, 1) colour5 = (0, 1, 0, 1) colou...
return TriangleVertexArray((positions, normals, colours))
Continue the code snippet: <|code_start|> #################################################################################################### logging.basicConfig( format='\033[1;32m%(asctime)s\033[0m - \033[1;34m%(name)s.%(funcName)s\033[0m - \033[1;31m%(levelname)s\033[0m - %(message)s', level=logging.INFO,...
api_number = ApiNumber('2.1')
Predict the next line after this snippet: <|code_start|># # GLFW Callbacks # @glfw.key_callback def on_key(window, key, scancode, action, mods): if key == glfw.KEY_ESCAPE and action == glfw.PRESS: glfw.set_window_should_close(window, 1) def error_callback(error, description): raise NameError("{} {}".f...
with TimerContextManager(logging, "GlWrapper.init"):
Given the code snippet: <|code_start|> enum_name, enum_value = str(enum), int(enum) # store enumerants and commands at the same level setattr(self, enum_name, enum_value) # store enumerants in a dedicated place setattr(gl_enums, enum_name, enum_value) s...
if hasattr(PythonicWrapper, command_name):
Using the snippet: <|code_start|># but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see ...
shader_manager = GlShaderManager()
Predict the next line after this snippet: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # #######################################################################...
basic_shader_program_interface = GlShaderProgramInterface(uniform_blocks=('viewport',),
Given the code snippet: <|code_start|> for k in range(3): positions[j+k] = struct.unpack('<fff', stream.read(12)) stream.read(2) # struct.unpack('<H', stream.read(2)) # stream.seek(84) # Center the solid for i in range(3): positions...
return TriangleVertexArray((self.positions, self.normals, self.colours))
Predict the next line for this snippet: <|code_start|>MAJOR version denotes backwards incompatible changes (old dnf won't work with new transaction JSON). MINOR version denotes extending the format without breaking backwards compatibility (old dnf can work with new transaction JSON). Forwards compatibility needs to be...
msg = _('The following problems occurred while replaying the transaction from file "{filename}":').format(filename=filename)
Here is a 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 Library General Public License for more details. # # You should have received a copy o...
self.value = None if value is None else ucd(value)
Given the code snippet: <|code_start|> return '\n'.join(errstrings) def __str__(self): return self.errmap2str(self.errmap) class LockError(Error): pass class MarkingError(Error): # :api def __init__(self, value=None, pkg_spec=None): """Initialize the marking error instance."...
msg = _("Problems in request:")
Predict the next line for this snippet: <|code_start|> def __init__(self, value=None, pkg_spec=None): """Initialize the marking error instance.""" super(MarkingError, self).__init__(value) self.pkg_spec = None if pkg_spec is None else ucd(pkg_spec) def __str__(self): string = sup...
msg += "\n" + "\n".join([P_('Modular dependency problem with Defaults:',
Given snippet: <|code_start|> def _terminal_messenger(tp='write', msg="", out=sys.stdout): try: if tp == 'write': out.write(msg) elif tp == 'flush': out.flush() elif tp == 'write_flush': out.write(msg) out.flush() elif tp == 'print': ...
msg += "\n " + _("Problem") + " %d: " % i
Based on the snippet: <|code_start|> if s.startswith(prefix): return s[len(prefix):] return None def touch(path, no_create=False): """Create an empty file if it doesn't exist or bump it's timestamps. If no_create is True only bumps the timestamps. """ if no_create or os.access(path, os...
logger.critical('{}: {}'.format(type(e).__name__, ucd(e)))
Predict the next line after this snippet: <|code_start|> return modules, nsvcap return (), None def _get_latest(self, module_list): latest = None if module_list: latest = module_list[0] for module in module_list[1:]: if module.getVersio...
raise EnableMultipleStreamsException(moduleName, msg)
Given the code snippet: <|code_start|> STATE_DEFAULT = libdnf.module.ModulePackageContainer.ModuleState_DEFAULT STATE_ENABLED = libdnf.module.ModulePackageContainer.ModuleState_ENABLED STATE_DISABLED = libdnf.module.ModulePackageContainer.ModuleState_DISABLED STATE_UNKNOWN = libdnf.module.ModulePackageContainer.Mod...
logger.info(_("Ignoring unnecessary profile: '{}/{}'").format(
Given snippet: <|code_start|># Copyright (C) 2017-2018 Red Hat, Inc. # # 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; either version 2 of the License, or # (at your option) any later version. ...
MODULE_TABLE_HINT = _("\n\nHint: [d]efault, [e]nabled, [x]disabled, [i]nstalled")
Given the code snippet: <|code_start|> install_base_query = base_no_source_query.filter(nevra_strict=install_set_artifacts) error_specs = [] # add hot-fix packages hot_fix_repos = [i.id for i in self.base.repos.iter_enabled() if i.module_hotfixes] hotfix_packages = base_no_source...
[P_('Modular dependency problem:', 'Modular dependency problems:', len(errors)), msg])
Predict the next line for this snippet: <|code_start|> else: stream = self.base._moduleContainer.getDefaultStream(moduleName) if not stream or stream not in streamDict: raise EnableMultipleStreamsException(moduleName) for key in sort...
logger.error(ucd(e))
Predict the next line for this snippet: <|code_start|># # Copyright (C) 2016 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # Th...
summary = _("[deprecated, use repoquery --deplist] List package's dependencies and what packages provide them")
Given the following code snippet before the placeholder: <|code_start|> 'next', 'clean'] self.tsflags = [] self.open = True def __del__(self): # Automatically close the rpm transaction when the reference is lost self.close() def ...
_logger.error(_('The openDB() function cannot open rpm database.'))
Here is a snippet: <|code_start|> # Mapping from email address to b64 encoded public key or NoKey in case of proven nonexistence _cache = {} # type: Dict[str, Union[str, NoKey]] @staticmethod def _cache_hit(key_union, input_key_string): # type: (Union[str, NoKey], str) -> Validity ""...
msg = _("Configuration option 'gpgkey_dns_verification' requires "
Given the following code snippet before the placeholder: <|code_start|># 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; either version 2 of the License, or # (at your option) any later version. #...
_logger.debug(_('Using rpmkeys executable at %s to verify signatures'),
Given snippet: <|code_start|>from __future__ import unicode_literals logger = logging.getLogger('dnf') class RepoReader(object): def __init__(self, conf, opts): self.conf = conf self.opts = opts def __iter__(self): # get the repos from the main yum.conf file for r in self._ge...
logger.warning(_("Warning: failed loading '%s', skipping."),
Here is a snippet: <|code_start|> # Check the repo.id against the valid chars invalid = dnf.repo.repo_id_invalid(substituted_id) if invalid is not None: if substituted_id != id_: msg = _("Bad id for repo: {} ({}), byte = {} {}").format(substituted_id, id_, ...
repo.name = ucd(repo.name)
Next line prediction: <|code_start|> for i in installed: env = i.getCompsEnvironmentItem() if not env: continue result.add(env.getEnvironmentId()) return result def get(self, *patterns): res = dnf.util.Bunch() re...
raise CompsError(msg)
Based on the snippet: <|code_start|> def _get_envs(self, available, installed): result = set() if self.status & self.AVAILABLE: result.update({i.id for i in available}) if self.status & self.INSTALLED: for i in installed: env = i.getCompsEnvironmentItem...
msg = _("Module or Group '%s' is not installed.") % ucd(pat)
Predict the next line for this snippet: <|code_start|>from __future__ import unicode_literals logger = logging.getLogger("dnf") # :api :binformat CONDITIONAL = libdnf.transaction.CompsPackageType_CONDITIONAL DEFAULT = libdnf.transaction.CompsPackageType_DEFAULT MANDATORY = libdnf.transaction.CompsPackageType...
pattern = dnf.i18n.ucd(pattern)
Continue the code snippet: <|code_start|> self.progress(pkg, dnf.transaction.PKG_VERIFY, 100, 100, count, total) class ErrorTransactionDisplay(TransactionDisplay): """An RPMTransaction display that prints errors to standard output.""" def error(self, message): super(ErrorTransactionDisplay, s...
self.rpm_logger.info(ucd(msgs))
Given the following code snippet before the placeholder: <|code_start|># 02110-1301, USA. Any Red Hat trademarks that are incorporated in the # source code or documentation are not subject to the GNU General Public # License and may only be used or replicated with the express permission of # Red Hat, Inc. # # The cur...
logger.warning(_("%s is empty file"), json_path)
Continue the code snippet: <|code_start|> lst_length = len(lst) right_count = cols_count - 1 missing_items = -lst_length % right_count if not lst_length: lst = itertools.repeat('', right_count) elif missing_items: lst.extend(('',) * missing_items) lst_iter = iter(lst) return l...
col_data = [dict() for _ in rows[0]]
Given the code snippet: <|code_start|> """ name = ucd(name) cols = self.term.columns - 2 name_len = exact_width(name) if name_len >= (cols - 4): beg = end = fill * 2 else: beg = fill * ((cols - name_len) // 2) end = fill * (cols - name_l...
key = select_short_long(12, C_("short", "Name"),
Given snippet: <|code_start|> for obspo in sorted(obsoletes): appended = ' ' + _('replacing') + ' %s%s%s.%s %s\n' appended %= (hibeg, obspo.name, hiend, obspo.arch, obspo.evr) msg += appended totalmsg = totalmsg + msg ...
msg_pkgs = P_('Package', 'Packages', count)
Using the snippet: <|code_start|> continue columns[d] += norm total_width -= norm # Split the remaining spaces among each column equally, except the # last one. And put the rest into the remainder column cols -= 1 ...
return (ucd(val), width, hibeg, hiend)
Here is a snippet: <|code_start|> """ columns = list(columns) total_width = len(msg) data = [] for col_data in columns[:-1]: (val, width, hibeg, hiend) = self._col_data(col_data) if not width: # Don't count this column, invisible text msg +...
val = fill_exact_width(val, width, left=align_left,
Given the following code snippet before the placeholder: <|code_start|> columns = zip((envra, rid), columns, hi_cols) print(self.fmtColumns(columns)) def simple_name_list(self, pkg): """Print a package as a line containing its name.""" print(ucd(pkg.name)) def simple_nevra_list(...
ret = textwrap_fill(val, width=cols, initial_indent=key,
Next line prediction: <|code_start|> # | four | # ...than: # |one two three| # | f| # |our | # ...the later being what we get if we pre-allocate the last column, and # thus. the space, due to "three" overflowing it's column by 2 chars. ...
total_width -= (sum(columns) + (cols - 1) + exact_width(indent))
Predict the next line for this snippet: <|code_start|> """ name = ucd(name) cols = self.term.columns - 2 name_len = exact_width(name) if name_len >= (cols - 4): beg = end = fill * 2 else: beg = fill * ((cols - name_len) // 2) end = fill ...
key = select_short_long(12, C_("short", "Name"),
Given snippet: <|code_start|> logger.debug(_('--> Finished dependency resolution')) class CliKeyImport(dnf.callback.KeyImport): def __init__(self, base, output): self.base = base self.output = output def _confirm(self, id, userid, fingerprint, url, timestamp): def short_id(id)...
class CliTransactionDisplay(TransactionDisplay):