
AhmedSSoliman/LUKE-Marian-Model-on-DJANGO
Translation
•
Updated
•
7
Unnamed: 0
int64 0
10k
| nl
stringlengths 3
2.42k
| code
stringlengths 4
3.76k
|
---|---|---|
0 |
define the method i with an argument self.
|
def i ( self ) :
|
1 |
if out has an 'isatty' argument and return value of the function out.isatty is true,
|
if hasattr ( out , 'isatty' ) and out . isatty ( ) :
|
2 |
if ValueError exception is caught,
|
except ValueError :
|
3 |
raise an ValueError exception with an argument string "Base36 conversion input too large.".
|
raise ValueError ( "Base36 conversion input too large." )
|
4 |
return is empty dictionary.
|
return { }
|
5 |
get the value under the key 'database' of the options dictionary, use it as a index to get an element from connections, substitute it for connection.
|
connection = connections [ options [ 'database' ] ]
|
6 |
if out_log is true,
|
if out_log :
|
7 |
substitute model._meta.app_label for app.
|
app = model . _meta . app_label
|
8 |
define the method __nonzero__ with an argument self.
|
def __nonzero__ ( self ) :
|
9 |
from django.db.migrations.loader import MigrationLoader into default name space.
|
from django . db . migrations . loader import MigrationLoader
|
10 |
call the method gettext_module.find with 3 arguments: string 'django', path and list with an element: result of the function,
|
if gettext_module . find ( 'django' , path , [ to_locale ( lang_code ) ] ) is not None :
|
11 |
from django.conf import settings into default name space.
|
from django . conf import settings
|
12 |
define the method as_bytes with arguments self and unixfrom set to boolean False.
|
def as_bytes ( self , unixfrom = False ) :
|
13 |
define the method add with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None.
|
def add ( self , key , value , timeout = DEFAULT_TIMEOUT , version = None ) :
|
14 |
HITS and MISSES are integer 0 and 1, respectively.
|
HITS , MISSES = 0 , 1
|
15 |
if key if contained in value under the DEFAULT_CACHE_ALIAS key of caches dictionary, return boolean True, otherwise return False.
|
return key in caches [ DEFAULT_CACHE_ALIAS ]
|
16 |
substitute asvar for self.asvar.
|
self . asvar = asvar
|
17 |
raise an TypeError with an argument string "update expected at most 1 arguments, got %d" formated with length of args.
|
raise TypeError ( "update expected at most 1 arguments, got %d" % len ( args ) )
|
18 |
define the method getlist with 2 arguments: self and key.
|
def getlist ( self , key ) :
|
19 |
call the function _add_doc with 2 arguments: reraise and string """Reraise an exception.""".
|
_add_doc ( reraise , """Reraise an exception.""" )
|
20 |
if encoding does not exists substitute it for settings.DEFAULT_CHARSET.
|
encoding = encoding or settings . DEFAULT_CHARSET
|
21 |
call the method form.add_initial_prefix with an argument self.auto_id, substitute the result for self.html_initial_id.
|
self . html_initial_id = form . add_initial_prefix ( self . auto_id )
|
22 |
define the method start_serialization with an argument self.
|
def start_serialization ( self ) :
|
23 |
if result is not None,
|
if result is not None :
|
24 |
convert host to lowercase.
|
host = host . lower ( )
|
25 |
for every var in self.vars,
|
for var in self . vars :
|
26 |
call the method parser.skip_past with an argument string 'endcomment'.
|
parser . skip_past ( 'endcomment' )
|
27 |
call the method parser.delete_first_token.
|
parser . delete_first_token ( )
|
28 |
if model_identifier is false,
|
if not model_identifier :
|
29 |
get the type of form object, return an instance of resulting class created with 3 arguments: class_name, tuple with an element form,
|
return type ( form ) ( class_name , ( form , ) , form_class_attrs )
|
30 |
__all__ is a list containing next strings, 'CheckMessage', 'Debug', 'Info', 'Warning', 'Error', 'Critical',
|
__all__ = [ 'CheckMessage' , 'Debug' , 'Info' , 'Warning' , 'Error' , 'Critical' , 'DEBUG' , 'INFO' , 'WARNING' , 'ERROR' , 'CRITICAL' , 'register' , 'run_checks' , 'tag_exists' , 'Tags' , ]
|
31 |
substitute params for self.params.
|
self . params = params
|
32 |
' ' for 's', 'x' for 'S', 'x' for 'W', '!' for 'W' and None for 'Z'. derive the class Choice from list base class.
|
class Choice ( list ) :
|
33 |
return boolean False.
|
return False
|
34 |
return boolean True.
|
return True
|
35 |
return the result. define the method id_for_label with 2 arguments: self and id_.
|
def id_for_label ( self , id_ ) :
|
36 |
call the method parser.add_argument with 4 arguments: string 'args', metavar set to string 'fixture', nargs set to '+',
|
parser . add_argument ( 'args' , metavar = 'fixture' , nargs = '+' , help = 'Fixture labels.' )
|
37 |
call the method self.setFeature with 2 arguments: handler.feature_external_pes and boolean False.
|
self . setFeature ( handler . feature_external_pes , False )
|
38 |
from django.utils.safestring import mark_safe into default name space.
|
from django . utils . safestring import mark_safe
|
39 |
if not,
|
else :
|
40 |
call the function warnings.warn with 2 arguments: string '"requires_model_validation" is deprecated '
|
warnings . warn ( '"requires_model_validation" is deprecated ' 'in favor of "requires_system_checks".' , RemovedInDjango19Warning )
|
41 |
return nothing.
|
return
|
42 |
if NotImplementedError exception is caught,
|
except NotImplementedError :
|
43 |
if current_len is smaller than or equal to length,
|
if current_len <= length :
|
44 |
otherwise if msg and visible_issue_count are true,
|
elif msg and visible_issue_count :
|
45 |
append value to self.dicts list.
|
self . dicts . append ( value )
|
46 |
if confirm equals string 'yes',
|
if confirm == 'yes' :
|
47 |
if kwarg_format is true,
|
if kwarg_format :
|
48 |
format string normal_row with an dictionary containing 6 entries: return value of the function force_text with an argument bf_errors,
|
output . append ( normal_row % { 'errors' : force_text ( bf_errors ) , 'label' : force_text ( label ) , 'field' : six . text_type ( bf ) , 'help_text' : help_text , 'html_class_attr' : html_class_attr , 'field_name' : bf . html_name , } )
|
49 |
if self.activated is boolean False,
|
if not self . activated :
|
50 |
do nothing.
|
pass
|
51 |
content_length is None.
|
content_length = None
|
52 |
define the method __init__ with 2 arguments: self and token.
|
def __init__ ( self , tokens ) :
|
53 |
split locale by '_', append the first element of the result to locales.
|
locales . append ( locale . split ( '_' ) [ 0 ] )
|
54 |
substitute var for self.var.
|
self . var = var
|
55 |
define the method __iter__ with an argument self.
|
def __iter__ ( self ) :
|
56 |
" * The database isn't running or isn't configured correctly.\n * At least one of the expected database tables doesn't exist.\n" " * The SQL was invalid.\nHint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.\n" "The full error: %s", where '%s' is replaced by value under the 'NAME' key of the connection.settings_dict dictionary and e. call the function six.reraise with 3 arguments: CommandError, CommandError created with argument new_msg,
|
six . reraise ( CommandError , CommandError ( new_msg ) , sys . exc_info ( ) [ 2 ] )
|
57 |
return the result. if UnicodeDecodeError exception is caught,
|
except UnicodeDecodeError :
|
58 |
if value under the 'primary_key' key of the dictionary contained under the column_name key of the dictionary indexes is true,
|
if indexes [ column_name ] [ 'primary_key' ] :
|
59 |
define the function build_request_repr with arguments: request, path_override set to None, GET_override set to None,
|
def build_request_repr ( request , path_override = None , GET_override = None , POST_override = None , COOKIES_override = None , META_override = None ) :
|
60 |
evaluate the method type(self).__bool__ with argument self, return the result.
|
return type ( self ) . __bool__ ( self )
|
61 |
call the form.is_valid method, if it evaluates to false,
|
if not form . is_valid ( ) :
|
62 |
import module sys.
|
import sys
|
63 |
increment s_len by integer 1,
|
s_len += 1
|
64 |
call the function get_urlconf with an argument urlconf.
|
urlconf = get_urlconf ( )
|
65 |
from email.mime.message import MIMEMessage into default name space.
|
from email . mime . message import MIMEMessage
|
66 |
return a string '<%s: %r>', format it with __name__ field of the self class and repr_attr.
|
return '<%s: %r>' % ( type ( self ) . __name__ , repr_attr )
|
67 |
if not,
|
else :
|
68 |
default set to DEFAULT_DB_ALIAS and help as a string 'Nominates a specific database to load fixtures into. Defaults to the "default" database.' call the method parser.add_argument with 5 arguments: string '--app', action as a string 'store', dest as a string 'app_label',
|
parser . add_argument ( '--app' , action = 'store' , dest = 'app_label' , default = None , help = 'Only look for fixtures in the specified app.' )
|
69 |
__version__ is a string "1.6.1".
|
__version__ = "1.6.1"
|
70 |
call the method render from the base class of the class FileInput, called with 3 arguments: name, None and attrs as attrs.
|
return super ( FileInput , self ) . render ( name , None , attrs = attrs )
|
71 |
convert priority into a floating point integer, substitute it for priority.
|
priority = float ( priority )
|
72 |
define the function resolve with arguments path and urlconf set to None.
|
def resolve ( path , urlconf = None ) :
|
73 |
derive the class File from the FileProxyMixin base class.
|
class File ( FileProxyMixin ) :
|
74 |
if not,
|
else :
|
75 |
__author__ is a string "Benjamin Peterson <benjamin@python.org>".
|
__author__ = "Benjamin Peterson <benjamin@python.org>"
|
76 |
call the method __init__ with an argument name form the base class of the class MovedAttribute.
|
super ( MovedAttribute , self ) . __init__ ( name )
|
77 |
if use_natural_keys is true,
|
if use_natural_keys :
|
78 |
define the method to_python with arguments self and value.
|
def to_python ( self , value ) :
|
79 |
if not,
|
else :
|
80 |
define the method __repr__ with an argument self.
|
def __repr__ ( self ) :
|
81 |
import module warnings.
|
import warnings
|
82 |
import module threading.
|
import threading
|
83 |
return an empty string,
|
return ''
|
84 |
if attrs is None,
|
if attrs is None :
|
85 |
return an empty string.
|
return ''
|
86 |
raise an ValueError exception with an argument e.
|
raise ValueError ( e )
|
87 |
call the function urlquote with 2 arguments value and unpacked dictionary kwargs, return the result.
|
return urlquote ( value , ** kwargs )
|
88 |
substitute the '%s' with table and 3 elements of a list: b64encoded, exp and key, respectively. if DatabaseError exception is caught,
|
except DatabaseError :
|
89 |
define the function do_filter with 2 arguments: parser and token.
|
def do_filter ( parser , token ) :
|
90 |
fp is a instance of a class six.BytesIO.
|
fp = six . BytesIO ( )
|
91 |
try,
|
try :
|
92 |
register.tag decorator,
|
@ register . tag
|
93 |
call the method return self.format with an argument string 'D, j M Y H:i:s O', return the result.
|
return self . format ( 'D, j M Y H:i:s O' )
|
94 |
derive the class Form from the base classes DeclarativeFieldsMetaclass and BaseForm.
|
class Form ( six . with_metaclass ( DeclarativeFieldsMetaclass , BaseForm ) ) :
|
95 |
substitute it for value of dictionary response under the key 'Vary'. define function has_vary_header, with response and header_query as arguments.
|
def has_vary_header ( response , header_query ) :
|
96 |
extension_map is a dictioanry with 6 initial elntries: TarArchive for '.tar', TarArchive for '.tar.bz2', TarArchive for '.tar.gz',
|
extension_map = { '.tar' : TarArchive , '.tar.bz2' : TarArchive , '.tar.gz' : TarArchive , '.tgz' : TarArchive , '.tz2' : TarArchive , '.zip' : ZipArchive , }
|
97 |
for every app_config in return value of the method apps.get_app_configs,
|
for app_config in apps . get_app_configs ( ) :
|
98 |
while x is greater than zero,
|
while x > 0 :
|
99 |
if length of name is greater than integer 255,
|
if len ( name ) > 255 :
|
Django dataset used in the paper "Learning to Generate Pseudo-Code from Source Code Using Statistical Machine Translation", Oda et al., ASE, 2015.
The Django dataset is a dataset for code generation comprising of 16000 training, 1000 development and 1805 test annotations. Each data point consists of a line of Python code together with a manually created natural language description.
@inproceedings{oda2015ase:pseudogen1,
author = {Oda, Yusuke and Fudaba, Hiroyuki and Neubig, Graham and Hata, Hideaki and Sakti, Sakriani and Toda, Tomoki and Nakamura, Satoshi},
title = {Learning to Generate Pseudo-code from Source Code Using Statistical Machine Translation},
booktitle = {Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE)},
series = {ASE '15},
month = {November},
year = {2015},
isbn = {978-1-5090-0025-8},
pages = {574--584},
numpages = {11},
url = {https://doi.org/10.1109/ASE.2015.36},
doi = {10.1109/ASE.2015.36},
acmid = {2916173},
publisher = {IEEE Computer Society},
address = {Lincoln, Nebraska, USA}
}