Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line after this snippet: <|code_start|> def test_reverse_terra_with_zero_iterations(): # With zero iterations, should return "geocentric" rather than # "geodetic" (="correct") longitude and latitude. lat, lon, elevation = reverse_terra(array([1, 0, 1]), 0, iterations=0) assert abs(lat -...
assert lon == 0.0
Here is a snippet: <|code_start|> def test_radec_and_altaz_angles_and_rates(): # HORIZONS test data in Skyfield repository: authorities/radec-altaz-rates ts = load.timescale() t = ts.utc(2021, 2, 3) top = wgs84.latlon(35.1844866, 248.347300, elevation_m=2106.9128) planets = load('de421.bsp') a =...
dec, ra, distance, dec_rate, ra_rate, range_rate = (
Based on the snippet: <|code_start|> def test_radec_and_altaz_angles_and_rates(): # HORIZONS test data in Skyfield repository: authorities/radec-altaz-rates ts = load.timescale() t = ts.utc(2021, 2, 3) top = wgs84.latlon(35.1844866, 248.347300, elevation_m=2106.9128) planets = load('de421.bsp') ...
dec, ra, distance, dec_rate, ra_rate, range_rate = (
Given the following code snippet before the placeholder: <|code_start|> # Verify RA and declination rates of change. assert round(dec_rate.arcseconds.per_hour, 5) == 25.61352 assert round(ra_rate.arcseconds.per_hour * cos(dec.radians), 4) == round(75.15571, 4) # TODO: get last digit to ag...
t = ts.utc(2020, 11, 27, 15, 34) # Arbitrary time; LST ~= 20.03.
Given the following code snippet before the placeholder: <|code_start|> # Verify RA and declination rates of change. assert round(dec_rate.arcseconds.per_hour, 5) == 25.61352 assert round(ra_rate.arcseconds.per_hour * cos(dec.radians), 4) == round(75.15571, 4) # TODO: get last digit to agr...
p = top.at(t)
Based on the snippet: <|code_start|> assert max(abs(v.km_per_s)) < 3e-15 # km/s def test_from_frame_method(): ts = load.timescale() t = ts.utc(2020, 11, 27, 15, 34) g1 = Geocentric([1,2,3], [4,5,6], t=t) r, v = g1.frame_xyz_and_velocity(framelib.itrs) # which we trust: see above g2 = Geocentric...
t = ts.utc(2020, 11, 27, 15, 34)
Based on the snippet: <|code_start|> # Verify altitude and azimuth rates of change. assert abs(range_rate.km_per_s - 16.7926932) < 2e-5 assert round(alt_rate.arcseconds.per_minute, 2) == 548.66 assert round(az_rate.arcseconds.per_minute * cos(alt.radians), 2) == 663.55 def test_frame_round_trip(): ...
assert max(abs(g2.velocity.au_per_d - [4,5,6])) < 3e-14
Predict the next line for this snippet: <|code_start|> def test_radec_and_altaz_angles_and_rates(): # HORIZONS test data in Skyfield repository: authorities/radec-altaz-rates ts = load.timescale() t = ts.utc(2021, 2, 3) top = wgs84.latlon(35.1844866, 248.347300, elevation_m=2106.9128) planets = load...
4) == round(75.15571, 4) # TODO: get last digit to agree?
Given the code snippet: <|code_start|>#!/usr/bin/env python def main(): f = load.open(mpc.COMET_URL) t0 = time() c = mpc.load_comets_dataframe(f) print(time() - t0, 'seconds for load_comets_dataframe()') assert len(c) == 864 <|code_end|> , generate the next line using the imports in this file: ...
f.seek(0)
Given the code snippet: <|code_start|> (-1, 1, 0, -2, 1), ( 0, 0, 0, -4, 1), ( 1, -1, 0, 2, 1), ( 1, 1, 0, 2, 1), (-1, 2, 2, 2, 2), ( 3, 1, 2, -2, 2), ( 0, -1, 0, 4, 0), ( 2, -1, 0, 2, ...
( 1, 0, 0, -1, 2),
Predict the next line for this snippet: <|code_start|> ( 1, 0, 0, -2, 1), ( 0, -1, 0, 0, 1), (-1, 0, 2, 2, 1), ( 0, 2, 0, 0, 0), ( 1, 0, 2, 2, 2), (-2, 0, 2, 0, 0), ( 0, 1, 2, 0, 2), ( 0, ...
( 1, 1, 2, 0, 2),
Given the following code snippet before the placeholder: <|code_start|> ( -23.0, 0.0, 0.0, 9.0, 0.0, 0.0), ( 16.0, 0.0, 0.0, -1.0, 0.0, 0.0), ( -12.0, 0.0, 0.0, 6.0, 0.0, 0.0), ( -8.0, 0.0...
( 3.0, 0.0, 0.0, -1.0, 0.0, 0.0),
Predict the next line for this snippet: <|code_start|> t = ts.utc(2021, 2, 19, 13, 47) planets = load('de421.bsp') observer = planets['earth'].at(t) target = planets['mars'] r, v, t2, light_time = cfltt(observer, target) print(t.shape, observer.position.km.shape, r.shape) print('==== N times...
earth._at = build_multi_at(earth._at)
Using the snippet: <|code_start|> # t = ts.tt(t.tt[:,None]) # What if we add a dimension to t? # print('t', t.shape) r, v, t2, light_time = _correct_for_light_travel_time3(observer, target) print(t.shape, observer.position.km.shape, '->', r.shape) print('Does it look like a second planet 1 AU away...
print('Supplementing dimensions')
Given the following code snippet before the placeholder: <|code_start|> # that would need to be expanded in t = ts.tt(t.tt[:,None]) # What if we add a dimension to t? # print('t !!!!!!!!!!!!!!', t.shape) # print('t !!!!!!!!!!!!!!', t.whole.shape) # print('t !!!!!!!!!!!!!!', t.tdb_fraction.shape) ...
tvelocity = tvelocity[:,:,None] + offset
Next line prediction: <|code_start|> # routine. But to proceed from here, we need to switch. print('==== N times, one observers, M targets [TRY: RIGHT SIDE UP] ====') t = ts.utc(2021, 2, 19, 13, [46, 47, 48, 49]) planets = load('de421.bsp') earth = planets['earth'] if 0: # Turn Earth ...
print(r[:,:,1])
Given the following code snippet before the placeholder: <|code_start|> def test_spline_and_derivative(): parameters = 10, 12, 2.0, 3.0, 5.0, 7.0 x = 8.0, 9.0, 10.0, 11.0, 12.0 expected_values = 3.0, 5.0, 7.0, 10.5, 17.0 expected_slope = 2.5, 1.75, 2.5, 4.75, 8.5 # Does the Spline class work? ...
assert tuple(curve.derivative(x)) == expected_slope
Using the snippet: <|code_start|> _lock = Lock() def _build_legacy_data(deltat_data, deltat_preds, leap_second_dat): data_end_time = deltat_data[0, -1] i = np.searchsorted(deltat_preds[0], data_end_time, side='right') delta_t_recent = np.concatenate([deltat_data, deltat_preds[:,i:]], axis=1) leap_date...
return delta_t_recent, leap_dates, leap_offsets
Continue the code snippet: <|code_start|> def test_magnitudes(): ts = load.timescale() #t = ts.utc(1995, 5, 22) # Rings edge-on from Earth. t = ts.utc(2021, 10, 4) eph = load('de421.bsp') names = [ 'mercury', 'venus', 'mars', 'jupiter barycenter', 'saturn barycenter', 'uranus baryce...
]
Next line prediction: <|code_start|> def test_magnitudes(): ts = load.timescale() #t = ts.utc(1995, 5, 22) # Rings edge-on from Earth. t = ts.utc(2021, 10, 4) eph = load('de421.bsp') names = [ 'mercury', 'venus', 'mars', 'jupiter barycenter', <|code_end|> . Use current file imports: (from ...
'saturn barycenter', 'uranus barycenter', 'neptune barycenter',
Using the snippet: <|code_start|> class _NotFound(object): pass class CombinedConstants(object): def __init__(self, *constants): self.constants = constants def __getattr__(self, item): for c in self.constants: result = getattr(c, item, _NotFound) if result is not ...
pad = '\t' * indent
Predict the next line for this snippet: <|code_start|> class _NotFound(object): pass class CombinedConstants(object): def __init__(self, *constants): self.constants = constants def __getattr__(self, item): for c in self.constants: result = getattr(c, item, _NotFound) ...
print(pad + '/' + token.__class__.__name__)
Next line prediction: <|code_start|> def normalize_list_elements(tokens): for token in tokens: if isinstance(token, BaseList): normalize_list(token) else: normalize_list_elements(token.children) def normalize_list(op: BaseList): # If there are > 1 lists to move out the...
for child in children:
Next line prediction: <|code_start|> def normalize_list_elements(tokens): for token in tokens: if isinstance(token, BaseList): normalize_list(token) <|code_end|> . Use current file imports: (from wordinserter.operations import BaseList, ListElement) and context including class names, function...
else:
Given the code snippet: <|code_start|> class TestNormalizeTable: # Lists of (table_length, given, expected) table colspans TABLES = [ (8, (5, 1, 3), (5, 1, 2)), # Reduce last column by 1 (8, (3, 1, 4, 4), (3, 1, 3, 1)), # Reduce 3rd column by one, last column to 1 (8, (3, 2, 4, 4), (...
given_row
Continue the code snippet: <|code_start|> class TestNormalizeTable: # Lists of (table_length, given, expected) table colspans TABLES = [ (8, (5, 1, 3), (5, 1, 2)), # Reduce last column by 1 (8, (3, 1, 4, 4), (3, 1, 3, 1)), # Reduce 3rd column by one, last column to 1 (8, (3, 2, 4, 4)...
@pytest.mark.parametrize('table_length, given_spans,expected_spans', TABLES)
Using the snippet: <|code_start|> class TestNormalizeTable: # Lists of (table_length, given, expected) table colspans TABLES = [ (8, (5, 1, 3), (5, 1, 2)), # Reduce last column by 1 (8, (3, 1, 4, 4), (3, 1, 3, 1)), # Reduce 3rd column by one, last column to 1 <|code_end|> , determine the nex...
(8, (3, 2, 4, 4), (3, 2, 2, 1)), # Reduce 2nd column, third and fourth
Next line prediction: <|code_start|> MD5Submission-type homework""" client = paramiko.SSHClient() try: vmcfg = StorerCourseConfig(CourseList().course_config(courseId)) assignments = vmcfg.assignments() storage_hostname = assignments.get(assignmentId, 'AssignmentStorageHost') s...
finally:
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, packetData): # get token data username = userToken.username # Read packet data packetData = clientPackets.setAwayMessage(packetData) # Set token away message <|code_end|> , predict the next line using imports from the ...
userToken.awayMessage = packetData["awayMessage"]
Based on the snippet: <|code_start|> "Dank memes", "1337ms Ping", "Iscriviti a Xenotoze", "...e i marò?", "Superman dies", "The brace is on fire", "print_foot()", "#FREEZEBARKEZ", "Ripple devs are actually cats", "Thank Mr Shaural", "NEVER GIVE UP", "T I E D W I T H U N I T E D", ...
else:
Given the following code snippet before the placeholder: <|code_start|> # Update match settings match.inProgress = packetData["inProgress"] if packetData["matchPassword"] != "": match.matchPassword = generalUtils.stringMd5(packetData["matchPassword"]) else: match.matchPassword = "" match.beatmapName = p...
else:
Predict the next line after this snippet: <|code_start|> "RWC 2020", "Fokabot is a duck", "Dank memes", "1337ms Ping", "Iscriviti a Xenotoze", "...e i marò?", "Superman dies", "The brace is on fire", "print_foot()", "#FREEZEBARKEZ", "Ripple devs are actually cats", "Thank Mr Shaural",...
if packetData["matchPassword"] != "":
Based on the snippet: <|code_start|> return # Some dank memes easter egg memeTitles = [ "RWC 2020", "Fokabot is a duck", "Dank memes", "1337ms Ping", "Iscriviti a Xenotoze", "...e i marò?", "Superman dies", "The brace is on fire", "print_foot()", "#FREEZEBARKEZ", "Ripple devs are...
match.matchName = packetData["matchName"] if packetData["matchName"] != "meme" else random.choice(memeTitles)
Based on the snippet: <|code_start|> class handler(generalPubSubHandler.generalPubSubHandler): def __init__(self): super().__init__() self.structure = { "userID": 0, "reason": "" } def handle(self, data): data = super().parseData(data) if data is None: <|code_end|> , predict the immediate next line w...
return
Given snippet: <|code_start|> class handler(generalPubSubHandler.generalPubSubHandler): def __init__(self): super().__init__() self.type = "int" def handle(self, userID): <|code_end|> , continue by predicting the next line. Consider current file imports: from common.redis import generalPubSubHandler from common...
userID = super().parseData(userID)
Predict the next line for this snippet: <|code_start|> class handler(generalPubSubHandler.generalPubSubHandler): def __init__(self): super().__init__() self.type = "int" def handle(self, userID): userID = super().parseData(userID) if userID is None: <|code_end|> with the help of current file imports: from ...
return
Predict the next line for this snippet: <|code_start|> def handle(userToken, packetData): try: # Start spectating packet packetData = clientPackets.startSpectating(packetData) # If the user id is less than 0, treat this as a stop spectating packet if packetData["userID"] < 0: userToken.stopSpectating() ...
userToken.startSpectating(targetToken)
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, packetData): try: # Start spectating packet packetData = clientPackets.startSpectating(packetData) # If the user id is less than 0, treat this as a stop spectating packet if packetData["userID"] < 0: <|code_end|> , p...
userToken.stopSpectating()
Here is a snippet: <|code_start|> def handle(userToken, packetData): try: # Start spectating packet packetData = clientPackets.startSpectating(packetData) # If the user id is less than 0, treat this as a stop spectating packet if packetData["userID"] < 0: userToken.stopSpectating() return # Get host ...
userToken.startSpectating(targetToken)
Based on the snippet: <|code_start|> class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado def asyncGet(self): <|code_end|> , predict the immediate next line with the help of imports: import json import tornado.web import tornado.gen from common...
statusCode = 400
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): statusCode = 400 data = {"message": "unknown error"} try: # Check arguments if not reques...
statusCode = 400
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): statusCode = 400 data = {"message": "unknown error"} try: # Check arguments if not reque...
key = self.get_argument("k")
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, _): # Get usertoken data userID = userToken.userID # Make sure the match exists matchID = userToken.matchID if matchID not in glob.matches.matches: return with glob.matches.matches[matchID] as match: # Get our slot...
match.sendReadyStatus()
Continue the code snippet: <|code_start|> class handler(generalPubSubHandler.generalPubSubHandler): def __init__(self): super().__init__() self.structure = { "userID": 0, "mainMenuIconID": 0 } def handle(self, data): data = super().parseData(data) if data is None: return targetTokens = glob.tok...
"https://i.ppy.sh/{}.png".format(icon["file_id"]),
Next line prediction: <|code_start|> class handler(generalPubSubHandler.generalPubSubHandler): def __init__(self): super().__init__() self.structure = { "userID": 0, "mainMenuIconID": 0 } def handle(self, data): data = super().parseData(data) if data is None: return targetTokens = glob.tokens.g...
"https://i.ppy.sh/{}.png".format(icon["file_id"]),
Predict the next line after this snippet: <|code_start|> def handleUsernameChange(userID, newUsername, targetToken=None): try: userUtils.appendNotes(userID, "Username change: '{}' -> '{}'".format(userUtils.getUsername(userID), newUsername)) userUtils.changeUsername(userID, newUsername=newUsername) if targetToken...
return
Here is a snippet: <|code_start|> def handle(userToken, packetData): # get token data userID = userToken.userID # Send spectator frames to every spectator streamName = "spect/{}".format(userID) glob.streams.broadcast(streamName, serverPackets.spectatorFrames(packetData[7:])) log.debug("Broadcasting {}'s frames t...
userID,
Continue the code snippet: <|code_start|> def handle(userToken, packetData): # get token data userID = userToken.userID # Send spectator frames to every spectator streamName = "spect/{}".format(userID) glob.streams.broadcast(streamName, serverPackets.spectatorFrames(packetData[7:])) log.debug("Broadcasting {}'s ...
userID,
Continue the code snippet: <|code_start|> def handle(userToken, packetData): # Get usertoken data userID = userToken.userID # Get match ID and match object matchID = userToken.matchID # Make sure we are in a match if matchID == -1: return # Make sure the match exists if matchID not in glob.matches.matches:...
match.updateHP(slotID, data["currentHp"])
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, packetData): # Get usertoken data userID = userToken.userID # Get match ID and match object matchID = userToken.matchID # Make sure we are in a match if matchID == -1: return # Make sure the match exists if matchI...
match.updateScore(slotID, data["totalScore"])
Continue the code snippet: <|code_start|> def handle(userToken, packetData): # Get usertoken data userID = userToken.userID # Get match ID and match object matchID = userToken.matchID # Make sure we are in a match if matchID == -1: return # Make sure the match exists if matchID not in glob.matches.matches:...
return
Predict the next line after this snippet: <|code_start|> def handle(userToken, packetData): # Read packet data. Same structure as changeMatchSettings packetData = clientPackets.changeMatchSettings(packetData) # Make sure the match exists matchID = userToken.matchID if matchID not in glob.matches.matches: return...
return
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, packetData): # Read packet data. Same structure as changeMatchSettings packetData = clientPackets.changeMatchSettings(packetData) # Make sure the match exists matchID = userToken.matchID if matchID not in glob.matches.ma...
return
Given the code snippet: <|code_start|> def handle(userToken, _): try: # We don't have the beatmap, we can't spectate if userToken.spectating not in glob.tokens.tokens: raise exceptions.tokenNotFoundException() # Send the packet to host glob.tokens.tokens[userToken.spectating].enqueue(serverPackets.noSongS...
userToken.stopSpectating()
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, _): try: # We don't have the beatmap, we can't spectate if userToken.spectating not in glob.tokens.tokens: raise exceptions.tokenNotFoundException() # Send the packet to host glob.tokens.tokens[userToken.spectati...
log.warning("Spectator can't spectate: token not found")
Given snippet: <|code_start|> class tokenList: def __init__(self): self.tokens = {} self._lock = threading.Lock() def __enter__(self): <|code_end|> , continue by predicting the next line. Consider current file imports: import threading import time import redis from common.ripple import userUtils from common....
self._lock.acquire()
Continue the code snippet: <|code_start|> def handle(userToken, _=None, deleteToken=True): # get usertoken data userID = userToken.userID username = userToken.username requestToken = userToken.token # Big client meme here. If someone logs out and logs in right after, # the old logout packet will still be in th...
userToken.stopSpectating()
Based on the snippet: <|code_start|> def handle(userToken, _=None, deleteToken=True): # get usertoken data userID = userToken.userID username = userToken.username requestToken = userToken.token # Big client meme here. If someone logs out and logs in right after, # the old logout packet will still be in the que...
if int(time.time() - userToken.loginTime) >= 5 or userToken.irc:
Next line prediction: <|code_start|> # Part all joined channels for i in userToken.joinedChannels: chat.partChannel(token=userToken, channel=i) # Leave all joined streams userToken.leaveAllStreams() # Enqueue our disconnection to everyone else glob.streams.broadcast("main", serverPackets.userLogout(user...
log.info("{} has been disconnected. (logout)".format(username))
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, packetData): # Get usertoken data userID = userToken.userID # Read packet data packetData = clientPackets.changeSlot(packetData) with glob.matches.matches[userToken.matchID] as match: # Change slot <|code_end|> , pred...
match.userChangeSlot(userID, packetData["slotID"])
Given the code snippet: <|code_start|> class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado def asyncGet(self): <|code_end|> , generate the next line using the imports in this file: import json import tornado.web import tornado.gen from common....
statusCode = 400
Continue the code snippet: <|code_start|> class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado def asyncGet(self): statusCode = 400 <|code_end|> . Use current file imports: import json import tornado.web import tornado.gen from common.sentry ...
data = {"message": "unknown error"}
Predict the next line for this snippet: <|code_start|> def handle(userToken, packetData): # Friend remove packet packetData = clientPackets.addRemoveFriend(packetData) userUtils.removeFriend(userToken.userID, packetData["friendID"]) # Console output <|code_end|> with the help of current file imports: from commo...
log.info("{} have removed {} from their friends".format(userToken.username, str(packetData["friendID"])))
Here is a snippet: <|code_start|> response = chat.IRCJoinChannel(self.banchoUsername, channel) if response == 0: # Joined successfully self.joinedChannels.append(channel) # Let everyone in this channel know that we've joined self.messageChannel(channel, "{} JOIN".format(self.IRCUsername), channel,...
elif response == 403:
Given snippet: <|code_start|> channels = arguments[0].split(",") for channel in channels: # Make sure we are not already in that channel # (we already check this bancho-side, but we need to do it # also here k maron) if channel.lower() in token.joinedChannels: continue # Attempt to join the chan...
usernames = []
Predict the next line after this snippet: <|code_start|> def handle(userToken, packetData): # Read userIDs list packetData = clientPackets.userPanelRequest(packetData) # Process lists with length <= 32 if len(packetData) > 256: log.warning("Received userPanelRequest with length > 256") return <|code_end|> u...
for i in packetData["users"]:
Continue the code snippet: <|code_start|> def handle(userToken, packetData): # Read userIDs list packetData = clientPackets.userPanelRequest(packetData) # Process lists with length <= 32 if len(packetData) > 256: <|code_end|> . Use current file imports: from common.log import logUtils as log from constants impor...
log.warning("Received userPanelRequest with length > 256")
Predict the next line after this snippet: <|code_start|> def handle(userToken, packetData): packetData = clientPackets.tournamentLeaveMatchChannel(packetData) matchID = packetData["matchID"] if matchID not in glob.matches.matches or not userToken.tournament: <|code_end|> using the current file's imports: from cons...
return
Given the following code snippet before the placeholder: <|code_start|> def handle(userToken, _): # Get userToken data userID = userToken.userID # Get match ID and match object matchID = userToken.matchID # Make sure we are in a match if matchID == -1: <|code_end|> , predict the next line using imports from the...
return
Given the code snippet: <|code_start|> def handle(userToken, _): # Get match ID and match object matchID = userToken.matchID # Make sure we are in a match if matchID == -1: <|code_end|> , generate the next line using the imports in this file: from objects import glob and context (functions, classes, or occasion...
return
Given the code snippet: <|code_start|> def handle(userToken, packetData): try: # get usertoken data userID = userToken.userID # Read packet data packetData = clientPackets.createMatch(packetData) # Make sure the name is valid matchName = packetData["matchName"].strip() if not matchName: raise excep...
match.changePassword(packetData["matchPassword"])
Continue the code snippet: <|code_start|> def handle(userToken, packetData): try: # get usertoken data userID = userToken.userID # Read packet data packetData = clientPackets.createMatch(packetData) # Make sure the name is valid matchName = packetData["matchName"].strip() if not matchName: raise ex...
match.setHost(userID)
Predict the next line for this snippet: <|code_start|> class channelList: def __init__(self): self.channels = {} <|code_end|> with the help of current file imports: from common.log import logUtils as log from objects import channel from objects import glob from helpers import chatHelper as chat and context from...
def loadChannels(self):
Predict the next line for this snippet: <|code_start|> class channelList: def __init__(self): self.channels = {} <|code_end|> with the help of current file imports: from common.log import logUtils as log from objects import channel from objects import glob from helpers import chatHelper as chat and context from...
def loadChannels(self):
Given the code snippet: <|code_start|> def handle(userToken, packetData): packetData = clientPackets.tournamentJoinMatchChannel(packetData) matchID = packetData["matchID"] if matchID not in glob.matches.matches or not userToken.tournament: return <|code_end|> , generate the next line using the imports in this file...
userToken.matchID = matchID
Predict the next line after this snippet: <|code_start|> def bloodcatMessage(beatmapID): beatmap = glob.db.fetch("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", [beatmapID]) if beatmap is None: return "Sorry, I'm not able to provide a download link for this map :(" <|code_end|> us...
return "Download [https://bloodcat.com/osu/s/{} {}] from Bloodcat".format(
Continue the code snippet: <|code_start|> def bloodcatMessage(beatmapID): beatmap = glob.db.fetch("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", [beatmapID]) if beatmap is None: <|code_end|> . Use current file imports: import json import random import re import threading import req...
return "Sorry, I'm not able to provide a download link for this map :("
Based on the snippet: <|code_start|> def bloodcatMessage(beatmapID): beatmap = glob.db.fetch("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", [beatmapID]) if beatmap is None: <|code_end|> , predict the immediate next line with the help of imports: import json import random import re ...
return "Sorry, I'm not able to provide a download link for this map :("
Given snippet: <|code_start|> def bloodcatMessage(beatmapID): beatmap = glob.db.fetch("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", [beatmapID]) if beatmap is None: return "Sorry, I'm not able to provide a download link for this map :(" return "Download [https://bloodcat.com/osu...
)
Given snippet: <|code_start|> def bloodcatMessage(beatmapID): beatmap = glob.db.fetch("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", [beatmapID]) if beatmap is None: return "Sorry, I'm not able to provide a download link for this map :(" <|code_end|> , continue by predicting the n...
return "Download [https://bloodcat.com/osu/s/{} {}] from Bloodcat".format(
Using the snippet: <|code_start|> def bloodcatMessage(beatmapID): beatmap = glob.db.fetch("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", [beatmapID]) if beatmap is None: return "Sorry, I'm not able to provide a download link for this map :(" return "Download [https://bloodcat.com...
beatmap["song_name"],
Continue the code snippet: <|code_start|> def handle(userToken, packetData): # Read userIDs list packetData = clientPackets.userStatsRequest(packetData) # Process lists with length <= 32 if len(packetData) > 32: log.warning("Received userStatsRequest with length > 32") <|code_end|> . Use current file imports: ...
return
Using the snippet: <|code_start|> class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} try: # Check arguments if "u" not in self.request.arguments and "id" not ...
try:
Predict the next line for this snippet: <|code_start|> class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} try: # Check arguments if "u" not in self.request.ar...
data["result"] = False
Predict the next line for this snippet: <|code_start|> # Get token data userID = userToken.userID # Get packet data packetData = clientPackets.changeMods(packetData) # Make sure the match exists matchID = userToken.matchID if matchID not in glob.matches.matches: return # Set slot or match mods according to ...
slotID = match.getUserSlotID(userID)
Based on the snippet: <|code_start|> userID = userToken.userID # Get packet data packetData = clientPackets.changeMods(packetData) # Make sure the match exists matchID = userToken.matchID if matchID not in glob.matches.matches: return # Set slot or match mods according to modType with glob.matches.matches[m...
if slotID is not None:
Based on the snippet: <|code_start|> class slot: def __init__(self): self.status = slotStatuses.FREE self.team = matchTeams.NO_TEAM self.userID = -1 <|code_end|> , predict the immediate next line with the help of imports: import copy import json import threading import time from common.log import logUtils as...
self.user = None
Given the following code snippet before the placeholder: <|code_start|> class slot: def __init__(self): self.status = slotStatuses.FREE self.team = matchTeams.NO_TEAM self.userID = -1 self.user = None self.mods = 0 self.loaded = False self.skip = False self.complete = False <|code_end|> , predict th...
self.score = 0
Based on the snippet: <|code_start|> class slot: def __init__(self): self.status = slotStatuses.FREE self.team = matchTeams.NO_TEAM self.userID = -1 self.user = None self.mods = 0 self.loaded = False <|code_end|> , predict the immediate next line with the help of imports: import copy import json import...
self.skip = False
Predict the next line after this snippet: <|code_start|> class slot: def __init__(self): self.status = slotStatuses.FREE self.team = matchTeams.NO_TEAM self.userID = -1 self.user = None self.mods = 0 self.loaded = False self.skip = False self.complete = False self.score = 0 <|code_end|> using the...
self.failed = False
Next line prediction: <|code_start|> class slot: def __init__(self): self.status = slotStatuses.FREE self.team = matchTeams.NO_TEAM self.userID = -1 self.user = None self.mods = 0 self.loaded = False self.skip = False self.complete = False self.score = 0 self.failed = False self.passed = True ...
def __init__(self, matchID, matchName, matchPassword, beatmapID, beatmapName, beatmapMD5, gameMode, hostUserID, isTourney=False):
Using the snippet: <|code_start|> class slot: def __init__(self): self.status = slotStatuses.FREE self.team = matchTeams.NO_TEAM self.userID = -1 self.user = None self.mods = 0 self.loaded = False self.skip = False self.complete = False self.score = 0 self.failed = False <|code_end|> , determine...
self.passed = True
Continue the code snippet: <|code_start|> def handle(userToken, packetData): # Get token data userID = userToken.userID # Get packet data packetData = clientPackets.lockSlot(packetData) # Make sure the match exists matchID = userToken.matchID if matchID not in glob.matches.matches: <|code_end|> . Use current f...
return
Continue the code snippet: <|code_start|> def handle(userToken, packetData): # Get token data userID = userToken.userID # Get packet data packetData = clientPackets.lockSlot(packetData) # Make sure the match exists matchID = userToken.matchID if matchID not in glob.matches.matches: return with glob.matches...
return
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): statusCode = 400 data = {"message": "unknown error"} try: # Check arguments if not reque...
data["message"] = "invalid ci key"
Here is a snippet: <|code_start|> @tornado.web.asynchronous @tornado.gen.engine @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} try: # Check arguments if not requestsManager.checkArguments(self.request.arguments, ["k"]): raise exceptions.invalidArgument...
self.write(json.dumps(data))
Predict the next line after this snippet: <|code_start|> class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine def asyncGet(self): if not glob.debug: self.write("Nope") return time.sleep(0.5) self.write("meemmeemmeemmeemmeemmeemmeemmeemmeemmeemmeemmeemmeemmeemm...
self.add_header("Keep-Alive", "timeout=5, max=100")
Given the code snippet: <|code_start|> # Get IP from tornado request requestIP = tornadoRequest.getRequestIP() # Avoid exceptions clientData = ["unknown", "unknown", "unknown", "unknown", "unknown"] osuVersion = "unknown" # Split POST body so we can get username/password/hardware data # 2:-3 thing is because re...
username = str(loginData[0])
Next line prediction: <|code_start|> chat.joinChannel(token=responseToken, channel="#admin") # Output channels info for key, value in glob.channels.channels.items(): if value.publicRead and not value.hidden: responseToken.enqueue(serverPackets.channelInfo(key)) # Send friends list responseToken.enque...
longitude = 0
Continue the code snippet: <|code_start|> raise exceptions.loginBannedException() # Save HWID in db for multiaccount detection hwAllowed = userUtils.logHardware(userID, clientData, firstLogin) # This is false only if HWID is empty # if HWID is banned, we get restricted so there's no # need to deny banch...
expireIn = "{} days".format(expireDays) if expireDays > 1 else "less than 24 hours"