Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Next line prediction: <|code_start|> else: # Multiaccount detected log.info("Account {} NOT verified!".format(userID)) glob.verifiedCache[str(userID)] = 0 raise exceptions.loginBannedException() # Save HWID in db for multiaccount detection hwAllowed = userUtils.logHardware(userID, clientData, fi...
if responseToken.privileges & privileges.USER_DONOR > 0:
Given snippet: <|code_start|> # Send login notification before maintenance message if glob.banchoConf.config["loginNotification"] != "": responseToken.enqueue(serverPackets.notification(glob.banchoConf.config["loginNotification"])) # Maintenance check if glob.banchoConf.config["banchoMaintenance"]: if not...
if responseToken.admin:
Predict the next line for this snippet: <|code_start|> raise exceptions.forceUpdateException() # Try to get the ID from username username = str(loginData[0]) userID = userUtils.getID(username) if not userID: # Invalid username raise exceptions.loginFailedException() if not userUtils.checkLogin(userI...
if userUtils.verifyUser(userID, clientData):
Given the following code snippet before the placeholder: <|code_start|> class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado def asyncGet(self): <|code_end|> , predict the next line using imports from the current file: import json import tornad...
statusCode = 400
Using the snippet: <|code_start|> def handle(userToken, packetData): # Read token and packet data userID = userToken.userID packetData = clientPackets.matchInvite(packetData) # Get match ID and match object matchID = userToken.matchID # Make sure we are in a match if matchID == -1: return # Make sure the m...
match.invite(userID, packetData["userID"])
Based on the snippet: <|code_start|> def handle(userToken, packetData): # Read token and packet data userID = userToken.userID packetData = clientPackets.matchInvite(packetData) # Get match ID and match object matchID = userToken.matchID # Make sure we are in a match if matchID == -1: <|code_end|> , predict th...
return
Based on the snippet: <|code_start|> def handle(userToken, packetData): # read packet data packetData = clientPackets.joinMatch(packetData) matchID = packetData["matchID"] password = packetData["password"] # Get match from ID try: # Make sure the match exists if matchID not in glob.matches.matches: <|code_e...
return
Here is a snippet: <|code_start|> def handle(userToken, packetData): # read packet data packetData = clientPackets.joinMatch(packetData) matchID = packetData["matchID"] password = packetData["password"] # Get match from ID <|code_end|> . Write the next line using the current file imports: from common.log import...
try:
Here is a snippet: <|code_start|> def handle(userToken, packetData): # read packet data packetData = clientPackets.joinMatch(packetData) matchID = packetData["matchID"] password = packetData["password"] # Get match from ID try: # Make sure the match exists if matchID not in glob.matches.matches: return ...
if match.matchPassword != "" and match.matchPassword != password:
Given the code snippet: <|code_start|> class SentinelOperation(Operation): def __init__(self, *args, **kwargs): super(SentinelOperation, self).__init__(*args, **kwargs) self.times_run = 0 def apply(self, runner): self.times_run += 1 class Numeric(SentinelOperation): def __mul__(...
return "{}".format(self.input)
Here is a snippet: <|code_start|> class SentinelOperation(Operation): def __init__(self, *args, **kwargs): super(SentinelOperation, self).__init__(*args, **kwargs) self.times_run = 0 def apply(self, runner): self.times_run += 1 class Numeric(SentinelOperation): def __mul__(self,...
return MultiplyOperation(self, other)
Predict the next line after this snippet: <|code_start|> def test_fifo(self): runner = OperationRunner(execute_cache_size=len(self.operations)) # everything should be run once self.run_and_assert(runner, 1) # everything should be cached self.run_and_assert(runner, 1) ...
cardinality[sop] += 1
Using the snippet: <|code_start|>class SentinelOperation(Operation): def __init__(self, *args, **kwargs): super(SentinelOperation, self).__init__(*args, **kwargs) self.times_run = 0 def apply(self, runner): self.times_run += 1 class Numeric(SentinelOperation): def __mul__(self, ot...
super(MultiplyOperation, self).apply(runner)
Here is a snippet: <|code_start|> # it's a constant that is different from every other object _no_default = object() class MockIterable(object): def __len__(self): return def __getitem__(self, _): return def __setitem__(self, _, __): return <|code_end|> . Write the next line using the current file imp...
def __delitem__(self, _): return
Predict the next line for this snippet: <|code_start|> # it's a constant that is different from every other object _no_default = object() class MockIterable(object): def __len__(self): return def __getitem__(self, _): return def __setitem__(self, _, __): return def __delitem__(self, _): return ...
class Field(object):
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.core.manage.commands.create ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ アプリケーションを新たに作成する create コマンド 各コマンドモジュールは共通インターフェースとして Command クラスを持ちます。 ==========...
===============================
Using the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.core.manage.commands.clean ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ clean コマンド 各コマンドモジュールは共通インターフェースとして Command クラスを持ちます。 <|code_end|> , determine the next line of code. You ...
===============================
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.core.manage.commands.clean ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ clean コマンド 各コマンドモジュールは共通インターフェースとして Command クラスを持ちます。 =============================...
::pkg:: Shimehari.core.manage.commands.clean
Based on the snippet: <|code_start|> ストアの中のキャッシュを全て消去します [args] :key ------------------------------""" def clear(self): pass class NullCacheStore(BaseCacheStore): pass u"""----------------------------- Shimehari.core.cachestore.SimpleCacheStore ~~~~~~~~~~~~~~~...
Shimehari.core.cachestore._prune
Continue the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- class Command(AbstractCommand): name = 'checkconfig' summary = 'Check Your Shimehari Application Configration' usage = "Usage: %prog [OPTIONS]" option_list = AbstractCommand.option_list + ( make_option('--...
)
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- class Command(AbstractCommand): name = 'checkconfig' summary = 'Check Your Shimehari Application Configration' usage = "Usage: %prog [OPTIONS]" option_list = AbstractCommand.option_list + ( ...
except ImportError:
Given snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- class Command(AbstractCommand): name = 'checkconfig' summary = 'Check Your Shimehari Application Configration' usage = "Usage: %prog [OPTIONS]" option_list = AbstractCommand.option_list + ( make_option('--env', '-e', ...
)
Given snippet: <|code_start|> except HTTPException, e: self.request.routingException = e u"""----------------------------- ::pkg:: Shimehari.contexts.RequestContext push ~~~~ 現在のリクエストコンテキストをスタックに追加します。 ------------------------------""" def push(self): ...
------------------------------"""
Based on the snippet: <|code_start|> self.matchRequest() u"""----------------------------- ::pkg:: Shimehari.contexts.RequestContext matchRequest ~~~~~~~~~~~~ リクエストに対してマッチするルールが存在するかチェックします ------------------------------""" def matchRequest(self): try: ...
self._pushedApplicationContext = _getNecessaryAppContext(self.app)
Next line prediction: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.wrappers ~~~~~~~~~~~~~~~~~~ <|code_end|> . Use current file imports: (from werkzeug.utils import cached_property from werkzeug.wrappers import Request as RequestBase, Response as Re...
リクエストやらレスポンスやら
Continue the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.wrappers <|code_end|> . Use current file imports: from werkzeug.utils import cached_property from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase from shi...
~~~~~~~~~~~~~~~~~~
Given snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.wrappers <|code_end|> , continue by predicting the next line. Consider current file imports: from werkzeug.utils import cached_property from werkzeug.wrappers import Request as RequestBase, Re...
~~~~~~~~~~~~~~~~~~
Based on the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.wrappers <|code_end|> , predict the immediate next line with the help of imports: from werkzeug.utils import cached_property from werkzeug.wrappers import Request as RequestBase, Respon...
~~~~~~~~~~~~~~~~~~
Here is a snippet: <|code_start|> filePath = loader.get_filename(importName) else: __import__(importName) filePath = sys.modules[importName].__file__ return os.path.dirname(os.path.abspath(filePath)) u"""----------------------------- ::pkg:: Shimehari.helpers getEnviron ~~~~...
options.setdefault('conditional', True)
Using the snippet: <|code_start|> def urlFor(endpoint, **values): appctx = _appContextStack.top reqctx = _requestContextStack.top if appctx is None: raise RuntimeError('hoge') if reqctx is not None: urlAdapter = reqctx.urlAdapter # if urlAdapter is None: # raise Ru...
return appctx.app.handleBuildError(error, endpoint, **values)
Predict the next line after this snippet: <|code_start|> return os.getcwd() if hasattr(loader, 'get_filename'): filePath = loader.get_filename(importName) else: __import__(importName) filePath = sys.modules[importName].__file__ return os.path.dirname(os.path.abspath(filePath)...
filename = safeJoin(directory, filename)
Predict the next line for this snippet: <|code_start|> rv = urlAdapter.build(endpoint, values, method=method, force_external=external) if anchor is not None: rv += '#' + url_quote(anchor) return rv def findPackage(importName): rootModName = importName.split('.')[0] loader = pkgutil.get_lo...
elif siteFolder.lower() == 'site-packages':
Based on the snippet: <|code_start|> def _assertHaveJson(): if not jsonAvailable: raise RuntimeError(u'json ないじゃん') u"""redis が使用可能かどうか""" redisAvailable = True redis = None try: except ImportError: redisAvailable = False def _assertHaveRedis(): if not redisAvailable: raise RuntimeError...
:param action: ハンドラを取得したいアクション
Next line prediction: <|code_start|> if not '__init__' in fn: fn = fn.replace(rootPath, '')[1:].replace('.py', '').replace('/', '.') modules.append(fn) return modules u"""----------------------------- ::pkg:: Shimehari.helpers getRootPath ~~~~~~~~~~~ root パスを取得します ...
__import__(importName)
Continue the code snippet: <|code_start|> class ShimehariSetupError(ShimehariException): def __str__(self): return 'ShimehariSetupError: %s' % self.description class CommandError(Exception): def __init__(self, description): self.description = description def __str__(self): return ...
def get_headers(self, environ):
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.configuration ~~~~~~~~~~~~~~~~~~~~~~~ アプリケーション内の様々な設定や環境情報を保持する Config クラスを提供します。 <|code_end|> using the current file's imports: from shimehari.helpe...
===============================
Using the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- u""" =============================== Shimehari.testing ~~~~~~~~~~~~~~~~~ <|code_end|> , determine the next line of code. You have imports: from contextlib import contextmanager from werkzeug.test import Client, EnvironBuilder from ...
テスト
Using the snippet: <|code_start|> class FilterInline(admin.TabularInline): model = WatchFilter class WatchAdmin(admin.ModelAdmin): list_filter = ['content_type', 'event_type'] raw_id_fields = ['user'] inlines = [FilterInline] class WatchFilterAdmin(admin.ModelAdmin): list_filter = ['name'] <|c...
raw_id_fields = ['watch']
Based on the snippet: <|code_start|> def user(save=False, **kwargs): defaults = {'password': 'sha1$d0fcb$661bd5197214051ed4de6da4ecdabe17f5549c7c'} if 'username' not in kwargs: defaults['username'] = ''.join(random.choice(ascii_letters) for x in ...
'is_active': True,
Using the snippet: <|code_start|> def user(save=False, **kwargs): defaults = {'password': 'sha1$d0fcb$661bd5197214051ed4de6da4ecdabe17f5549c7c'} if 'username' not in kwargs: defaults['username'] = ''.join(random.choice(ascii_letters) for x in ran...
if save:
Predict the next line for this snippet: <|code_start|> defaults = {'password': 'sha1$d0fcb$661bd5197214051ed4de6da4ecdabe17f5549c7c'} if 'username' not in kwargs: defaults['username'] = ''.join(random.choice(ascii_letters) for x in range(15)) def...
if save:
Predict the next line for this snippet: <|code_start|> class Tests(TestCase): """Tests for our lone template tag""" def test_unsubscribe_instructions(self): """Make sure unsubscribe_instructions renders and contains the unsubscribe URL.""" w = watch(save=True) template = Templ...
assert w.unsubscribe_url() in template.render(Context({'watch': w}))
Using the snippet: <|code_start|> pl.plot_signal(t_enc, u[k_start:k_end], fig_title_in, output_name + str(output_count) + output_ext) u_list.append(u) output_count += 1 t = np.arange(len(u_list[0]), dtype=np.float)*dt # Define neuron parameters: def randu(a, b, *d): """Create an arra...
', Neuron #' + str(j+1) + ')'
Continue the code snippet: <|code_start|>a_list = map(list, np.reshape(np.random.exponential(0.003, N*M), (N, M))) w_list = map(list, np.reshape(randu(0.5, 1.0, N*M), (N, M))) T_block = T/2.0 T_overlap = T_block/3.0 fig_title = 'Signal Encoded Using Real-Time Delayed IAF Encoder' print fig_title s_list = func_timer(rt...
u_rec_list[i][0:k_end-k_start], fig_title_out,
Here is a snippet: <|code_start|> href = WhamTextField(null=True) popularity = WhamIntegerField(null=True) uri = WhamTextField(null=True) albums = WhamManyToManyField( 'SpotifyAlbum', related_name='artists', wham_endpoint='artists/{{id}}/albums', wham_results_path=('item...
endpoint = 'search'
Using the snippet: <|code_start|> # ) class Meta: db_table = 'spotify_artist' class WhamMeta(SpotifyMeta): endpoint = 'artists' # i reckon this stuff should really be in Manager, as it has more to do with filter() # which is a Manager method class Search: ...
class Meta:
Based on the snippet: <|code_start|> class SpotifyMeta: base_url = 'https://api.spotify.com/v1/' class SpotifyTrack(WhamModel): id = WhamCharField(max_length=255, primary_key=True) name = WhamTextField() href = WhamTextField(null=True) popularity = WhamIntegerField(null=True) track_number = ...
return self.name
Given the following code snippet before the placeholder: <|code_start|> # Create your models here. class SpotifyMeta: base_url = 'https://api.spotify.com/v1/' class SpotifyTrack(WhamModel): id = WhamCharField(max_length=255, primary_key=True) name = WhamTextField() href = WhamTextField(null=True) ...
endpoint = 'tracks'
Given snippet: <|code_start|> # Create your models here. # http://api.soundcloud.com/tracks/13158665.json?client_id=a43d27e75fbd64533f57428dd7be3ba5 class SoundcloudMeta: base_url = 'http://api.soundcloud.com/' auth_for_public_get = 'API_KEY' <|code_end|> , continue by predicting the next line. Consider cur...
api_key_settings_name = 'SOUNDCLOUD_CLIENT_ID'
Predict the next line for this snippet: <|code_start|> # Create your models here. # http://api.soundcloud.com/tracks/13158665.json?client_id=a43d27e75fbd64533f57428dd7be3ba5 class SoundcloudMeta: base_url = 'http://api.soundcloud.com/' auth_for_public_get = 'API_KEY' api_key_settings_name = 'SOUNDCLOUD_...
endpoint = 'tracks/'
Here is a snippet: <|code_start|> APP_DIR = os.path.dirname(__file__) MOCK_RESPONSES_DIR = join(APP_DIR, 'mock_responses') mock_functions = build_httmock_functions(MOCK_RESPONSES_DIR) class TestCase(TestCase): def setUp(self): <|code_end|> . Write the next line using the current file imports: from os.path im...
pass
Given the following code snippet before the placeholder: <|code_start|> APP_DIR = os.path.dirname(__file__) MOCK_RESPONSES_DIR = join(APP_DIR, 'mock_responses') mock_functions = build_httmock_functions(MOCK_RESPONSES_DIR) class TestCase(TestCase): def setUp(self): pass def test_lastfm(self): ...
for artist in artists:
Predict the next line after this snippet: <|code_start|> APP_DIR = os.path.dirname(__file__) MOCK_RESPONSES_DIR = join(APP_DIR, 'mock_responses') mock_functions = build_httmock_functions(MOCK_RESPONSES_DIR) <|code_end|> using the current file's imports: from os.path import join from django.test import TestCase f...
class TestCase(TestCase):
Next line prediction: <|code_start|> if field.primary_key is True: continue #no need to include the fk as we *assume* it's an autoincrementing id (naughty naughty) #FIXME if isinstance(field, ForeignKey): ...
if m2m_field.wham_pk_param:
Based on the snippet: <|code_start|> def dict_to_model_instance(self, dict): pass def get_from_dict(self, data, pk_dict_key='id'): field_names = self.get_field_names() kwargs = {} for field_name in field_names: field = self.get_field(field_name) resul...
time.mktime(time.strptime(value, '%a %b %d %H:%M:%S +0000 %Y')))
Given snippet: <|code_start|> endpoint = Template(m2m_field.wham_endpoint).render(Context({'id': self.instance.pk})) params = m2m_field.wham_params if m2m_field.wham_pk_param: params[m2m_field.wham_pk_param] = self.instance.pk while (pa...
self.model.wham_oauth_token = token #store the token in the model class. why not.
Based on the snippet: <|code_start|> class LastFmMeta: base_url = 'http://ws.audioscrobbler.com/2.0/' auth_for_public_get = 'API_KEY' api_key_settings_name = 'LASTFM_API_KEY' api_params = { <|code_end|> , predict the immediate next line with the help of imports: from django.db import models from wham....
'format': 'json',
Here is a snippet: <|code_start|> 'limit': 500, } # class LastFmTrack(WhamModel): # # objects = WhamManager() # # id = WhamCharField(max_length=255, primary_key=True) # name = WhamTextField() # listeners = WhamIntegerField() # playcount = WhamIntegerField() # duration = WhamIntegerFi...
through='LastFmUserTopArtists',
Using the snippet: <|code_start|># playcount = WhamIntegerField() # duration = WhamIntegerField() # # class Meta: # db_table = 'lastfm_track' # # class WhamMeta(LastFmMeta): # endpoint = '' # params = {'method': 'track.getInfo'} # # def __unicode__(self): # return sel...
class WhamMeta(LastFmMeta):
Continue the code snippet: <|code_start|># params = {'method': 'track.getInfo'} # # def __unicode__(self): # return self.name class LastFmUser(WhamModel): name = WhamCharField(max_length=255, primary_key=True) top_artists = WhamManyToManyField( #http://ws.audioscrobbler.com/2.0/?m...
return self.name
Given the code snippet: <|code_start|> pager_type = FROM_LAST_ID class TwitterUser(WhamModel): id = WhamIntegerField(primary_key=True) text = WhamTextField() screen_name = WhamTextField(unique=True, wham_can_lookup=True) #this is dodgy, because this should really be a oneToMany field which you h...
endpoint = 'users/show'
Predict the next line after this snippet: <|code_start|> pager_param = 'max_id' pager_type = FROM_LAST_ID class TwitterUser(WhamModel): id = WhamIntegerField(primary_key=True) text = WhamTextField() screen_name = WhamTextField(unique=True, wham_can_lookup=True) #this is dodgy, because this s...
class WhamMeta(TwitterMeta):
Based on the snippet: <|code_start|> # Create your models here. CREATED_AT_FORMAT = '%a %b %d %H:%M:%S +0000 %Y' class TwitterMeta: base_url = 'https://api.twitter.com/1.1/' auth_for_public_get = 'TWITTER' #this needs to be abstracted more url_postfix = '.json' pager_param = 'max_id' pager_type =...
related_name='users',
Continue the code snippet: <|code_start|># Create your models here. CREATED_AT_FORMAT = '%a %b %d %H:%M:%S +0000 %Y' class TwitterMeta: base_url = 'https://api.twitter.com/1.1/' auth_for_public_get = 'TWITTER' #this needs to be abstracted more url_postfix = '.json' pager_param = 'max_id' pager_ty...
'count': 200,
Here is a snippet: <|code_start|> text = WhamTextField() screen_name = WhamTextField(unique=True, wham_can_lookup=True) #this is dodgy, because this should really be a oneToMany field which you have # to specify as a FK on the other model (which can be annoying!) tweets = WhamManyToManyField( ...
def __unicode__(self):
Here is a snippet: <|code_start|> pager_param = 'max_id' pager_type = FROM_LAST_ID class TwitterUser(WhamModel): id = WhamIntegerField(primary_key=True) text = WhamTextField() screen_name = WhamTextField(unique=True, wham_can_lookup=True) #this is dodgy, because this should really be a oneTo...
class WhamMeta(TwitterMeta):
Predict the next line for this snippet: <|code_start|> id = WhamCharField(max_length=255, primary_key=True) title = WhamTextField() #TODO: this shouldn't be required if json property is same as django fieldname rank = WhamIntegerField(null=True) bpm = WhamFloatField(null=True) track_position = WhamI...
endpoint = 'track'
Given the code snippet: <|code_start|> id = WhamCharField(max_length=255, primary_key=True) title = WhamTextField() #TODO: this shouldn't be required if json property is same as django fieldname rank = WhamIntegerField(null=True) bpm = WhamFloatField(null=True) track_position = WhamIntegerField(nul...
class WhamMeta(DeezerMeta):
Continue the code snippet: <|code_start|> class TestCase(TestCase): def test_deezer(self): track = DeezerTrack.objects.get(id='3135556') print track track = DeezerTrack.objects.get(pk='3135556') <|code_end|> . Use current file imports: from os.path import join from django.test import TestC...
print track
Given the code snippet: <|code_start|> # def mock_function_builder(scheme, netloc, url_name, settings, responses_dir): # url_path = settings['url_path'] # params = settings.get('params', {}) # method = settings.get('method', 'GET') # @urlmatch(scheme=scheme, netloc=netloc, path=url_path, method=method,...
def mock_function(_url, _request):
Using the snippet: <|code_start|> address_2 = WhamTextField(wham_result_path=('address', 'address_2'), null=True) country_name = WhamTextField(wham_result_path=('address', 'country_name'), null=True) class Meta: db_table = 'eventbrite_venue' def __unicode__(self): return self.name cla...
def __unicode__(self):
Based on the snippet: <|code_start|> # Create your models here. class EventbriteMeta: base_url = 'https://www.eventbriteapi.com/v3/' requires_oauth_token = True class EventbriteVenue(WhamModel): id = WhamCharField(max_length=255, primary_key=True) name = WhamTextField() latitude = WhamFloatFiel...
return self.name
Given the following code snippet before the placeholder: <|code_start|> country = WhamTextField(wham_result_path=('address', 'country'), null=True) region = WhamTextField(wham_result_path=('address', 'region'), null=True) address_1 = WhamTextField(wham_result_path=('address', 'address_1'), null=True) add...
class Meta:
Predict the next line for this snippet: <|code_start|> # Create your models here. class EventbriteMeta: base_url = 'https://www.eventbriteapi.com/v3/' requires_oauth_token = True class EventbriteVenue(WhamModel): id = WhamCharField(max_length=255, primary_key=True) name = WhamTextField() latitu...
def __unicode__(self):
Given the code snippet: <|code_start|> id = WhamCharField(max_length=255, primary_key=True) name = WhamTextField() latitude = WhamFloatField() longitude = WhamFloatField() city = WhamTextField(wham_result_path=('address', 'city'), null=True) country = WhamTextField(wham_result_path=('address', '...
endpoint = 'events'
Next line prediction: <|code_start|> posts = WhamManyToManyField( # https://api.instagram.com/v1/tags/djangocon/media/recent 'InstagramPost', related_name='tags', wham_endpoint='tags/{{id}}/media/recent', wham_results_path=('data',) ) class Meta: db_table = '...
class Search:
Here is a snippet: <|code_start|> # https://api.instagram.com/v1/tags/djangocon/media/recent?client_id=c3cdcbff22f649f1a08bedf12be1ca86 class InstagramMeta: base_url = 'https://api.instagram.com/v1/' auth_for_public_get = 'API_KEY' <|code_end|> . Write the next line using the current file imports: from dja...
api_key_settings_name = 'INSTAGRAM_CLIENT_ID'
Predict the next line after this snippet: <|code_start|> # https://api.instagram.com/v1/tags/djangocon/media/recent?client_id=c3cdcbff22f649f1a08bedf12be1ca86 class InstagramMeta: base_url = 'https://api.instagram.com/v1/' auth_for_public_get = 'API_KEY' api_key_settings_name = 'INSTAGRAM_CLIENT_ID' ...
related_name='tags',
Predict the next line for this snippet: <|code_start|> # https://api.instagram.com/v1/tags/djangocon/media/recent?client_id=c3cdcbff22f649f1a08bedf12be1ca86 class InstagramMeta: base_url = 'https://api.instagram.com/v1/' auth_for_public_get = 'API_KEY' api_key_settings_name = 'INSTAGRAM_CLIENT_ID' a...
)
Given the following code snippet before the placeholder: <|code_start|> '8475297d-fb78-4630-8d74-9b87b6bb7cc8', '61dd30be-8e7b-4c85-9aa4-be66702c4644', '1cf5f079-706d-4b1f-9de9-0bf8e298cc97', '6c4faf49-a133-4465-a97d-6c68c52ad88b', '582748ae-a993-4b14-a2be-199f...
]
Using the snippet: <|code_start|> class WhamMeta(FreebaseMeta): endpoint = 'topic' def __unicode__(self): return self.name # class FreebaseMusicArtist(WhamModel): # objects = WhamManager() # id = WhamCharField(max_length=255, primary_key=True) # musicbrainz_id = WhamCharField(max_...
endpoint = 'topic/authority/musicbrainz/artist'
Predict the next line after this snippet: <|code_start|> # Create your models here. class FreebaseMeta: base_url = 'https://www.googleapis.com/freebase/v1/' class Person(WhamModel): id = models.CharField(max_length=255, primary_key=True) name = WhamTextField() class WhamMeta(FreebaseMeta): ...
endpoint = 'topic'
Predict the next line for this snippet: <|code_start|># Create your models here. class FacebookMeta: base_url = 'https://graph.facebook.com/' requires_oauth_token = True class FacebookUser(WhamModel): id = WhamCharField(max_length=255, primary_key=True) username = WhamTextField(unique=True) name...
db_table = 'facebook_user'
Here is a snippet: <|code_start|># Create your models here. class FacebookMeta: base_url = 'https://graph.facebook.com/' requires_oauth_token = True class FacebookUser(WhamModel): id = WhamCharField(max_length=255, primary_key=True) username = WhamTextField(unique=True) name = WhamTextField() ...
return self.name
Predict the next line for this snippet: <|code_start|># Create your models here. class FacebookMeta: base_url = 'https://graph.facebook.com/' requires_oauth_token = True class FacebookUser(WhamModel): id = WhamCharField(max_length=255, primary_key=True) username = WhamTextField(unique=True) name...
class WhamMeta(FacebookMeta):
Next line prediction: <|code_start|>from __future__ import print_function logger = mylog.getLogger(__name__) def write_collapse_fastq(reads, out_fn): idx = 0 with open(out_fn, 'a') as outh: <|code_end|> . Use current file imports: (from optparse import OptionParser from mirtop.mirna import fasta from mirto...
for r in reads:
Given the code snippet: <|code_start|> query_name = "%s.%s.%s" % (mirna, iso.format_id("."), randSeq) reads[query_name] = realign.hits() reads[query_name].set_sequence(randSeq) reads[query_name].counts = e reads[query_name].set_precursor(name, iso) ...
help="", metavar="FILE")
Predict the next line for this snippet: <|code_start|> randS = 1 if randE > len(seq): randE = info[1] - 1 randSeq = seq[randS:randE] t5Lab = "" t5Lab = seq[randS:info[0]] if randS < info[0] else t5Lab t5Lab = seq[info[0]:randS].lower() if randS > info[0] else t5Lab t3Lab = "" ...
if nt[ntAdd] == seq[randS + len(randSeq)]:
Here is a snippet: <|code_start|> if isAdd == 2: posAdd = random.randint(1, 3) for numadd in range(posAdd): ntAdd = random.randint(0, 1) print([randSeq, seq[randS + len(randSeq)]]) if nt[ntAdd] == seq[randS + len(randSeq)]: ntAdd = 1 if ntAdd == 0 e...
seen.add(randSeq)
Given snippet: <|code_start|> parser = OptionParser(usage=usagetxt, version="%prog 1.0") parser.add_option("--fa", help="", metavar="FILE") parser.add_option("--gtf", help="", metavar="FILE") parser.add_option("-n", "--num", dest="numsim", help="") parser.add_option...
nt = ['A', 'T', 'G', 'C']
Predict the next line after this snippet: <|code_start|> password = self.get_argument("p").strip() user_id = userUtils.getID(username) checksum = self.get_argument("c").strip() if not user_id: raise exceptions.loginFailedException(self.MODULE_NAME, user_id) if not userUtils.checkLogin(user_id, passwor...
if vote is None:
Predict the next line after this snippet: <|code_start|> ip = self.getRequestIP() username = self.get_argument("u").strip() password = self.get_argument("p").strip() user_id = userUtils.getID(username) checksum = self.get_argument("c").strip() if not user_id: raise exceptions.loginFailedException(...
output = f"alreadyvoted\n{rating['rating']:.2f}"
Given the code snippet: <|code_start|> class cacheMiss(Exception): pass class personalBestCache: <|code_end|> , generate the next line using the imports in this file: from common.log import logUtils as log from common import generalUtils from objects import glob and context (functions, classes, or occasionally code...
def get(self, userID, fileMd5, country=False, friends=False, mods=-1, relax=False):
Given the code snippet: <|code_start|> class handler(requestsManager.asyncRequestHandler): MODULE_NAME = "osu_download" @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado <|code_end|> , generate the next line using the imports in this file: import tornado.gen import tornado.web from common.log ...
def asyncGet(self, fileName = None):
Next line prediction: <|code_start|>"""Some console related functions""" ASCII = """ ( ( )\\ ) * ) )\\ ) (()/( ( ` ) /((()/( /(_)) )\\ ( )(_))/(_)) (_)) ((_) (_(_())(_)) | | | __||_ _|/ __| | |__ | _| | | \\__ \\ |____||___| |_| |___/ \n""" <|code_end|> ...
def printServerStartHeader(asciiArt):
Here is a snippet: <|code_start|> raise exceptions.invalidArgumentsException(self.MODULE_NAME) # Add a comment, removing all illegal characters and trimming after 128 characters comment = self.get_argument("comment").replace("\r", "").replace("\t", "").replace("\n", "")[:128] try: time_ = int(self.get_argum...
elif target == "map":
Predict the next line after this snippet: <|code_start|> except ValueError: raise exceptions.invalidArgumentsException(self.MODULE_NAME) # Add a comment, removing all illegal characters and trimming after 128 characters comment = self.get_argument("comment").replace("\r", "").replace("\t", "").replace("\n", ""...
column = "beatmapset_id"
Given the code snippet: <|code_start|> try: with open("version") as f: VERSION = f.read().strip() except: VERSION = "Unknown" ACHIEVEMENTS_VERSION = 1 DATADOG_PREFIX = "lets" db = None redis = None <|code_end|> , generate the next line using the imports in this file: from collections import defaultdict from com...
conf = None
Based on the snippet: <|code_start|> def isBeatmap(fileName=None, content=None): if fileName is not None: with open(fileName, "rb") as f: firstLine = f.readline().decode("utf-8-sig").strip() elif content is not None: try: firstLine = content.decode("utf-8-sig").split("\...
else:
Continue the code snippet: <|code_start|> def isBeatmap(fileName=None, content=None): if fileName is not None: with open(fileName, "rb") as f: firstLine = f.readline().decode("utf-8-sig").strip() elif content is not None: try: firstLine = content.decode("utf-8-sig").spl...
return True