Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Using the snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import division class BroadcastDetailView(DetailView): model = Broadcast slug_field = 'number' class BroadcastListView(ListView): model = Broadcast def calculate_highlights_per_episode(self, **kwargs): episodes = Br...
highlights = Highlight.objects.count()
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import division class BroadcastDetailView(DetailView): model = Broadcast slug_field = 'number' class BroadcastListView(ListView): model = Broadcast def calculate_highlights_per_episode(self, **kwargs): episodes = Br...
raids = Raid.objects.count()
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class Quote(models.Model): text = models.TextField() timestamp = models.DateField(default=timezone.now) subject = models.CharField(blank=True, max_length=200, help_text='The person that was quoted.') creator = models.CharField(blank=Tru...
broadcast = models.ForeignKey(Broadcast, blank=True, null=True, related_name='quotes')
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- class Quote(models.Model): text = models.TextField() timestamp = models.DateField(default=timezone.now) subject = models.CharField(blank=True, max_length=200, help_text='The person that was quoted.') creator = models.CharField(blank=...
game = models.ForeignKey(Game, blank=True, null=True, related_name='quoted_on')
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class GameAdmin(admin.ModelAdmin): list_display = ['name', 'platform', 'is_abandoned', 'is_completed'] list_editable = ['is_abandoned', 'is_completed'] ordering = ['name'] raw_id_fields = ['platform'] autocomplete_lookup_fields = { 'fk': [...
admin.site.register(Game, GameAdmin)
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- class GameAdmin(admin.ModelAdmin): list_display = ['name', 'platform', 'is_abandoned', 'is_completed'] list_editable = ['is_abandoned', 'is_completed'] ordering = ['name'] raw_id_fields = ['platform'] ...
admin.site.register(Platform, PlatformAdmin)
Given the following code snippet before the placeholder: <|code_start|> class HighlightInline(admin.StackedInline): extra = 1 model = Highlight class HostInline(admin.TabularInline): extra = 1 model = Host class RaidInline(admin.TabularInline): extra = 1 model = Raid class BroadcastAdmin(...
admin.site.register(Broadcast, BroadcastAdmin)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- class HighlightInline(admin.StackedInline): extra = 1 model = Highlight class HostInline(admin.TabularInline): extra = 1 <|code_end|> . Write the next line using the current file imports: from django.contrib import admin from .models import Broa...
model = Host
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- class HighlightInline(admin.StackedInline): extra = 1 model = Highlight class HostInline(admin.TabularInline): extra = 1 model = Host class RaidInline(admin.TabularInline): extra = 1 <|code_end|> , ...
model = Raid
Predict the next line for this snippet: <|code_start|> def game_list(self, obj): return ", ".join([g.name for g in obj.games.all()]) admin.site.register(Broadcast, BroadcastAdmin) class HighlightAdmin(admin.ModelAdmin): fieldsets = ( (None, {'fields': (('broadcast', 'twid'),)}), ('Detai...
admin.site.register(Series, SeriesAdmin)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_game_factory(): factory = GameFactory() assert isinstance(factory, Game) def test_platform_factory(): <|code_end|> , generate the next line using the imports in this file: import pytest from .factori...
factory = PlatformFactory()
Given snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_game_factory(): factory = GameFactory() <|code_end|> , continue by predicting the next line. Consider current file imports: import pytest from .factories import GameFactory, PlatformFactory from ..models import Gam...
assert isinstance(factory, Game)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_game_factory(): factory = GameFactory() assert isinstance(factory, Game) def test_platform_factory(): factory = PlatformFactory() <|code_end|> , generate the next line using the imports in this fi...
assert isinstance(factory, Platform)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- class StatusView(JSONResponseMixin, View): def get(self, request, *args, **kwargs): broadcast = Broadcast.objects.latest() context = { 'is_episodic': is_episodic(), <|code_end|> with the help of current f...
'is_live': bool(fetch_stream()),
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- class StatusView(JSONResponseMixin, View): def get(self, request, *args, **kwargs): broadcast = Broadcast.objects.latest() context = { <|code_end|> , predict the immediate next line with the help of imports: from django.views.generic ...
'is_episodic': is_episodic(),
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class PlatformFactory(factory.django.DjangoModelFactory): class Meta: model = Platform class GameFactory(factory.django.DjangoModelFactory): class Meta: <|code_end|> , determine the next line of code. You have imports: import factory from .....
model = Game
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_ticket_factory(): factory = TicketFactory() <|code_end|> , predict the next line using imports from the current file: import pytest from .factories import TicketFactory fro...
assert isinstance(factory, Ticket)
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db class TestBroadcasts: def test_factory(self): <|code_end|> , predict the next line using imports from the current file: import pytest from .factories import (BroadcastFactory) from ...
factory = BroadcastFactory()
Given snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db class TestBroadcasts: def test_factory(self): factory = BroadcastFactory() <|code_end|> , continue by predicting the next line. Consider current file imports: import pytest from .factories import (BroadcastFactory) ...
assert isinstance(factory, Broadcast)
Using the snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_broadcast_factory(): factory = BroadcastFactory() assert isinstance(factory, Broadcast) def test_host_factory(): <|code_end|> , determine the next line of code. You have imports: import pytest from .facto...
factory = HostFactory()
Given snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_broadcast_factory(): factory = BroadcastFactory() assert isinstance(factory, Broadcast) def test_host_factory(): factory = HostFactory() assert isinstance(factory, Host) def test_raid_factory(): <|co...
factory = RaidFactory()
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_broadcast_factory(): factory = BroadcastFactory() assert isinstance(factory, Broadcast) def test_host_factory(): factory = HostFactory() assert isinstance(fact...
factory = SeriesFactory()
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_broadcast_factory(): factory = BroadcastFactory() <|code_end|> , predict the next line using imports from the current file: import pytest from .factories import (BroadcastF...
assert isinstance(factory, Broadcast)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_broadcast_factory(): factory = BroadcastFactory() assert isinstance(factory, Broadcast) def test_host_factory(): factory = HostFactory() <|code_end|> with the help of current file...
assert isinstance(factory, Host)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_broadcast_factory(): factory = BroadcastFactory() assert isinstance(factory, Broadcast) def test_host_factory(): factory = HostFactory() assert isinstance(factory, Host) def ...
assert isinstance(factory, Raid)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_broadcast_factory(): factory = BroadcastFactory() assert isinstance(factory, Broadcast) def test_host_factory(): factory = HostFactory() assert isinstance(factory, Host) def test_raid_fac...
assert isinstance(factory, Series)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- class Command(NoArgsCommand): help = 'Counts and saves the total number of subscriptions for the current day.' def handle_noargs(self, **options): <|code_end|> . Use current file imports: from django.core.management.base import NoArgsCommand ...
count = Count.objects.create_count()
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- urlpatterns = [ # Temporary redirect to Twitch channel. url(r'^$', name='site-home', view=RedirectView.as_view(url='http://twitch.tv/avalonstar', permanent=False)), # Core Modules. url(r'^', include('apps.broadcasts.urls')), url(r'^',...
url(r'^robots.txt$', name='robots', view=PlainTextView.as_view(template_name='robots.txt'))
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) <|code_end|> . Write the next line using the current file imports: from django.conf.urls import url, include from rest_framework import r...
router.register(r'hosts', HostViewSet)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) router.register(r'quotes', Quot...
router.register(r'raids', RaidViewSet)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) <|code_end|> . Write the next line using the current file imports: from django.conf.urls import ur...
router.register(r'platforms', PlatformViewSet)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) <|code_end|> . Write the next line using the current...
router.register(r'quotes', QuoteViewSet)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) router.register(r'quotes', QuoteViewSet) router...
router.register(r'tickets', TicketViewSet)
Using the snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) router.register(r'quotes', QuoteViewSet) router.regi...
url(r'^pusher/donation/$', name='pusher-donation', view=PusherDonationView.as_view()),
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) router.register(r'quotes', QuoteViewSet) router.r...
url(r'^pusher/host/$', name='pusher-host', view=PusherHostView.as_view()),
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) router.register(r'quotes', QuoteViewSet) rou...
url(r'^pusher/resubscription/$', name='pusher-resubscription', view=PusherResubscriptionView.as_view()),
Given snippet: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) router.register(r'quotes', QuoteViewSet) router.register...
url(r'^pusher/subscription/$', name='pusher-subscription', view=PusherSubscriptionView.as_view()),
Next line prediction: <|code_start|># -*- coding: utf-8 -*- router = routers.DefaultRouter() router.register(r'broadcasts', BroadcastViewSet) router.register(r'games', GameViewSet) router.register(r'hosts', HostViewSet) router.register(r'platforms', PlatformViewSet) router.register(r'quotes', QuoteViewSet) router.r...
url(r'^pusher/substreak/$', name='pusher-substreak', view=PusherSubstreakView.as_view()),
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class Series(models.Model): name = models.CharField(max_length=200) class Meta: ordering = ['name'] verbose_name_plural = 'series' def __str__(self): return '{}'.format(self.name) @staticmethod def autocomplete_se...
games = models.ManyToManyField(Game, related_name='appears_on')
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- class TicketAdmin(admin.ModelAdmin): list_display = ['name', 'display_name', 'created', 'updated', 'streak', 'is_active', 'is_paid', 'twid'] list_editable = ['is_active', 'is_paid'] ordering = ['-updated'] <|code_end|> using...
admin.site.register(Ticket, TicketAdmin)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- pytestmark = pytest.mark.django_db def test_quote_factory(): factory = QuoteFactory() <|code_end|> . Write the next line using the current file imports: import pytest from .factories import QuoteFactory from ..models import Quote and context from other ...
assert isinstance(factory, Quote)
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class SeriesFactory(factory.django.DjangoModelFactory): class Meta: model = Series class BroadcastFactory(factory.django.DjangoModelFactory): class Meta: <|code_end|> , determine the next line of code. You have imports: import factory from ....
model = Broadcast
Next line prediction: <|code_start|># -*- coding: utf-8 -*- class SeriesFactory(factory.django.DjangoModelFactory): class Meta: model = Series class BroadcastFactory(factory.django.DjangoModelFactory): class Meta: model = Broadcast class HighlightFactory(factory.django.DjangoModelFactory)...
model = Highlight
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- class SeriesFactory(factory.django.DjangoModelFactory): class Meta: model = Series class BroadcastFactory(factory.django.DjangoModelFactory): class Meta: model = Broadcast class HighlightFactory(factory.django.DjangoModelFactory): ...
model = Host
Given snippet: <|code_start|> class SeriesFactory(factory.django.DjangoModelFactory): class Meta: model = Series class BroadcastFactory(factory.django.DjangoModelFactory): class Meta: model = Broadcast class HighlightFactory(factory.django.DjangoModelFactory): class Meta: model...
model = Raid
Predict the next line after this snippet: <|code_start|>def main(args=None): # parse command-line options parser = argparse.ArgumentParser( description='description: convert JSON file with refined multislit ' 'parameters to new JSON format' ) # required arguments parser....
refined_boundary_model = RefinedBoundaryModelParam(instrument='EMIR')
Continue the code snippet: <|code_start|># (at your option) any later version. # # PyEmir 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. # #...
aa = encloses_annulus(x_min, x_max, y_min, y_max,
Given the following code snippet before the placeholder: <|code_start|># # Copyright 2015-2019 Universidad Complutense de Madrid # # This file is part of PyEmir # # SPDX-License-Identifier: GPL-3.0+ # License-Filename: LICENSE.txt # """Test the AIV pinhole mask recipe""" BASE_URL = 'https://guaix.fis.ucm.es/data...
run_recipe()
Next line prediction: <|code_start|>"""Recipe for the reduction of gain calibration frames.""" _logger = logging.getLogger('numina.recipes.emir') class GainRecipe1(EmirRecipe): """Detector Gain Recipe. Recipe to calibrate the detector gain. """ obresult = ObservationResultRequirement() ...
return QUADRANTS
Given snippet: <|code_start|> _logger = logging.getLogger('numina.recipes.emir') class GainRecipe1(EmirRecipe): """Detector Gain Recipe. Recipe to calibrate the detector gain. """ obresult = ObservationResultRequirement() region = Parameter('channel', 'Region used to compute: ' ...
return CHANNELS
Predict the next line for this 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 PyEmir....
gain = Result(MasterGainMap(None, None, None))
Given 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 PyEmir. If not, see <http://www.gnu.org/licenses/>. # """Recipe for the reduction of g...
ron = Result(MasterRONMap(None, None))
Using the snippet: <|code_start|> def useful_mos_xpixels(reduced_mos_data, base_header, vpix_region, npix_removed_near_ohlines=0, list_valid_wvregions=None, debugplot=0): """Useful X-axis pixels re...
islitlet_min = get_islitlet(nsmin)
Given snippet: <|code_start|># License-Filename: LICENSE.txt # """Twilight Flat Recipe for a list of frames in different filters""" class MultiTwilightFlatRecipe(EmirRecipe): """Create a list of twilight flats""" obresult = reqs.ObservationResultRequirement() master_bpm = reqs.MasterBadPixelMaskRequ...
iinfo = gather_info_frames(rinput.obresult.frames)
Given the following code snippet before the placeholder: <|code_start|> m, s = np.mean(data_sub), np.std(data_sub) ax.imshow(data_sub, interpolation='nearest', cmap='gray', vmin=m - s, vmax=m + s, origin='lower', extent=bounding_box.extent) if plot_reference: ...
class MaskCheckRecipe(EmirRecipe):
Using the snippet: <|code_start|> if not csu_conf.is_open(): #self.logger.info('CSU is configured, detecting slits') # slits_bb = self.compute_slits(hdulist_slit, csu_conf) # Not detecting slits. We trust the model slits_bb = None image_sep = hdulist_o...
ipa_rot = create_rot2d(ipa_deg.to('', equivalencies=u.dimensionless_angles()))
Predict the next line after this snippet: <|code_start|> trans3 = [[0, -1, 0], [1, 0, 0], [0, 0, 1]] # T3 = T2 * T1 vec = np.dot(trans3, dtuconf.coor_r) * u.micron/ cons.EMIR_PIXSIZE self.logger.debug('DTU shift is %s', vec) self.logger.debug('create bar model') barmodel = csuc...
if slit.target_type == TargetType.REFERENCE:
Here is a snippet: <|code_start|># the tagger is global, powered by the singleton module in tweedr.ml.ark logger = logging.getLogger(__name__) def pos_tags(document): text = ' '.join(document) <|code_end|> . Write the next line using the current file imports: from tweedr.ark.java.singleton import tagger import ...
tokens_line, tags_line = tagger.tokenize_and_tag(text)
Here is a snippet: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log extra output') opts = parser.parse_...
cli_pipeline = pipeline.Pipeline(
Given the following code snippet before the placeholder: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log e...
basic.EmptyLineFilter(),
Continue the code snippet: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log extra output') opts = parse...
similar.TextCounter(),
Given the following code snippet before the placeholder: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log e...
nlp.POSTagger(),
Continue the code snippet: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log extra output') opts = parse...
ml.CorpusClassifier(a126730_datasource(), naive_bayes.MultinomialNB()),
Given the code snippet: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log extra output') opts = parser.p...
ml.CorpusClassifier(a126730_datasource(), naive_bayes.MultinomialNB()),
Predict the next line after this snippet: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log extra output') ...
ml.CorpusClassifier(a121571_datasource(), svm.SVC(gamma=2, C=1)),
Given snippet: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log extra output') opts = parser.parse_args...
ml.CorpusClassifier(a126728_datasource(), neighbors.KNeighborsClassifier(3)),
Given the code snippet: <|code_start|> logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='Run tweets from STDIN through the tweedr pipeline, output to STDOUT.') parser.add_argument('-v', '--verbose', action='store_true', help='Log extra output') opts = parser.pa...
ml.CorpusClassifier(a122047_datasource(), linear_model.LogisticRegression()),
Predict the next line after this snippet: <|code_start|> DamageClassification, TokenizedLabel, UniformSample, Label, KeywordSample, Tweet, ) ''' class BaseMixin(object): def __json__(self): '''This method serves to both clone the record (copying its values) as well as filt...
Base = declarative_base(metadata=metadata, cls=BaseMixin)
Using the snippet: <|code_start|> crf_feature_functions = [ ngrams.unigrams, characters.plural, lexicons.is_transportation, lexicons.is_building, characters.capitalized, characters.numeric, ngrams.unique, lexicons.hypernyms, <|code_end|> , determine the next line of code. You have import...
dbpedia.features,
Predict the next line for this snippet: <|code_start|> crf_feature_functions = [ ngrams.unigrams, characters.plural, <|code_end|> with the help of current file imports: from tweedr.ml.features import characters, dbpedia, lexicons, ngrams and context from other files: # Path: tweedr/ml/features/characters.py...
lexicons.is_transportation,
Here is a snippet: <|code_start|> def main(): '''This is called by the package's console_scripts entry point "tweedr-ui" The reloader is slow and only handles python module changes. I recommend using 3rd party restarter, say, node_restarter: node_restarter **/*.py **/*.css **/*.mako 'python tweedr...
app = middleware.add_duration_header(crf.app)
Given the code snippet: <|code_start|> def main(): '''This is called by the package's console_scripts entry point "tweedr-ui" The reloader is slow and only handles python module changes. I recommend using 3rd party restarter, say, node_restarter: node_restarter **/*.py **/*.css **/*.mako 'python t...
app = middleware.add_duration_header(crf.app)
Given snippet: <|code_start|># 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 limitations # under the License. @ddt.ddt class ShellTestCase...
shell.main()
Predict the next line after this 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 lang...
mock_shell.side_effect = exc.CommandError("some_message")
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 # # ...
@cliutils.arg("trace", help="File with trace or trace id")
Given the code snippet: <|code_start|> "only), e.g. rabbit://user:password@host:5672/") @cliutils.arg("--idle-timeout", dest="idle_timeout", type=int, default=1, help="How long to wait for the trace to finish, in seconds " "(for messaging:// driver only...
engine = base.get_driver(args.conn_str, **args.__dict__)
Based on the snippet: <|code_start|> class TraceCommands(BaseCommand): group_name = "trace" @cliutils.arg("trace", help="File with trace or trace id") @cliutils.arg("--connection-string", dest="conn_str", default=(cliutils.env("OSPROFILER_CONNECTION_STRING")), help="Stor...
raise exc.CommandError(
Predict the next line for this 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.apa...
ValueError, base.get_driver,
Here is a snippet: <|code_start|> def __enter__(self): start(self._name, info=self._info) def __exit__(self, etype, value, traceback): if etype: info = { "etype": reflection.get_class_name(etype), "message": value.args[0] if value.args else None ...
return format(utils.shorten_id(uuid_id), "x")
Given snippet: <|code_start|> info = info or {} info["host"] = self._host self._name.append(name) self._trace_stack.append(str(uuidutils.generate_uuid())) self._notify("%s-start" % name, info) def stop(self, info=None): """Finish latest event. Same as a start...
notifier.notify(payload)
Next line prediction: <|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 a...
raise exc.CommandError(
Using the snippet: <|code_start|> class OSProfilerShell(object): def __init__(self, argv): args = self._get_base_parser().parse_args(argv) opts.set_defaults(cfg.CONF) args.func(args) def _get_base_parser(self): parser = argparse.ArgumentParser( prog="osprofiler...
for group_cls in commands.BaseCommand.__subclasses__():
Continue the code snippet: <|code_start|> subcommand_parser = group_parser.add_subparsers() for name, callback in inspect.getmembers( group_cls(), predicate=inspect.ismethod): command = name.replace("_", "-") desc = callback.__doc__ or "" ...
except exc.CommandError as e:
Here is a 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.apache.org/licenses/LICE...
opts.set_defaults(cfg.CONF)
Given snippet: <|code_start|> if es_scroll_size is not None: conf.set_default("es_scroll_size", es_scroll_size, group=_profiler_opt_group.name) if socket_timeout is not None: conf.set_default("socket_timeout", socket_timeout, group=_profiler_opt...
web.enable(conf.profiler.hmac_keys)
Predict the next line for this snippet: <|code_start|> def get(): """Returns notifier callable.""" return __notifier def set(notifier): """Service that are going to use profiler should set callable notifier. Callable notifier is instance of callable object, that accept exactly one argument...
driver = base.get_driver(connection_string, *args, **kwargs)
Predict the next line for this snippet: <|code_start|> LI_OSPROFILER_AGENT_ID = "F52D775B-6017-4787-8C8A-F21AE0AEC057" # API paths SESSIONS_PATH = "api/v1/sessions" CURRENT_SESSIONS_PATH = "api/v1/sessions/current" EVENTS_INGEST_PATH = "api/v1/events/ingest/%s" % LI_OSPROFILER_AGENT_ID QUERY_EV...
raise exc.LogInsightLoginTimeout()
Given snippet: <|code_start|># Copyright (c) 2016 VMware, 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/LICEN...
self._client = mock.Mock(spec=loginsight.LogInsightClient)
Given the following code snippet before the placeholder: <|code_start|> self._driver.get_report(self.BASE_ID) self._client.query_events.assert_called_once_with({"base_id": self.BASE_ID}) append_results.assert_has_calls( [mock....
exc.LogInsightLoginTimeout, self._client._check_response, resp)
Next line prediction: <|code_start|> ) parsed_url = parser.urlparse(connection_str) cfg = { "local_agent": { "reporting_host": parsed_url.hostname, "reporting_port": parsed_url.port, } } # Initialize tracer for each pro...
trace_id=utils.shorten_id(payload["base_id"]),
Given snippet: <|code_start|># Copyright 2018 Fujitsu Ltd. # 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/LICENSE-2...
raise exc.CommandError(
Here is a snippet: <|code_start|># 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 under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
pack = utils.signed_pack(data, p.hmac_key)
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 # # U...
p = profiler.get()
Using the snippet: <|code_start|> data = info.copy() base_id = data.pop("base_id", None) timestamp = data.pop("timestamp", None) parent_id = data.pop("parent_id", None) trace_id = data.pop("trace_id", None) project = data.pop("project", self.project) host = data.po...
raise exc.CommandError(
Here is a snippet: <|code_start|>def add_tracing(sqlalchemy, engine, name, hide_result=True): """Add tracing to all sqlalchemy calls.""" if not _DISABLED: sqlalchemy.event.listen(engine, "before_cursor_execute", _before_cursor_execute(name)) sqlalchemy.event.list...
profiler.start(name, info=info)
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 permissi...
for driver in _utils.itersubclasses(Driver):
Predict the next line for this snippet: <|code_start|> class JaegerTestCase(test.TestCase): def setUp(self): super(JaegerTestCase, self).setUp() self.payload_start = { "name": "api-start", "base_id": "4e3e0ec6-2938-40b1-8504-09eb1d4b0dee", "trace_id": "1c089ea8-2...
self.driver = jaeger.Jaeger("jaeger://127.0.0.1:6831",
Next line prediction: <|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...
self.mongodb = MongoDB("mongodb://localhost")
Next line prediction: <|code_start|># License for the specific language governing permissions and limitations # under the License. def dummy_app(environ, response): res = webob_response.Response() return res(environ, response) class WebTestCase(test.TestCase): def setUp(self): super(We...
trace_info = utils.signed_unpack(headers["X-Trace-Info"],
Continue the code 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.apache.org/licen...
profiler.clean()