Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given snippet: <|code_start|>#!/usr/bin/env python """ AES Block Cipher. Performs single block cipher decipher operations on a 16 element list of integers. These integers represent 8 bit bytes in a 128 bit block. The result of cipher or decipher operations is the transformed 16 element list of integers. Algorithm per...
def cipher_block(z,s0,s=sbox,g0=galNI[0],g1=galNI[1]):
Next line prediction: <|code_start|>AES Block Cipher. Performs single block cipher decipher operations on a 16 element list of integers. These integers represent 8 bit bytes in a 128 bit block. The result of cipher or decipher operations is the transformed 16 element list of integers. Algorithm per NIST FIPS-197 http...
def decipher_block(z,s0,s=i_sbox,g0=galI[0],g1=galI[1],g2=galI[2],g3=galI[3]):
Given snippet: <|code_start|>AES Block Cipher. Performs single block cipher decipher operations on a 16 element list of integers. These integers represent 8 bit bytes in a 128 bit block. The result of cipher or decipher operations is the transformed 16 element list of integers. Algorithm per NIST FIPS-197 http://csrc...
def decipher_block(z,s0,s=i_sbox,g0=galI[0],g1=galI[1],g2=galI[2],g3=galI[3]):
Next line prediction: <|code_start|>#!/usr/bin/env python """ AES Block Cipher. Performs single block cipher decipher operations on a 16 element list of integers. These integers represent 8 bit bytes in a 128 bit block. The result of cipher or decipher operations is the transformed 16 element list of integers. Algori...
def cipher_block(z,s0,s=sbox,g0=galNI[0],g1=galNI[1]):
Given the following code snippet before the placeholder: <|code_start|># modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version # 2 of the License, or (at your option) any later version. # # btcrecover is distributed in the hope that it will be use...
parser.add_argument("--version", "-v", action="version", version="%(prog)s " + addressset.__version__)
Here is a snippet: <|code_start|>Copyright (c) 2010, Adam Newman http://www.caller9.com Licensed under the MIT license http://www.opensource.org/licenses/mit-license.php """ __all__ = "expandKey", _expanded_key_length={16:176,24:208,32:240} def expandKey(new_key): """Expand the encryption key per AES key schedule s...
nx=n0,n1,n2,n3=(sbox[n1]^rcon[rcon_iter]^new_key[_n0],
Based on the snippet: <|code_start|>Copyright (c) 2010, Adam Newman http://www.caller9.com Licensed under the MIT license http://www.opensource.org/licenses/mit-license.php """ __all__ = "expandKey", _expanded_key_length={16:176,24:208,32:240} def expandKey(new_key): """Expand the encryption key per AES key schedul...
nx=n0,n1,n2,n3=(sbox[n1]^rcon[rcon_iter]^new_key[_n0],
Given the code snippet: <|code_start|> NoneType = type(None) T = TypeVar("T") V = TypeVar("V") class UnstructureStrategy(Enum): """`attrs` classes unstructuring strategies.""" AS_DICT = "asdict" AS_TUPLE = "astuple" def _subclass(typ): """a shortcut""" return lambda cls: issubclass(cls, typ)...
return is_union_type(typ) and all(has(get_origin(e) or e) for e in typ.__args__)
Using the snippet: <|code_start|> NoneType = type(None) T = TypeVar("T") V = TypeVar("V") class UnstructureStrategy(Enum): """`attrs` classes unstructuring strategies.""" AS_DICT = "asdict" AS_TUPLE = "astuple" def _subclass(typ): """a shortcut""" return lambda cls: issubclass(cls, typ) de...
return is_union_type(typ) and all(has(get_origin(e) or e) for e in typ.__args__)
Given the code snippet: <|code_start|> NoneType = type(None) T = TypeVar("T") V = TypeVar("V") class UnstructureStrategy(Enum): """`attrs` classes unstructuring strategies.""" AS_DICT = "asdict" AS_TUPLE = "astuple" def _subclass(typ): """a shortcut""" return lambda cls: issubclass(cls, typ)...
return is_union_type(typ) and all(has(get_origin(e) or e) for e in typ.__args__)
Here is a snippet: <|code_start|> T = TypeVar("T") T2 = TypeVar("T2") def test_deep_copy(): """Test the deep copying of generic parameters.""" mapping = {T.__name__: int} assert deep_copy_with(Optional[T], mapping) == Optional[int] assert ( deep_copy_with(List_origin[Optional[T]], mapping) ...
deep_copy_with(Dict_origin[T2, List_origin[Optional[T]]], mapping)
Here is a snippet: <|code_start|> T = TypeVar("T") T2 = TypeVar("T2") def test_deep_copy(): """Test the deep copying of generic parameters.""" mapping = {T.__name__: int} assert deep_copy_with(Optional[T], mapping) == Optional[int] assert ( <|code_end|> . Write the next line using the current file ...
deep_copy_with(List_origin[Optional[T]], mapping) == List_origin[Optional[int]]
Predict the next line after this snippet: <|code_start|> def deep_copy_with(t, mapping: Mapping[str, Any]): args = get_args(t) rest = () if is_annotated(t) and args: # If we're dealing with `Annotated`, we only map the first type parameter rest = tuple(args[1:]) args = (args[0],) ...
return copy_with(t, new_args) if new_args != args else t
Given the code snippet: <|code_start|> def deep_copy_with(t, mapping: Mapping[str, Any]): args = get_args(t) rest = () <|code_end|> , generate the next line using the imports in this file: from typing import Any, Mapping from ._compat import copy_with, get_args, is_annotated, is_generic and context (functio...
if is_annotated(t) and args:
Based on the snippet: <|code_start|> def deep_copy_with(t, mapping: Mapping[str, Any]): args = get_args(t) rest = () if is_annotated(t) and args: # If we're dealing with `Annotated`, we only map the first type parameter rest = tuple(args[1:]) args = (args[0],) new_args = ( ...
else (deep_copy_with(a, mapping) if is_generic(a) else a)
Given the code snippet: <|code_start|> """ FunctionDispatch is similar to functools.singledispatch, but instead dispatches based on functions that take the type of the first argument in the method, and return True or False. objects that help determine dispatch should be instantiated objects. """...
raise StructureHandlerNotFoundError(
Based on the 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 permissions a...
FileWriter(ctx).write(datafile)
Given snippet: <|code_start|> if not found: raise error if len(found) == 1: return found[0] self._raise_multiple_matching_keywords_found(name, found) def _get_embedded_arg_handlers(self, name): found = [] for template in self.embedd...
self.keywords = Keywords(keyword.steps)
Given the following code snippet before the placeholder: <|code_start|> def _import_default_libraries(self): for name in self._default_libraries: self.import_library(name) def _handle_imports(self, import_settings): for item in import_settings: try: if no...
= UserLibrary(resource.keyword_table.keywords, resource.source)
Given the following code snippet before the placeholder: <|code_start|> return found[0] self._raise_multiple_keywords_found(name, found) def _get_handler_from_library_keywords(self, name): found = [lib.get_handler(name) for lib in self._testlibs.values() if lib.has_handl...
if not RUN_KW_REGISTER.is_run_keyword(external.library.orig_name, external.name):
Based on the snippet: <|code_start|> if handler is None: raise DataError("No keyword with name '%s' found." % name) except DataError, err: handler = UserErrorHandler(name, unicode(err)) self._replace_variables_from_user_handlers(handler) return handler ...
return _XTimesHandler(self._get_handler('Repeat Keyword'), name)
Continue the code snippet: <|code_start|> except DataError, error: pass errors.append("Replacing variables from setting '%s' failed: %s" % (name, error)) return utils.unescape(item) def __getitem__(self, name): return self.current[name] ...
for ns in EXECUTION_CONTEXTS.namespaces:
Predict the next line after this snippet: <|code_start|># Copyright 2008-2012 Nokia Siemens Networks Oyj # # 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/lic...
self.comment = Comment(comment)
Predict the next line after this snippet: <|code_start|> class Populator(object): """Explicit interface for all populators.""" def add(self, row): raise NotImplementedError def populate(self): raise NotImplementedError class NullPopulator(Populator): def add(self, row): pa...
self._comment_cache = CommentCache()
Next line prediction: <|code_start|> return NullPopulator() if setter.im_class is Documentation: return DocumentationPopulator(setter) return SettingPopulator(setter) if row.starts_for_loop(): return ForLoopPopulator(self._test_or_uk.add_for_loo...
self._comments = Comments()
Given the code snippet: <|code_start|> else: self._populator.populate() self._populator = self._get_populator(row) self._consume_standalone_comments() self._populator.add(row) def _is_continuing(self, row): return row.is_continuing() and self._populator ...
if setter.im_class is Documentation:
Given the code snippet: <|code_start|> self._populator = self._get_populator(row) self._consume_standalone_comments() self._populator.add(row) def _is_continuing(self, row): return row.is_continuing() and self._populator def _get_populator(self, row): raise NotIm...
if setter.im_class is MetadataList:
Using the snippet: <|code_start|> class _RunKeywordHandler(_PythonHandler): def __init__(self, library, handler_name, handler_method): _PythonHandler.__init__(self, library, handler_name, handler_method) self._handler_method = handler_method def _run_with_signal_monitoring(self, runner, conte...
keywords = Keywords([])
Predict the next line after this snippet: <|code_start|># # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
if RUN_KW_REGISTER.is_run_keyword(library.orig_name, name):
Given the following code snippet before the placeholder: <|code_start|> def _cached_download_helper(cache_obj_name, dl_func, reset=False): """Helper function for downloads. Takes care of checking if the file is already cached. Only calls the actual download function when no cached version exists. """ ...
raise InvalidParamsError("Need a valid PATHS['working_dir']!")
Continue the code snippet: <|code_start|> if wd is not None and os.path.isdir(wd): fb_cache_dir = os.path.join(wd, 'cache') else: fb_cache_dir = os.path.join(cfg.CACHE_DIR, 'cache') check_fb_dir = True if not cache_dir: # Defaults to working directory: it must...
raise NoInternetException("Download required, but "
Next line prediction: <|code_start|> list of known static files. Uses _cached_download_helper to perform the actual download. """ path = _cached_download_helper(cache_obj_name, dl_func, reset) try: dl_verify = cfg.PARAMS['dl_verify'] except KeyError: dl_verify = True if dl_v...
raise DownloadVerificationFailedException(msg=err, path=path)
Based on the snippet: <|code_start|> """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._sock = None @property def sock(self): """Return the socket.""" return self._sock @sock.setter def sock(self, value): """When modifying t...
raise DownloadCredentialsMissingException('No authentication '
Based on the snippet: <|code_start|> else: # compute the hash sha256 = hashlib.sha256() with open(path, 'rb') as f: for b in iter(lambda: f.read(0xFFFF), b''): sha256.update(b) sha256 = sha256.digest() size = os.path....
raise HttpDownloadError(r.status_code, url)
Given snippet: <|code_start|> def _requests_urlretrieve(url, path, reporthook, auth=None, timeout=None): """Implements the required features of urlretrieve on top of requests """ chunk_size = 128 * 1024 chunk_count = 0 with requests.get(url, stream=True, auth=auth, timeout=timeout) as r: ...
raise HttpContentTooShortError()
Given snippet: <|code_start|>def rema_zone(lon_ex, lat_ex): """Returns a list of REMA-DEM zones covering the desired extent. """ gdf = gpd.read_file(get_demo_file('REMA_Tile_Index_Rel1.1.shp')) p = _extent_to_polygon(lon_ex, lat_ex, to_crs=gdf.crs) gdf = gdf.loc[gdf.intersects(p)] return gdf.ti...
raise InvalidDEMError('COPDEM Version not valid.')
Given the code snippet: <|code_start|> # Decide if Implicit or Explicit FTPS is used based on the port in url if upar.port == 990: ftps = ImplicitFTPTLS() elif upar.port == 21: ftps = ftplib.FTP_TLS() try: # establish ssl connection ftps.connect(host=upar.hostname, port=...
raise FTPSDownloadError(err)
Predict the next line after this snippet: <|code_start|> help='Run OGGM in mpi mode') args, unkn = parser.parse_known_args() if not args.mpi: return OGGM_MPI_COMM = MPI.COMM_WORLD OGGM_MPI_SIZE = OGGM_MPI_COMM.Get_size() - 1 rank = OGGM_MPI_COMM.Get_rank() if OG...
cfg_store = cfg.pack_config()
Given the following code snippet before the placeholder: <|code_start|> except BaseException: raise ValueError('DocumentedDict accepts only tuple of len 2') def info_str(self, key): """Info string for the documentation.""" return ' {}'.format(self[key]) + '\n' + ' ' + s...
raise InvalidParamsError('The value you are trying to set does '
Using the snippet: <|code_start|> @background(queue=settings.INBOX_EMAIL_NOTIFICATION_QUEUE) def send_email_notification(message_id, base_site_url): message_template = 'inbox/message_notification_email.html' message = Message.objects.select_related('thread').get(pk=message_id) thread = message.thread ...
send_email(subject=subject, message=m, recipient_list=[recipient.email])
Here is a snippet: <|code_start|> @background(queue=settings.INBOX_EMAIL_NOTIFICATION_QUEUE) def send_email_notification(message_id, base_site_url): message_template = 'inbox/message_notification_email.html' <|code_end|> . Write the next line using the current file imports: from urllib.parse import urljoin from...
message = Message.objects.select_related('thread').get(pk=message_id)
Given snippet: <|code_start|> app_name = 'inbox' urlpatterns = [ re_path(r'^@(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), <|code_end|> , continue by predicting the next line. Consider current file imports: from django.urls import path, re_path from .views import (Me...
path('<int:pk>/new/', MessageCreateView.as_view(),
Next line prediction: <|code_start|> app_name = 'inbox' urlpatterns = [ re_path(r'^@(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), path('<int:pk>/new/', MessageCreateView.as_view(), name='new-message'), path('santa/', SantaThreadDetailView.as_view(), na...
path('', ThreadListView.as_view(), name='threads')
Given snippet: <|code_start|> app_name = 'inbox' urlpatterns = [ re_path(r'^@(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), path('<int:pk>/new/', MessageCreateView.as_view(), name='new-message'), <|code_end|> , continue by predicting the next line. Consider...
path('santa/', SantaThreadDetailView.as_view(), name='santa-detail'),
Based on the snippet: <|code_start|> app_name = 'inbox' urlpatterns = [ re_path(r'^@(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), path('<int:pk>/new/', MessageCreateView.as_view(), name='new-message'), path('santa/', SantaThreadDetailView.as_view(), na...
path('santee/', SanteeThreadDetailView.as_view(), name='santee-detail'),
Next line prediction: <|code_start|> class ImageUploadForm(ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # make description optional field self.fields['description'].required = False self.helper = FormHelper() self.helper.layout = Lay...
model = Image
Next line prediction: <|code_start|> class HomePageView(TemplateView): template_name = 'home.html' template_name_authenticated = 'home_authenticated.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) if self.request.user.is_authenticated: ...
context['form'] = SignupForm()
Based on the snippet: <|code_start|> @method_decorator(login_required, name='dispatch') class ImageUploadView(CreateView): model = Image <|code_end|> , predict the immediate next line with the help of imports: from django.views.generic.edit import CreateView from django.views.generic import DetailView, ListView ...
form_class = ImageUploadForm
Next line prediction: <|code_start|>"""della URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$',...
path('', HomePageView.as_view()),
Next line prediction: <|code_start|> self.helper = FormHelper() self.helper.layout = Layout( Fieldset( 'Update Your Profile', 'avatar', 'bio', 'website_url', 'fb_profile_url', 'twitter_profile_url'...
model = UserProfile
Predict the next line after this snippet: <|code_start|>def create_user_profile(user): UserProfile.objects.create(user=user, is_enabled_exchange=False) def activate_user(user): if user.is_active: return True user.is_active = True user.save() return True def enable_for_exchange(user): ...
send_email(subject=subject, message=message, recipient_list=[user.email])
Given the code snippet: <|code_start|> @method_decorator(login_required, name='dispatch') class MessageCreateView(CreateView): model = Message <|code_end|> , generate the next line using the imports in this file: from django.views.generic.edit import CreateView from django.views.generic import DetailView, ListVi...
form_class = MessageCreateForm
Here is a snippet: <|code_start|> @method_decorator(login_required, name='dispatch') class MessageCreateView(CreateView): model = Message form_class = MessageCreateForm success_url = '/' def post(self, request, pk, *args, **kwargs): if not request.is_ajax(): raise Http404('Haxxeru...
return Thread.objects.filter(
Given the following code snippet before the placeholder: <|code_start|> app_name = 'gallery' urlpatterns = [ path('upload/', ImageUploadView.as_view(), name='upload'), <|code_end|> , predict the next line using imports from the current file: from django.urls import path from .views import ImageUploadView, ImageD...
path('<int:pk>/', ImageDetailView.as_view(), name='image-detail'),
Next line prediction: <|code_start|> app_name = 'gallery' urlpatterns = [ path('upload/', ImageUploadView.as_view(), name='upload'), path('<int:pk>/', ImageDetailView.as_view(), name='image-detail'), <|code_end|> . Use current file imports: (from django.urls import path from .views import ImageUploadView, Im...
path('', ImageListView.as_view(), name='image-list')
Given the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-12-12 18:17:20 # @Author : yml_bright@163.com class JWCHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.write("hello") def...
status = self.db.query(JWCCache).filter( JWCCache.date > int(time())-jwcCacheTime).order_by(JWCCache.date.desc()).all()
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-12-12 18:17:20 # @Author : yml_bright@163.com class JWCHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): ...
status = self.db.query(JWCCache).filter( JWCCache.date > int(time())-jwcCacheTime).order_by(JWCCache.date.desc()).all()
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- # @Date : 2016-03-14 17:34:57 # @Author : jerry.liangj@qq.com class HotHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self....
status = self.db.query(LibraryHotCache).one()
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-10-26 12:46:36 # @Author : yml_bright@163.com class LectureHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.wri...
if status.date > int(time()) - lectureCacheTime and status.text != '*':
Based on the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-10-26 12:46:36 # @Author : yml_bright@163.com class LectureHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.write('Herald Web Ser...
status = self.db.query(LectureCache).filter( LectureCache.cardnum == cardnum ).one()
Next line prediction: <|code_start|> def get(self): self.write('Herald Web Service') @tornado.web.asynchronous @tornado.gen.engine def post(self): cardnum = self.get_argument('cardnum') data = { 'Login.Token1':cardnum, 'Login.Token2':self.get_argument('pas...
response = authApi(cardnum,self.get_argument('password'))
Based on the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-10-26 12:46:36 # @Author : yml_bright@163.com class PhylabHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.write('H...
if status.date > int(time())-phylabCacheTime and status.text != '*':
Using the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-10-26 12:46:36 # @Author : yml_bright@163.com class PhylabHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.write('Hera...
status = self.db.query(PhylabCache).filter( PhylabCache.cardnum == number ).one()
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-11-04 13:38:58 # @Author : yml_bright@163.com class NICHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): ...
status = self.db.query(NicCache).filter( NicCache.cardnum == cardnum ).one()
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # @Date : 2016-03-24 16 16:34:57 # @Author : jerry.liangj@qq.com def getCookie(db,cardnum,card_pwd): state = 1 ret = {'code':200,'content':''} try: <|code_end|> . Use current file imports: import time,json import urllib from tornado.httpclient i...
result = db.query(CookieCache).filter(CookieCache.cardnum==cardnum).one()
Next line prediction: <|code_start|># -*- coding: utf-8 -*- class LibAuthCheckHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self.write('herald web service') @tornado.web.asynch...
status = self.db.query(LibraryAuthCache).filter(LibraryAuthCache.cardnum == cardnum).one()
Given the following code snippet before the placeholder: <|code_start|># @Date : 2014-06-27 14:36:45 # @Author : xindervella@gamil.com yml_bright@163.com class SRTPHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.clo...
if status.date > int(time())-srtpCacheTime and status.text != '*':
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- # @Date : 2014-06-27 14:36:45 # @Author : xindervella@gamil.com yml_bright@163.com class SRTPHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): se...
status = self.db.query(SRTPCache).filter(SRTPCache.cardnum == number).one()
Next line prediction: <|code_start|># @Date : 2014-10-26 12:46:36 # @Author : yml_bright@163.com class NewCARDHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self.write('Herald Web...
status = self.db.query(CardCache).filter( CardCache.cardnum == cardnum ).one()
Given snippet: <|code_start|> @tornado.web.asynchronous @tornado.gen.engine def post(self): timedelta = int(self.get_argument('timedelta', default=0)) # if int(timedelta)>7: # timedelta = 7 cardnum = self.get_argument('cardnum') data = { 'Login.Token1':...
response = authApi(cardnum,self.get_argument('password'))
Using the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2015-03-17 12:06:02 # @Author : yml_bright@163.com class LectureNoticeHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.write('Herald Web...
status = self.db.query(LectureDB).filter( LectureDB.date >= date ).all()
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- # @Date : 2016-03-24 16 16:34:57 # @Author : jerry.liangj@qq.com class YuyueHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): ...
cookie = getCookie(self.db,cardnum,password)
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- # @Date : 2015-03-19 16 16:34:57 # @Author : yml_bright@163.com class UserHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.d...
if ((user.last_update != None) and (now - user.last_update) < userCacheTime):
Given snippet: <|code_start|># -*- coding: utf-8 -*- # @Date : 2015-03-19 16 16:34:57 # @Author : yml_bright@163.com class UserHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self...
user = self.db.query(UserDetail).filter(_number == UserDetail.cardnum).one()
Using the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2015-08-24 12:46:36 # @Author : LiangJ class RoomHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.write('Herald Web Service') def o...
status = self.db.query(RoomCache).filter(RoomCache.cardnum == number).one()
Next line prediction: <|code_start|> self.db.close() @tornado.web.asynchronous @tornado.gen.engine def post(self): number = self.get_argument('number',default=None) retjson = {'code':200, 'content':''} data = { 'Login.Token1':number, 'Login.Token2'...
response = authApi(number,self.get_argument("password"))
Here is a snippet: <|code_start|> @property def db(self): return self.application.db def get(self): self.write('Herald Web Service') def on_finish(self): self.db.close() @tornado.web.asynchronous @tornado.gen.engine def post(self): state = 'success' ...
user = self.db.query(PEUser).filter(
Here is a snippet: <|code_start|> front_day = 6-current_date front_day = front_day if front_day>0 else 0 back_remain = 5 all_week = (alldays-5-front_remain)/7 workday_count = (all_week+1)*5+front_day if current_date<=6: workday_count = workday_count-1 r...
status = self.db.query(TiceCache).filter(TiceCache.cardnum == cardnum).one()
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- # modified from old renewhandler.py # by yml_bright@163.com class LibRenewHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): ...
status = self.db.query(LibraryAuthCache).filter(LibraryAuthCache.cardnum == cardnum).one()
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-12-15 18:07:58 # @Author : yml_bright@163.com class SchoolBusHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): sel...
data = self.db.query(DataCache).filter( DataCache.key == 10001 ).one()
Based on the snippet: <|code_start|> def end_td(self): self.flag -= 1 def handle_data(self, text): if self.flag == 3 and self.form == 1: self.row.append(text) class pedetailHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db ...
status = self.db.query(PeDetailCache).filter(PeDetailCache.cardnum == cardnum).one()
Given the code snippet: <|code_start|> class CARDHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self.write('Herald Web Service') @tornado.web.asynchronous @tornado.gen...
if status.date > int(time())-cardCacheTime and status.text != '*':
Next line prediction: <|code_start|># @Author : yml_bright@163.com class CARDHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self.write('Herald Web Service') @tornado.web...
status = self.db.query(CardCache).filter( CardCache.cardnum == cardnum_with_delta ).one()
Given snippet: <|code_start|> def post(self): timedelta = int(self.get_argument('timedelta', default=0)) # if int(timedelta)>7: # timedelta = 7 cardnum = self.get_argument('cardnum') cardnum_with_delta = cardnum + str(timedelta) data = { 'Login.Token1':...
response = authApi(cardnum,self.get_argument('password'))
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- class LibListHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self.write('herald webservi...
status = self.db.query(LibraryAuthCache).filter(LibraryAuthCache.cardnum == cardnum).one()
Using the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2015-12-3 12:46:36 # @Author : jerry.liangj@qq.com class ExamHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def g...
if status.date > int(time())-examCacheTime and status.text != '*':
Given snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2015-12-3 12:46:36 # @Author : jerry.liangj@qq.com class ExamHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(s...
status = self.db.query(ExamCache).filter(ExamCache.cardnum == number).one()
Next line prediction: <|code_start|> self.finish() return except NoResultFound: status = ExamCache(cardnum = number,text = '*',date = int(time())) self.db.add(status) try: self.db.commit() except: self.db.rollback() ...
response = authApi(number,password)
Next line prediction: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2015-10-26 14:46:50 # @Author : jerry.liangj@qq.com class PCHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get(self): self.write('Herald Web Service...
status = self.db.query(PCCache).filter( PCCache.date == self.today(),PCCache.lastdate+180>int(time())).one()
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- class LibAuthHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): cardnum = self.get_argument('cardnum', default=None) ...
status = self.db.query(LibraryAuthCache).filter(LibraryAuthCache.cardnum == cardnum).one()
Here is a snippet: <|code_start|> method='POST', request_timeout=TIME_OUT) response = yield tornado.gen.Task(client.fetch, request) body = response.body if not body: retjson['code'] = 408 retjs...
'month': start_date.month - 1,
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # @Date : 2014-06-26 13:57:44 #Author : xindervella@gamil.com yml_bright@163.com class CurriculumHandler(tornado.web.RequestHandler): def get(self): self.write('Herald Web Service') @property def db(self): return self.ap...
term = self.get_argument('term', default=default_term)
Next line prediction: <|code_start|># @Author : xindervella@gamil.com yml_bright@163.com # import Image class GPAHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): self.write('Herald...
if status.date > int(time())-gpaCacheTime and status.text != '*':
Given snippet: <|code_start|># @Date : 2014-06-26 17:00:02 # @Author : xindervella@gamil.com yml_bright@163.com # import Image class GPAHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def on_finish(self): self.db.close() def get(self): ...
status = self.db.query(GpaCache).filter(GpaCache.cardnum == username).one()
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Date : December 09, 2016 @Author : corvo vim: set ts=4 sw=4 tw=99 et: """ class LogHandler(tornado.web.RequestHandler): """ 本模块为日志分析后端模块, 预先分析好的日志先存储于数据库中, 使用时读取数据库中的json信...
log_list = self.db.query(DayLogAnalyze).\
Next line prediction: <|code_start|>def on_color_test_cases(request): return request.param @pytest.fixture( scope="session", ids=attrs_id_func, params=[ # Supported attrs (["bold"], ["bold"]), (["dark"], ["dark"]), (["underline"], ["underline"]), (["blink"], ["b...
params=sorted([k for k, v in COLOR_MAP.items() if v == "color"]),
Based on the snippet: <|code_start|>@pytest.fixture( scope="session", params=[ # Empty b"", u"", # Success b"OK", u"OK", b"\xe2\x9c\x94", u"✔", # Sun b"\xe2\x98\x80\xef\xb8\x8f", u"☀️", # Spark b"\xf0\x9f\x92...
{signal.SIGHUP: default_handler},
Next line prediction: <|code_start|> scope="session", params=[ # Empty b"", u"", # Success b"OK", u"OK", b"\xe2\x9c\x94", u"✔", # Sun b"\xe2\x98\x80\xef\xb8\x8f", u"☀️", # Spark b"\xf0\x9f\x92\xa5", u"...
{signal.SIGINT: fancy_handler},
Based on the snippet: <|code_start|> @pytest.mark.parametrize( "spinner, expected", [ # None (None, default_spinner), # hasattr(spinner, "frames") and not hasattr(spinner, "interval") (namedtuple("Spinner", "frames")("-\\|/"), default_spinner), # not hasattr(spinner, "fra...
sp = yaspin(spinner)
Next line prediction: <|code_start|>""" tests.test_yaspin ~~~~~~~~~~~~~~~~~ Basic unittests. """ @pytest.mark.parametrize( "spinner, expected", [ # None (None, default_spinner), # hasattr(spinner, "frames") and not hasattr(spinner, "interval") (namedtuple("Spinner", "frames...
(Spinner("", 0), default_spinner),