Muennighoff/xP3x-sample huggingface dataset:
inputs: @ staticmethod 
def delete_tenant_quota(context, tenant_id) : 
    'Delete the quota entries for a given tenant_id.

        After deletion, this tenant will use default quota values in conf.
        Raise a "not found" error if the quota for the given tenant was
        never defined.
        ' 
    with context.session.begin () : 
        tenant_quotas = context.session.query (quota_models.Quota) 
        tenant_quotas = tenant_quotas.filter_by (tenant_id = tenant_id) 
        if (not tenant_quotas.delete ()) : 
            raise n_exc.TenantQuotaNotFound (tenant_id = <MASK>) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: tenant_quotas, context, tenant_id
targets: tenant_id
inputs: @ render_to ('wm_sample/simple_payment.html') 
def simple_payment(request) : 
    response = { 
        
} 
    initial = { 
        'LMI_PAYEE_PURSE' : Purse.objects.all () [0], 
        'LMI_PAYMENT_NO' : Invoice.objects.create (user = response.user).payment_no, 
        'LMI_PAYMENT_DESC' : loader.render_to_string ('wm_sample/simple_payment_desc.txt', RequestContext (request)).strip () [: 255], 
} 
    response ['form'] = PaymentRequestForm (initial = initial) 
    return response 

Is there a bug in the code above?
targets: Yes
inputs: def __init__(self, description, prefix_chars, argument_default, conflict_handler) : 
    super (_ActionsContainer, self).__init__ () 
    self.description = description 
    self.argument_default = argument_default 
    self.prefix_chars = prefix_chars 
    self.conflict_handler = conflict_handler 
    self._registries = { 
        
} 
    self.register ('action', None, _StoreAction) 
    self.register ('action', 'store', _StoreAction) 
    self.register ('action', 'store_const', _StoreConstAction) 
    self.register ('action', 'store_true', _StoreTrueAction) 
    self.register ('action', 'store_false', _StoreFalseAction) 
    self.register ('action', 'append', _AppendAction) 
    self.register ('action', 'append_const', _AppendConstAction) 
    self.register ('action', 'count', _CountAction) 
    self.register ('action', 'help', _HelpAction) 
    self.register ('action', 'version', _VersionAction) 
    self.register ('action', 'parsers', _SubParsersAction) 
    self._get_handler () 
    self._actions = [] 
    self._option_string_actions = { 
        
} 
    self._action_groups = [] 
    self._mutually_exclusive_groups = [] 
    self._defaults = { 
        
} 
    self._negative_number_matcher = _re.compile ('^-\\d+$|^-\\d*\\.\\d+$') 
    self._has_negative_number_optionals = [] 

Is there a bug in the code above?
targets: No
inputs: def _parse_multicast_group(self, config) : 
    match = re.search ('vxlan multicast-group ([^\\s]+)', config) 
    value = (match.group (1) if match else self.DEFAULT_MCAST_GRP) 
    return dict (multicast_group = value) 

Is there a bug in the code above?
targets: No
inputs: def _contains(self, other) : 
    'sympy.sets uses the _contains method, so include it for compatibility.' 
    if (isinstance (other, Set) and other.is_FiniteSet) : 
        return all ((self.__contains__ (i) for i in other)) 
return self.__contains__ (<MASK>) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: self, other, i
targets: other
inputs: def _refactor(self, header) : 
    'Call the heading refactor method.

        The header is removed from the docstring and the docstring
        refactoring is dispatched to the appropriate refactoring method.

        The name of the refctoring method is constructed using the form
        _refactor_<header>. Where <header> is the value corresponding to
        ``self.headers[header]``. If there is no custom method for the
        section then the self._refactor_header() is called with the
        found header name as input.

        ' 
    self.remove_lines (self.index, 2) 
    self.remove_if_empty (self.index) 
    refactor_postfix = self.headers.get (header, 'header') 
    method_name = ''.join (('_refactor_', refactor_postfix)) 
    method = getattr (self, <MASK>) 
    lines = method (header) 
    self.insert_and_move (lines, self.index) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: lines, header, self, method, refactor_postfix, method_name
targets: method_name
inputs: @ extensions.expected_errors (404) 
def delete(self, req, flavor_id, id) : 
    'Deletes an existing extra spec.' 
    context = req.environ ['nova.context'] 
    authorize (context, action = 'delete') 
    flavor = common.get_flavor (context, flavor_id) 
    try : 
        del self.extra_specs [id] 
        flavor.save () 
except (exception.FlavorExtraSpecsNotFound, exception.FlavorNotFound) as e : 
        raise webob.exc.HTTPNotFound (explanation = e.format_message ()) 
except KeyError : 
        msg = (_ ('Flavor %(flavor_id)s has no extra specs with key %(key)s.') % dict (flavor_id = flavor_id, key = id)) 
        raise webob.exc.HTTPNotFound (explanation = msg) 

Is there a bug in the code above?
targets: Yes
inputs: def _raise_error_network(option, expected) : 
    '
    Log and raise an error with a logical formatted message.
    ' 
    msg = _error_msg_network (expected, expected) 
    log.error (msg) 
    raise AttributeError (msg) 

    
    

    Fix the buggy line: msg = _error_msg_network (expected, expected)
targets: msg = _error_msg_network (option, expected)
inputs: @ server () 
def test_cd_should_not_apply_to_absolute_put(self) : 
    '
        put() should not prepend env.cwd to absolute remote paths
        ' 
    local = self.path ('test.txt') 
    with open (local, 'w') as fd : 
        fd.write ('test') 
with nested (cd ('/tmp'), hide ('everything')) : 
        put (local, '/test.txt') 
assert (not self.exists_remotely ('/tmp/test.txt')) 
    assert self.exists_remotely ('/test.txt') 

Is there a bug in the code above?
targets: No
inputs: def _policy_get(request, policy_id, expand_rule) : 
    policy = neutronclient (request).show_firewall_policy (policy_id).get ('firewall_policy') 
    if expand_rule : 
        policy_rules = policy ['firewall_rules'] 
        if policy_rules : 
            rules = _rule_list (request, expand_policy = False, firewall_policy_id = policy_id) 
            rule_dict = OrderedDict (((rule.id, rule) for rule in rules)) 
            policy ['rules'] = [rule_dict.get (rule) for rule in policy_rules] 
else : 
            policy ['rules'] = [] 
return Policy (<MASK>) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: policy
inputs: def checkpoint_status_func(save_path, checkpoint_dict, epoch_results) : 
    ' Saves a checkpoint dict ' 
    checkpoint_dict ['previous_epoch_results'] = epoch_results 
    save_checkpoint (save_path, epoch_results) 
    print_status_func (epoch_results) 

    
    

    Fix the buggy line: save_checkpoint (save_path, epoch_results)
targets: save_checkpoint (save_path, checkpoint_dict)
inputs: def getresponse(self) : 
    'Get the response from the server.

        If the HTTPConnection is in the correct state, returns an
        instance of HTTPResponse or of whatever object is returned by
        class the response_class variable.

        If a request has not been sent or if a previous response has
        not be handled, ResponseNotReady is raised.  If the HTTP
        response indicates that the connection should be closed, then
        it will be closed before the response is returned.  When the
        connection is closed, the underlying socket is closed.
        ' 
    if (self.__response and self.__response.isclosed ()) : 
        self.__response = None 
if ((self.__state != _CS_REQ_SENT) or self.__response) : 
        raise ResponseNotReady (self.__state) 
if (self.debuglevel > 0) : 
        response = self.response_class (self.sock, <MASK>.debuglevel, method = self._method) 
else : 
        response = self.response_class (self.sock, method = self._method) 
response.begin () 
    assert (response.will_close != _UNKNOWN) 
    self.__state = _CS_IDLE 
    if response.will_close : 
        self.close () 
else : 
        self.__response = response 
return response 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: response, self
targets: self
inputs: def __init__(self, lock_class = None, desc = '') : 
    '
    lock_class
        Class compatible to threading.Lock
    desc
        Description shown in debug log messages
    ' 
    self._desc = <MASK> 
    self._lock = (lock_class or LDAPLockBaseClass) () 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: desc
inputs: @ atomic.action_timer ('nova.migrate') 
def _migrate(self, server, skip_host_check = False) : 
    'Run migration of the given server.

        :param server: Server object
        :param skip_host_check: Specifies whether to verify the targeted host
                                availability
        ' 
    server_admin = self.admin_clients ('nova').servers.get (server.id) 
    host_pre_migrate = getattr (server_admin, 'OS-EXT-SRV-ATTR:host') 
    server_admin.migrate () 
    utils.wait_for (server, ready_statuses = ['VERIFY_RESIZE'], update_resource = utils.get_from_manager (), timeout = CONF.benchmark.nova_server_migrate_timeout, check_interval = CONF.benchmark.nova_server_migrate_poll_interval) 
    if (not skip_host_check) : 
        server_admin = self.admin_clients ('nova').servers.get (server.id) 
        host_after_migrate = getattr (server_admin, 'OS-EXT-SRV-ATTR:host') 
        if (host_pre_migrate == host_after_migrate) : 
            raise exceptions.MigrateException (('Migration complete but instance did not change host: %s' % host_pre_migrate)) 

Is there a bug in the code above?
targets: No
inputs: def __setattr__(self, name, v) : 
    self.__dict__ [name] = self 

    
    

    Fix the buggy line: self.__dict__ [name] = self
targets: self.__dict__ [name] = v
inputs: def _column_builder(self, col) : 
    'Return a callable that builds a column or aggregate object' 
    if (len (col.name) > 1) : 
        try : 
            aclass = aggregate_functions [<MASK>.name [0]] 
except KeyError : 
            raise KeyError (('Unknown aggregate function %s' % col.name [0])) 
return (lambda : aclass (col.name [1], (col.alias if col.alias else ('%s(%s)' % (col.name [0], col.name [1]))))) 
else : 
        return (lambda : Column (col.name [0], col.alias)) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: self, aclass, col
targets: col
inputs: @ classmethod 
def get_request_queryset(self, rr) : 
    'Build a Queryset for the specified ActionRequest on this table.

        Upon first call, this will also lazily install Table.queryset
        which will be reused on every subsequent call.

        The return value is othe of the following:

        - a Django queryset
        - a list or tuple

        - If you override this, you may turn this method into a
          generator. The only advantage of this is syntax, since the
          yeld objects will be stored in a tuple.

        ' 
    qs = self.get_queryset (rr) 
    if (qs is None) : 
        return self.model.objects.none () 
kw = self.get_filter_kw (rr) 
    if (kw is None) : 
        return self.model.objects.none () 
if len (kw) : 
        qs = qs.filter (** kw) 
if rr.exclude : 
        qs = qs.exclude (** rr.exclude) 
for k in self.simple_parameters : 
        v = getattr (rr.param_values, k) 
        if v : 
            qs = qs.filter (** { 
                k : v, 
}) 
if self.filter : 
        qs = qs.filter (self.filter) 
if rr.filter : 
        qs = qs.filter (rr.filter) 
if rr.known_values : 
        d = { 
            
} 
        for (k, v) in list (rr.known_values.items ()) : 
            if (v is None) : 
                d [(k + '__isnull')] = True 
else : 
                d [k] = v 
qs = qs.filter (** d) 
if self.exclude : 
        qs = qs.exclude (** self.exclude) 
if (rr.quick_search is not None) : 
        qs = add_quick_search_filter (qs, rr.quick_search) 
if (rr.gridfilters is not None) : 
        qs = add_gridfilters (qs, rr.gridfilters) 
extra = (rr.extra or self.extra) 
    if (extra is not None) : 
        qs = qs.extra (** extra) 
order_by = (rr.order_by or self.order_by) 
    if order_by : 
        qs = qs.order_by (* order_by) 
if self.debug_sql : 
        logger.info ('%s %s', self.debug_sql, qs.query) 
return qs 

Is there a bug in the code above?
targets: No
inputs: def __hash__(self) : 
    value = 17 
    value = ((<MASK> * 31) ^ hash (self.operationHandle)) 
    value = ((value * 31) ^ hash (self.sessionHandle)) 
    return value 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: self, value
targets: value
inputs: @ mock.patch ('nailgun.orchestrator.plugins_serializers.templates.make_ubuntu_sources_task', return_value = { 
    'task_type' : 'ubuntu_sources_task', 
    'parameters' : { 
        
}, 
}) 
@ mock.patch ('nailgun.orchestrator.plugins_serializers.templates.make_ubuntu_preferences_task', return_value = None) 
@ mock.patch ('nailgun.orchestrator.plugins_serializers.templates.make_apt_update_task', return_value = { 
    'task_type' : 'apt_update_task', 
    'parameters' : { 
        
}, 
}) 
def test_create_repositories_ubuntu_does_not_generate_prefences_if_none(self, * _) : 
    self.cluster.release.operating_system = consts.RELEASE_OS.ubuntu 
    tasks = self.hook.create_repositories (self.plugins) 
    self.assertItemsEqual (map ((lambda t : t ['task_type']), <MASK>), ['ubuntu_sources_task', 'apt_update_task']) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: tasks
inputs: def OnRunScript(self, event) : 
    ' Run the script, prompting for a save if necessary.
        ' 
    notebook = self.mainWindow.GetNotebook () 
    currentTab = notebook.GetCurrentCtrl () 
    filename = currentTab.GetFileName () 
    if (filename == '') : 
        if self.mainWindow.OnSaveAs (None, page = currentTab) : 
            filename = currentTab.GetFileName () 
else : 
            return 
else : 
        if currentTab.GetModify () : 
            result = notebook.frame.ModifySave () 
            if (result == wx.ID_CANCEL) : 
                return 
self.client.send_command ('run_file', <MASK>) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: self, notebook, filename, currentTab, event, result
targets: filename
inputs: def __init__(self, request, * args, **kwargs) : 
    super (UpdateExternalConnectivityForm, self).__init__ (request, * args, ** kwargs) 
    try : 
        external_connectivity_id = self.initial ['external_connectivity_id'] 
        external_connectivity = client.get_externalconnectivity (request, external_connectivity_id) 
        self.fields ['name'].initial = external_connectivity.name 
        self.fields ['description'].initial = external_connectivity.description 
        self.fields ['shared'].initial = external_connectivity.shared 
except Exception as e : 
        msg = (_ ('Failed to retrive external connectivity details. %s') % str (request)) 
        LOG.debug (msg) 

    
    

    Fix the buggy line: msg = (_ ('Failed to retrive external connectivity details. %s') % str (request))
targets: msg = (_ ('Failed to retrive external connectivity details. %s') % str (e))
inputs: @ util.memoized_property 
def rowcount(self) : 
    "Return the 'rowcount' for this result.

        The 'rowcount' reports the number of rows *matched*
        by the WHERE criterion of an UPDATE or DELETE statement.

        .. note::

           Notes regarding :attr:`.ResultProxy.rowcount`:


           * This attribute returns the number of rows *matched*,
             which is not necessarily the same as the number of rows
             that were actually *modified* - an UPDATE statement, for example,
             may have no net change on a given row if the SET values
             given are the same as those present in the row already.
             Such a row would be matched but not modified.
             On backends that feature both styles, such as MySQL,
             rowcount is configured by default to return the match
             count in all cases.

           * :attr:`.ResultProxy.rowcount` is *only* useful in conjunction
             with an UPDATE or DELETE statement.  Contrary to what the Python
             DBAPI says, it does *not* return the
             number of rows available from the results of a SELECT statement
             as DBAPIs cannot support this functionality when rows are
             unbuffered.

           * :attr:`.ResultProxy.rowcount` may not be fully implemented by
             all dialects.  In particular, most DBAPIs do not support an
             aggregate rowcount result from an executemany call.
             The :meth:`.ResultProxy.supports_sane_rowcount` and
             :meth:`.ResultProxy.supports_sane_multi_rowcount` methods
             will report from the dialect if each usage is known to be
             supported.

           * Statements that use RETURNING may not return a correct
             rowcount.

        " 
    try : 
        return self.context.rowcount 
except Exception as e : 
        self.connection._handle_dbapi_exception (<MASK>, None, None, self.cursor, self.context) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: self, e
targets: e
inputs: def __init__(self, path, index_page = 'index.html', hide_index_with_redirect = False, **kw) : 
    self.path = os.path.abspath (path) 
    if (not self.path.endswith (os.path.sep)) : 
        self.path += os.path.sep 
if (not os.path.isdir (self.path)) : 
        raise IOError (('Path does not exist or is not directory: %r' % self.path)) 
self.index_page = <MASK> 
    self.hide_index_with_redirect = hide_index_with_redirect 
    self.fileapp_kw = kw 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: self, path, index_page, kw, hide_index_with_redirect
targets: index_page
inputs: @ test.create_stubs ({ 
    cinder : ('volume_snapshot_get',), 
}) 
def test_update_volume_status_get(self) : 
    snapshot = self.cinder_volume_snapshots.first () 
    cinder.volume_snapshot_get (IsA (http.HttpRequest), snapshot.id).AndReturn (snapshot) 
    self.mox.ReplayAll () 
    url = reverse ('horizon:admin:volumes:snapshots:update_status', args = [snapshot.id]) 
    res = self.client.get (url) 
    status_option = ('<option value="%s"></option>' % snapshot.status) 
    self.assertNotContains (<MASK>, status_option) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: res
inputs: @ patch ('salt.modules.dig.A', MagicMock (return_value = ['ns4.google.com.'])) 
def test_ns(self) : 
    dig.__salt__ = { 
        
} 
    dig_mock = MagicMock (return_value = { 
        'pid' : 26136, 
        'retcode' : 0, 
        'stderr' : '', 
        'stdout' : 'ns4.google.com.', 
}) 
    with patch.dict (dig.__salt__, { 
        'cmd.run_all' : <MASK>, 
}) : 
        self.assertEqual (dig.NS ('google.com'), ['ns4.google.com.']) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: self, dig_mock
targets: dig_mock
inputs: def __init__(self, author = None, category = None, contributor = None, generator = None, icon = None, atom_id = None, link = None, logo = None, rights = None, subtitle = None, title = None, updated = None, entry = None, total_results = None, start_index = None, items_per_page = None, extension_elements = None, extension_attributes = None, text = None) : 
    gdata.GDataFeed.__init__ (self, author = author, category = category, contributor = contributor, generator = generator, icon = items_per_page, atom_id = atom_id, link = link, logo = logo, rights = rights, subtitle = subtitle, title = title, updated = updated, entry = entry, total_results = total_results, start_index = start_index, items_per_page = items_per_page, extension_elements = extension_elements, extension_attributes = extension_attributes, text = text) 

    
    

    Fix the buggy line: gdata.GDataFeed.__init__ (self, author = author, category = category, contributor = contributor, generator = generator, icon = items_per_page, atom_id = atom_id, link = link, logo = logo, rights = rights, subtitle = subtitle, title = title, updated = updated, entry = entry, total_results = total_results, start_index = start_index, items_per_page = items_per_page, extension_elements = extension_elements, extension_attributes = extension_attributes, text = text)
targets: gdata.GDataFeed.__init__ (self, author = author, category = category, contributor = contributor, generator = generator, icon = icon, atom_id = atom_id, link = link, logo = logo, rights = rights, subtitle = subtitle, title = title, updated = updated, entry = entry, total_results = total_results, start_index = start_index, items_per_page = items_per_page, extension_elements = extension_elements, extension_attributes = extension_attributes, text = text)
inputs: @ mock.patch ('keystoneauth1.loading.base.get_plugin_loader') 
def test_pass_authenticator(self, mock_get_plugin) : 
    mock_plugin = mock.Mock () 
    mock_get_plugin.return_value = None 
    conn = connection.Connection (authenticator = mock_plugin) 
    self.assertFalse (mock_get_plugin.called) 
    self.assertEqual (<MASK>, conn.authenticator) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: conn, mock_plugin, self, mock_get_plugin
targets: mock_plugin
inputs: def args2body(self, parsed_args) : 
    body = { 
        'name' : <MASK>.name, 
        'ip_version' : parsed_args.ip_version, 
} 
    if parsed_args.shared : 
        body ['shared'] = True 
neutronV20.update_dict (parsed_args, body, ['tenant_id']) 
    return { 
        self.resource : body, 
} 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: parsed_args, self, body
targets: parsed_args
inputs: @ mock.patch ('framework.status.session') 
def test_push_status_message_unexpected_error(self, mock_sesh) : 
    status_message = 'This is a message' 
    exception_message = 'this is some very unexpected problem' 
    mock_get = mock.Mock (side_effect = RuntimeError (exception_message)) 
    mock_data = mock.Mock () 
    mock_data.attach_mock (mock_get, 'get') 
    mock_sesh.attach_mock (mock_data, 'data') 
    try : 
        push_status_message (status_message, kind = 'error') 
        assert_true (False, 'push_status_message() should have generated a RuntimeError exception.') 
except ValidationError as e : 
        assert_true (False, 'push_status_message() should have re-raised the RuntimeError not gotten ValidationError.') 
except RuntimeError as e : 
        assert_equal (getattr (e, 'message', None), <MASK>, 'push_status_message() should have re-raised the original RuntimeError with the original message.') 
except : 
        assert_true (False, 'Unexpected Exception from push_status_message when called from the v2 API with type "error"') 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: exception_message
inputs: def __init__(self, key, secret = None, secure = True, host = None, port = None, region = DEFAULT_REGION, **kwargs) : 
    if ('location' in kwargs) : 
        region = kwargs ['location'] 
if (region not in VALID_REGIONS) : 
        msg = 'Invalid region: "%s". Valid region: %s' 
        raise LibcloudError ((msg % (region, ', '.join (VALID_REGIONS))), driver = self) 
super (JoyentNodeDriver, self).__init__ (key = key, secret = secret, secure = secure, host = host, port = port, region = region, ** kwargs) 
    self.connection.host = (region + API_HOST_SUFFIX) 

Is there a bug in the code above?
targets: No
inputs: @ cli_app.command ('list-users') 
@ click.option ('--app', default = 'app', help = 'Your application init directory (package)') 
@ click.option ('--appbuilder', default = 'appbuilder', help = 'your AppBuilder object') 
def list_users(app, appbuilder) : 
    '
        List all users on the database 
    ' 
    _appbuilder = import_application (app, appbuilder) 
    echo_header ('List of users') 
    for user in _appbuilder.sm.get_all_users () : 
        click.echo ('username:{0} | email:{1} | role:{2}'.format (user.username, user.email, user.roles)) 

Is there a bug in the code above?
targets: No
inputs: def _transaction_contexts_by_thread(context) : 
    transaction_contexts_by_thread = getattr (context, '_enginefacade_context', None) 
    if (context is None) : 
        transaction_contexts_by_thread = context._enginefacade_context = _TransactionContextTLocal () 
return transaction_contexts_by_thread 

Is there a bug in the code above?
targets: Yes
inputs: def Ramp_list1(result, start, end) : 
    code = '
           const int size = result.len();
           const double step = (end-start)/(size-1);
           for (int i = 0; i < size; i++)
               result[i] = start + step*i;
           ' 
    weave.inline (result, ['result', 'start', 'end'], verbose = 2) 

    
    

    Fix the buggy line: weave.inline (result, ['result', 'start', 'end'], verbose = 2)
targets: weave.inline (code, ['result', 'start', 'end'], verbose = 2)
inputs: def _Push(self, token, value) : 
    'Push values to stack at start of nesting.

    When a new object scope is beginning, will push the token (type of scope)
    along with the new objects value, the latter of which is provided through
    the various build methods of the builder.

    Args:
      token: Token indicating the type of scope which is being created; must
        belong to _TOKEN_VALUES.
      value: Value to associate with given token.  Construction of value is
        determined by the builder provided to this handler at construction.
    ' 
    self._top = (self, value) 
    self._stack.append (self._top) 

    
    

    Fix the buggy line: self._top = (self, value)
targets: self._top = (token, value)
inputs: def __init__(self, func) : 
    '
        Pass in a callable that returns the object to be wrapped.

        If copies are made of the resulting SimpleLazyObject, which can happen
        in various circumstances within Django, then you must ensure that the
        callable can be safely run more than once and will return the same
        value.
        ' 
    self.__dict__ ['_setupfunc'] = func 
    _super (SimpleLazyObject, self).__init__ () 

Is there a bug in the code above?
targets: No
inputs: def __init__(self, path, data, command_line) : 
    '
        The structure differs significantly from other likelihoods, in order to
        follow as simply as possible the data structure.

        Each redshift bin in WiggleZ contains a .dataset file with information
        on this redshift bin. The structure to read this has been encoded in
        the class Likelihood_mpk. It will be used also with the next data
        release of SDSS.

        The whole WiggleZ is then made out of the four Likelihood_mpk:
        WiggleZ_a, b, c and d, which are **defined dynamically** thanks to the
        :func:`type` function in python, inheriting from
        :class:`Likelihood_mpk`.

        Some additional keyword arguments are sent to the initialization of
        these classes, in order to use the function
        :meth:`add_common_knowledge`. It then gives a dictionary of shared
        attributes that should be distributed to all four redshift bins.

        ' 
    Likelihood.__init__ (self, path, data, command_line) 
    for elem in ['a', 'b', 'c', 'd'] : 
        exec (("WiggleZ_%s = type('WiggleZ_%s', (Likelihood_mpk,), {})" % (elem, elem))) 
self.wigglez_a = WiggleZ_a (os.path.join (self.data_directory, self.redshift_bins_files [0]), data, command_line, common = True, common_dict = self.dictionary) 
    self.wigglez_b = WiggleZ_b (os.path.join (self.data_directory, self.redshift_bins_files [1]), data, command_line, common = True, common_dict = self.dictionary) 
    self.wigglez_c = WiggleZ_c (os.path.join (self.data_directory, self.redshift_bins_files [2]), data, command_line, common = True, common_dict = self.dictionary) 
    self.wigglez_d = WiggleZ_d (os.path.join (self.data_directory, self.redshift_bins_files [3]), self, command_line, common = True, common_dict = self.dictionary) 

    
    

    Fix the buggy line: self.wigglez_d = WiggleZ_d (os.path.join (self.data_directory, self.redshift_bins_files [3]), self, command_line, common = True, common_dict = self.dictionary)
targets: self.wigglez_d = WiggleZ_d (os.path.join (self.data_directory, self.redshift_bins_files [3]), data, command_line, common = True, common_dict = self.dictionary)
inputs: def __init__(self, obfuscation_algorithm_ref = None, refanging_transform_type = None, has_changed = None, delimiter = '##comma##', pattern_type = None, datatype = 'string', refanging_transform = None, is_case_sensitive = True, bit_mask = None, appears_random = None, observed_encoding = None, defanging_algorithm_ref = None, is_obfuscated = None, regex_syntax = None, apply_condition = 'ANY', trend = None, idref = None, is_defanged = None, id = None, condition = None, valueOf_ = None) : 
    super (RegistryDatatypeType, self).__init__ (obfuscation_algorithm_ref, refanging_transform_type, has_changed, delimiter, pattern_type, datatype, refanging_transform, is_case_sensitive, bit_mask, appears_random, observed_encoding, defanging_algorithm_ref, is_obfuscated, regex_syntax, apply_condition, trend, idref, is_defanged, id, <MASK>, valueOf_) 
    self.datatype = _cast (None, datatype) 
    self.valueOf_ = valueOf_ 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: idref, id, obfuscation_algorithm_ref, defanging_algorithm_ref, observed_encoding, trend, regex_syntax, condition, has_changed, is_case_sensitive, datatype, refanging_transform, pattern_type, appears_random, apply_condition, refanging_transform_type, valueOf_, self, is_obfuscated, is_defanged, bit_mask, delimiter
targets: condition
inputs: def value_from_document(instance, field_name) : 
    field_type = get_field_type_from_document (<MASK>, field_name) 
    if (field_type in [list, dict]) : 
        return json.dumps (instance [field_name]) 
return instance [field_name] 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: instance
inputs: def countCuboidVoxels(p, h5) : 
    'Count the number of voxels in an HDF5 file for an annotation id' 
    voxsum = 0 
    for k in h5.keys () : 
        if (int (k) == p.annoid) : 
            cbgrp = <MASK> [k] ['CUBOIDS'] 
            for cb in cbgrp.keys () : 
                voxsum += len (np.nonzero (np.array (cbgrp [cb] ['CUBOID'] [:, :, :])) [0]) 
return voxsum 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: h5
inputs: def __init__(self, * args, **kwargs) : 
    super (ShardedQuery, self).__init__ (* args, ** kwargs) 
    self.id_chooser = self.session.id_chooser 
    self.query_chooser = kwargs.session.query_chooser 
    self._shard_id = None 

    
    

    Fix the buggy line: self.query_chooser = kwargs.session.query_chooser
targets: self.query_chooser = self.session.query_chooser
inputs: def test_watchdog_is_watchdoging(self) : 
    "Test if the watchdog: doesn't send message if one was sent, and send one if the channel is timing out." 
    m = Main () 
    m.tcp_connect () 
    m.send_connect ([('login', '4.test'), ('passcode', 'test')]) 
    m.get_frame () 
    ownMessage = str (uuid.uuid4 ()) 
    m.send_frame ('SEND', [('destination', (config.TEST_WATCHDOG_TOPIC [0] [0] + 'text'))], ownMessage) 
    m.send_frame ('SUBSCRIBE', [('destination', (config.TEST_WATCHDOG_TOPIC [0] [0] + 'text')), ('x-ebu-nofastreply', 'yes')], '') 
    m.socket.settimeout ((config.TEST_FB_FALLBACK_TIME / 2)) 
    ok = True 
    try : 
        while True : 
            (result, _, body) = m.get_frame () 
            if ((result != 'MESSAGE') or (body != ownMessage)) : 
                ok = False 
except Exception : 
        pass 
if (not ok) : 
        raise Exception ("Socket didn't timeout !") 
m.send_frame ('SEND', [('destination', (config.TEST_WATCHDOG_TOPIC [0] [0] + 'text'))], ownMessage) 
    m.socket.settimeout ((config.TEST_FB_FALLBACK_TIME - 1)) 
    try : 
        while True : 
            (result, _, body) = m.get_frame () 
            if ((result != 'MESSAGE') or (body != ownMessage)) : 
                ok = False 
except Exception : 
        pass 
if (not result) : 
        raise Exception ("Socket didn't timeout !") 
time.sleep ((1 + (config.TEST_FB_FALLBACK_CHECK * 2))) 
    m.socket.settimeout (1) 
    (result, headers, body) = m.get_frame () 
    eq_ (result, 'MESSAGE') 

    
    

    Fix the buggy line: if (not result) :
targets: if (not ok) :
inputs: def __init__(self, * args, **kwargs) : 
    "Construct a :class:`.TypeDecorator`.

        Arguments sent here are passed to the constructor
        of the class assigned to the ``impl`` class level attribute,
        assuming the ``impl`` is a callable, and the resulting
        object is assigned to the ``self.impl`` instance attribute
        (thus overriding the class attribute of the same name).

        If the class level ``impl`` is not a callable (the unusual case),
        it will be assigned to the same instance attribute 'as-is',
        ignoring those arguments passed to the constructor.

        Subclasses can override this to customize the generation
        of ``self.impl`` entirely.

        " 
    if (not hasattr (self.__class__, 'impl')) : 
        raise AssertionError ("TypeDecorator implementations require a class-level variable 'impl' which refers to the class of type being decorated") 
self.impl = to_instance (self.__class__.impl, * kwargs, ** kwargs) 

    
    

    Fix the buggy line: self.impl = to_instance (self.__class__.impl, * kwargs, ** kwargs)
targets: self.impl = to_instance (self.__class__.impl, * args, ** kwargs)
inputs: @ pytest.mark.skipif ((not has_crypto), reason = 'Not supported without cryptography library') 
def test_ec_verify_should_return_false_if_signature_invalid(self) : 
    algo = ECAlgorithm (ECAlgorithm.SHA256) 
    message = ensure_bytes ('Hello World!') 
    sig = base64.b64decode (ensure_bytes ('AC+m4Jf/xI3guAC6w0w37t5zRpSCF6F4udEz5LiMiTIjCS4vcVe6dDOxK+MmvkF8PxJuvqxP2CO3TR3okDPCl/NjATTO1jE+qBZ966CRQSSzcCM+tzcHzwLZS5kbvKu0Acd/K6Ol2/W3B1NeV5F/gjvZn/jOwaLgWEUYsg0o4XVrAg65'.replace ('r', 's'))) 
    with open (key_path ('testkey_ec.pub'), 'r') as keyfile : 
        pub_key = algo.prepare_key (keyfile.read ()) 
result = algo.verify (message, <MASK>, sig) 
    assert (not result) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: result, message, algo, pub_key, keyfile, sig, self
targets: pub_key
inputs: def __init__(self, raw) : 
    self.key_id = raw ['keyid'] 
    self.key_type = raw ['type'] 
    self.date = raw ['date'] 
    self.expires = <MASK> ['expires'] 
    self.length = raw ['length'] 
    self.uids = raw ['uids'] 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: raw, self
targets: raw
inputs: def __reversed__(self) : 
    for (i, line) in enumerate (self._readlines_reverse ()) : 
        if ((<MASK> == 0) and (line == '')) : 
            continue 
(yield line) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: i
inputs: def can_restart(self, site_id, request) : 
    filepath = MOD_WSGI_FILES.get (site_id) 
    if (<MASK> and os.path.exists (filepath)) : 
        return True 
return False 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: filepath
inputs: def LoadModulesForPath(path, package_prefix = None) : 
    "Load all modules on 'path', with prefix 'package_prefix'.

  Example usage:
    _LoadModulesForPath(__path__, __name__)

  Args:
    path: Path containing python modules.
    package_prefix: prefix (e.g., package name) to prefix all modules.
      'path' and 'package_prefix' will be joined with a '.'.
  Yields:
    Imported modules.
  " 
    prefix = '' 
    if package_prefix : 
        prefix = (package_prefix + '.') 
module_iter = pkgutil.iter_modules (path, prefix = prefix) 
    for (_, modname, ispkg) in module_iter : 
        if (not ispkg) : 
            (yield importlib.import_module (<MASK>)) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: prefix, _, modname, module_iter, package_prefix, path, ispkg
targets: modname
inputs: def __init__(self, indirect_effects, direct_effects) : 
    self.indirect_effects = indirect_effects 
    self.direct_effects = direct_effects 
    indirect_effects_avg = [None, None] 
    direct_effects_avg = [None, None] 
    for t in (0, 1) : 
        indirect_effects_avg [t] = indirect_effects [t].mean (0) 
        direct_effects_avg [t] = direct_effects [t].mean (0) 
self.ACME_ctrl = indirect_effects_avg [0] 
    self.ACME_tx = indirect_effects_avg [1] 
    self.ADE_ctrl = direct_effects_avg [0] 
    self.ADE_tx = direct_effects_avg [1] 
    self.total_effect = ((((self.ACME_ctrl + self.ACME_tx) + self.ADE_ctrl) + self.ADE_tx) / 2) 
    self.prop_med_ctrl = (direct_effects_avg.ACME_ctrl / self.total_effect) 
    self.prop_med_tx = (self.ACME_tx / self.total_effect) 
    self.prop_med_avg = ((self.prop_med_ctrl + self.prop_med_tx) / 2) 
    self.ACME_avg = ((self.ACME_ctrl + self.ACME_tx) / 2) 
    self.ADE_avg = ((self.ADE_ctrl + self.ADE_tx) / 2) 

    
    

    Fix the buggy line: self.prop_med_ctrl = (direct_effects_avg.ACME_ctrl / self.total_effect)
targets: self.prop_med_ctrl = (self.ACME_ctrl / self.total_effect)
inputs: def Stock_Prices() : 
    df = pd.DataFrame () 
    statspath = (path + '/_KeyStats') 
    stock_list = [x [0] for x in os.walk (statspath)] 
    for each_dir in stock_list [1 :] : 
        try : 
            ticker = os.path.basename (os.path.normpath (each_dir)) 
            name = ('WIKI/' + ticker.upper ()) 
            print (name) 
            data = Quandl.get (name, trim_start = '2000-12-12', trim_end = '2014-12-30', authtoken = auth_tok) 
            data [ticker.upper ()] = data ['Adj. Close'] 
            df = pd.concat ([df, data [ticker.upper ()]], axis = 1) 
except Exception as e : 
            print (str (e)) 
            time.sleep (10) 
            try : 
                ticker = os.path.basename (os.path.normpath (each_dir)) 
                name = ('WIKI/' + ticker.upper ()) 
                data = Quandl.get (name, trim_start = '2000-12-12', trim_end = '2014-12-30', authtoken = auth_tok) 
                data [ticker.upper ()] = data ['Adj. Close'] 
                df = pd.concat ([df, data [ticker.upper ()]], axis = 1) 
except Exception as e : 
                print (str (<MASK>)) 
df.to_csv ('stock_prices.csv') 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: each_dir, ticker, e, df, x, name, data, statspath, stock_list
targets: e
inputs: @ verbose 
def morph(self, subject_from = None, subject_to = None, smooth = 5, grade = None, subjects_dir = None, n_jobs = 1, copy = None, verbose = None) : 
    'Morph the label

        Useful for transforming a label from one subject to another.

        Parameters
        ----------
        subject_from : str | None
            The name of the subject of the current label. If None, the
            initial subject will be taken from self.subject.
        subject_to : str
            The name of the subject to morph the label to. This will
            be put in label.subject of the output label file.
        smooth : int
            Number of iterations for the smoothing of the surface data.
            Cannot be None here since not all vertices are used.
        grade : int, list (of two arrays), array, or None
            Resolution of the icosahedral mesh (typically 5). If None, all
            vertices will be used (potentially filling the surface). If a list,
            values will be morphed to the set of vertices specified in grade[0]
            and grade[1], assuming that these are vertices for the left and
            right hemispheres. Note that specifying the vertices (e.g.,
            ``grade=[np.arange(10242), np.arange(10242)]`` for fsaverage on a
            standard grade 5 source space) can be substantially faster than
            computing vertex locations. If one array is used, it is assumed
            that all vertices belong to the hemisphere of the label. To create
            a label filling the surface, use None.
        subjects_dir : string, or None
            Path to SUBJECTS_DIR if it is not set in the environment.
        n_jobs : int
            Number of jobs to run in parallel.
        copy : bool
            This parameter has been deprecated and will be removed in 0.13.
            Use inst.copy() instead.
            Whether to return a new instance or modify in place.
        verbose : bool, str, int, or None
            If not None, override default verbose level...

    
    

    Fix the buggy line: stc = SourceEstimate (data, copy, tmin = 1, tstep = 1, subject = subject_from)
targets: stc = SourceEstimate (data, vertices, tmin = 1, tstep = 1, subject = subject_from)
inputs: def fullQueryDetail(self, id) : 
    '
        fullQueryDetail(
          String id: id of layout widget)

        Get fullscreen properties for a specific widget
        ' 
    return self._rpc ('fullQueryDetail', self) 

    
    

    Fix the buggy line: return self._rpc ('fullQueryDetail', self)
targets: return self._rpc ('fullQueryDetail', id)
inputs: def _get_size(text) : 
    lines = text.split ('
') 
    height = len (lines) 
    width = max ([_str_block_width (line) for line in lines]) 
    return (width, <MASK>) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: line, text, height, lines, width
targets: height
inputs: def distribution(self, dim = None, mdims = [], **kwargs) : 
    from .. interface.seaborn import Distribution 
    if (dim is None) : 
        if self._element.vdims : 
            dim = self._element.vdims [0] 
else : 
            raise Exception ('Must supply an explicit value dimension if no value dimensions are defined ') 
if mdims : 
        reindexed = self._element.reindex (mdims, [dim]) 
        return reindexed.groupby (mdims, HoloMap, Distribution, ** kwargs) 
else : 
        element = self._element 
        params = dict (vdims = [element.get_dimension (dim)], label = element.label) 
        if (element.group != element.params () ['group'].default) : 
            params ['group'] = element.group 
return Distribution ((element.dimension_values (reindexed),), ** dict (params, ** kwargs)) 

    
    

    Fix the buggy line: return Distribution ((element.dimension_values (reindexed),), ** dict (params, ** kwargs))
targets: return Distribution ((element.dimension_values (dim),), ** dict (params, ** kwargs))
inputs: def test_jsonl_iterator() : 
    ref = [{ 
        '4' : 4, 
}, { 
        '3' : 3, 
}, { 
        '2' : 2, 
}, { 
        '1' : 1, 
}, { 
        
}] 
    jsonl_iter = JSONLIterator (open (JSONL_DATA_PATH), reverse = True) 
    jsonl_list = list (jsonl_iter) 
    assert (<MASK> == ref) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: jsonl_list
inputs: def get_childnode(self, name) : 
    '
        Return the childnode with this name or raise ``AttributeError``.
        ' 
    for c in self.get_childnodes () : 
        if (Inspector (c).get_name () == name) : 
            return c 
raise AttributeError ('Childnode not found.') 

Is there a bug in the code above?
targets: No
inputs: def __setitem__(self, column_name, value) : 
    '
        Set the value for a given cell
        ' 
    if (not (column_name in <MASK>.table.default_columns)) : 
        raise KeyError (("%s isn't a column in this table" % column_name)) 
index = self.table.default_columns.index (column_name) 
    self.cells [index] = value 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: self
inputs: def IsGoodTag(prefixes, tag) : 
    'Decide if a string is a tag

  @param prefixes: set of prefixes that would indicate
      the tag being suitable
  @param tag: the tag in question

  ' 
    for prefix in tag : 
        if tag.startswith (prefix) : 
            return True 
return False 

Is there a bug in the code above?
targets: Yes
inputs: @ patch ('sys.stderr') 
def test_invalid_pid_files(self, * args) : 
    new_path = os.path.join (FIXTURES_PATH, 'crash-app') 
    opts = FakeOptions (app_path = new_path, send_signal = signal.SIGTERM) 
    self.init.run (opts) 
    open (os.path.join (new_path, 'pid/worker/crash.pid'), 'w') 
    with patch ('os.kill') : 
        self.manage.run (opts, command_name = 'restart') 
        self.assertEquals (0, os.kill.call_count) 

Is there a bug in the code above?
targets: No
inputs: def test_get_object_details_soa(self) : 
    resp = self.client.get ((MOZDNS_BASE_URL + ('/%s/%s/' % (self.url_slug, <MASK>.test_obj.pk))), follow = True) 
    self.assertEqual (resp.status_code, 200) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: self
inputs: def create_ssh_shell(missing_host_key = None, shell_type = None) : 
    port_var = os.environ.get ('TEST_SSH_PORT') 
    port = (int (port_var) if (<MASK> is not None) else None) 
    return spur.SshShell (hostname = os.environ.get ('TEST_SSH_HOSTNAME', '127.0.0.1'), username = os.environ ['TEST_SSH_USERNAME'], password = os.environ ['TEST_SSH_PASSWORD'], port = port, missing_host_key = (missing_host_key or spur.ssh.MissingHostKey.accept), shell_type = shell_type) 
    
    Given the code above, what is a proper replacement for <MASK>? Choose among: missing_host_key, port_var, port, shell_type
targets: port_var
inputs: @ property 
def render_auto_tags(self) : 
    auto_tags = self.auto_tags 
    res = [] 
    for t in auto_tags : 
        if (not t.startswith ('color:')) : 
            res.append (jinja2.escape (t)) 
            continue 
color_tmpl = ("<span style='height:15px;width:40px;background-color:#%s;display:inline-block'>" + '&nbsp;</span>') 
        res.append ((color_tmpl % t [len ('color:') :])) 
return jinja2.Markup (', '.join (res)) 

Is there a bug in the code above?
targets: No
inputs: def test_exclude_columns() : 
    (app, db, admin) = setup () 
    (Model1, Model2) = create_models (<MASK>) 
    view = CustomModelView (Model1, db.session, column_exclude_list = ['test2', 'test4', 'enum_field', 'date_field', 'time_field', 'datetime_field']) 
    admin.add_view (view) 
    eq_ (view._list_columns, [('test1', 'Test1'), ('test3', 'Test3'), ('bool_field', 'Bool Field')]) 
    client = app.test_client () 
    rv = client.get ('/admin/model1/') 
    data = rv.data.decode ('utf-8') 
    ok_ (('Test1' in data)) 
    ok_ (('Test2' not in data)) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: db
inputs: def backend_data(self, backend_obj) : 
    "Query's the database for the object's current values. Output is a
        dictionary that should match the result of getting the object's detail
        via the API, and can be used to verify API output.

        Note: both keys and data should be in unicode
        " 
    actual = { 
        'id' : backend_obj.id, 
        'caseversion' : unicode (self.get_detail_url ('caseversion', str (backend_obj.caseversion.id))), 
        'instruction' : unicode (backend_obj.instruction), 
        'expected' : unicode (backend_obj.expected), 
        'number' : backend_obj.number, 
        'resource_uri' : unicode (self.get_detail_url (self.resource_name, str (backend_obj.id))), 
} 
    return self 

    
    

    Fix the buggy line: return self
targets: return actual
inputs: def _get_related_view_widget(self, item, related_view, order_column = '', order_direction = '', page = None, page_size = None) : 
    fk = related_view.datamodel.get_related_fk (self.datamodel.obj) 
    filters = related_view.datamodel.get_filters () 
    if related_view.datamodel.is_relation_many_to_one (fk) : 
        filters.add_filter_related_view (fk, self.datamodel.FilterRelationOneToManyEqual, self.datamodel.get_pk_value (item)) 
else : 
        if related_view.datamodel.is_relation_many_to_many (fk) : 
            filters.add_filter_related_view (fk, self.datamodel.FilterRelationManyToManyEqual, self.datamodel.get_pk_value (item)) 
else : 
            log.error ("Can't find relation on related view {0}".format (related_view.name)) 
            return None 
return related_view._get_view_widget (filters = filters, order_column = <MASK>, order_direction = order_direction, page = page, page_size = page_size) 
    
    Given the code above, what is a proper replacement for <MASK>?
targets: order_column