Found duplicated code in this file

本文介绍了解决IntelliJ IDEA中因代码重复导致的小黄线提示的方法。首先建议检查并重构代码,避免重复;其次可通过IDEA设置来管理此类警告。

Found duplicated code in this file IntelliJ IDEA去除小黄线解决办法

IntelliJ IDEA去除小黄线解决办法

在这里插入图片描述
看到如图所示的代码,是不是很不得劲,其实出现这一堆小黄线不必慌张,从字面的意思理解,就是“代码出现重复”了,首选仔细阅读自己的代码,换个思路编写代码,或者直接将重复的代码编写到一个方法中,然后调用这个方法。
又或者可以通过设置解决。

通过设置解决:

图片: 在这里插入图片描述

UserWarning: The NumPy module was reloaded (imported a second time). This can in some cases result in small but subtle issues and is discouraged. __import__(dependency) RuntimeError: module was compiled against NumPy C-API version 0x10 (NumPy 1.23) but the running NumPy has C-API version 0xe. Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem. Traceback (most recent call last): File "D:\code\DCUnemployed\app\main.py", line 5, in <module> from app import API, CONFIG File "D:\code\DCUnemployed\app\__init__.py", line 54, in <module> API = get_api(CONFIG) File "D:\code\DCUnemployed\app\__init__.py", line 45, in get_api router = import_string(router) File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\werkzeug\utils.py", line 627, in import_string raise ImportStringError(import_name, e).with_traceback( File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\werkzeug\utils.py", line 619, in import_string module = __import__(module_name, globals(), locals(), [obj_name]) File "D:\code\DCUnemployed\app\dashboard\routes\dashboard.py", line 2, in <module> from app.dashboard.view.street_unemployed import StreetUnemployedView File "D:\code\DCUnemployed\app\dashboard\view\street_unemployed.py", line 1, in <module> from pandas import DataFrame, Series File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\__init__.py", line 50, in <module> from pandas.core.api import ( File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\core\api.py", line 29, in <module> from pandas.core.arrays import Categorical File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\core\arrays\__init__.py", line 6, in <module> from pandas.core.arrays.boolean import BooleanArray File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\core\arrays\boolean.py", line 36, in <module> from pandas.core.arrays.masked import ( File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\core\arrays\masked.py", line 46, in <module> from pandas.core import ( File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\core\nanops.py", line 60, in <module> bn = import_optional_dependency("bottleneck", errors="warn") File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\compat\_optional.py", line 131, in import_optional_dependency version = get_version(module_to_get) File "C:\Users\tong.zhang\AppData\Local\anaconda3\envs\python39\lib\site-packages\pandas\compat\_optional.py", line 60, in get_version raise ImportError(f"Can't determine version for {module.__name__}") werkzeug.utils.ImportStringError: import_string() failed for 'app.dashboard.routes.dashboard.router'. Possible reasons are: - missing __init__.py in a package; - package or module path not included in sys.path; - duplicated package or module name taking precedence in sys.path; - missing module, class, function or variable; Debugged import: - 'app' found in 'D:\\code\\DCUnemployed\\app\\__init__.py'. - 'app.dashboard' found in 'D:\\code\\DCUnemployed\\app\\dashboard\\__init__.py'. - 'app.dashboard.routes' found in 'D:\\code\\DCUnemployed\\app\\dashboard\\routes\\__init__.py'. - 'app.dashboard.routes.dashboard' not found. Original exception: ImportError: Can't determine version for bottleneck
最新发布
09-12
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值