Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line after this snippet: <|code_start|># Copyright 2014 Mirantis Inc. # 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. You may obtain # a copy of the License at # # http://www.a...
class WebTestCase(test.TestCase):
Given the following code snippet before the placeholder: <|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 # # Unl...
headers = web.get_trace_id_headers()
Given the following code snippet before the placeholder: <|code_start|># Copyright 2014 Mirantis Inc. # 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. You may obtain # a copy of the License at # # ...
handler = sqlalchemy._before_cursor_execute("sql")
Given 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 or agreed t...
raise exc.CommandError(
Based on the snippet: <|code_start|># Copyright 2016 Mirantis Inc. # 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. You may obtain # a copy of the License at # # http://www.apache.org/licenses/L...
opts.set_defaults(self.conf_fixture.conf)
Continue the code snippet: <|code_start|># Copyright 2016 Mirantis Inc. # 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. You may obtain # a copy of the License at # # http://www.apache.org/licen...
raise exc.CommandError(
Given the following code snippet before the placeholder: <|code_start|># 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. # # IMUSim is distributed in the hope that it will be useful, # but WITHOUT...
assert_almost_equal(transforms.polarToCartesian(*polar), cartesian)
Given the code snippet: <|code_start|> # each element of the list is a tuple of vectors in NED and CG co-ords NED_CG_TEST_VALUES = [ (vector(1,0,0), vector(0,0,1)), (vector(0,1,0), vector(-1,0,0)), (vector(0,0,1), vector(0,-1,0)) ] def checkNED_to_CG(ned, cg): assert_almost_equal(tr...
(AffineTransform(transform=np.eye(3)), vector(1,0,0), vector(1,0,0)),
Given the following code snippet before the placeholder: <|code_start|># # IMUSim 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 sho...
ukf = UnscentedKalmanFilter(stateUpdate, measurementFunc, initialState,
Given the following code snippet before the placeholder: <|code_start|> from __future__ import division def loadViconCSVFile(filename): """ Load 3DOF marker data from a Vicon CSV file. @param filename: Name of the CSV file to load. @return: A L{MarkerCapture} object. """ # Open file to read h...
capture = MarkerCapture()
Using the snippet: <|code_start|> @param filename: Name of the CSV file to load. @return: A L{MarkerCapture} object. """ # Open file to read header. datafile = open(filename, 'r') # Function to get comma-separated values from a line. values = lambda line: line.rstrip('\r\n').split(',') ...
marker = Marker3DOF(capture, name)
Based on the snippet: <|code_start|>""" Tests for vector observation algorithms. """ # Copyright (C) 2009-2011 University of Edinburgh # # This file is part of IMUSim. # # IMUSim 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...
vector_observation.LeastSquaresOptimalVectorObservation):
Predict the next line after this snippet: <|code_start|># IMUSim 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. # # IMUSim is distribu...
capture = MarkerCapture()
Next line prediction: <|code_start|> while True: # Read and count each file header line. line = datafile.readline().strip('\r\n') headerLines = headerLines + 1 # Key and values are tab-separated. items = line.split('\t') key = items[0] values = items[1:] ...
markerClass = Marker3DOF
Predict the next line for this snippet: <|code_start|> markerIndices = dict() while True: # Read and count each file header line. line = datafile.readline().strip('\r\n') headerLines = headerLines + 1 # Key and values are tab-separated. items = line.split('\t') ...
markerClass = Marker6DOF
Here is a snippet: <|code_start|>""" Tests for static trajectories """ # Copyright (C) 2009-2011 University of Edinburgh # # This file is part of IMUSim. # # IMUSim 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 Foundati...
s = StaticTrajectory(p, r)
Based on the snippet: <|code_start|># 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. # # IMUSim is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the imp...
yield checkVectorSpline, UnivariateVectorSpline, x, y, order
Predict the next line for this snippet: <|code_start|>""" Tests for vector splines. """ # Copyright (C) 2009-2011 University of Edinburgh # # This file is part of IMUSim. # # IMUSim 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 ...
splines = spline.splines if isinstance(spline, PartialInputVectorSpline) else [spline]
Predict the next line for this snippet: <|code_start|>class OffsetTrajectory(PositionTrajectory, RotationTrajectory): """ Trajectory at an offset from another trajectory. @ivar parent: the L{AbstractTrajectory} from which this one inherits @ivar positionOffset: the offset from the parent trajectory in ...
@CacheLastValue()
Predict the next line after this snippet: <|code_start|> class NoisyTransformedAccelerometer(NoisyTransformedSensor, IdealAccelerometer): """ Accelerometer with affine transform transfer function and Gaussian noise. """ pass class MMA7260Q(NoisyTransformedSensor, Accelerometer): """ Model of th...
sensitivity = MMA7260Q.NOMINAL_SENSITIVITIES[sensitivity] / STANDARD_GRAVITY
Here is a 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 IMUSim. If not, see <http:/...
class Radio(Component):
Predict the next line for this snippet: <|code_start|># You should have received a copy of the GNU General Public License # along with IMUSim. If not, see <http://www.gnu.org/licenses/>. from __future__ import division x = np.linspace(0,10,100) dt = x[1]-x[0] functions = ( lambda x: x, lambda x: x**2, ...
integrator = integrators.DoubleIntegrator(doubleIntegral(0),integral(0),
Given snippet: <|code_start|>""" Tests for orientation tracking algorithms. """ # Copyright (C) 2009-2011 University of Edinburgh # # This file is part of IMUSim. # # IMUSim 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...
orientation.OrientCF : {
Given the following code snippet before the placeholder: <|code_start|> ] def checkBaseField(field, nominal): assert_almost_equal(field.nominalValue, nominal) assert_almost_equal(field(vector(0,0,0), 0), nominal) def testEarthField(): for args, nominal in TEST_PARAMS: yield checkBaseField, ...
AffineTransform()))
Using the snippet: <|code_start|>""" Tests for position estimation algorithms. """ # Copyright (C) 2009-2011 University of Edinburgh # # This file is part of IMUSim. # # IMUSim 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 Softw...
sampledModel = SampledBodyModel.structureCopy(referenceModel)
Given the code snippet: <|code_start|># # IMUSim 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. # # IMUSim is distributed in the hope ...
initialPosition = referenceModel.position(referenceModel.startTime),
Next line prediction: <|code_start|> @param stateUpdateFunction: Non-linear function to propagate state into the next timestep. The function is called with two arguments, the current Nx1 state vector and the current Mx1 control input vector. It should return a new Nx1 state ve...
self._stateUpdateUT = UnscentedTransform(function)
Given the code snippet: <|code_start|> @property def bytes(self): size = 2 for key in self.keys(): data = self[key] if isinstance(data, Quaternion): size += array(data.components).nbytes elif isinstance(data, numpy.ndarray): siz...
class MasterMAC(MAC):
Predict the next line after this snippet: <|code_start|> @ivar source: Source device ID. @ivar dest: Destination device ID. """ def __init__(self, source, dest, data): """ Initialise auxillary packet. @param source: Source device ID. @param dest: Destination device ID. ...
self.frameTimer = VirtualTimer(timerMux, self._frameTimerHandler)
Predict the next line for this snippet: <|code_start|># along with IMUSim. If not, see <http://www.gnu.org/licenses/>. from __future__ import division class Schedule(object): """ Transmission schedule. """ def __init__(self, dataSlotTime, syncSlotTime, dataSlots): """ Initialise sche...
class SyncPacket(RadioPacket):
Predict the next line for this snippet: <|code_start|>""" Tests for ASF/AMC input """ # Copyright (C) 2009-2011 University of Edinburgh # # This file is part of IMUSim. # # IMUSim 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 So...
asfModel = loadASFFile(asfFile, amcFile, scaleFactor=2.54/100,
Given the code snippet: <|code_start|>""" Tests for ASF/AMC input """ # Copyright (C) 2009-2011 University of Edinburgh # # This file is part of IMUSim. # # IMUSim 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 Foundatio...
bvhModel = loadBVHFile(bvhFile, 1.0/100)
Here is a snippet: <|code_start|> """ with open(filename,'r') as bvhFile: loader = BVHLoader(bvhFile,conversionFactor) loader._readHeader() loader._readMotionData() return loader.model class BVHLoader(object): ''' Loader class for BVH files. ''' def __init__(self, bvh...
self.model = SampledBodyModel()
Using the snippet: <|code_start|> name = self._token() # name will be 'Site' for End Site joints. if name == 'Site': name = currentJoint.parent.name+"_end" currentJoint.name = name self._checkToken("{") while True: token = self._token() ...
joint = SampledJoint(currentJoint)
Predict the next line for this snippet: <|code_start|> if name == 'Site': name = currentJoint.parent.name+"_end" currentJoint.name = name self._checkToken("{") while True: token = self._token() if token == "OFFSET": x = self._floatToken...
joint = PointTrajectory(currentJoint)
Predict the next line after this snippet: <|code_start|> Read the motion data from the BVH file. ''' # update joint tree with new data. frame = 0 lastRotation = {} for frame in range(self.frameCount): time = frame * self.framePeriod channelData = se...
p = convertCGtoNED(p)
Given the following code snippet before the placeholder: <|code_start|> self.bvhFile = bvhFile self.model = model self.samplePeriod = samplePeriod self.conversionFactor = conversionFactor @property def frames(self): """ The number of frames that will be exported. """ ...
for v in convertNEDtoCG(p.positionOffset):
Continue the code snippet: <|code_start|># This file is part of IMUSim. # # IMUSim 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. # # ...
class _TimerProcess(SimPy.Simulation.Process):
Predict the next line after this snippet: <|code_start|> ] initialStates = [ np.zeros((1,1)), np.array([[1]]), np.array([[0],[0]]) ] initialCovariances = [ np.array([[0.1]]), np.array([[0.5]]), 0.2**2 * np.array([[dt**4/4,dt**3/2],[dt**3/2, dt**2]]) ...
filter = kalman.KalmanFilter(stateTransition, control,
Next line prediction: <|code_start|> for bone in self: if bone.name == bonename: return bone def loadASFFile(asfFileName, amcFileName, scaleFactor, framePeriod): """ Load motion capture data from an ASF and AMC file pair. @param asfFileName: Name of the ASF file containi...
imusimModel = SampledBodyModel('root')
Continue the code snippet: <|code_start|> from the CMU motion capture corpus this should be 2.54/100 to convert from inches to metres. @return: A {SampledBodyModel} representing the root of the rigid body model structure. """ with open(asfFileName, 'r') as asfFile: data = asf...
SampledJoint(parent=imusimModel.getJoint(ancestor.name),
Using the snippet: <|code_start|> model structure. """ with open(asfFileName, 'r') as asfFile: data = asfParser.parseFile(asfFile) scale = (1.0/data.units.get('length',1)) * scaleFactor bones = dict((bone.name,bone) for bone in data.bones) asfModel = ASFRoot(data.root) ...
PointTrajectory(
Given the code snippet: <|code_start|> for subtree in asfModel.children: for bone in subtree: if not bone.isDummy: offset = vector(0,0,0) ancestors = bone.ascendTree() while True: ancestor = ancestors....
position = convertCGtoNED(scale * vector(data['tx'],
Predict the next line for this snippet: <|code_start|># # You should have received a copy of the GNU General Public License # along with IMUSim. If not, see <http://www.gnu.org/licenses/>. def testBVHInput(): data = r"""HIERARCHY ROOT root { OFFSET 0.0 0.0 0.0 CHANNELS 6 Xposition Yposition Zposition Zro...
model = loadBVHFile(testFile.name)
Given the code snippet: <|code_start|> data = r"""HIERARCHY ROOT root { OFFSET 0.0 0.0 0.0 CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation JOINT j1 { OFFSET 10.0 0.0 0.0 CHANNELS 3 Zrotation Xrotation Yrotation End Site { OFFSET 0.0 1...
saveBVHFile(model, exportFile.name, 0.1)
Predict the next line after this snippet: <|code_start|> OFFSET 0.0 0.0 0.0 CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation JOINT j1 { OFFSET 10.0 0.0 0.0 CHANNELS 3 Zrotation Xrotation Yrotation End Site { OFFSET 0.0 10.0 0.0 } ...
convertCGtoNED(Quaternion(1,0,0,0)))
Given snippet: <|code_start|> class HomeView(DetailView): def get_object(self, queryset=None): if self.request.user.is_authenticated: <|code_end|> , continue by predicting the next line. Consider current file imports: import hashlib import rules from django.conf import settings from django.contrib impo...
up, created = UserProfile.objects.get_or_create(user=self.request.user)
Predict the next line for this snippet: <|code_start|> class CommunitySubscriptionInline(admin.TabularInline): model = CommunitySubscription extra = 1 <|code_end|> with the help of current file imports: from django.contrib import admin from django.db.models import Count from .models import ( Community...
@admin.register(Community)
Predict the next line for this snippet: <|code_start|> class JSONFeed(SyndicationFeed): mime_type = "application/json" def write(self, outfile, encoding): data = {} data.update(self.feed) data['items'] = self.items json.dump(data, outfile, cls=DjangoJSONEncoder) # outf...
return Event.objects.filter(community=obj).order_by('-created')
Based on the snippet: <|code_start|># coding: utf-8 class LogHistoryChangeDecoratorTest(unittest.TestCase): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown() def test_invoke_without_params_must_crash(self): with self.assertRaises(TypeError): ...
@LogHistoryChange()
Based on the snippet: <|code_start|> return data, xml class RefIdPipe(plumber.Pipe): def transform(self, data): raw, xml = data ref = xml.find('.') ref.set('id', 'B{0}'.format(str(raw.index_number))) return data class MixedCitationPipe(plum...
xml.append(utils.convert_all_html_tags_to_jats(mixed_citation))
Given the code snippet: <|code_start|> class FunctionDatesToStringTests(unittest.TestCase): def test_converts_datatime_in_processing_date_value(self): data = {'processing_date': datetime(2017, 9, 14)} expected_result = {'processing_date': '2017-09-14'} <|code_end|> , generate the next line using th...
self.assertEqual(controller.dates_to_string(data), expected_result)
Given the following code snippet before the placeholder: <|code_start|># coding: utf-8 class LoadLicensesTest(unittest.TestCase): def test_scrapt_body(self): data = u"""<html><header></header><body><div class="content"><div class="index,en"><div class="title">Crazy <i>Title</i></div><p>Crazy Body</p><p...
result = load_body.scrap_body(data.encode('utf-8'), 'en')
Using the snippet: <|code_start|># coding: utf-8 class ExportTests(unittest.TestCase): def setUp(self): self._raw_json = json.loads(open(os.path.dirname(__file__)+'/fixtures/article_meta.json').read()) self._article_meta = Article(self._raw_json) def test_xmlclose_pipe(self): pxm...
xmlarticle = export_pubmed.XMLClosePipe()
Given the following code snippet before the placeholder: <|code_start|> self.assertEqual('<ArticleSet><Article><ArticleIdList><ArticleId IdType="pii">S0034-89102010000400007</ArticleId><ArticleId IdType="doi">10.1590/S0034-89102010000400007</ArticleId></ArticleIdList></Article></ArticleSet>'.encode('utf-8'), ET....
xml = ET.XML(export.Export(self._raw_json).pipeline_pubmed())
Given the following code snippet before the placeholder: <|code_start|># coding: utf-8 class XMLCitationTests(unittest.TestCase): def setUp(self): self._raw_json = json.loads(open(os.path.dirname(__file__)+'/fixtures/article_meta.json').read()) self._citation_meta = Article(self._raw_json).cit...
self._xmlcitation = export_sci.XMLCitation()
Given the following code snippet before the placeholder: <|code_start|># coding: utf-8 """ This processing import affiliation metadata for the Article Meta database. input: CSV file formated as below Collection|PID|Publication Year|Journal Title|number label|Affiliation ID [aff1, aff2]|Affiliaton as it was marked...
config = utils.Configuration.from_env()
Here is a snippet: <|code_start|> class MockJournal(object): @property def title(self): return 'Title' class MockArticle(object): def __init__(self): self.publisher_id = u'S0001-37652013000100001' self.affiliations = [ ...
result = importaffiliation.parse_csv_line(line.split('|'))
Continue the code snippet: <|code_start|># coding: utf-8 class ViewsTest(unittest.TestCase): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown() def test_get_request_limit_param_by_default(self): """ test default behavior of the helper...
result_limit = articlemeta._get_request_limit_param(request)
Given snippet: <|code_start|># coding: utf-8 class ExportTests(unittest.TestCase): def setUp(self): self._raw_json = json.loads(open(os.path.dirname(__file__)+'/fixtures/article_meta.json').read()) self._article_meta = Article(self._raw_json) def test_xmlclose_pipe(self): pxml = E...
xmlarticle = export_doaj.XMLClosePipe()
Given the following code snippet before the placeholder: <|code_start|> 'Terapia de Reemplazo Renal', 'Sistemas de Información en Hospital', 'Registros de Mortalidad', 'Insuficiência Renal Crônica', 'Terapia de Substituição Renal', 'Sistemas de Info...
xml = export.Export(self._raw_json).pipeline_doaj()
Predict the next line for this snippet: <|code_start|> class TagHandler(BaseHandler): def read(self, request, tag_id): try: tag = Tag.objects.get(id=tag_id) except: resp = rc.NOT_HERE resp.write(": Tag does not exist.") return resp <|code...
snipts = TaggedItem.objects.get_by_model(Snippet.objects.filter(public='1'), tag)
Given snippet: <|code_start|> DEBUG = False DATABASE_ENGINE = '' DATABASE_NAME = '' DATABASE_USER = '' DATABASE_PASSWORD = '' TIME_ZONE = '' SECRET_KEY = '' <|code_end|> , continue by predicting the next line. Consider current file imports: from settings import INSTALLED_APPS and context: # Path: settings.py # I...
INSTALLED_APPS += ('gunicorn',)
Predict the next line for this snippet: <|code_start|> # If the user is at the homepage (no tag specified). else: # Retrieve latest 20 snipts for user. if mine: snipts = Snippet.objects.filter(user=context_user.id).order_by('-created') favsnipts = FavSnipt.ob...
if not DEBUG:
Given snippet: <|code_start|> class MemphisCouncilCalNotifier(BaseNotifier): def get_site(self): return Document.Site.MEMPHIS_COUNCIL_CALENDAR def get_listings_pre_text(self, items_length): return ("We have found {} new documents ".format(items_length) + "since we last sent you...
return make_doc_item_body(doc)
Given the following code snippet before the placeholder: <|code_start|> log = logging.getLogger(__name__) URL_PREFIX = 'http://www.mass.gov/eopss/funding-and-training/' class MassGovEOPSSScraper(BaseScraper): def __init__(self): <|code_end|> , predict the next line using imports from the current file: from do...
self.url_dict = url_scraper_dict.MASSGOV_DICT
Next line prediction: <|code_start|> log = logging.getLogger(__name__) URL_PREFIX = 'http://www.mass.gov/eopss/funding-and-training/' class MassGovEOPSSScraper(BaseScraper): def __init__(self): self.url_dict = url_scraper_dict.MASSGOV_DICT def get_site(self): return Document.Site.MASSGOV_E...
results_page_scraper.scrape_results_page(page.content, xpaths)
Predict the next line after this snippet: <|code_start|> class MassGovNotifier(BaseNotifier): def get_site(self): return Document.Site.MASSGOV_EOPSS def get_listings_pre_text(self, items_length): formatted_text = "{} new Funding and Training documents" \ .format(items_length) ...
return make_doc_item_body(doc)
Predict the next line after this snippet: <|code_start|> class KnoxCoTNAgendaNotifier(BaseNotifier): def get_site(self): return Document.Site.KNOX_CO_TN_AGENDAS def get_listings_pre_text(self, items_length): return ("We have found {} new documents ".format(items_length) + "sinc...
return make_doc_item_body(doc)
Using the snippet: <|code_start|> # TODO(anaulin): Remove this method, and replace it with setting the # site_name in each constructor. def get_site(self): """Identifies the site type of the notifier Returns: site -- object of type Bid.Site """ raise NotImplementedEr...
send_email(subject, self.make_email_body(bids), recipients)
Based on the snippet: <|code_start|> def get_site(self): """Identifies the site type of the notifier Returns: site -- object of type Bid.Site """ raise NotImplementedError def get_listings_pre_text(self, items_length): """Heading text before listings are displaye...
return make_html_body(
Given the code snippet: <|code_start|> class KnoxvilleTNMeetingsNotifier(BaseNotifier): def get_site(self): return Document.Site.KNOXVILLE_TN_MEETINGS def get_listings_pre_text(self, items_length): return ("We have found {} new documents ".format(items_length) + "since we last ...
return make_doc_item_body(doc)
Predict the next line for this snippet: <|code_start|># Commenting out in since CISv1 is no longer up and running # todo: this will need to get modified to reach out to person api v2 # import urllib class API(object): """Retrieve data from person api as needed. Will eventually replace Mozillians API""" def...
self.config = config.OIDCConfig()
Given snippet: <|code_start|>"""Test to cover signed error message system.""" class ErrorTest(object): public_key_file = os.path.join( os.path.abspath( os.path.dirname(__file__) ), 'data/public-signing-key.pem' ) public_key = open(public_key_file).read() sample_j...
tv = oidc_auth.tokenVerification(
Predict the next line for this snippet: <|code_start|> logger = logging.getLogger(__name__) class AuthorizeAPI(object): def __init__(self, app, oidc_config): self.app = app self.algorithms = "RS256" self.auth0_domain = oidc_config.OIDC_DOMAIN # auth.mozilla.auth0.com self.audience...
raise AuthError(
Given snippet: <|code_start|> else: # This could mean a user is authing with non-ldap return [] @property def first_name(self): """Return user first_name.""" try: return self.idvault_info.get("firstName", "") except KeyError: return...
alerts = alert.Alert().find(user_id=self.userinfo["sub"])
Continue the code snippet: <|code_start|> class Router(object): def __init__(self, app, app_list): self.app = app <|code_end|> . Use current file imports: from flask import make_response from flask import redirect from flask import request from dashboard.op import yaml_loader and context (classes, funct...
self.url_list = yaml_loader.Application(app_list.apps_yml).vanity_urls()
Based on the snippet: <|code_start|>"""Install siptools.""" def scripts_list(): """Return list of command line tools from package pas.scripts.""" scripts = [] for modulename in os.listdir('siptools/scripts'): if modulename == '__init__.py': continue if not modulename.endswith(...
version=get_version(),
Here is a snippet: <|code_start|> # If temporary file was written, it'll replace the existing reference # file as a whole. if os.path.exists('%s.tmp' % reference_file): os.rename('%s.tmp' % reference_file, reference_file) # pylint: disable=too-many-arguments # pylint: disable...
digest = generate_digest(metadata)
Given the code snippet: <|code_start|> if os.path.exists('%s.tmp' % reference_file): os.rename('%s.tmp' % reference_file, reference_file) # pylint: disable=too-many-arguments # pylint: disable=too-many-locals def write_md(self, metadata, mdtype, mdtypeversion, othermdtype=None, ...
filename = encode_path("%s-%s-amd.xml" % (digest, suffix))
Given snippet: <|code_start|> creator.add_videomd_md("tests/data/video/valid_1.m1v") creator.write() # Check that mdreference and one VideoMD-amd files are created assert os.path.isfile(os.path.join(testpath, 'create-videomd-md-references.jsonl')) filepath = ...
fsencode_path(relative_path)
Predict the next line for this snippet: <|code_start|> assert os.path.isfile(os.path.join(testpath, 'create-videomd-md-references.jsonl')) filepath = os.path.join( testpath, '36260c626dac2f82359d7c22ef378392-VideoMD-amd.xml' ) assert os.path.isfile(filepat...
refs = read_md_references(testpath, 'create-videomd-md-references.jsonl')
Given the following code snippet before the placeholder: <|code_start|> filepath = os.path.join( testpath, 'eae4d239422e21f3a8cfa57bb2afcb9e-AudioMD-amd.xml' # testpath, '704fbd57169eac3af9388e03c89dd919-AudioMD-amd.xml' # testpath, '4dab7d9d5bab960188ea0f25e478cb17-AudioMD-amd.xml' ) ...
refs = read_md_references(testpath, 'create-audiomd-md-references.jsonl')
Next line prediction: <|code_start|> def get_amd_file(path): """Get id""" refs = read_md_references(path, 'define-xml-schemas-md-references.jsonl') reference = refs['.'] amdrefs = reference['md_ids'] output = [] for amdref in amdrefs: output_file = os.path.join( path, amd...
run_cli(define_xml_schemas.main, arguments)
Continue the code snippet: <|code_start|> amdrefs = reference['md_ids'] output = [] for amdref in amdrefs: output_file = os.path.join( path, amdref[1:] + '-PREMIS%3AOBJECT-amd.xml') if os.path.exists(output_file): output.append(output_file) return output def t...
namespaces=NAMESPACES)) == 1
Here is a snippet: <|code_start|># encoding: utf-8 """Unit tests for ``siptools.scripts.import_object`` module.""" from __future__ import unicode_literals def get_amd_file(path, input_file, stream=None, ref_file='import-object-md-references.jsonl', ...
refs = read_md_references(path, ref_file)
Given the following code snippet before the placeholder: <|code_start|>def test_create_mix_techmdfile(testpath): """Test for ``create_mix_techmdfile`` function. Creates MIX techMD for three different image files. Two of the image files share the same MIX metadata, so only two MIX techMD files should be crea...
refs = read_md_references(testpath, 'create-mix-md-references.jsonl')
Next line prediction: <|code_start|>"""Command line tool for collecting agent metadata""" from __future__ import unicode_literals, print_function click.disable_unicode_literals_warning = True @click.command() @click.argument('agent_name', required=True, type=str) @click.option('--workspace', type=cl...
list2str(PREMIS_AGENT_TYPES)))
Predict the next line after this snippet: <|code_start|>"""Command line tool for collecting agent metadata""" from __future__ import unicode_literals, print_function click.disable_unicode_literals_warning = True @click.command() @click.argument('agent_name', required=True, type=str) @click.option('--workspace', ...
type=click.Choice(PREMIS_AGENT_TYPES),
Next line prediction: <|code_start|>"""Command line tool for creating tar file from SIP directory""" from __future__ import unicode_literals, print_function click.disable_unicode_literals_warning = True @click.command() @click.argument('dir_to_tar', type=click.Path(exists=True)) @click.option( '--tar_filename...
command = ['tar', '-cvvf', fsencode_path(tar_filename), '.']
Given snippet: <|code_start|> ], ids=("Agent with minimum data", "Agent with event role", "Agent with given identifier that should be written to the output", "Agent_version that shouldn't be written due to the agent_type", "Agent with agent_version that should be written", ...
run_cli(create_agent.main, cli_args)
Based on the snippet: <|code_start|> # Check individual elements tags = ["fieldSeparatingChar", "charset", "recordSeparator", "quotingChar"] vals = [";", "UTF-8", "CR+LF", '"'] for i, tag in enumerate(tags): val = addml_etree.find(ADDML_NS + tag).text assert val == vals[i] # Check ...
assert decode_path(flatfile.get("name")) == "path/to/test"
Given the following code snippet before the placeholder: <|code_start|> @pytest.mark.parametrize("file_, base_path", [ ('tests/data/csvfile.csv', ''), ('./tests/data/csvfile.csv', ''), ('csvfile.csv', 'tests/data'), ('./csvfile.csv', './tests/data'), ('data/csvfile.csv', 'absolute') ]) def test_path...
references = read_md_references(testpath,
Based on the snippet: <|code_start|> mets_element.append(metshdr) for element in elements: mets_element.append(element) lxml.etree.cleanup_namespaces(mets_element) return lxml.etree.ElementTree(mets_element) def clean_metsparts(path): """ Clean mets parts from workspace. :path: Wo...
files = get_objectlist(read_md_references(
Next line prediction: <|code_start|> mets_element.append(metshdr) for element in elements: mets_element.append(element) lxml.etree.cleanup_namespaces(mets_element) return lxml.etree.ElementTree(mets_element) def clean_metsparts(path): """ Clean mets parts from workspace. :path: Wo...
files = get_objectlist(read_md_references(
Predict the next line after this snippet: <|code_start|> agent_role='CREATOR', othertype='SOFTWARE')) else: agents = [mets.agent(attributes["organization_name"], agent_role='CREATOR')] # Create mets header ...
METS_CATALOG,
Using the snippet: <|code_start|>"""Command line tool for creating METS document and copying files to workspace directory. """ from __future__ import print_function, unicode_literals try: except ImportError: click.disable_unicode_literals_warning = True @click.command() <|code_end|> , determine the next line of...
@click.argument('mets_profile', type=click.Choice(METS_PROFILE))
Continue the code snippet: <|code_start|> othertype='SOFTWARE')) else: agents = [mets.agent(attributes["organization_name"], agent_role='CREATOR')] # Create mets header metshdr = mets.metshdr(attributes["create_date"], ...
METS_SPECIFICATION,
Using the snippet: <|code_start|> :returns: METS document ElementTree object """ attributes = _attribute_values(attributes, fill_contentid) # Create list of agent elements if attributes["packagingservice"]: agents = [mets.agent(attributes["organization_name"], age...
elements = mets.merge_elements('{%s}amdSec' % NAMESPACES['mets'], elements)
Predict the next line after this snippet: <|code_start|> help='Workspace directory. Defaults to "./workspace".') @click.option('--base_path', metavar='<BASE PATH>', type=click.Path(exists=True), default='.', help='Base path of the digital objects.') @...
type=click.Choice(RECORD_STATUS_TYPES),