Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Based on the snippet: <|code_start|> if axis != -1: raise NotImplementedError( 'Only last axis supported for now. Please send a feature request.') # Normalize to array (to support broadcasting). # If inputs are static arguments (not `tf.Tensor`), use numpy arrays for # optimization (factors statical...
size: Union[None, int, Shape] = None,
Given snippet: <|code_start|> raise ValueError(f'interp input should be float32. Got: {x.dtype}') if axis != -1: raise NotImplementedError( 'Only last axis supported for now. Please send a feature request.') # Normalize to array (to support broadcasting). # If inputs are static arguments (not `tf...
a: Union[int, TensorLike],
Here is a snippet: <|code_start|> Args: split: The dataset split to load (e.g. 'train', 'train[80%:]',...) decoders: Optional decoders (e.g. to skip the image decoding) pipeline_kwargs: Additional kwargs to forward to the pipeline function. **kwargs: Kwargs to forward to `tfds.core.DatasetBu...
def frame_specs(self) -> Optional[FeatureSpecsHint]:
Based on the snippet: <|code_start|>class FrameTask(Task): """Frame task. Frame task allow to easily create pipelines based on the frame dataset. It requires to define: * `frame_specs`: Which subset of the feature specs to read. * `pipeline`: Which pre-processing to apply to the `tf.data.Dataset` object. ...
split: Tree[Split],
Using the snippet: <|code_start|>class FrameTask(Task): """Frame task. Frame task allow to easily create pipelines based on the frame dataset. It requires to define: * `frame_specs`: Which subset of the feature specs to read. * `pipeline`: Which pre-processing to apply to the `tf.data.Dataset` object. ...
split: Tree[Split],
Given snippet: <|code_start|> """Frame task. Frame task allow to easily create pipelines based on the frame dataset. It requires to define: * `frame_specs`: Which subset of the feature specs to read. * `pipeline`: Which pre-processing to apply to the `tf.data.Dataset` object. ```python ds = sunds.load...
decoders: Optional[TreeDict[tfds.decode.Decoder]] = None,
Predict the next line for this snippet: <|code_start|>class _Param(NamedTuple): """`pytest.mark.parametrize` single param.""" value: Any default: Any expected: Any @pytest.mark.parametrize( 'value, default, expected', [ _Param(False, tfds.features.Image(), {}), _Param( valu...
default=spec_dict.labeled_image(shape=(28, 28, 1)),
Next line prediction: <|code_start|> tf.constant([ [0., -2., -2], [2., 2., 2.], [8., -2., 4.], [8., -2., 4.], ]), 'ray_directions': tf.constant([ [0., 0., 23.], [1., 1., 0.], [3., 3., 0.]...
scene_boundaries = boundaries_utils.MultiSceneBoundaries(scene_ex)
Using the snippet: <|code_start|> split='train', task=sunds.tasks.Nerf( additional_frame_specs={'timestamp', 'pose'}, additional_camera_specs={'intrinsics'}, yield_mode=yield_mode, ), ) assert 'timestamp' in ds.element_spec assert 'pose' in ds.element_spec if yield...
additional_frame_specs: FeatureSpecsHint,
Based on the snippet: <|code_start|># Copyright 2022 The sunds Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
world_from_camera: isometry.Isometry,
Here is a snippet: <|code_start|> class MultiSceneBoundaries: """Lookup table across scene boundaries.""" def __init__(self, scene_boundaries: List[ArrayDict]): """Constructor. Args: scene_boundaries: List of scene examples (as numpy arrays). """ # Create the scene_name -> index id mapping ...
def get_corners(self, scene_name: TensorLike) -> Tuple[tf.Tensor, tf.Tensor]:
Predict the next line for this snippet: <|code_start|># Copyright 2022 The sunds Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
scene_boundaries = boundaries_utils.MultiSceneBoundaries(
Predict the next line after this snippet: <|code_start|># Copyright 2022 The sunds Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
specs = spec_dict.SpecDict({
Next line prediction: <|code_start|> cameras: A dict[camera_name, sunds.specs.camera_spec()] Returns: A composite `tfds` feature defining the specification of `frame` data. """ return { # A unique name 🔑 that identifies the sequence the frame is from. 'scene_name': tfds.features.Text(), ...
img_shape: Tuple[Dim, Dim] = (None, None),
Predict the next line for this snippet: <|code_start|># Copyright 2022 The sunds Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
point_cloud: FeaturesOrBool = False,
Using the snippet: <|code_start|> See `frame_info_spec()` for a lightweight version (without sensor data) of `frame` which is used to store information about all frames in a scene. Args: cameras: A dict[camera_name, sunds.specs.camera_spec()] Returns: A composite `tfds` feature defining the specificat...
category_image: LabelOrFeaturesOrBool = False,
Given the code snippet: <|code_start|> def test_fit_success(): # causal direction: x0 --> x1 --> x3 x0 = np.random.uniform(size=1000) x1 = 2.0 * x0 + np.random.uniform(size=1000) x2 = np.random.uniform(size=1000) x3 = 4.0 * x1 + np.random.uniform(size=1000) X = pd.DataFrame(np.array([x0, x1, x2...
model = ICALiNGAM()
Based on the snippet: <|code_start|>with open('requirements.txt') as f: requirements = f.readlines() requirements = [i.replace('\n', '') for i in requirements] setup( name='Hashmal', version = '0.1.0a', description='Bitcoin transaction script IDE.', url='https://github.com/mazaclub/hashmal', i...
entry_points = hashmal_entry_points,
Given the following code snippet before the placeholder: <|code_start|>known_script_formats = ['Human', 'Hex'] class HashmalMain(QMainWindow): # Signals # Emitted when the list of user's layouts changes. layoutsChanged = QtCore.pyqtSignal() def __init__(self, app): super(HashmalMain, self).__i...
chainparams.set_to_preset(active_params)
Given the following code snippet before the placeholder: <|code_start|> # Singleton instance hashmal_config = None def set_config(c): global hashmal_config hashmal_config = c def get_config(): return hashmal_config class Config(QtCore.QObject): """Wrapper for core.Config. This exists so that ...
self.conf = my_config.Config()
Based on the snippet: <|code_start|> def make_plugin(): p = Plugin(ChainParams) p.has_gui = False return p class ChainParamsObject(QtCore.QObject): """This class exists so that a signal can be emitted when chainparams presets change.""" paramsPresetsChanged = QtCore.pyqtSignal() class ChainParam...
chainparams.add_preset(preset)
Predict the next line after this snippet: <|code_start|> def on_option_changed(self, key): if key == 'enabled_plugins': new_enabled = self.config.get_option('enabled_plugins', default_plugins) # Update view if necessary. if self.enabled_plugins != new_enabled: ...
if plugin.ui.category == Category.Core:
Next line prediction: <|code_start|> form.addRow(self.create_filters_box()) form.addRow(self.view) # Controls for adding/removing variables self.new_var_key = QLineEdit() self.new_var_key.setPlaceholderText('Key') self.new_var_key.setWhatsThis('Enter the name to give the...
form.addRow(floated_buttons([self.auto_save_check, self.save_button]))
Using the snippet: <|code_start|> self.view = QTableView() self.view.setWhatsThis('This table displays the variables you have defined.') self.view.setModel(self.proxy_model) self.view.setSortingEnabled(True) self.view.sortByColumn(0, QtCore.Qt.AscendingOrder) self.view.hor...
add_var_hbox = HBox(self.new_var_key, QLabel(':'), self.new_var_value, add_var_btn)
Predict the next line for this snippet: <|code_start|> def make_plugin(): return Plugin(Variables) VariableType = namedtuple('VariableType', ('name', 'classify')) """Variable type. Attributes: name (str): Human-readable name. classify (function): Function returning whether a value has this variable type...
VariableType('Hex', is_hex),
Predict the next line after this snippet: <|code_start|> A module's make_plugin() function should return an instance of this class. """ def __init__(self, ui_class): self.ui_class = ui_class self.ui = None # name is set when the entry point is loaded. self.name = '' ...
self.config = config.get_config()
Next line prediction: <|code_start|> class UtilsTest(unittest.TestCase): def test_is_hex(self): hex_tests = ( ('0x0', True), ('0x00', True), ('0', True), ('00', True), ('f', True), ('x', False), ('0x', False), ) ...
self.assertEqual(expected, utils.is_hex(value))
Predict the next line for this snippet: <|code_start|> description = '\n'.join([ 'Address Encoder encodes/decodes addresses with version bytes (blockchain identifiers).', 'Addresses are decoded into their 20-byte RIPEMD-160 hashes.' ]) category = Category.Key def __init__(self, h...
self.address_line.setFont(monospace_font)
Continue the code snippet: <|code_start|> form = QFormLayout() form.setRowWrapPolicy(QFormLayout.WrapAllRows) self.address_line = QLineEdit() self.address_line.setWhatsThis('Enter a cryptocurrency address in this field to decode it into its raw format.') self.address_line.setFont...
sep = Separator()
Based on the snippet: <|code_start|> class ChainparamsComboBox(QComboBox): """ComboBox for selecting chainparams presets. Separated from SettingsDialog so it can be used elsewhere. """ paramsChanged = pyqtSignal() def __init__(self, main_window, parent=None): super(ChainparamsComboBox, sel...
preset_names = [i.name for i in chainparams.get_presets()]
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- def test_read_spec(): for api_level in defaults.API_LEVELS: base_path = '/api/{}/{}'.format(settings.API_VERSION, api_level) for ext in ('yaml', 'json'): <|code_end|> , generate the next line using the imports in this file: import os ...
spec = utils.read_spec(api_level, ext=ext)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- @pytest.fixture(scope="module") def specs(): data = {} <|code_end|> . Write the next line using the current file imports: import json import pytest import requests from scalrctl import defaults, examples and context from other files: # Path: scalrctl/d...
for api_level in defaults.API_LEVELS:
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- @pytest.fixture(scope="module") def specs(): data = {} for api_level in defaults.API_LEVELS: <|code_end|> , predict the immediate next line with the help of imports: import json import pytest import requests from scalrctl import defaults, examples...
data[api_level] = json.loads(examples._read_spec(api_level))
Given the following code snippet before the placeholder: <|code_start|> :param required: controls if this is optional or not. :param default: the default value if omitted. This can also be a callable, in which case it's invoked when the default is needed without any argum...
self.type = convert_type(type, default)
Predict the next line after this snippet: <|code_start|> else: prompt_text = prompt self.prompt = prompt_text self.confirmation_prompt = confirmation_prompt self.hide_input = hide_input self.hidden = hidden # Flags if is_flag is None: if fl...
self.type = IntRange(min=0)
Given the code snippet: <|code_start|> multiple=False, count=False, allow_from_autoenv=True, type=None, help=None, hidden=False, **attrs): default_is_missing = attrs.get('default', _missing) is _missing Parameter.__init__(self, param_decls, type=type, **attrs) i...
self.type = BOOL
Given the code snippet: <|code_start|> row.append('') if row: rows.append(row) pagination = response_json.get("pagination", None) pagenum_last, current_pagenum = 1, 1 if pagination: url_last = pagination.get('last', None) if url_last: number = ...
template = '\x1b[1m%s\x1b[0m' if settings.colored_output else "%s"
Here is a snippet: <|code_start|> port (int): port number is_auth (bool): server requires authentication username (str): server auth username password (str): server auth password is_tls (bool): use TLS mode """ msg = MIMEMultipart() msg['From'] = send_from msg['To'...
class PictureMailer(WorkerTask):
Predict the next line after this snippet: <|code_start|># it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOU...
for state in self._comm.iter(Workers.GUI):
Given snippet: <|code_start|> app_name = 'widgets' urlpatterns = [ url(r'^$', MapWidgetListView.as_view(), name="list"), <|code_end|> , continue by predicting the next line. Consider current file imports: from django.conf.urls import url from .views import MapWidgetListView, PointFieldGoogleWidgetView, PointFiel...
url(r'^google-point-widget/$', PointFieldGoogleWidgetView.as_view(), name="google-point"),
Given the following code snippet before the placeholder: <|code_start|> app_name = 'widgets' urlpatterns = [ url(r'^$', MapWidgetListView.as_view(), name="list"), url(r'^google-point-widget/$', PointFieldGoogleWidgetView.as_view(), name="google-point"), url(r'^google-point-static-widget/$', <|code_end|> ,...
PointFieldGoogleStaticWidgetView.as_view(),
Given snippet: <|code_start|> app_name = 'widgets' urlpatterns = [ url(r'^$', MapWidgetListView.as_view(), name="list"), url(r'^google-point-widget/$', PointFieldGoogleWidgetView.as_view(), name="google-point"), url(r'^google-point-static-widget/$', PointFieldGoogleStaticWidgetView.as_view(), ...
PointFieldGoogleStaticOverlayWidgetView.as_view(),
Based on the snippet: <|code_start|> class MapWidgetListView(TemplateView): template_name = "widgets/widget_list.html" class PointFieldGoogleWidgetView(FormView): template_name = "widgets/google_point_widget.html" <|code_end|> , predict the immediate next line with the help of imports: from django.views.ge...
form_class = PointFieldCreateForm
Next line prediction: <|code_start|> if not isinstance(mw_settings.GoogleStaticMapMarkerSettings, dict): # pragma: no cover raise TypeError('GoogleStaticMapMarkerSettings must be a dictionary.') return mw_settings.GoogleStaticMapMarkerSettings def get_point_field_params(self, latitude,...
return static(STATIC_MAP_PLACEHOLDER_IMAGE)
Given snippet: <|code_start|> class BasePointFieldMapWidget(BaseGeometryWidget): settings_namespace = None settings = None def __init__(self, *args, **kwargs): attrs = kwargs.get('attrs') self.attrs = {} for key in ('geom_type', 'map_srid', 'map_width', 'map_height', 'display_raw'):...
custom_settings = MapWidgetSettings(app_settings=self.settings)
Predict the next line after this snippet: <|code_start|> class StreetInline(admin.TabularInline): model = Street formfield_overrides = { <|code_end|> using the current file's imports: import mapwidgets from django.contrib import admin from django.contrib.gis.db import models from .models import PointField,...
models.PointField: {"widget": mapwidgets.GooglePointFieldWidget}
Given the following code snippet before the placeholder: <|code_start|> class WidgetSettingsTests(TestCase): def test_default_settings_values(self): mw_settings = MapWidgetSettings() with override_settings(MAP_WIDGETS={}): <|code_end|> , predict the next line using imports from the current file: ...
google_point_widget_default_settings = OrderedDict(DEFAULTS["GooglePointFieldWidget"])
Given the following code snippet before the placeholder: <|code_start|>try: except ImportError: try: except ImportError: GOOGLE_MAP_API_KEY = os.environ.get("TEST_GOOGLE_MAP_API_KEY", test_app_settings.GOOGLE_MAP_API_KEY) DJANGO_DEFAULT_SRID_VALUE = 4326 GOOGLE_MAP_DEFAULT_SRID_VALUE = 4326 class GooglePointWidg...
reload_module(mw_widgets)
Given snippet: <|code_start|> def test_widget_with_default_settings(self): """ Test the widget with default settings which is defined in django settings file """ zoom = 13 map_size = "200x200" widget_settings = { "GoogleStaticMapWidget": ( ...
self.assertIn(html_escape(map_image_url), result)
Given snippet: <|code_start|> Test the widget with default settings which is defined in django settings file """ zoom = 15 default_map_center = [51.5073509, -0.12775829999] widget_settings = { "GooglePointFieldWidget": ( ("zoom", zoom), ...
self.assertIn(get_textarea_html(widget_html_elem_id, widget_html_elem_name, point), result)
Continue the code snippet: <|code_start|> def api(self): """ Return a list of API specifications to be used by auto-suggest and call tips. """ return [] def start(self): """ Start debugging the current script. """ # Grab the Python file. ...
venv.interpreter, tab.path, cwd, debugger=True, envars=envars
Continue the code snippet: <|code_start|> "ussl", "ustruct", "utime", "uzlib", "_thread", "btree", "framebuf", "machine", "micropython", "network", "ucryptolib", "uctypes", "pyb", "lcd160cr", } def ac...
if CHARTS:
Given the following code snippet before the placeholder: <|code_start|> of the new child Python process. If running on Darwin, ensure that the correct encoding for the Python environment is used (Flask stop and complain about a misconfigured Python 3 using an ASCII encoding). """ mock_process = ...
expected_encoding = "{}.utf-8".format(i18n.language_code)
Continue the code snippet: <|code_start|> """ Check the correct stylesheet values are being set. """ di = mu.interface.panes.DebugInspector() di.setStyleSheet = mock.MagicMock() di.set_font_size(16) style = di.setStyleSheet.call_args[0][0] assert "font-size: 16pt;" in style assert "fo...
@pytest.mark.skipif(not CHARTS, reason="QtChart unavailable")
Predict the next line after this snippet: <|code_start|> jw.on_append_text.emit.assert_called_once_with("hello".encode("utf-8")) def test_JupyterREPLPane_set_font_size(): """ Check the new point size is succesfully applied. """ jw = mu.interface.panes.JupyterREPLPane() jw.set_font_size(16) ...
assert jw.style_sheet == DAY_STYLE
Given snippet: <|code_start|> def test_JupyterREPLPane_set_zoom(): """ Ensure the expected font point size is set from the zoom size. """ jw = mu.interface.panes.JupyterREPLPane() jw.set_font_size = mock.MagicMock() jw.set_zoom("xxl") jw.set_font_size.assert_called_once_with( mu.int...
assert jw.style_sheet == NIGHT_STYLE
Predict the next line for this snippet: <|code_start|> mu.interface.panes.PANE_ZOOM_SIZES["xxl"] ) def test_JupyterREPLPane_set_theme_day(): """ Make sure the theme is correctly set for day. """ jw = mu.interface.panes.JupyterREPLPane() jw.set_theme("day") assert jw.style_sheet == D...
assert jw.style_sheet == CONTRAST_STYLE
Predict the next line for this snippet: <|code_start|> # Valid links links = [] # Iterate over each of the urls attached to the event for url in event.mimeData().urls(): # Check the url is to a local file # (not a webpage for example) ...
font = Font().load()
Using the snippet: <|code_start|> # click handler to ignore clicks on this margin: self.connect_margin. self.setMarginWidth(4, 8) self.setMarginSensitivity(4, True) # Indicators self.setIndicatorDrawUnder(True) for type_ in self.check_indicators: self.indicator...
def set_theme(self, theme=DayTheme):
Given snippet: <|code_start|> else: return None return " ".join(kws) class CssLexer(QsciLexerCSS): """ Fixes problems with comments in CSS. """ def description(self, style): """ Ensures "Comment" is returned when the lexer encounters a comment (this ...
def __init__(self, path, text, newline=NEWLINE):
Based on the snippet: <|code_start|> call_args = mock_shutil.rmtree.call_args_list assert call_args[0][0][0] == os.path.join("foo", "bar") assert call_args[1][0][0] == os.path.join("foo", "bin") pd.end_state.assert_called_once_with() @pytest.mark.skip( reason="Superseded probably by nto...
venv = virtual_environment.VirtualEnvironment(".")
Based on the snippet: <|code_start|> If python_args is given, these are passed as arguments to the Python interpreter used to launch the child process. """ self.is_interactive = interactive if not envars: # Envars must be a dict if not passed a value. envars = {} ...
encoding = "{}.utf-8".format(language_code)
Predict the next line for this snippet: <|code_start|> Override base setFocus so the focus happens to the embedded _control within this widget. """ self._control.setFocus() VT100_RETURN = b"\r" VT100_BACKSPACE = b"\b" VT100_DELETE = b"\x1B[\x33\x7E" VT100_UP = b"\x1B[A" VT100_DOWN = b"\...
self.setFont(Font().load())
Based on the snippet: <|code_start|> "s": 10, "m": 14, "l": 16, "xl": 18, "xxl": 24, "xxxl": 28, } class JupyterREPLPane(RichJupyterWidget): """ REPL = Read, Evaluate, Print, Loop. Displays a Jupyter iPython session. """ on_append_text = pyqtSignal(bytes) def __init__...
def set_font_size(self, new_size=DEFAULT_FONT_SIZE):
Continue the code snippet: <|code_start|> Ensures appended text is emitted as a signal with associated bytes. """ super()._append_plain_text(text, *args, **kwargs) self.on_append_text.emit(text.encode("utf-8")) def set_font_size(self, new_size=DEFAULT_FONT_SIZE): """ ...
self.style_sheet = DAY_STYLE
Given snippet: <|code_start|> def _append_plain_text(self, text, *args, **kwargs): """ Ensures appended text is emitted as a signal with associated bytes. """ super()._append_plain_text(text, *args, **kwargs) self.on_append_text.emit(text.encode("utf-8")) def set_font_si...
self.style_sheet = NIGHT_STYLE
Predict the next line for this snippet: <|code_start|> super().__init__(parent) self.set_theme(theme) self.console_height = 10 def _append_plain_text(self, text, *args, **kwargs): """ Ensures appended text is emitted as a signal with associated bytes. """ supe...
self.style_sheet = CONTRAST_STYLE
Based on the snippet: <|code_start|> "sys", "terminalio", "time", "touchio", "uheap", "usb_cdc", "usb_hid", "usb_midi", "ustack", "vectorio", "watchdog", "wifi", "wiznet", "zlib", } def actions(self):...
if CHARTS:
Predict the next line for this snippet: <|code_start|> wd = super().workspace_dir() if self.connected: m = _("Could not find an attached CircuitPython device.") info = _( "Python files for CircuitPython devices" " are stored ...
return Device(
Using the snippet: <|code_start|>#!/usr/bin/env python3 """This is a test program for testing the code out on the host.""" sysname = os.uname().sysname if sysname == 'Linux' or sysname == 'Darwin': port = '/dev/ttyUSB0' try: port = SerialPort(port, 38400) except serial.serialutil.SerialException:...
crx = CommanderRx()
Given the code snippet: <|code_start|>"""This module provides the Bus class which knows how to talk to Bioloid devices, and the BusError exception which is raised when an error is enountered. """ class BusError(Exception): """Exception which is raised when a non-successful status packet is received.""" ...
return "Rcvd Status: " + str(packet.ErrorCode(self.error_code))
Next line prediction: <|code_start|> def __init__(self, error_code, *args, **kwargs): super(BusError, self).__init__(self, *args, **kwargs) self.error_code = error_code def get_error_code(self): """Retrieves the error code associated with the exception.""" return self.error_code ...
log('Broadcasting ACTION')
Given the following code snippet before the placeholder: <|code_start|>"""This module implements the UART_Port class which talks to bioloid devices using a UART on the pyboard. """ class UART_Port: """Implements a port which can send or receive commands with a bioloid device using the pyboard UART class. Thi...
self.uart = UART(uart_num)
Given snippet: <|code_start|>"""This module implements the UART_Port class which talks to bioloid devices using a UART on the pyboard. """ class UART_GPIO_Port: """Implements a port which can send or receive commands with a bioloid device using the pyboard UART class. This class assumes that there is an ...
self.uart = UART(uart_num)
Using the snippet: <|code_start|>"""This module implements the USB_Port class which allows the pyboard to implement bioloid devices using the pyboard's USB Serial. """ class USB_Port: """Implements a port which can be used to receive bioloid device commands from a host. """ def __init__(self): <|cod...
self.usb_serial = USB_VCP()
Using the snippet: <|code_start|>#!/usr/bin/env python3 # This file tests the packet parser PREFIX = ' Prefix' class TestDumpMem(unittest.TestCase): def clear_log(self): self.log_lines = [] def log(self, str): self.log_lines.append(str) #print(str) def test_empty_buffer(self): self.clea...
dump_mem(b'', prefix=PREFIX, log=self.log)
Using the snippet: <|code_start|> context = self._get_context() context.setdefault('media_license', attrs_d) self.push('license', 1) def _end_media_license(self): license_ = self.pop('license') if license_ is not None and license_.strip(): context = self._get_cont...
self._get_context()['media_player'] = FeedParserDict(attrs_d)
Based on the snippet: <|code_start|> super(_StrictFeedParser, self).__init__() @staticmethod def _normalize_attributes(kv): k = kv[0].lower() v = k in ('rel', 'type') and kv[1].lower() or kv[1] return k, v def startPrefixMapping(self, prefix, uri): if not uri: ...
raise UndeclaredNamespace("'%s' is not associated with a namespace" % givenprefix)
Given the following code snippet before the placeholder: <|code_start|># 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 # CONTRACT, STRICT LIABILITY,...
attrs_d = FeedParserDict()
Given the following code snippet before the placeholder: <|code_start|> 'szeptember': '09', 'okt\u00f3ber': '10', # f3 in iso-8859-2 'november': '11', 'december': '12', } _hungarian_date_format_re = re.compile(r'(\d{4})-([^-]+)-(\d{,2})T(\d{,2}):(\d{2})((\+|-)(\d{,2}:\d{2}))') def _pars...
return _parse_date_w3dtf(w3dtfdate)
Predict the next line for this snippet: <|code_start|> lazy_chardet_encoding, 'utf-8', 'windows-1252', 'iso-8859-2'): if callable(proposed_encoding): proposed_encoding = proposed_encoding(data) if not proposed_encoding: continue if proposed_en...
error = CharacterEncodingOverride(
Given snippet: <|code_start|> # determine character encoding known_encoding = 0 tried_encodings = [] # try: HTTP encoding, declared XML encoding, encoding sniffed from BOM for proposed_encoding in (rfc3023_encoding, xml_encoding, bom_encoding, lazy_chardet_encoding, 'ut...
error = CharacterEncodingUnknown(
Predict the next line after this snippet: <|code_start|> and http_content_type.endswith('+xml') ) ): acceptable_content_type = 1 rfc3023_encoding = http_encoding or 'us-ascii' elif http_content_type.startswith('text/'): rfc3023_encoding = http_encoding or '...
error = NonXMLContentType(msg)
Given the following code snippet before the placeholder: <|code_start|> '\u039a\u03c5\u03c1': 'Sun', # caf5f1 in iso-8859-7 '\u0394\u03b5\u03c5': 'Mon', # c4e5f5 in iso-8859-7 '\u03a4\u03c1\u03b9': 'Tue', # d4f1e9 in iso-8859-7 '\u03a4\u03b5\u03c4': 'Wed', # d4e5f4 in iso-8859-7 '\u03a0\u03b5\u03bc': 'Thu...
return _parse_date_rfc822(rfc822date)
Continue the code snippet: <|code_start|> def _end_itunes_subtitle(self): self._end_subtitle() def _start_itunes_summary(self, attrs_d): self._start_summary(attrs_d) def _end_itunes_summary(self): self._end_summary() def _start_itunes_owner(self, attrs_d): self.inpublis...
self._get_context()['image'] = FeedParserDict({'href': attrs_d.get('href')})
Given snippet: <|code_start|> 'sep', 'oct', 'nov', 'dec', ] def _parse_date_asctime(dt): """Parse asctime-style dates. Converts asctime to RFC822-compatible dates and uses the RFC822 parser to do the actual parsing. Supported formats (format is standardized to the first one listed): ...
return _parse_date_rfc822(' '.join([
Given the code snippet: <|code_start|>from __future__ import unicode_literals # 8-bit date handling routines written by ytrewq1. _korean_year = '\ub144' # b3e2 in euc-kr _korean_month = '\uc6d4' # bff9 in euc-kr _korean_day = '\uc77c' # c0cf in euc-kr _korean_am = '\uc624\uc804' # bfc0 c0fc in euc-kr _korean_pm = '\...
return _parse_date_w3dtf(w3dtfdate)
Using the snippet: <|code_start|># # or in the "license" file accompanying this file. This file is # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. class Ba...
if not accepts_kwargs(subscriber_method):
Predict the next line after this snippet: <|code_start|># Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. Thi...
raise InvalidSubscriberMethodError(
Given the code snippet: <|code_start|># Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0...
SOCKET_ERROR,
Based on the snippet: <|code_start|> """ # If it does not exist, it must be a new file so it cannot be # a special file. if not os.path.exists(filename): return False mode = os.stat(filename).st_mode # Character special device. if stat.S_ISCHR(mode): ...
fallocate(f, size)
Predict the next line after this snippet: <|code_start|> def open_file_chunk_reader_from_fileobj( self, fileobj, chunk_size, full_file_size, callbacks, close_callbacks=None, ): return ReadFileChunk( fileobj, chunk_size, ...
def rename_file(self, current_filename, new_filename):
Given the code snippet: <|code_start|> """ with self._lock: self._exception = None self._result = result self._status = 'success' def set_exception(self, exception, override=False): """Set an exception for the TransferFuture Implies the TransferFu...
self._done_event.wait(MAXINT)
Next line prediction: <|code_start|> Implies the TransferFuture failed. :param exception: The exception that cause the transfer to fail. :param override: If True, override any existing state. """ with self._lock: if not self.done() or override: self._...
def cancel(self, msg='', exc_type=CancelledError):
Based on the snippet: <|code_start|> if meta is None: self._meta = TransferMeta() self._coordinator = coordinator if coordinator is None: self._coordinator = TransferCoordinator() @property def meta(self): return self._meta def done(self): re...
raise TransferNotDoneError(
Using the snippet: <|code_start|> 'Unable to transition from done state %s to non-done ' 'state %s.' % (self.status, desired_state) ) self._status = desired_state def submit(self, executor, task, tag=None): """Submits a task to a provided e...
FunctionContainer(self.remove_associated_future, future)
Next line prediction: <|code_start|> def __init__( self, max_size, max_num_threads, tag_semaphores=None, executor_cls=None ): """An executor implementation that has a maximum queued up tasks The executor will block if the number of tasks that have been submitted and is currently ...
self._semaphore = TaskSemaphore(max_size)
Using the snippet: <|code_start|> result.append(future.result()) # Otherwise if the pending_value is a future, just wait for it. else: result = pending_value.result() # Add the retrieved value to the kwargs to be sent to the # main() cal...
on_queued_callbacks = get_callbacks(transfer_future, 'queued')
Given the code snippet: <|code_start|>REVERSE_THRESHOLD = 1500 - STOP_RANGE # left and right thresholds set the limit on when a command will begin # to increse the turn command in the left and right direction respectively LEFT_THRESHOLD = 1500 - STOP_RANGE RIGHT_THRESHOLD = 1500 + STOP_RANGE # RC input below the arme...
self.rc_input = RCInput()
Predict the next line for this snippet: <|code_start|>PWM_FREQUENCY = 50 # Hz def _calculate_value_in_range(min_val, max_val, percentage): """Get the value within a range based on percentage. Example: A percentage 0.0 maps to min_val A percentage of 1.0 maps to max_val """ value_rang...
self.pwm = PWM(self.rc_channel - 1)