示例代码:

class Car(object):
# 未定义任何类属性 def move(self): # 方法会出现下划线提示This inspection detects any methods which may safely be made static.
print("---车在移动---") def stop(self):
print("---停车---")

原因是该方法不涉及对该类属性的操作,编译器建议声明为@staticmethod,面向对象思想体现

扩展知识

PEP8编码规范

pycharm提示This inspection detects any methods which may safely be made static.的更多相关文章

  1. pycharm提示This inspection detects instance attribute definition outside __init__ method

    示例代码: class MiNiCarStore(CarStore): def createCar(self, typeName): self.carFactory = CarFactory() # ...

  2. 【PyCharm编辑器】之无法导入引用手动新建的包或类,报:This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases.

    一.现象描述 如下图所示,手动新建个类包calculator.py,想在test.py文件引用它,发现一直报红线,引用失败 Unresolved reference 'calculator' less ...

  3. this inspection detects names that should resolved but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are sup

    输入第一行代码:import logging;logging.basicConfig(level==logging.INFO) 提示:this inspection detects names tha ...

  4. TortoiseGit做push时提示Disconnected: No supported authentication methods available (server sent: publickey)错误

    通过Git从远程服务器上获得到自己的项目,但是通过TortoiseGit做push时提示Disconnected: No supported authentication methods availa ...

  5. pycharm 提示:this license **** has been cancelled(2)

    pycharm安装激活过程中,提示 this license **** has been cancelled .这个问题并不是你的激活码不对,而是需要修改系统的hosts文件,下面详细讲解下如何修改h ...

  6. This inspection detects shadowing names defined in outer scopes.

    错误信息:This inspection detects shadowing names defined in outer scopes. 检查到波浪处的单词已在函数外部定义. 解决:使用global ...

  7. 解决pycharm 提示no tests were found的问题

    在使用pycharm,做日志模块封装,代码中觉得没有问题,运行就提示no  tests were found 查询了下这个问题,原因是我创建的类名是以test方法开头,类似这样 不知道是不是把它默认当 ...

  8. pycharm提示your evalluation license has expired解决方法

    安装pycharm,一段时间后提示your evalluation license has expired:打开pycharm--点击help--register--选中license server, ...

  9. PyCharm提示ModuleNotFoundError: No module named 'pymysql'

    初学python,连接mysql时遇到了提示pymysql模块导入有问题,本人虽是window系统,解决思路是一样的 代码如下: import pymysql#打开数据库,参数依次为:主机名/IP,用 ...

随机推荐

  1. sqlmap 使用总结

    一直在用sqlmap,一直在浅层的使用方面,所以我想深入了解一下sqlmap. 参考文章: Sqlmap使用教程[个人笔记精华整理]        http://www.vuln.cn/1992 sq ...

  2. vue 学习笔记—axios(替代vue-resource)

    一.使用 1. 引入CDN的方式   https://unpkg.com/axios@0.16.2/dist/axios.min.js  或者 npm方式 npm install axios --sa ...

  3. ODS、DW和DM

    参考资料: 数据仓库ODS.DW和DM概念区分:https://www.jianshu.com/p/72e395d8cb33

  4. SpringMVC中请求路径参数使用正则表达式

    @GetMapping("/user/{id:\\d+}") //使用正则指定Id为数字 public User getInfo(@PathVariable String id){ ...

  5. python使用pudb调试

    pudb是pdb的升级版本 安装 pip3 install pudb 使用方法 在程序文件的开头导入包 from pudb import set_trace set_trace()#断点位置 运行的时 ...

  6. python模块之sniffio

    嗅探python用了哪个异步库 from sniffio import current_async_library import trio import asyncio async def print ...

  7. VC显示网页验证码、模拟CSDN网页登录

    摘要:by:koma 这两天,本来想花点时间研究一下QQ空间.农场外挂,于是抓包分析一了下,只可惜,在QQ网页登录时进行了加密处理,可惜我对网页编程一窍不通.有些朋友曾讲过那些是通过JS代码进行加密, ...

  8. percona mysql5.7关闭审计功能方法

    数据库的审计日志占用大量空间,当时是为了测试审计功能开启的,现在需要关闭 # /data/mysql_data]# du -sh * 124G audit.log # 查询审计相关参数 mysql&g ...

  9. opensips redis配置记录

    说明:本配置目的:增加opensips对 Redis 的支持. 一.步骤: 1.Redis Server 安装. 2.Hiredis Client 安装.Hiredis 是 Redis 官方指定的C语 ...

  10. Codeforces 1107G Vasya and Maximum Profit [单调栈]

    洛谷 Codeforces 我竟然能在有生之年踩标算. 思路 首先考虑暴力:枚举左右端点直接计算. 考虑记录\(sum_x=\sum_{i=1}^x c_i\),设选\([l,r]\)时那个奇怪东西的 ...