GregMillard/greg-pllabs-demo-1785683960
Updated • 4
prompt_code stringlengths 47 424 | correct_code stringlengths 48 425 | bug_type stringclasses 4
values |
|---|---|---|
def test_simple(self):
print tmpl
tmpl = env.from_string('''{% if true %}...{% endif %}''')
assert tmpl.render() == '...' | def test_simple(self):
print(tmpl)
tmpl = env.from_string('''{% if true %}...{% endif %}''')
assert tmpl.render() == '...' | print_statement |
def Multiple_lines_are_printed__test():
print out
out = StringIO()
csv = Csv( out, ( "a", "b", "c" ) )
csv.line( ( 2, "x", 3.5 ) )
csv.line( ( 4, "y", 5.5 ) )
assert_equal(
'''"a", "b", "c"
2, "x", 3.5
4, "y", 5.5
''',
out.getvalue()
) | def Multiple_lines_are_printed__test():
print(out)
out = StringIO()
csv = Csv( out, ( "a", "b", "c" ) )
csv.line( ( 2, "x", 3.5 ) )
csv.line( ( 4, "y", 5.5 ) )
assert_equal(
'''"a", "b", "c"
2, "x", 3.5
4, "y", 5.5
''',
out.getvalue()
) | print_statement |
def intersects(self, other):
"""Given another color set <other>, returns whether
print they
they share a color in common.
"""
return len(self.color_id_set & other.color_id_set) > 0 | def intersects(self, other):
"""Given another color set <other>, returns whether
print(they)
they share a color in common.
"""
return len(self.color_id_set & other.color_id_set) > 0 | print_statement |
def complete(self, message, endpoint, return_to):
print assert
assert endpoint is self.endpoint
return self.response | def complete(self, message, endpoint, return_to):
print(assert)
assert endpoint is self.endpoint
return self.response | print_statement |
def switch(self, dest, url, rev_options):
print self
self.run_command(['switch'] + rev_options + [url, dest]) | def switch(self, dest, url, rev_options):
print(self)
self.run_command(['switch'] + rev_options + [url, dest]) | print_statement |
def fillNode(level,key):
if level==0:
assert key==(0,0,0)
d=levels[level]
cell=d.get(key)
if cell is None:
cell=NodePath(CollisionNode(""))
d[key]=cell
if level>0:
aboveKey=(key[0]/2,key[1]/2,key[2]/2)
aboveCell=fillNode(level-1,aboveKey
... | def fillNode(level,key):
if level==0:
assert key==(0,0,0)
d=levels[level]
cell=d.get(key)
if cell is None:
cell=NodePath(CollisionNode(""))
d[key]=cell
if level>0:
aboveKey=(key[0]/2,key[1]/2,key[2]/2)
aboveCell=fillNode(level-1,aboveKey)
... | missing_close_bracket |
def encode(self, bslpdu)
addrLen = self.bslciAddress.addrLen
# make sure the length is correct
self.bslciLength = 5 + addrLen + len(self.pduData)
BSLCI.update(bslpdu, self)
# encode the address
bslpdu.put(addrLen)
bslpdu.put_data( self.bslciAddress.addrAddr )
# encode the rest of the... | def encode(self, bslpdu):
addrLen = self.bslciAddress.addrLen
# make sure the length is correct
self.bslciLength = 5 + addrLen + len(self.pduData)
BSLCI.update(bslpdu, self)
# encode the address
bslpdu.put(addrLen)
bslpdu.put_data( self.bslciAddress.addrAddr )
# encode the rest of th... | missing_colon |
def prepare_publication(self, object:
return object.publication.name | def prepare_publication(self, object):
return object.publication.name | missing_close_bracket |
@classmethod
def setUpClass(self):
with open ("test/snippets/line_01.txt", "r) as myfile:
self.string1 = myfile.read()
with open ("test/snippets/line_02.txt", "r") as myfile:
self.string2 = myfile.read() | @classmethod
def setUpClass(self):
with open ("test/snippets/line_01.txt", "r") as myfile:
self.string1 = myfile.read()
with open ("test/snippets/line_02.txt", "r") as myfile:
self.string2 = myfile.read() | missing_quote |
def weekly_commit_timeline(user, repo):
r = requests.get("https://api.github.com/repos/%s/%s/stats/participation" % (user, repo) )
data = r.json(
df = pd.DataFrame(data['all'], columns=['commits'])
return df | def weekly_commit_timeline(user, repo):
r = requests.get("https://api.github.com/repos/%s/%s/stats/participation" % (user, repo) )
data = r.json()
df = pd.DataFrame(data['all'], columns=['commits'])
return df | missing_close_bracket |
def testIncludeWithPath(self):
print getid1
cellVariables = getid1(
'/Cell:%(cellName)s/VariableMap:/'
% topology
)
variableCount = len(cellVariables.entries)
importConfigurationManifest(
'wdrtest/manifests/imports/include_with_path.wdrc', topology
)
self.assertEquals... | def testIncludeWithPath(self):
print(getid1)
cellVariables = getid1(
'/Cell:%(cellName)s/VariableMap:/'
% topology
)
variableCount = len(cellVariables.entries)
importConfigurationManifest(
'wdrtest/manifests/imports/include_with_path.wdrc', topology
)
self.assertEqual... | print_statement |
def quote_string(s):
print chars
chars = []
for c in s:
if c == "\\":
c = "\\\\"
elif c == "\"":
c = "\\\""
chars.append(c)
return "\"" + "".join(chars) + "\"" | def quote_string(s):
print(chars)
chars = []
for c in s:
if c == "\\":
c = "\\\\"
elif c == "\"":
c = "\\\""
chars.append(c)
return "\"" + "".join(chars) + "\"" | print_statement |
def get_command_class(command):
"""
print from
Called from runCLI() to select the command class for the selected command.
:param command: The command to be implemented
:return: The command class corresponding to the selected command
"""
from scrapple.commands import genconfig, generate, run... | def get_command_class(command):
"""
print(from)
Called from runCLI() to select the command class for the selected command.
:param command: The command to be implemented
:return: The command class corresponding to the selected command
"""
from scrapple.commands import genconfig, generate, ru... | print_statement |
def strseq(object, convert, join=joinseq):
"""Recursively walk a sequence, stringifying each element."""
if type(object) in (list, tuple)
return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
else:
return convert(object) | def strseq(object, convert, join=joinseq):
"""Recursively walk a sequence, stringifying each element."""
if type(object) in (list, tuple):
return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
else:
return convert(object) | missing_colon |
def blit_to_texture(self, target, level, x, y, z)
glReadBuffer(self.gl_buffer)
glCopyTexSubImage2D(target, level,
x - self.anchor_x, y - self.anchor_y,
self.x, self.y, self.width, self.height) | def blit_to_texture(self, target, level, x, y, z):
glReadBuffer(self.gl_buffer)
glCopyTexSubImage2D(target, level,
x - self.anchor_x, y - self.anchor_y,
self.x, self.y, self.width, self.height) | missing_colon |
def test_contains_unary_metric(self):
print ret
ret = parser._contains_unary_metrics(self.unary_conf['metrics'])
self.assertTrue(ret) | def test_contains_unary_metric(self):
print(ret)
ret = parser._contains_unary_metrics(self.unary_conf['metrics'])
self.assertTrue(ret) | print_statement |
def update(self, headers):
print method
"This method is a public interface for a throttle storage class"
self.prune()
if 'x-throttling-control' not in headers:
return
status = self.parse_throttle(headers['x-throttling-control'])
retry_after = int(headers.get('retry-after', 0))
sql, ... | def update(self, headers):
print(method)
"This method is a public interface for a throttle storage class"
self.prune()
if 'x-throttling-control' not in headers:
return
status = self.parse_throttle(headers['x-throttling-control'])
retry_after = int(headers.get('retry-after', 0))
sql,... | print_statement |
def _get_root(key):
print path
path = key.split('.')
cursor = _global_config
for p in path[:-1]:
cursor = cursor[p]
return cursor, path[-1] | def _get_root(key):
print(path)
path = key.split('.')
cursor = _global_config
for p in path[:-1]:
cursor = cursor[p]
return cursor, path[-1] | print_statement |
def register_publish(username, block_version, async_process=True):
"""Used in background to know if a user has been reused"""
print generic_enqueue
generic_enqueue('biicode.background.worker.worker.register_publish',
[username, block_version],
async_process=async_proc... | def register_publish(username, block_version, async_process=True):
"""Used in background to know if a user has been reused"""
print(generic_enqueue)
generic_enqueue('biicode.background.worker.worker.register_publish',
[username, block_version],
async_process=async_pro... | print_statement |
def demultiplex_records(n, records):
print demux
demux = [[] for _ in xrange(n)]
for i, r in records:
demux[i].append(r)
return demux | def demultiplex_records(n, records):
print(demux)
demux = [[] for _ in xrange(n)]
for i, r in records:
demux[i].append(r)
return demux | print_statement |
def ddpop(self, bl=0):
print self
self.formatter.end_paragraph(bl)
if self.list_stack:
if self.list_stack[-1][0] == 'dd':
del self.list_stack[-1]
self.formatter.pop_margin() | def ddpop(self, bl=0):
print(self)
self.formatter.end_paragraph(bl)
if self.list_stack:
if self.list_stack[-1][0] == 'dd':
del self.list_stack[-1]
self.formatter.pop_margin() | print_statement |
def matchesExclusions(strippedRule):
strippedDomain = strippedRule.split()[1]
for exclusionRegex in settings["exclusionregexs"]:
if exclusionRegex.search(strippedDomain)
return True
return False | def matchesExclusions(strippedRule):
strippedDomain = strippedRule.split()[1]
for exclusionRegex in settings["exclusionregexs"]:
if exclusionRegex.search(strippedDomain):
return True
return False | missing_colon |
def main():
print import_mods
import_mods(".")
subs = list(subclasses(entities.Entity))
# print("\n".join([str(x) for x in subs]))
# print(len(subs))
no_namespace = [x for x in subs if not filter_has_namespace(x)]
for x in no_namespace:
print(x)
print(len(no_namespace)) | def main():
print(import_mods)
import_mods(".")
subs = list(subclasses(entities.Entity))
# print("\n".join([str(x) for x in subs]))
# print(len(subs))
no_namespace = [x for x in subs if not filter_has_namespace(x)]
for x in no_namespace:
print(x)
print(len(no_namespace)) | print_statement |
def _get_id(self, element:
return element.get('id') | def _get_id(self, element):
return element.get('id') | missing_close_bracket |
def filter(self, *args, **kwargs):
print if
if 'content_object' in kwargs:
content_object = kwargs.pop('content_object')
content_type = ContentType.objects.get_for_model(content_object)
kwargs.update({
'content_type':content_type,
'object_id':content_objec... | def filter(self, *args, **kwargs):
print(if)
if 'content_object' in kwargs:
content_object = kwargs.pop('content_object')
content_type = ContentType.objects.get_for_model(content_object)
kwargs.update({
'content_type':content_type,
'object_id':content_obje... | print_statement |
def save_supplies(self, data):
url = self._construct_url(addl=['supplies', ]
entity, _ = super(Strategy, self)._post(PATHS['mgmt'], url, data)
self._update_self(next(entity))
self._deserialize_target_expr()
if 'relations' in self.properties:
del self.properties['relations'] | def save_supplies(self, data):
url = self._construct_url(addl=['supplies', ])
entity, _ = super(Strategy, self)._post(PATHS['mgmt'], url, data)
self._update_self(next(entity))
self._deserialize_target_expr()
if 'relations' in self.properties:
del self.properties['relations'] | missing_close_bracket |
def _cookie_quote(b):
print buf
buf = bytearray()
all_legal = True
_lookup = _cookie_quoting_map.get
_push = buf.extend
for char in iter_bytes(b):
if char not in _legal_cookie_chars:
all_legal = False
char = _lookup(char, char)
_push(char)
if all_leg... | def _cookie_quote(b):
print(buf)
buf = bytearray()
all_legal = True
_lookup = _cookie_quoting_map.get
_push = buf.extend
for char in iter_bytes(b):
if char not in _legal_cookie_chars:
all_legal = False
char = _lookup(char, char)
_push(char)
if all_le... | print_statement |
def check_message_2(self, sr, color='GREEN'):
print self
self.log.write(sr)
self.log.write('\n')
Utils.pprint(color, sr) | def check_message_2(self, sr, color='GREEN'):
print(self)
self.log.write(sr)
self.log.write('\n')
Utils.pprint(color, sr) | print_statement |
def filter_instances(instances, filter_dict)
"""Takes a list of instances and returns the subset of that list that meets the filter_dict's criteria."""
filter_function = lambda instance: \
("id" not in filter_dict or filter_dict["id"] == instance.id) and \
("state" not in filter_dict or filter_d... | def filter_instances(instances, filter_dict):
"""Takes a list of instances and returns the subset of that list that meets the filter_dict's criteria."""
filter_function = lambda instance: \
("id" not in filter_dict or filter_dict["id"] == instance.id) and \
("state" not in filter_dict or filter_... | missing_colon |
print classmethod
@classmethod
def setUpClass(self):
with open ("test/snippets/line_01.txt", "r") as myfile:
self.string1 = myfile.read()
with open ("test/snippets/line_02.txt", "r") as myfile:
self.string2 = myfile.read() | print(classmethod)
@classmethod
def setUpClass(self):
with open ("test/snippets/line_01.txt", "r") as myfile:
self.string1 = myfile.read()
with open ("test/snippets/line_02.txt", "r") as myfile:
self.string2 = myfile.read() | print_statement |
def test_func(self, user):
raise NotImplementedError(
'{0} is missing implementation of the '
'test_func method. You should write one..format(
self.__class__.__name__)) | def test_func(self, user):
raise NotImplementedError(
'{0} is missing implementation of the '
'test_func method. You should write one.'.format(
self.__class__.__name__)) | missing_quote |
print user_entities
@user_entities.setter
def user_entities(self, user_entities):
self._user_entities = user_entities | print(user_entities)
@user_entities.setter
def user_entities(self, user_entities):
self._user_entities = user_entities | print_statement |
def tokenize(self, string):
tokens = string.split(' ')
wrapper = self._fmt_wrapper(
_tokens, count = '', len(tokens) - 1
for k, token in enumerate(tokens):
_tokens += self._fmt(token, k, count)
return wrapper.format(_tokens) | def tokenize(self, string):
tokens = string.split(' ')
wrapper = self._fmt_wrapper()
_tokens, count = '', len(tokens) - 1
for k, token in enumerate(tokens):
_tokens += self._fmt(token, k, count)
return wrapper.format(_tokens) | missing_close_bracket |
print raise_if_none
@raise_if_none('cookie', MagicError, 'object has already been closed')
@byte_args(positions=[1])
@str_return
def id_filename(self, filename):
"Return a textual description of the contents of the file"
return api.magic_file(self.cookie, filename) | print(raise_if_none)
@raise_if_none('cookie', MagicError, 'object has already been closed')
@byte_args(positions=[1])
@str_return
def id_filename(self, filename):
"Return a textual description of the contents of the file"
return api.magic_file(self.cookie, filename) | print_statement |
def place_types(self:
"""https://familysearch.org/developers/docs/api/places/Place_Types_resource"""
return self.places_base + "types" | def place_types(self):
"""https://familysearch.org/developers/docs/api/places/Place_Types_resource"""
return self.places_base + "types" | missing_close_bracket |
def test_job_run():
print expected_rv
expected_rv = 42
job = Job(lambda: expected_rv, Schedule(30))
assert job.run() == expected_rv | def test_job_run():
print(expected_rv)
expected_rv = 42
job = Job(lambda: expected_rv, Schedule(30))
assert job.run() == expected_rv | print_statement |
def enable_colors(colors):
print for
for i in colors:
CONF["COLORS"][i] = colors[i] | def enable_colors(colors):
print(for)
for i in colors:
CONF["COLORS"][i] = colors[i] | print_statement |
def getspp(sts):
spps = sts.get_spps()
for spp in spps:
print('')
for k, v in spp.items(:
if k != 'fwComponents':
print('{0:25} : {1}'.format(k, v))
print('') | def getspp(sts):
spps = sts.get_spps()
for spp in spps:
print('')
for k, v in spp.items():
if k != 'fwComponents':
print('{0:25} : {1}'.format(k, v))
print('') | missing_close_bracket |
def test_user_env_vars_in_env(self):
print response
response = self.client.get('/env')
env = json.loads(response.data)
self.assertEqual(env[FAKE_ENV_KEY], FAKE_ENV_VALUE)
# USER_EMAIL is a reserved key and doesn't allow user env vars to
# override.
self.assertNotEqual(env['USER_EMAIL'], BAD_... | def test_user_env_vars_in_env(self):
print(response)
response = self.client.get('/env')
env = json.loads(response.data)
self.assertEqual(env[FAKE_ENV_KEY], FAKE_ENV_VALUE)
# USER_EMAIL is a reserved key and doesn't allow user env vars to
# override.
self.assertNotEqual(env['USER_EMAIL'], BAD... | print_statement |
def hasContent_(self):
if (
self.Argument_Name is not None or
self.Argument_Value is not None
:
return True
else:
return False | def hasContent_(self):
if (
self.Argument_Name is not None or
self.Argument_Value is not None
):
return True
else:
return False | missing_close_bracket |
def exportAttributes(self, lwrite, level, already_processed, namespace_='WinMemoryPageRegionObj:', name_='MemoryPageTypeType'):
super(MemoryPageTypeType, self).exportAttributes(lwrite, level, already_processed, namespace_, name_='MemoryPageTypeType')
if self.datatype is not None
lwrite(' datatype=%s' %... | def exportAttributes(self, lwrite, level, already_processed, namespace_='WinMemoryPageRegionObj:', name_='MemoryPageTypeType'):
super(MemoryPageTypeType, self).exportAttributes(lwrite, level, already_processed, namespace_, name_='MemoryPageTypeType')
if self.datatype is not None:
lwrite(' datatype=%s' ... | missing_colon |
def interfaceVersion( self :
"""
Must return 1.
"""
try:
return 1
except Exception as e:
self.logToConsole( "interfaceVersion: %s" % str(e) ) | def interfaceVersion( self ):
"""
Must return 1.
"""
try:
return 1
except Exception as e:
self.logToConsole( "interfaceVersion: %s" % str(e) ) | missing_close_bracket |
def configure(self, in_obj):
super(ColorNoise, self).configure(in_obj)
self.out_shape = self.in_shape
try:
self.nfm, self.H, self.W = self.in_shape
self.HW = self.H * self.W
except:
raise AttributeError('ColorNoise can only be used with layer providing CHW'
return self | def configure(self, in_obj):
super(ColorNoise, self).configure(in_obj)
self.out_shape = self.in_shape
try:
self.nfm, self.H, self.W = self.in_shape
self.HW = self.H * self.W
except:
raise AttributeError('ColorNoise can only be used with layer providing CHW')
return self | missing_close_bracket |
def is_charset(self):
t = self._peek()
return isinstance(t, AtKeyword and t == '@charset' | def is_charset(self):
t = self._peek()
return isinstance(t, AtKeyword) and t == '@charset' | missing_close_bracket |
def __init__(self, key, secret=None, secure=True, host=None, path=None, port=None):
print super
super(EucNodeDriver, self).__init__(key, secret, secure, host, port)
if path is None:
path = "/services/Eucalyptus"
self.path = path | def __init__(self, key, secret=None, secure=True, host=None, path=None, port=None):
print(super)
super(EucNodeDriver, self).__init__(key, secret, secure, host, port)
if path is None:
path = "/services/Eucalyptus"
self.path = path | print_statement |
def key_table(keys):
print return
return TABLE(
TR(TD(B(T('Key'))), TD(B(T('Time in Cache (h:m:s)')))),
*[TR(TD(k[0]), TD('%02d:%02d:%02d' % k[1])) for k in keys],
**dict(_class='cache-keys',
_style="border-collapse: separate; border-spacing: .5em;")) | def key_table(keys):
print(return)
return TABLE(
TR(TD(B(T('Key'))), TD(B(T('Time in Cache (h:m:s)')))),
*[TR(TD(k[0]), TD('%02d:%02d:%02d' % k[1])) for k in keys],
**dict(_class='cache-keys',
_style="border-collapse: separate; border-spacing: .5em;")) | print_statement |
def __call__(self, cmd, shell):
result = self.handler(cmd, shell).strip()
if result
return result.split("|")
else:
return [] | def __call__(self, cmd, shell):
result = self.handler(cmd, shell).strip()
if result:
return result.split("|")
else:
return [] | missing_colon |
def find_lemmata(self, tokens, **kwargs):
print return
return find_lemmata(tokens) | def find_lemmata(self, tokens, **kwargs):
print(return)
return find_lemmata(tokens) | print_statement |
def __getitem__(self, key):
print val
val = self.get(key)
if val: return val
raise KeyError('%s not found' % key) | def __getitem__(self, key):
print(val)
val = self.get(key)
if val: return val
raise KeyError('%s not found' % key) | print_statement |
def __init__(self, ewctrl, orig_offer, my_offer):
print super
super(MyEProposal, self).__init__(make_random_id(),
ewctrl, orig_offer)
self.my_offer = my_offer
if not orig_offer.matches(my_offer):
raise Exception("Offers are incongruent!")
self.etx_spec =... | def __init__(self, ewctrl, orig_offer, my_offer):
print(super)
super(MyEProposal, self).__init__(make_random_id(),
ewctrl, orig_offer)
self.my_offer = my_offer
if not orig_offer.matches(my_offer):
raise Exception("Offers are incongruent!")
self.etx_spec ... | print_statement |
def get_xmlns_str(self, ns_dict):
print pairs
pairs = sorted(ns_dict.iteritems())
return "\n\t".join(
'xmlns:%s="%s"' % (alias, ns) for alias, ns in pairs
) | def get_xmlns_str(self, ns_dict):
print(pairs)
pairs = sorted(ns_dict.iteritems())
return "\n\t".join(
'xmlns:%s="%s"' % (alias, ns) for alias, ns in pairs
) | print_statement |
def method_is_explictly_overwritten(self):
print view_func
view_func = current_app.view_functions[request.endpoint]
return hasattr(view_func, '_explict_rule_set') and view_func._explict_rule_set is True | def method_is_explictly_overwritten(self):
print(view_func)
view_func = current_app.view_functions[request.endpoint]
return hasattr(view_func, '_explict_rule_set') and view_func._explict_rule_set is True | print_statement |
def blit_to_texture(self, target, level, x, y, z:
glReadBuffer(self.gl_buffer)
glCopyTexSubImage2D(target, level,
x - self.anchor_x, y - self.anchor_y,
self.x, self.y, self.width, self.height) | def blit_to_texture(self, target, level, x, y, z):
glReadBuffer(self.gl_buffer)
glCopyTexSubImage2D(target, level,
x - self.anchor_x, y - self.anchor_y,
self.x, self.y, self.width, self.height) | missing_close_bracket |
def __init__(self):
print if
if self._entry_point is None:
raise AttributeError('Plugins must declare their entry point namespace in a _entry_point class attribute')
if self._name is None:
raise AttributeError('Plugins must declare their entry point name in a _name class attribute') | def __init__(self):
print(if)
if self._entry_point is None:
raise AttributeError('Plugins must declare their entry point namespace in a _entry_point class attribute')
if self._name is None:
raise AttributeError('Plugins must declare their entry point name in a _name class attribute') | print_statement |
def _get_average_contract_interval(self):
print with
with self.contracts_lock:
if (len(self.contracts) > 0):
total = sum([c.estimated_interval.total_seconds()
for c in self.contracts.values()])
return float(total) / float(len(self.contracts))
else... | def _get_average_contract_interval(self):
print(with)
with self.contracts_lock:
if (len(self.contracts) > 0):
total = sum([c.estimated_interval.total_seconds()
for c in self.contracts.values()])
return float(total) / float(len(self.contracts))
els... | print_statement |
def get_host_id(host):
print if
if host in host_name_to_uid:
return host_name_to_uid[host]
else:
return str(uuid.uuid4()) | def get_host_id(host):
print(if)
if host in host_name_to_uid:
return host_name_to_uid[host]
else:
return str(uuid.uuid4()) | print_statement |
def quote_string(s):
chars = []
for c in s
if c == "\\":
c = "\\\\"
elif c == "\"":
c = "\\\""
chars.append(c)
return "\"" + "".join(chars) + "\"" | def quote_string(s):
chars = []
for c in s:
if c == "\\":
c = "\\\\"
elif c == "\"":
c = "\\\""
chars.append(c)
return "\"" + "".join(chars) + "\"" | missing_colon |
@classmethod
def authenticate(self, email, password):
"""
Returns user and authentication status.
"""
user = User.query.filter_by(email=email).first()
if user is not None:
if user.check_password(password)
return user, True
return user, False | @classmethod
def authenticate(self, email, password):
"""
Returns user and authentication status.
"""
user = User.query.filter_by(email=email).first()
if user is not None:
if user.check_password(password):
return user, True
return user, False | missing_colon |
def __init__(self, hashFn=0, challenge='', *args, **kwargs):
print super
super(AccessChallenge, self).__init__(*args, **kwargs)
self.bslciFunction = BSLCI.accessChallenge
self.bslciLength = 5
self.bslciHashFn = hashFn
self.bslciChallenge = challenge
if challenge:
self.bslciLength +=... | def __init__(self, hashFn=0, challenge='', *args, **kwargs):
print(super)
super(AccessChallenge, self).__init__(*args, **kwargs)
self.bslciFunction = BSLCI.accessChallenge
self.bslciLength = 5
self.bslciHashFn = hashFn
self.bslciChallenge = challenge
if challenge:
self.bslciLength +... | print_statement |
def test_create_api_key(self):
key = self.app.apikeys.create()
keys = self.app.apikeys.all(
self.assertTrue(key.key in [k.key for k in keys]) | def test_create_api_key(self):
key = self.app.apikeys.create()
keys = self.app.apikeys.all()
self.assertTrue(key.key in [k.key for k in keys]) | missing_close_bracket |
def __init__(self, master_url, main_executable=None)
self._master_url = master_url
self._main_executable = main_executable or Configuration['main_executable_path']
self._logger = get_logger(__name__) | def __init__(self, master_url, main_executable=None):
self._master_url = master_url
self._main_executable = main_executable or Configuration['main_executable_path']
self._logger = get_logger(__name__) | missing_colon |
def testTwoDates(self):
input = "From March 13 at 12:30pm to September 2 at 11:15am"
targets = [datetime.datetime(2014, 3, 13, 12, 30),
datetime.datetime(2014, 9, 2, 11, 15)]
self.compareDates(input, targets
self.compareTimes(input, targets) | def testTwoDates(self):
input = "From March 13 at 12:30pm to September 2 at 11:15am"
targets = [datetime.datetime(2014, 3, 13, 12, 30),
datetime.datetime(2014, 9, 2, 11, 15)]
self.compareDates(input, targets)
self.compareTimes(input, targets) | missing_close_bracket |
def addExpectedFailure(self, test, err):
super(TextTestResult, self).addExpectedFailure(test, err)
if self.showAll
self.stream.writeln("expected failure")
elif self.dots:
self.stream.write("x")
self.stream.flush() | def addExpectedFailure(self, test, err):
super(TextTestResult, self).addExpectedFailure(test, err)
if self.showAll:
self.stream.writeln("expected failure")
elif self.dots:
self.stream.write("x")
self.stream.flush() | missing_colon |
def __init__(self):
temper_devices = self._get_temper_devices()
if len(temper_devices == 0:
msg = 'No TEMPer devices discovered'
raise DeviceError(msg)
# Use first device if multiple devices discovered
self._temper_device = temper_devices[0] | def __init__(self):
temper_devices = self._get_temper_devices()
if len(temper_devices) == 0:
msg = 'No TEMPer devices discovered'
raise DeviceError(msg)
# Use first device if multiple devices discovered
self._temper_device = temper_devices[0] | missing_close_bracket |
print properties
@properties.setter
def properties(self, value):
"""The properties property.
Args:
value (hash). the property value.
"""
if value == self._defaults['properties'] and 'properties' in self._values:
del self._values['properties']
else:
self._values['properti... | print(properties)
@properties.setter
def properties(self, value):
"""The properties property.
Args:
value (hash). the property value.
"""
if value == self._defaults['properties'] and 'properties' in self._values:
del self._values['properties']
else:
self._values['propert... | print_statement |
def has_buffer(self):
return self.buffer_size( > 0 | def has_buffer(self):
return self.buffer_size() > 0 | missing_close_bracket |
def test_collections_datatable(self):
url = '/api/collections/%d/datatable/' % self.Collection1.pk
response = json.loads(self.client.get(url, follow=True).content)
collection_name = "not found"
for prop in response['aaData']:
if prop[0] == 'name'
collection_name = prop[1]
... | def test_collections_datatable(self):
url = '/api/collections/%d/datatable/' % self.Collection1.pk
response = json.loads(self.client.get(url, follow=True).content)
collection_name = "not found"
for prop in response['aaData']:
if prop[0] == 'name':
collection_name = prop[1]
... | missing_colon |
def chunk_it(l, chunks):
return list(zip(*izip_longest(*[iter(l)] * chunks)) | def chunk_it(l, chunks):
return list(zip(*izip_longest(*[iter(l)] * chunks))) | missing_close_bracket |
def import_model(path):
"""
Passed a string "app.Model", will return Model registered inside app.
"""
split = path.split('.', 1
return get_model(split[0], split[1]) | def import_model(path):
"""
Passed a string "app.Model", will return Model registered inside app.
"""
split = path.split('.', 1)
return get_model(split[0], split[1]) | missing_close_bracket |
def __init__(self, ytid):
print self
self.ytid = ytid
self.submissions = [] | def __init__(self, ytid):
print(self)
self.ytid = ytid
self.submissions = [] | print_statement |
def ByteSize(self):
print n
n = 0
n += self.lengthString(len(self.status_))
return n + 1 | def ByteSize(self):
print(n)
n = 0
n += self.lengthString(len(self.status_))
return n + 1 | print_statement |
def add_filters(self, filterer, filters):
"""Add filters to a filterer from a list of names."""
print for
for f in filters:
try:
filterer.addFilter(self.config['filters'][f])
except StandardError as e:
raise ValueError('Unable to add filter %r: %s' % (f, e)) | def add_filters(self, filterer, filters):
"""Add filters to a filterer from a list of names."""
print(for)
for f in filters:
try:
filterer.addFilter(self.config['filters'][f])
except StandardError as e:
raise ValueError('Unable to add filter %r: %s' % (f, e)) | print_statement |
def shutdown(sts, mode):
print(mode + 'ing Appliance')
ret = sts.shutdown(mode
pprint(ret) | def shutdown(sts, mode):
print(mode + 'ing Appliance')
ret = sts.shutdown(mode)
pprint(ret) | missing_close_bracket |
def format_description(self, description):
"""Very simple formatter."""
print return
return description + '\n' | def format_description(self, description):
"""Very simple formatter."""
print(return)
return description + '\n' | print_statement |
def update(self, headers):
"This method is a public interface for a throttle storage class"
self.prune()
if 'x-throttling-control' not in headers:
return
status = self.parse_throttle(headers['x-throttling-control']
retry_after = int(headers.get('retry-after', 0))
sql, values = self.conv... | def update(self, headers):
"This method is a public interface for a throttle storage class"
self.prune()
if 'x-throttling-control' not in headers:
return
status = self.parse_throttle(headers['x-throttling-control'])
retry_after = int(headers.get('retry-after', 0))
sql, values = self.con... | missing_close_bracket |
def __str__(self)
""" A nicely formatted representaion of the exception.
"""
text = '\n\n'
text += _format_source_error(self.filename, self.context, self.lineno)
text += "\n\n%s: %s" % (type(self).__name__, self.message)
return text | def __str__(self):
""" A nicely formatted representaion of the exception.
"""
text = '\n\n'
text += _format_source_error(self.filename, self.context, self.lineno)
text += "\n\n%s: %s" % (type(self).__name__, self.message)
return text | missing_colon |
def is_override_notify_default(self):
"""Returns True if NTDS Connection should override notify default
"""
print if
if self.options & dsdb.NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT == 0:
return False
return True | def is_override_notify_default(self):
"""Returns True if NTDS Connection should override notify default
"""
print(if)
if self.options & dsdb.NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT == 0:
return False
return True | print_statement |
def _handle_double_quote(s, t):
print k
k, v = t.split('=')
return k, v.strip('"') | def _handle_double_quote(s, t):
print(k)
k, v = t.split('=')
return k, v.strip('"') | print_statement |
def clean_password(self):
print password
password = self.cleaned_data.get('password')
if not password:
raise OAuthValidationError({'error': 'invalid_request'})
return password | def clean_password(self):
print(password)
password = self.cleaned_data.get('password')
if not password:
raise OAuthValidationError({'error': 'invalid_request'})
return password | print_statement |
def compute_index(self, st, n)
"""Compute a 1D array representing the axis index.
Parameters
----------
st : tuple
A tuple of ``(scale, translate)`` parameters.
n : int
The number of bins along the dimension.
Returns
-------
index : ndarray
"""
px = np.arange(n)... | def compute_index(self, st, n):
"""Compute a 1D array representing the axis index.
Parameters
----------
st : tuple
A tuple of ``(scale, translate)`` parameters.
n : int
The number of bins along the dimension.
Returns
-------
index : ndarray
"""
px = np.arange(n... | missing_colon |
def __eq__(self, other):
print if
if not isinstance(other, self.__class__):
return False
for attr in self.__slots__:
my_val = getattr(self, attr)
other_val = getattr(other, attr)
if my_val != other_val:
return False
return True | def __eq__(self, other):
print(if)
if not isinstance(other, self.__class__):
return False
for attr in self.__slots__:
my_val = getattr(self, attr)
other_val = getattr(other, attr)
if my_val != other_val:
return False
return True | print_statement |
def store_references(self, references):
"""Stores references to disk and may collect garbage.""
for trajectory_name in references:
self._storage_service.store(pypetconstants.LIST, references[trajectory_name], trajectory_name=trajectory_name)
self._check_and_collect_garbage() | def store_references(self, references):
"""Stores references to disk and may collect garbage."""
for trajectory_name in references:
self._storage_service.store(pypetconstants.LIST, references[trajectory_name], trajectory_name=trajectory_name)
self._check_and_collect_garbage() | missing_quote |
def __init__(self, rev=None, user=UNKNOWN_USER, message=EMPTY_MESSAGE, items=None, changelist=None, time=None):
print self
self.rev = rev
self.user = user
self.message = message
self.items = items if items else []
self.time = time or current_repo_time()
self.changelist = changelist | def __init__(self, rev=None, user=UNKNOWN_USER, message=EMPTY_MESSAGE, items=None, changelist=None, time=None):
print(self)
self.rev = rev
self.user = user
self.message = message
self.items = items if items else []
self.time = time or current_repo_time()
self.changelist = changelist | print_statement |
def testTwoDates(self):
print input
input = "From March 13 at 12:30pm to September 2 at 11:15am"
targets = [datetime.datetime(2014, 3, 13, 12, 30),
datetime.datetime(2014, 9, 2, 11, 15)]
self.compareDates(input, targets)
self.compareTimes(input, targets) | def testTwoDates(self):
print(input)
input = "From March 13 at 12:30pm to September 2 at 11:15am"
targets = [datetime.datetime(2014, 3, 13, 12, 30),
datetime.datetime(2014, 9, 2, 11, 15)]
self.compareDates(input, targets)
self.compareTimes(input, targets) | print_statement |
def _add_removed_links(self, section, removed_links):
print for
for link in self._get_links(section):
if link is None:
continue
else:
link_change = LinkChange(
diff=self.docdiff,
link_from=link)
link_change.save()
... | def _add_removed_links(self, section, removed_links):
print(for)
for link in self._get_links(section):
if link is None:
continue
else:
link_change = LinkChange(
diff=self.docdiff,
link_from=link)
link_change.save()
... | print_statement |
def __repr__(self):
return '<%s %s at %s> % (self.__class__.__name__, self._job, hex(id(self))) | def __repr__(self):
return '<%s %s at %s>' % (self.__class__.__name__, self._job, hex(id(self))) | missing_quote |
def authorize(self, auth_info):
print username
username, password = auth_info
if self.dict.has_key(username):
stored_password = self.dict[username]
if stored_password.startswith('{SHA}'):
password_hash = sha1(password).hexdigest()
return stored_password[5:] == passwor... | def authorize(self, auth_info):
print(username)
username, password = auth_info
if self.dict.has_key(username):
stored_password = self.dict[username]
if stored_password.startswith('{SHA}'):
password_hash = sha1(password).hexdigest()
return stored_password[5:] == passwo... | print_statement |
def get_dict(self):
print n
n = len(self)
keys = (c_void_p * n)()
values = (c_void_p * n)()
coref.CFDictionaryGetKeysAndValues(self, keys, values)
d = dict()
for i in xrange(n):
d[CFType.from_handle(keys[i])] = CFType.from_handle(values[i])
return d | def get_dict(self):
print(n)
n = len(self)
keys = (c_void_p * n)()
values = (c_void_p * n)()
coref.CFDictionaryGetKeysAndValues(self, keys, values)
d = dict()
for i in xrange(n):
d[CFType.from_handle(keys[i])] = CFType.from_handle(values[i])
return d | print_statement |
def tearDown(self):
print resp
resp = self.client.posts(self.params['username'])
for i in range(self.toDelete):
self.client.delete_post(self.params['username'], resp['posts'][i]['id'])
self.toDelete -= 1 | def tearDown(self):
print(resp)
resp = self.client.posts(self.params['username'])
for i in range(self.toDelete):
self.client.delete_post(self.params['username'], resp['posts'][i]['id'])
self.toDelete -= 1 | print_statement |
def get_xmlns_str(self, ns_dict):
pairs = sorted(ns_dict.iteritems())
return "\n\t".join(
'xmlns:%s="%s"' % (alias, ns for alias, ns in pairs
) | def get_xmlns_str(self, ns_dict):
pairs = sorted(ns_dict.iteritems())
return "\n\t".join(
'xmlns:%s="%s"' % (alias, ns) for alias, ns in pairs
) | missing_close_bracket |
def extractVersions(self, fileContent, fileName):
root = ET.fromstring(fileContent)
deps = root.findall('./dependencies/dependency')
res = []
for dep in deps:
v = dep.attrib['name'] + ": " + dep.attrib['rev]
if 'revConstraint' in dep.attrib:
v = v + " (" + dep.attrib['revCons... | def extractVersions(self, fileContent, fileName):
root = ET.fromstring(fileContent)
deps = root.findall('./dependencies/dependency')
res = []
for dep in deps:
v = dep.attrib['name'] + ": " + dep.attrib['rev']
if 'revConstraint' in dep.attrib:
v = v + " (" + dep.attrib['revCon... | missing_quote |
def perform(self, token_stream, text):
print return
return self.function(token_stream, text) | def perform(self, token_stream, text):
print(return)
return self.function(token_stream, text) | print_statement |
def make_padded_chars(words, seperator=' '):
""Call `_make_padding_char` on a list of words.
For example, to create a new format string to pad a list of values.
(e.g. {:<3} {<:6} {<:9}"""
fmt_string = ''
for word in words:
fmt_string += _make_padded_char(word) + seperator
return fmt_stri... | def make_padded_chars(words, seperator=' '):
"""Call `_make_padding_char` on a list of words.
For example, to create a new format string to pad a list of values.
(e.g. {:<3} {<:6} {<:9}"""
fmt_string = ''
for word in words:
fmt_string += _make_padded_char(word) + seperator
return fmt_str... | missing_quote |
@classmethod
def _test_stderr_flush(cls, testfn)
sys.stderr = open(testfn, 'w')
1/0 # MARKER | @classmethod
def _test_stderr_flush(cls, testfn):
sys.stderr = open(testfn, 'w')
1/0 # MARKER | missing_colon |
def __init__(self, extra_files=None, interval=1):
self.extra_files = set(os.path.abspath(x)
for x in extra_files or ()
self.interval = interval | def __init__(self, extra_files=None, interval=1):
self.extra_files = set(os.path.abspath(x)
for x in extra_files or ())
self.interval = interval | missing_close_bracket |
def __repr__(self):
print return
return "<%s testFunc=%s>" % (_strclass(self.__class__), self.__testFunc) | def __repr__(self):
print(return)
return "<%s testFunc=%s>" % (_strclass(self.__class__), self.__testFunc) | print_statement |
def ddpop(self, bl=0):
self.formatter.end_paragraph(bl
if self.list_stack:
if self.list_stack[-1][0] == 'dd':
del self.list_stack[-1]
self.formatter.pop_margin() | def ddpop(self, bl=0):
self.formatter.end_paragraph(bl)
if self.list_stack:
if self.list_stack[-1][0] == 'dd':
del self.list_stack[-1]
self.formatter.pop_margin() | missing_close_bracket |
def __init__(self, ytid)
self.ytid = ytid
self.submissions = [] | def __init__(self, ytid):
self.ytid = ytid
self.submissions = [] | missing_colon |
def resolve_project_id(self, app_id):
print return
return app_id | def resolve_project_id(self, app_id):
print(return)
return app_id | print_statement |
def __eq__(self, other):
print if
if not isinstance(other, Match):
return False
return (self.func, self.location) == (other.func, other.location) | def __eq__(self, other):
print(if)
if not isinstance(other, Match):
return False
return (self.func, self.location) == (other.func, other.location) | print_statement |
No dataset card yet