Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line for this snippet: <|code_start|> open_mock = mock_open() with patch("builtins.open", open_mock): srt.return_value = "" caption = Caption( { "url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", ...
}
Given the code snippet: <|code_start|> captions.target_directory = MagicMock(return_value="/target") with patch("builtins.open", open_mock): srt.return_value = "" caption = Caption( { "url": "url1", "name": {"simpleText": "name1"}, "lang...
assert (
Using the snippet: <|code_start|> srt.return_value = "" caption = Caption( { "url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en" } ) caption.download("title") a...
open_mock.call_args_list[0][0][0].split(os.path.sep)[-1]
Given the code snippet: <|code_start|> def test_map_functions(): with pytest.raises(RegexMatchError): cipher.map_functions("asdf") def test_get_initial_function_name_with_no_match_should_error(): with pytest.raises(RegexMatchError): cipher.get_initial_function_name("asdf") def test_get_tra...
a = [1, 2, 3, 4]
Using the snippet: <|code_start|> def test_throttling_prepend(): a = [1, 2, 3, 4] cipher.throttling_prepend(a, 1) assert a == [4, 1, 2, 3] a = [1, 2, 3, 4] cipher.throttling_prepend(a, 2) assert a == [3, 4, 1, 2] def test_throttling_swap(): a = [1, 2, 3, 4] cipher.throttling_swap(a, 3...
raw_code = r'a.url="";a.C&&(b=a.get("n"))&&(b=Apa[0](b),a.set("n",b),'\
Predict the next line for this snippet: <|code_start|> PreferencesDialog.setWindowModality(QtCore.Qt.WindowModal) PreferencesDialog.resize(719, 528) self.verticalLayout_5 = QtWidgets.QVBoxLayout(PreferencesDialog) self.verticalLayout_5.setObjectName("verticalLayout_5") self.tabsPr...
self.scrollAreaWidgetLayoutSearch = QtWidgets.QGridLayout()
Next line prediction: <|code_start|> self.verticalLayout_5.setObjectName("verticalLayout_5") self.tabsPreferences = QtWidgets.QTabWidget(PreferencesDialog) self.tabsPreferences.setTabPosition(QtWidgets.QTabWidget.North) self.tabsPreferences.setObjectName("tabsPreferences") self.ta...
self.scrollAreaSearch.setWidget(self.scrollAreaWidgetSearch)
Predict the next line for this snippet: <|code_start|> self.optionSubFnSame = QtWidgets.QRadioButton(self.groupBoxSubFn) self.optionSubFnSame.setChecked(True) self.optionSubFnSame.setObjectName("optionSubFnSame") self.verticalLayout_2.addWidget(self.optionSubFnSame) self.optionSub...
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3 class ImdbSearchModel(QAbstractTableModel): NB_COLS = 2 COL_IMDB_ID = 0 <|code_end|> with the help of current file imports: from subdownloader.provider.imdb impo...
COL_NAME = 1
Based on the snippet: <|code_start|> def __init__(self, parent): QComboBox.__init__(self, parent) self._model = ProviderModel() self._current_provider_state = None self.setup_ui() def set_general_text(self, general_text): self._model.set_general_text(general_text) ...
return self._current_provider_state
Given the following code snippet before the placeholder: <|code_start|> @classmethod def local_search(cls, provider): try: module_name = 'subdownloader.provider.{provider}'.format(provider=provider) log.debug('Attempting to import "{}"...'.format(module_name)) provider...
for file in provider_path.iterdir():
Given snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3 try: def langdetect_detect(*args): try: return detect(*args) except LangDetectException: return UnknownLanguage.create_generic() except ImportError: ...
class NotALanguageException(ValueError):
Here is a snippet: <|code_start|> def sort(self, column, reverse=False): def vs_getitem(vs, column): if column == UploadDataCollection.COL_VIDEO: return vs.video else: # column == UploadDataCollection.COL_SUBTITLE: return vs.subtitle data = s...
data = [data[row] for row in new_rows]
Here is a snippet: <|code_start|> index_upl = sorted(l, key=lambda d: vs_getitem(d[1], column).get_filename(), reverse=reverse) data = [d for i, d in index_upl] none_keys = set(range(len(data))) - set(i for i, d in index_upl) data += [data[i] for i in none_keys] self._local_movie....
data = self._local_movie.get_data()
Given snippet: <|code_start|> self.label_filterBy.setFont(font) self.label_filterBy.setObjectName("label_filterBy") self.layoutTopVideos.addWidget(self.label_filterBy) self.filterLanguageForVideo = LanguageComboBox(self.pageSearchResult) sizePolicy = QtWidgets.QSizePolicy(QtWidget...
self.buttonIMDB.setIconSize(QtCore.QSize(32, 16))
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3 log = logging.getLogger('subdownloader.client.callback') class ClientCallback(ProgressCallback): def __init__(self, minimum=None, maximum=None): ProgressCa...
self._cancellable = True
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3 class VideoSubtitle(object): def __init__(self, video=None, subtitle=None): self.video = video self.subtitle = subtitle def check(self): if not self.vi...
self._hearing_impaired = None
Predict the next line after this snippet: <|code_start|> subtitle_paths = set() for data in self._data: if not data.check(): return False vfp = str(data.video.get_filepath().resolve()) if vfp in video_paths: return False vide...
return self._movie_name
Here is a snippet: <|code_start|> identity.merge(movie.get_identities()) return identity def movies(self): return self._movies def get_subtitles(self): return self._subtitles def search_more_subtitles(self): found_new = False for movie, query in zip(self...
else:
Using the snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3 log = logging.getLogger('subdownloader.client.gui.models.provider') class ProviderStateModelCallback(ProviderStateCallback): def __init__(self, provider_model): ProviderStateCal...
def __init__(self, general_text_visible=True, general_text=None):
Predict the next line for this snippet: <|code_start|> def __del__(self): self.status_progress.close() del self.status_progress def set_block(self, block): self._block = block def set_title_text(self, title_text): self._title_text = title_text def set_label_text(self, l...
def on_show(self):
Given snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3 class ImdbListView(QTableView): def __init__(self, parent=None): QTableView.__init__(self, parent) self._imdb_model = ImdbSearchModel() self.setup_ui() def setup...
self.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/home/maarten/programming/subdownloader_old/scripts/gui/ui/imdbSearch.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! class Ui_IMDBSearc...
sizePolicy.setHorizontalStretch(0)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/home/maarten/programming/subdownloader_old/scripts/gui/ui/imdbSearch.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! class Ui_IMDBSearchDi...
self._2 = QtWidgets.QVBoxLayout(IMDBSearchDialog)
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3 log = logging.getLogger('subdownloader.client.gui.models.language') class LanguageModel(QAbstractListModel): def __init__(self, unknown_text, unknown_visible, lan...
self._languages = languages
Based on the snippet: <|code_start|>################################################################################ # Copyright (C) 2015 Jaakko Luttinen # # This file is licensed under the MIT License. ################################################################################ class Add(Deterministic): ...
Second moment:
Next line prediction: <|code_start|> class Command(BaseCommand): help = ("Fills a cache with the json and image data for open spaces " "in all campuses") def handle(self, *args, **kwargs): if not hasattr(settings, 'SS_LOCATIONS'): raise("Error running load_open_now_cache - you...
fill_cache=True)
Predict the next line for this snippet: <|code_start|> class Command(BaseCommand): help = ("Fills a cache with the json and image data for open spaces " "in all campuses") <|code_end|> with the help of current file imports: from django.core.management.base import BaseCommand from django.conf import...
def handle(self, *args, **kwargs):
Using the snippet: <|code_start|> def getElementList(self, regex): compiledRE = re.compile(regex) exElementList = [] for str in (compiledRE.findall(self.fileText)): elementText, startIndex, endIndex = self.extractElementText(str) elementObj = self.getElementObject(ele...
if m.startswith('$'):
Next line prediction: <|code_start|> class TestHieSmells(TestCase): def test_detectBroHierarchy(self): folderName = "/Users/Tushar/Documents/Research/PuppetQuality/Repos/vagrant-baseline/puppet/" outFileName = "tmp/brokenHieTest.txt" outFile = open(outFileName, 'w') #fileObj = Sour...
outFileRead = open(outFileName, 'r')
Next line prediction: <|code_start|> def detectSmells(folder, outputFile): detectBrokenHie(folder, outputFile) def detectBrokenHie(folder, outputFile): modulesFolder = getModulesFolder(folder) if modulesFolder: for dir in os.listdir(modulesFolder): if os.path.isdir(os.path.join(module...
classNames, superClassNames = collectClassNames(folder)
Continue the code snippet: <|code_start|> class TestModSmells(TestCase): def test_detectDefEnc(self): fileName = "/Users/Tushar/Documents/Research/PuppetQuality/Repos/percona-xtradb-cluster-tutorial/manifests/master_slave.pp" outFileName = "tmp/DefEncTest.txt" fileObj = SourceModel.SM_File...
outFile = open(outFileName, 'w')
Based on the snippet: <|code_start|> if modulesFolder: for dir in os.listdir(modulesFolder): detectUnsModForm3(os.path.join(modulesFolder, dir), outputFile) def detectUnsModForm3(folder, outputFile): counter = 0 if os.path.isdir(folder): for dir in os.listdir(folder): ...
addGraphNodesFromRestPuppetFiles(folder, graph)
Given the following code snippet before the placeholder: <|code_start|> def detectSmells(folder, outputFile): detectInsufficientMod(folder, outputFile) detectUnstructuredMod(folder, outputFile) detectTightlyCoupledMod(folder, outputFile) detectHairballStrAndWeakendMod(folder, outputFile) def detectI...
detectWeakendMod(graph, folder, outputFile) #modularity ratio
Based on the snippet: <|code_start|> def myPrint(msg): if(CONSTS.DEBUG_ON): print(msg) def reportSmell(outputFile, fileName, smellName, reason): outputFile.write(smellName + " at " + reason + " in file " + fileName + "\n") myPrint(smellName + " at " + reason + " in file " + fileName + "\n") def i...
return list(set(list1) | set(list2))
Predict the next line after this snippet: <|code_start|> def getLCOM(elementList): disconnectedElements = 0 while len(elementList) > 0: disconnectedElements += 1 curElement = elementList.pop() variableList = curElement.getUsedVariables() i = 0 while len(elementList) > 0 ...
return LCOM
Predict the next line for this snippet: <|code_start|> class TestAggregator(TestCase): def test_aggregate(self): outFileName = "/Users/Tushar/Documents/Research/PuppetQuality/Puppet-lint_aggregator/testOut.csv" outFile = open(outFileName, 'w') outFile.write(CONSTS.HEADER) Aggregato...
self.assertGreater(len(outReadFile.read()), 0)
Given the following code snippet before the placeholder: <|code_start|> fileObj.getNoOfServiceDeclarations() + execDecls if float(totalDeclarations * CONSTS.IMPABS_THRESHOLD) <= float( execDecls) and execDecls > CONSTS.IMPABS_MAXEXECCOUNT: Utilities.reportSmell(outputFile,...
classAndDefineCount = len(fileObj.getOuterClassList() + fileObj.getOuterDefineList())
Given the code snippet: <|code_start|> class SM_ServiceResource(SourceModel.SM_Element.SM_Element): def __init__(self, text): self.resourceText = text super().__init__(text) def getUsedVariables(self): return super().getUsedVariables() def getPhysicalResourceDeclarationCount(self...
name = match.group(1)
Using the snippet: <|code_start|> outFileName = "tmp/unstructuredModForm3Test.txt" outFile = open(outFileName, 'w') ModSmellDectector.detectUnsModForm3(folderName, outFile) outFile.close() outFileRead = open(outFileName, 'r') self.assertGreater(len(outFileRead.read()), 0) ...
folderName = "/Users/Tushar/Documents/Research/PuppetQuality/Repos/devbox/modules/php/"
Based on the snippet: <|code_start|> def detectSmells(folder, outputFile): detectDeficientEnc(folder, outputFile) def detectDeficientEnc(folder, outputFile): for root, dirs, files in os.walk(folder): <|code_end|> , predict the immediate next line with the help of imports: import os import SourceModel.SM_Fil...
for file in files:
Using the snippet: <|code_start|>def getPackageCount(line, packageCount): pkgResourceCountIndex = line.find(CONSTS.TOTAL_PACKAGE_RES_DECLS) if pkgResourceCountIndex >= 0: packageCount = int(line[pkgResourceCountIndex + len(CONSTS.TOTAL_PACKAGE_RES_DECLS): len(line)]) return packageCount def getFil...
if fileCountIndex >= 0:
Here is a snippet: <|code_start|> class SM_FileResource(SourceModel.SM_Element.SM_Element): def __init__(self, text): self.resourceText = text super().__init__(text) def getUsedVariables(self): return super().getUsedVariables() def getPhysicalResourceDeclarationCount(self): ...
self.getDependentResource_(resultList, SMCONSTS.DEPENDENT_CLASS, SMCONSTS.DEPENDENT_GROUP_CLASS, SMCONSTS.CLASS)
Based on the snippet: <|code_start|> def collectSizeMetrics(folder, outputFile): totalClasses = 0 totalDefines = 0 totalFiles = 0 totalPackages = 0 totalServices = 0 totalExecs = 0 totalLOC = 0 for root, dirs, files in os.walk(folder): for file in files: if file.end...
totalPackages += fileObj.getNoOfPackageDeclarations()
Given the following code snippet before the placeholder: <|code_start|>class SM_PackageResource(SourceModel.SM_Element.SM_Element): def __init__(self, text): self.resourceText = text super().__init__(text) def getUsedVariables(self): return super().getUsedVariables() def getPhysica...
name = match.group(1)
Predict the next line after this snippet: <|code_start|> root = CONSTS.REPO_ROOT print("Initiating Analyzer...") totalRepos = len(os.listdir(root)) currentItem = 0 for item in os.listdir(root): currentFolder = os.path.join(root, item) #print("Anlyzing: " + currentFolder) if not os.path.isfile(currentFolder...
print (str("{:.2f}".format(float(currentItem * 100)/float(totalRepos))) + "% analysis done.")
Here is a snippet: <|code_start|> def test_detectMulAbsInModule_NegativeCase(self): fileName = "/Users/Tushar/Documents/Research/PuppetQuality/Repos/cmits/cmits-example/modules-unclass/automount/manifests/subdir.pp" testFile = "tmp/multifacetedAbsForm2ModuleTest.txt" fileObj = SourceModel.SM_...
def test_detectUnnAbsInModules(self):
Given the following code snippet before the placeholder: <|code_start|> def analyze(folder, repoName): outputFile = open(folder + "/" + CONSTS.PUPPETEER_OUT_FILE, 'w') puppetFileCount = FileOperations.countPuppetFiles(folder) outputFile.write(CONSTS.PUPPET_FILE_COUNT + str(puppetFileCount) + "\n") Uti...
outputFile.close()
Given the following code snippet before the placeholder: <|code_start|> def analyze(folder, repoName): outputFile = open(folder + "/" + CONSTS.PUPPETEER_OUT_FILE, 'w') puppetFileCount = FileOperations.countPuppetFiles(folder) outputFile.write(CONSTS.PUPPET_FILE_COUNT + str(puppetFileCount) + "\n") Uti...
outputFile.close()
Given the following code snippet before the placeholder: <|code_start|> def detectSmells(folder, outputFile): detectMissingDep(folder, outputFile) def detectMissingDep(folder, outputFile): detectMissingModules(folder, outputFile) def detectMissingModules(folder, outputFile): #print("%s" % (inspect.stack...
includeClassSet = set()
Given the following code snippet before the placeholder: <|code_start|> def __init__(self, date_col=None, order_by=(), sampling_expr=None, index_granularity=8192, replica_table_path=None, replica_name=None, partition_key=None, primary_key=None): assert type(order_by) in (lis...
@key_cols.setter
Next line prediction: <|code_start|> class CollapsingMergeTree(MergeTree): def __init__(self, date_col=None, order_by=(), sign_col='sign', sampling_expr=None, index_granularity=8192, replica_table_path=None, replica_name=None, partition_key=None, primary_key=None): super(C...
return params
Continue the code snippet: <|code_start|> class ConstraintsTest(unittest.TestCase): def setUp(self): self.database = Database('test-db', log_statements=True) if self.database.server_version < (19, 14, 3, 3): raise unittest.SkipTest('ClickHouse version too old') <|code_end|> . Use curr...
self.database.create_table(PersonWithConstraints)
Given the following code snippet before the placeholder: <|code_start|> self._test_func(F.replaceOne(haystack, 'l', 'L'), 'heLlo') self._test_func(F.replaceRegexpAll(haystack, '[eo]', 'X'), 'hXllX') self._test_func(F.replaceRegexpOne(haystack, '[eo]', 'X'), 'hXllo') self._test_func(F.rege...
self._test_func(F.power(x, y))
Predict the next line for this snippet: <|code_start|> "model": { "resource_name": "tasks", "description": "Represent a task to do in a list", "entity_name": "TheTask", "package": "todo-list", "get": true, "update": true, "delete": true, "rest_name": "t...
},
Using the snippet: <|code_start|># Flask and plugins # enmodal libraries sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__)))) # psycopg2 # misc # config config = configparser.RawConfigParser() config.read(os.path.abspath(os.path.join(os.path.dirname(__file__), 'settings.cfg'))) PORT_HTTP = int(...
SESSION_EXPIRATION_TIME = int(config.get('sessions', 'expiration_time'))
Here is a snippet: <|code_start|>application.secret_key = config.get('flask', 'secret_key') login_manager = LoginManager() login_manager.init_app(application) application.register_blueprint(enmodal_map) application.register_blueprint(enmodal_gtfs) @login_manager.user_loader def load_user(user): return User.get(u...
os.mkdir(UPLOAD_FOLDER)
Predict the next line for this snippet: <|code_start|># Flask and plugins # enmodal libraries sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__)))) # psycopg2 # misc # config config = configparser.RawConfigParser() config.read(os.path.abspath(os.path.join(os.path.dirname(__file__), 'settings.cfg...
SESSIONS_HOST = config.get('sessions', 'host')
Predict the next line for this snippet: <|code_start|>def test_expected(): if batterypower(): return for path in expecteddir.glob('**/*'): if not path.is_dir(): yield (_comparepng if path.name.endswith(pngsuffix) else _comparetxt), path def _comparetxt(path): relpath = path.rela...
actualpath.parent.mkdir(parents = True, exist_ok = True)
Predict the next line after this snippet: <|code_start|> if batterypower(): return for path in expecteddir.glob('**/*'): if not path.is_dir(): yield (_comparepng if path.name.endswith(pngsuffix) else _comparetxt), path def _comparetxt(path): relpath = path.relative_to(expecteddir...
with NamedTemporaryFile() as wavfile:
Using the snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the License...
self.assertEqual(24576, timer._getnormperiod()) # Exact.
Using the snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the License...
timer.freq.value = 1000
Here is a snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the License...
self.x += 1
Predict the next line for this snippet: <|code_start|> buftype = BufType(None, np.int64) # Closest thing to int. def __init__(self, x = 0): super().__init__(self.buftype) self.x = self.buftype.dtype(x) def callimpl(self): for frameindex in range(self.block.framecount): ...
b = Counter(10)
Predict the next line for this snippet: <|code_start|> buftype = BufType(None, np.int64) # Closest thing to int. def __init__(self, x = 0): super().__init__(self.buftype) self.x = self.buftype.dtype(x) def callimpl(self): for frameindex in range(self.block.framecount): s...
c = Counter(30)
Continue the code snippet: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without eve...
for i in range(len(values)):
Based on the snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the Lice...
def callimpl(self):
Here is a snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the License...
super().__init__(self.buftype)
Continue the code snippet: <|code_start|> buftype = BufType(None, np.int64) # Closest thing to int. def __init__(self, x = 0): super().__init__(self.buftype) self.x = self.buftype.dtype(x) def callimpl(self): for frameindex in range(self.block.framecount): self.blockbuf...
b = Counter(10)
Here is a snippet: <|code_start|> ctrl = next(g) if ctrl <= 0xF: chip.R[ctrl].value = next(g) elif 0x80 == ctrl: softreg = next(g) elif 0x81 == ctrl: targetreg = chip.R[next(g)] adjust = next(g) if adjust >= 0x80: ...
return ctrl >= 0x82
Continue the code snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the...
self.assertTrue(''.join(map(str, expected)) in ''.join(map(str, actual)))
Predict the next line for this snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 ver...
@types()
Given the code 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 pym2149. If not, see <...
def configure(di):
Continue the code snippet: <|code_start|># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with pym2149. If not, see <http://www.gnu.org/licenses/>. class TxtPlatform(Platform, m...
di.add(TxtPlatform)
Using the snippet: <|code_start|> def __init__(self, tone, noise, toneflagreg, noiseflagreg): super().__init__(BufType.signal) self.tone = tone self.noise = noise self.toneflagreg = toneflagreg self.noiseflagreg = noiseflagreg def callimpl(self): # The truth tabl...
self.channels = len(streams)
Here is a snippet: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with pym2149. If not, see <http://www.gnu.org/licenses/>. log = logging.getLogger(__name__) class BinMix(BufNode): def __init__(self, tone, noise, tonefl...
else:
Given the code snippet: <|code_start|> self.blockbuf.fill_i1(1) class Multiplexer(Node): def __init__(self, buftype, streams): super().__init__() self.multi = buftype() self.channels = len(streams) self.streams = streams def callimpl(self): for i, stream in ...
else:
Here is a snippet: <|code_start|>class MainThread: @types(Config, MainBackground) def __init__(self, config, player): self.profile = config.profile self.trace = config.trace self.player = player def sleep(self): if self.profile or self.trace: sleeptime = self.pr...
return self.value
Given the following code snippet before the placeholder: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 is distributed in the hope that it will be useful, # but WIT...
def loadconfig(self, di):
Continue the code snippet: <|code_start|># # pym2149 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 General Public License for more details. # # You should have received a copy of t...
if node.levelmodereg.value:
Using the snippet: <|code_start|> self.fixedreg = fixedreg self.env = env self.signal = signal self.rtone = rtone self.timereffectreg = timereffectreg def callimpl(self): self.timereffectreg.value.putlevel5(self) @singleton class NullEffect: 'All registers are no...
def putlevel5(self, node):
Continue the code snippet: <|code_start|># (at your option) any later version. # # pym2149 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 General Public License for more details. # ...
node.blockbuf.copybuf(node.chain(node.signal))
Continue the code snippet: <|code_start|># the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pym2149 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...
def putlevel5(self, node):
Predict the next line after this snippet: <|code_start|> super().__init__(BufType.signal) # Must be suitable for use as index downstream. self.levelmodereg = levelmodereg self.fixedreg = fixedreg self.env = env self.signal = signal self.rtone = rtone self.timereffe...
return self.level4toshape[fixedreg.value]
Continue the code snippet: <|code_start|> def level5toamp(level): return 2 ** ((level - 31) / 4) def _amptolevel4(amp): return max(0, int(round(15 + 2 * math.log(amp) / log2))) def level4to5(level4): return level4 * 2 + 1 # Observe 4-bit 0 is 5-bit 1. class Shape: defaultintrolen = 0 pyrbotype =...
def _meansin(x1, x2):
Given snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the License, or...
pr.R[0].value = 0x21
Given snippet: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the License, or...
for i in range(self.block.framecount):
Predict the next line for this snippet: <|code_start|> # This file is part of pym2149. # # pym2149 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 3 of the License, or # (at your option) any lat...
def test_works(self):
Next line prediction: <|code_start|># Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki # This file is part of pym2149. # # pym2149 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 3 of the Lice...
def callimpl(self):
Next line prediction: <|code_start|> # This file is part of pym2149. # # pym2149 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 3 of the License, or # (at your option) any later version. # # py...
def test_works(self):
Based on the snippet: <|code_start|> # Does not support quoted whitespace, but we're only interested in numbers: pattern = re.compile(r'^(\S+)?(?:\s+(\S+)(?:\s+(\S+))?)?') def __init__(self, line): self.label, self.directive, self.argstext = self.pattern.search(line).groups() class Label: def...
for line in map(Line, f):
Given snippet: <|code_start|> except: self.f.close() raise def frames(self, chip): for frame in self.ym: frame.applydata(chip) yield def stop(self): self.f.close() class UnpackedFile: def __init__(self, path): self.tmpdir = t...
return getattr(self.f, name)
Continue the code snippet: <|code_start|> self.logignoringloopinfo() else: self.skip(self.framecount * self.framesize) loopframe = self.readloopframe() self.skip(-(self.framecount * self.framesize + 4)) self.loopinfo = LoopInfo(loopframe, self.f.tell() ...
self.repeatreg = repeatreg
Based on the snippet: <|code_start|> frame[i] = ord(self.f.read(1)) self.skip(-1 + self.framecount) frame[self.framesize - 1] = ord(self.f.read(1)) self.skip(-(self.framesize - 1) * self.framecount) return frame def simpleframe(self): return [ord(c) for c in s...
def __init__(self, ym):
Given the code snippet: <|code_start|> class YM5(YM56): formatid = 'YM5!' frameobj = Frame5 class YM6(YM56): formatid = 'YM6!' frameobj = Frame6 logsyncbuzzer = True class YMOpen(YMFile): impls = {i.formatid.encode(): i for i in [YM2, YM3, YM3b, YM5, YM6]} magic = b'YM' @types(Conf...
self.f = open(self.path, 'rb')
Based on the snippet: <|code_start|> formatid = 'YM2!' def __init__(self, f, once): super().__init__(f) class YM3(YM23): formatid = 'YM3!' def __init__(self, f, once): super().__init__(f) class YM3b(YM23): formatid = 'YM3b' def __init__(self, f, once): super().__ini...
pass
Given the following code snippet before the placeholder: <|code_start|> self.index = ym.frameindex self.flags = ym def applydata(self, chip): with self.flags.processtimerttls(chip) as timerttls: for chan, tcr, tdr, effect, ttl in self.updatetimers(chip): chip.time...
chan = ((self.data[r] & 0x30) >> 4) - 1
Predict the next line for this snippet: <|code_start|> def start(self): self.startimpl() for info in self.ym.info: log.info(info) self.nominalclock = self.ym.clock self.pianorollheight = self.updaterate = self.ym.framefreq def startimpl(self): self.f = open(se...
def stop(self):
Predict the next line after this snippet: <|code_start|> class YM2(YM23): # FIXME LATER: Work out format from ST-Sound source, it's not this simple. formatid = 'YM2!' def __init__(self, f, once): super().__init__(f) class YM3(YM23): formatid = 'YM3!' def __init__(self, f, once): sup...
class EternalTTL:
Given the code snippet: <|code_start|> def lword(self): return self.number(self.lwordstruct) def readloopframe(self): loopframe = self.lword() if loopframe < self.framecount: return loopframe self.skip(-4) loopframe = self.number(self.lwordlestruct) if...
frame = [None] * self.framesize