Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Next line prediction: <|code_start|> try: except ImportError: class IgdbScraper(AbstractScraper): def __init__(self, core): AbstractScraper.__init__(self, core) self.api_url = 'https://www.igdb.com/api/v1/games/%s' self.api_img_url = 'https://res.cloudinary.com/igdb/image/upload/t_%s/%s.j...
return ApiResponse()
Given snippet: <|code_start|>class LoggerChain(object): def __init__(self, prefix): self.prefix = prefix self.logger_chain = [] def debug(self, message): for logger in self.logger_chain: logger.debug(self.prefix, message) def info(self, message): for logger in s...
if isinstance(logger, AbstractLogger):
Here is a snippet: <|code_start|> class GameListController(BaseController): def __init__(self, game_manager, game_helper, moonlight_helper, logger): self.game_manager = game_manager self.game_helper = game_helper self.moonlight_helper = moonlight_helper self.logger = logger ...
@route(name='list')
Given the code snippet: <|code_start|> class GameListController(BaseController): def __init__(self, game_manager, game_helper, moonlight_helper, logger): self.game_manager = game_manager self.game_helper = game_helper self.moonlight_helper = moonlight_helper self.logger = logger ...
self.window = GameList(controller=self, host=host, game_list=self.game_helper.get_games_as_list(host))
Predict the next line after this snippet: <|code_start|> class AudioController(BaseController): def __init__(self, core, audio_manager, config_helper): self.core = core self.audio_manager = audio_manager self.config_helper = config_helper <|code_end|> using the current file's imports: im...
@route(name="select")
Continue the code snippet: <|code_start|> if __name__ == '__main__': # TODO: This is sometimes called before main controller is known to router def callback(): RequiredFeature('core').request().check_script_permissions() updater = RequiredFeature('update-service').request() update_thread...
XBMCApplicationKernel().bootstrap(callback)
Next line prediction: <|code_start|> created. .. seealso:: :class:`xbmcswift2.TimedStorage` for more details. :param name: The name of the storage to retrieve. :param file_format: Choices are 'pickle', 'csv', and 'json'. Pickle is recommended as it supports ...
storage = TimedStorage(filename, file_format, TTL)
Based on the snippet: <|code_start|>MIN_INTERVAL = 0.100 ################################################################################ ### @class ScriptData ################################################################################ class ScriptData(): ##############################################...
data = ScriptFile(filename)
Next line prediction: <|code_start|> toc_count_pos = TOC_INFO[umdimage][game][COUNT] toc_name_off = TOC_INFO[umdimage][game][NAME_OFFSET] eboot_data.bytepos = toc_count_pos toc_count = eboot_data.read("uintle:32") eboot_data.bytepos = toc_start toc = [] file_starts = [] filenames = []...
filename = add_unique_postfix(filename, check_fn = (lambda fn: fn in filenames))
Here is a snippet: <|code_start|>################################################################################ ### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or modify it ...
self.highlighter = KeywordHighlighter(self.document())
Predict the next line for this snippet: <|code_start|>### ### You should have received a copy of the GNU General Public License ### along with the Super Duper Script Editor. ### If not, see <http://www.gnu.org/licenses/>. ################################################################################ #from PyQt4 imp...
img_filter = IMG_FILTERS.unfiltered,
Given the following code snippet before the placeholder: <|code_start|>### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor 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 Softwar...
voice = VoiceId(),
Given the code snippet: <|code_start|>### along with the Super Duper Script Editor. ### If not, see <http://www.gnu.org/licenses/>. ################################################################################ _LOGGER_NAME = common.LOGGER_NAME + "." + __name__ _LOGGER = logging.getLogger(_LOGGER_NAME) _NAME =...
files = [entry_data for (entry_name, entry_data) in get_pak_files(data)]
Given the following code snippet before the placeholder: <|code_start|> self.__gmo_files = [] if filename: self.load_file(filename) def load_file(self, filename): data = BitStream(filename = filename) self.load_data(data) def load_data(self, data): files = [entry_data for (entry_...
file_starts, file_ends = parse_pak_toc(data)
Given the following code snippet before the placeholder: <|code_start|> check_char = -1 cur_ammo = -1 cur_cutin = -1 cur_bgd = -1 cur_flash = -1 cur_movie = -1 # Because we can put flashes on top of flashes. flash_stack = [] # If we set the speaker with a speaker tag...
scene_info = SceneInfo()
Here is a snippet: <|code_start|> scene_info.extra_val = option_val #scene_info.trialcam = cur_trialcam ############################## ### Reset stuff ############################## cur_ammo = -1 scene_info.headshot = cur_sprite_obj if is_opt...
img_filter = IMG_FILTERS.unfiltered
Given the code snippet: <|code_start|>### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or modify it under the terms of the GNU General Public License as ### published by the Fre...
cur_voice = VoiceId()
Next line prediction: <|code_start|>################################################################################ ### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or modify ...
self.ui = Ui_Nonstop()
Here is a snippet: <|code_start|> sprite_id = mtb.read("uintle:16") sprite = SpriteId(SPRITE_TYPE.stand, sprite_char, sprite_id) # --- TABLE FORMAT --- # XX XX XX XX -- Number of files # # [for each line] # XX XX XX XX -- Offset (from table start) of voice info. # # -- V...
voice = VoiceId(voice_char, 0x63, voice_id)
Predict the next line for this snippet: <|code_start|> _LOGGER_NAME = common.LOGGER_NAME + "." + __name__ _LOGGER = logging.getLogger(_LOGGER_NAME) FONT_TYPES = Enum("font01", "font02") GAMES = Enum("dr", "sdr2") LINE_HEIGHT = {FONT_TYPES.font01: 25, FONT_TYPES.font02: 26} MAX_HEIGHT = 2048 HEIGHT_FACTOR = 128 ...
data = BitStream(SPFT_MAGIC)
Here is a snippet: <|code_start|>### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor 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 Sof...
self.highlighter = SpellCheckHighlighter(self.document())
Based on the snippet: <|code_start|> if sprite: painter.drawImage(out.rect(), sprite, sprite.rect()) if not scene_info.img_filter == IMG_FILTERS.unfiltered: painter.end() out = filter_image(out, scene_info.img_filter) painter = QPainter(out) painter.setRenderHint(QPainter.Antialiasing, Tru...
info = FONT_DATA[font][char]
Predict the next line after this snippet: <|code_start|> painter = QPainter(out) painter.setRenderHint(QPainter.Antialiasing, True) if show_sprite: sprite_id.sprite_type = SPRITE_TYPE.stand sprite = get_sprite(sprite_id) if sprite: painter.drawImage(out.rect(), sprite, sprite.rect()) ...
if not clt in CLT:
Given the code snippet: <|code_start|>################################################################################ ### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or modif...
self.ui = Ui_TermEdit()
Based on the snippet: <|code_start|>### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with the Super Duper Script Editor. ### If not, see <http://www.gnu.org/licenses/>. ##################################################################...
scene_info = SceneInfo(file_id = int(os.path.splitext(os.path.basename(filename))[0]))
Given the code snippet: <|code_start|>### published by the Free Software Foundation, either version 3 of the License, ### or (at your option) any later version. ### ### The Super Duper Script Editor is distributed in the hope that it will be ### useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ##...
except InvalidWrdHeader:
Given the code snippet: <|code_start|> # If there is no previous state, then it's -1, which makes the first line 0. # And every line after that increases as expected. line = self.previousBlockState() + 1 self.setCurrentBlockState(line) # Make sure we aren't too long. if len(self.matches) > s...
keyword_match = Keyword()
Continue the code snippet: <|code_start|>################################################################################ ### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or mo...
self.ui = Ui_Console()
Given the code snippet: <|code_start|>################################################################################ ### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or modif...
file = qt_to_unicode(file)
Next line prediction: <|code_start|> hard_orig = None if dat_file.pos >= dat_file.len: # If we don't have more data, then consider this untranslated. # Therefore, the data we collected becomes the data for the original anagram. easy_orig = easy normal_orig = normal hard_...
self.solution = ScriptFile(os.path.join(base_dir, ANAGRAM_DIR, "%04d.txt" % self.solution_index))
Given the code snippet: <|code_start|>################################################################################ ### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or modif...
self.highlighter = ReferenceHighlighter(self.document())
Next line prediction: <|code_start|>################################################################################ ### Copyright © 2012-2013 BlackDragonHunt ### ### This file is part of the Super Duper Script Editor. ### ### The Super Duper Script Editor is free software: you can redistribute it ### and/or modify ...
map_file = ScriptFile(filename)
Here is a snippet: <|code_start|> logger = logging.getLogger(__name__) class TestMetadataRegistryDefaults: @pytest.fixture(scope="session") def dataplex_expected_defaults(self): expected_defaults = { "DATAPLEX": { "projects": "<my-gcp-project-id>", "locat...
metadata_registry_defaults = MetadataRegistryDefaults.from_dict(dataplex_expected_defaults)
Here is a snippet: <|code_start|># # Unless required by applicable law or agreed to in writing, software # distributed under the License 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 # ...
metadata_defaults = load_metadata_registry_default_configs(configs_path=source_configs_path)
Based on the snippet: <|code_start|> output["description"] = self.column_description return dict({f"{self.column_id}": output}) def dict_values(self: DqEntityColumn) -> dict: """ Args: self: DqEntityColumn: Returns: """ return dict(self.to_di...
assert_not_none_or_empty(
Continue the code snippet: <|code_start|> column_id: str column_name: str column_type: str column_description: str | None entity_source_database: str def get_column_type_value(self: DqEntityColumn) -> str: return DatabaseType(self.entity_source_database).get_column_type( self...
column_name = get_from_dict_and_assert(
Based on the snippet: <|code_start|> @dataclass class DataplexEntityPartitionSchemaField: """ """ name: str type: str def to_dict(self: DataplexEntityPartitionSchemaField) -> dict: """ Args: self: DataplexEntityPartitionSchemaField: Returns: """ out...
assert_not_none_or_empty(
Given the code snippet: <|code_start|># Copyright 2021 Google LLC # # 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 by ap...
rule_type: RuleType
Given the following code snippet before the placeholder: <|code_start|>class DataplexEntitySchemaField: """ """ name: str type: str mode: str def to_dict(self: DataplexEntitySchemaField) -> dict: """ Args: self: DataplexEntitySchemaField: Returns: """ ...
assert_not_none_or_empty(
Given snippet: <|code_start|># Copyright 2021 Google LLC # # 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 by applicable ...
value = utils.get_keys_from_dict_and_assert_oneof('exactly_one', kwargs=kwargs, keys=keys)
Given the following code snippet before the placeholder: <|code_start|># 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 by applicable law or agreed to in writing, software # distributed un...
schema: DataplexEntitySchema
Here is a snippet: <|code_start|> return self.name.split("/")[3] @property def lake(self): return self.name.split("/")[5] @property def zone(self): return self.name.split("/")[7] def get_db_primary_key(self): return ( f"projects/{self.project_id}/locatio...
assert_not_none_or_empty(
Given snippet: <|code_start|># http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the ...
loaded_config = lib.load_configs(temp_dir, DqConfigType.ENTITIES)
Predict the next line for this snippet: <|code_start|># http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #...
loaded_config = lib.load_configs(temp_dir, DqConfigType.ENTITIES)
Based on the snippet: <|code_start|> DATAPLEX_URI_FIELDS = ["projects", "locations", "lakes", "zones", "entities"] BIGQUERY_URI_FIELDS = ["projects", "datasets", "tables"] SAMPLE_DEFAULT_REGISTRIES_YAML = """ metadata_registry_defaults: dataplex: projects: <my-gcp-project-id> locations: <my-gcp-dataplex-reg...
scheme = EntityUriScheme.from_scheme(registry_scheme)
Next line prediction: <|code_start|> logger.info("\nExecuting dbt command:\n %s", debug_commands) dbt(debug_commands) except SystemExit: pass else: if not dry_run: logger.info("\nExecuting dbt comm...
assert_not_none_or_empty(
Given snippet: <|code_start|> raise RuntimeError(f"dbt run failed with unknown error: '{e}'") def extract_dbt_env_var(text: str) -> str: var_env = re.search(ENV_VAR_PATTERN, text).group(1) var_env = [x.strip().strip("'\"") for x in var_env.split(",")] enrironment_variable = var_env.pop(0) defau...
dbt_profiles_key = load_yaml(dbt_project_path, "profile")
Predict the next line for this snippet: <|code_start|> environment: str = "clouddq", debug: bool = False, dry_run: bool = False, ) -> None: """ Args: dbt_path: Path: Path of dbt project described in `dbt_project.yml` dbt_profile_dir: str: configs: typing.Dict: environment: st...
with working_directory(dbt_path):
Given the following code snippet before the placeholder: <|code_start|># Copyright 2021 Google LLC # # 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/LICE...
scheme: EntityUriScheme
Continue the code snippet: <|code_start|> f"lakes/{self.get_configs('lakes')}/" f"zones/{self.get_configs('zones')}/" f"entities/{self.get_configs('entities')}" ) elif self.scheme == EntityUriScheme.BIGQUERY: return ( f"proje...
expected_fields = BIGQUERY_URI_FIELDS
Next line prediction: <|code_start|> elif self.scheme == EntityUriScheme.BIGQUERY: return self.get_db_primary_key() else: raise NotImplementedError( f"EntityUri.get_entity_id() for scheme '{self.scheme}' " f"is not yet supported in entity_uri '{self...
expected_fields = DATAPLEX_URI_FIELDS
Predict the next line for this snippet: <|code_start|> if self.scheme == EntityUriScheme.DATAPLEX: return ( f"projects/{self.get_configs('projects')}/" f"locations/{self.get_configs('locations')}/" f"lakes/{self.get_configs('lakes')}/" f...
f"{SAMPLE_DEFAULT_REGISTRIES_YAML}"
Next line prediction: <|code_start|>from __future__ import annotations @dataclass class DqRowFilter: """ """ row_filter_id: str filter_sql_expr: str @classmethod def from_dict( cls: DqRowFilter, row_filter_id: str, kwargs: dict, ) -> DqRowFilter: """ ...
assert_not_none_or_empty(
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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
_gcp_credentials: GcpCredentials
Predict the next line after this snippet: <|code_start|># Copyright 2021 Google LLC # # 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 # # Unl...
fields: list[DataplexEntitySchemaField]
Continue the code snippet: <|code_start|># Copyright 2021 Google LLC # # 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 by...
partitionFields: list[DataplexEntityPartitionSchemaField]
Given the following code snippet before the placeholder: <|code_start|># 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. """todo: add classes docstring.""" from __future__ import annotations ...
assert_not_none_or_empty(
Continue the code snippet: <|code_start|>), SELECT CURRENT_TIMESTAMP() AS execution_ts, '{{ rule_binding_id }}' AS rule_binding_id, '{{ rule_id }}' AS rule_id, (select distinct num_rows_validated from data) as num_rows_validated, FALSE AS simple_rule_row_is_valid, COUNT(*) as complex_rule_valida...
assert_not_none_or_empty(
Given the code snippet: <|code_start|> class Defer(Producer): def __init__(self, observableFactory): self.observableFactory = observableFactory def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() def eval(self): return self.obse...
return Disposable.empty()
Continue the code snippet: <|code_start|> class Amb(Producer): LEFT = 0 RIGHT = 1 NEITHER = 2 def __init__(self, left, right): self.left = left self.right = right def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() <|code_e...
class DecisionObserver(Observer):
Predict the next line after this snippet: <|code_start|> super(TestScheduler, self).start() return state.observer class MockObserver(Observer): def __init__(self, scheduler): super(TestScheduler.MockObserver, self).__init__() self.scheduler = scheduler self.messages = [] def onNex...
class HotObservable(Observable):
Given the code snippet: <|code_start|> def OnNext(value): return Notification.createOnNext(value) def OnError(exception): return Notification.createOnError(exception) def OnCompleted(): return Notification.createOnCompleted() <|code_end|> , generate the next line using the imports in this file: import unitt...
class TestScheduler(HistoricalScheduler):
Using the snippet: <|code_start|> self.dispose() class SkipLastTime(Producer): def __init__(self, source, duration, scheduler): self.source = source self.duration = duration self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setS...
self.queue.append(Struct(value=value,timeStamp=now))
Given the following code snippet before the placeholder: <|code_start|> class TimeInterval(Producer): def __init__(self, source, scheduler): self.source = source self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return s...
self.observer.onNext(Struct(value=value, interval=span))
Given snippet: <|code_start|> self.connectableSubscription = None def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() class Sink(rx.linq.sink.Sink): def __init__(self, parent, observer, cancel): super(RefCount.Sink, self).__in...
return Disposable.create(dispose)
Here is a snippet: <|code_start|> class Finally(Producer): def __init__(self, source, action): self.source = source self.action = action def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() class Sink(rx.linq.sink.Sink): def ...
return Disposable.create(dispose)
Given the following code snippet before the placeholder: <|code_start|> self.defaultValue = defaultValue def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return self.source.subscribeSafe(sink) class Sink(rx.linq.sink.Sink): def __init__(self, pare...
self.observer.onError(InvalidOperationException("No elements in observable"))
Using the snippet: <|code_start|> sink = self.Sink(self, observer, cancel) setSink(sink) return self.source.subscribeSafe(sink) class Sink(rx.linq.sink.Sink): def __init__(self, parent, observer, cancel): super(Max.Sink, self).__init__(observer, cancel) self.parent = parent self.last...
self.observer.onError(InvalidOperationException("No elements in observable"))
Here is a snippet: <|code_start|> class Disposable(object): """Represents a disposable object""" def dispose(self): pass def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.dispose() @staticmethod def create(action): return AnonymouseDisposable(actio...
self._isDisposed = Atomic(False)
Next line prediction: <|code_start|> class Never(Observable): def __init__(self): super(Never, self).__init__() def subscribeCore(self, observer): <|code_end|> . Use current file imports: (from rx.disposable import Disposable from rx.observable import Observable) and context including class names, function ...
return Disposable.empty()
Next line prediction: <|code_start|> sink = self.Sink(self, observer, cancel) setSink(sink) return self.source.subscribeSafe(sink) class Sink(rx.linq.sink.Sink): def __init__(self, parent, observer, cancel): super(Min.Sink, self).__init__(observer, cancel) self.parent = parent self.l...
self.observer.onError(InvalidOperationException("No elements in observable"))
Given the code snippet: <|code_start|> class MostRecent(PushToPullAdapter): def __init__(self, source, initialValue): super(MostRecent, self).__init__(source) self.initialValue = initialValue def run(self, subscription): return self.Sink(self.initialValue, subscription) class Sink(rx.linq.sink.Push...
self.kind = Notification.KIND_NEXT
Using the snippet: <|code_start|> class TakeLastCount(Producer): def __init__(self, source, count, scheduler): self.source = source self.count = count self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run...
return CompositeDisposable(self.subscription, self.loopDisposable)
Based on the snippet: <|code_start|> class TakeLastCount(Producer): def __init__(self, source, count, scheduler): self.source = source self.count = count self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink....
self.subscription = SingleAssignmentDisposable()
Given the code snippet: <|code_start|> return sink.run() class Sink(rx.linq.sink.Sink): def __init__(self, parent, observer, cancel): super(TakeLastTime.Sink, self).__init__(observer, cancel) self.parent = parent def run(self): self.subscription = SingleAssignmentDisposable() self...
self.queue.append(Struct(value=value,interval=now))
Predict the next line for this snippet: <|code_start|> class TakeLastBufferCount(Producer): def __init__(self, source, count): self.source = source self.count = count def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() class Sin...
return CompositeDisposable(self.subscription, self.loop)
Predict the next line after this snippet: <|code_start|> class TakeLastBufferCount(Producer): def __init__(self, source, count): self.source = source self.count = count def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() class S...
self.subscription = SingleAssignmentDisposable()
Predict the next line after this snippet: <|code_start|> return sink.run() class Sink(rx.linq.sink.Sink): def __init__(self, parent, observer, cancel): super(TakeLastBufferTime.Sink, self).__init__(observer, cancel) self.parent = parent def run(self): self.subscription = SingleAssignmen...
self.queue.append(Struct(value=value,interval=now))
Predict the next line after this snippet: <|code_start|> class SequenceEqual(Producer): def __init__(self, left, right, equals): self.left = left self.right = right self.equals = equals def run(self, observer, cancel, setSink): <|code_end|> using the current file's imports: from rx.disposable import...
if isinstance(self.right, Observable):
Predict the next line for this snippet: <|code_start|> class ObserveOn(Producer): def __init__(self, source, scheduler): self.source = source self.scheduler = scheduler def run(self, observer, cancel, setSink): <|code_end|> with the help of current file imports: from rx.observable import Producer from r...
sink = ObserveOnObserver(self.scheduler, observer, cancel)
Next line prediction: <|code_start|> class Using(Producer): def __init__(self, resourceFactory, observableFactory): self.resourceFactory = resourceFactory self.observableFactory = observableFactory def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) ...
return CompositeDisposable(Observable.throw(e).subscribeSafe(self), disposable)
Using the snippet: <|code_start|> class Using(Producer): def __init__(self, resourceFactory, observableFactory): self.resourceFactory = resourceFactory self.observableFactory = observableFactory def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) re...
disposable = Disposable.empty()
Using the snippet: <|code_start|> class Using(Producer): def __init__(self, resourceFactory, observableFactory): self.resourceFactory = resourceFactory self.observableFactory = observableFactory def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) re...
return CompositeDisposable(Observable.throw(e).subscribeSafe(self), disposable)
Based on the snippet: <|code_start|> class ToObservable(Producer): def __init__(self, source, scheduler): self.source = source self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() class Sink(rx.linq.sink...
flag = BooleanDisposable()
Here is a snippet: <|code_start|> class ToObservable(Producer): def __init__(self, source, scheduler): self.source = source self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() class Sink(rx.linq.sink.S...
return Disposable.empty()
Given the following code snippet before the placeholder: <|code_start|>class ToObservable(Producer): def __init__(self, source, scheduler): self.source = source self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sin...
scheduler.scheduleRecursiveWithState(Struct(flag=flag, it=it), self.loopRec)
Using the snippet: <|code_start|> class ForEach(Producer): class Sink(Observer): def __init__(self, onNext, done): self.onNextAction = onNext self.doneAction = done <|code_end|> , determine the next line of code. You have imports: from rx.observable import Producer from rx.observer import Observer ...
self.stopped = Atomic(False)
Next line prediction: <|code_start|> class Materialize(Producer): def __init__(self, source): self.source = source def dematerialize(self): return self.source.asObservable() def run(self, observer, cancel, setSink): sink = self.Sink(observer, cancel) setSink(sink) return self.source.subscri...
self.observer.onNext(Notification.createOnNext(value))
Given the code snippet: <|code_start|> class TimeStamp(Producer): def __init__(self, source, scheduler): self.source = source self.scheduler = scheduler def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return self.source.subscribeSafe(sink) cl...
self.observer.onNext(Struct(value=value, timestamp=self.parent.scheduler.now()))
Predict the next line after this snippet: <|code_start|> class GetIterator(Observer): def __init__(self): self.queue = Queue() self.gate = Semaphore(0) <|code_end|> using the current file's imports: from rx.disposable import SingleAssignmentDisposable from rx.exceptions import DisposedException from rx.obs...
self.subscription = SingleAssignmentDisposable()
Predict the next line for this snippet: <|code_start|> self.error = None self.done = False self.disposed = False def run(self, source): # [OK] Use of unsafe Subscribe: non-pretentious exact mirror with the dual GetEnumerator method. self.subscription.disposable = source.subscribe(self) return ...
raise DisposedException()
Predict the next line after this snippet: <|code_start|>class SingleAsync(Producer): def __init__(self, source, predicate, throwOnEmpty, defaultValue): self.source = source self.predicate = predicate self.throwOnEmpty = throwOnEmpty self.defaultValue = defaultValue def run(self, observer, cancel, s...
self.observer.onError(InvalidOperationException("More than one element in observable"))
Given snippet: <|code_start|> class Dematerialize(Producer): def __init__(self, source): self.source = source def run(self, observer, cancel, setSink): sink = self.Sink(observer, cancel) setSink(sink) return self.source.subscribeSafe(sink) class Sink(rx.linq.sink.Sink): def __init__(self, o...
if value.kind == Notification.KIND_NEXT:
Given the code snippet: <|code_start|> class Multicast(Producer): def __init__(self, source, subjectSelector, selector): self.source = source self.subjectSelector = subjectSelector self.selector = selector def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSi...
return Disposable.empty()
Predict the next line for this snippet: <|code_start|> self.source = source self.subjectSelector = subjectSelector self.selector = selector def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return sink.run() class Sink(rx.linq.sink.Sink): d...
return CompositeDisposable(subscription, connection)
Here is a snippet: <|code_start|> class Multicast(Producer): def __init__(self, source, subjectSelector, selector): self.source = source self.subjectSelector = subjectSelector self.selector = selector def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(si...
connectable = ConnectableObservable(self.parent.source, subject)
Given the code snippet: <|code_start|> self.throwOnEmpty = throwOnEmpty self.defaultValue = defaultValue def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return self.source.subscribeSafe(sink) class Sink(rx.linq.sink.Sink): def __init__(self, ...
self.observer.onError(InvalidOperationException("No elements in observable"))
Predict the next line for this snippet: <|code_start|> # catch up loop. In the best case, all work will be dispatched on the periodic scheduler. # # # We start with one tick pending because we're about to start doing OnNext(0L). # self.pendingTickCount.value = 1 d = SingleAss...
return CompositeDisposable(d, c)
Continue the code snippet: <|code_start|> def onCompleted(self): self.observer.onCompleted() self.dispose() def done(self): if self.lastException != None: self.observer.onError(self.lastException) else: self.observer.onCompleted() self.dispose() class CatchExcept...
self.subscription = SerialDisposable()
Given the code snippet: <|code_start|> self.dispose() def done(self): if self.lastException != None: self.observer.onError(self.lastException) else: self.observer.onCompleted() self.dispose() class CatchException(Producer): def __init__(self, source, handler, exceptionTy...
d = SingleAssignmentDisposable()