我正在尝试从代码中清除flake8错误,并且我有一个ipdb
导入文件,应该保留在那里。
我尝试过:
import ipdb # noqa: F811
import ipdb # NOQA
import ipdb # noqa
但是所有人都给出相同的错误:- ipdb imported
我如何使它消失? (我不想完全忽略它,因为我不想在代码中导入任何其他ipdb
,只允许这样做)
EDIT :我可能错了。我现在怀疑这与Flake8不相关,但与debug-statements
预提交挂钩相关。
答案 0 :(得分:0)
说,你可以骗它:
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.drawerlayout.widget.DrawerLayout;
import android.app.ActionBar;
import android.app.LauncherActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.MenuItem;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.google.android.material.navigation.NavigationView;
public class MainActivity extends AppCompatActivity {
private DrawerLayout D1;
private ActionBarDrawerToggle t;
private NavigationView nvs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
D1=(DrawerLayout) findViewById(R.id.activity_main);
t=new ActionBarDrawerToggle(this,D1,R.string.Open, R.string.Close);
D1.addDrawerListener(t);
t.syncState();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
final callActivity ca = new callActivity();
nvs = (NavigationView)findViewById(R.id.nv);
nvs.inflateMenu(R.menu.navigation_menu);
nvs.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem options) {
int val = options.getItemId();
switch(val)
{
case R.id.home:
ca.showActivity(MainActivity.class, false);
case R.id.team:
Log.d("Wait","Wait");
case R.id.images:
ca.showActivity(imageActivity.class, false);
case R.id.audit:
Log.d("Wait","Wait");
case R.id.settings:
ca.showActivity(configurationActivity.class, false);
}
return true;
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem options) {
if(t.onOptionsItemSelected(options))
{
return true;
}
return super.onOptionsItemSelected(options);
}
}
免责声明:我是pre-commit和pre-commit-hooks(以及调试语句钩子)的作者,也是flake8的维护者