- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在通过 codacy 审查一些代码时,Codacy 给出了以下代码段的问题:
def MyClass(OldClass):
def __init__(self, arg1, arg2, *args, **kwargs)
self.arg1 = arg1
self.arg2 = arg2
super(OldClass, self).__init__(*args, **kwargs)
Why is this an issue?
For example, calling super() with the base class as first argument is wrong:
class AnotherOldStyleClass(OldStyleClass):
def __init__(self):
super(OldStyleClass, self).__init__() The super invocationshould be:
super(AnotherOldStyleClass, self).__init__()
def MyClass(OldClass):
def __init__(self, arg1, arg2, *args, **kwargs)
self.arg1 = arg1
self.arg2 = arg2
super(OldClass, self).__init__(*args, **kwargs)
def MyClass(OldClass):
def __init__(self, arg1, arg2, *args, **kwargs)
super(MyClass, self).__init__(*args, **kwargs)
self.arg1 = arg1
self.arg2 = arg2
class TransferToBigQuery(GoogleCloudStorageToBigQueryOperator):
"""Class to transfer data from Google cloud storage to Big Query"""
def __init__(
self, id, bucket, destination_project_dataset_table, source_objects=None,
schema_fields=None, schema_object=None, source_format='CSV',
create_disposition='CREATE_IF_NEEDED',
skip_leading_rows=0, write_disposition='WRITE_EMPTY',
field_delimiter=',', max_id_key=None, file_xcom=None,
bigquery_conn_id='bigquery_default',
google_cloud_storage_conn_id='google_cloud_storage_default',
delegate_to=None, schema_update_options=(), *args, **kwargs):
super(GoogleCloudStorageToBigQueryOperator, self).__init__(*args,
**kwargs)
最佳答案
我希望下一个例子能解释不同之处
class Grandparent(object):
def hello(self):
print "hi, I am Grandparent"
class Parent(Grandparent):
def hello(self):
print "hi, I am Parent"
class Child(Parent):
def test(self):
super(Parent, self).hello() # print "hi, I am Grandparent"
super(Child, self).hello() # print "hi, I am Parent"
def proper_way_to_do_same(self):
Grandparent.hello(self) # print "hi, I am Grandparent"
Parent.hello(self) # print "hi, I am Parent"
关于python - Codacy bad 给 super 的第一个论点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46580179/
我听说好的做法是使用一些东西来检查我的代码。我找到了一个叫做 Codacy 的东西.我理解除了 TSLint 和 TSLint4 中的“预期空格缩进”之外的所有内容。是因为我在project中的ide
现在我们有 Codacy 监控 DEV 分支,并且按照推荐的做法,每当我们做某事时,我们都会创建一个 DEV 个人分支,处理它,然后合并回来。 事情是,如果 Codacy 发现问题,我们有从 DEV
我的 Codacy 有很多问题仪表板,但这些没有显示在我的 github 存储库中。我想将它们从 Codacy 导入到 GitHub 以用于存储库管理。 这可能吗?如果可以,我该怎么做? 最佳答案 我
我有一个包含 Codacy 的存储库,用于检查代码的质量。当尝试提交时,我遇到了这两个错误,我不知道如何修复...有帮助吗? 预期属性简写。 在这一行中:this.state.notification
在通过 codacy 审查一些代码时,Codacy 给出了以下代码段的问题: def MyClass(OldClass): def __init__(self, arg1, arg2, *ar
我尝试将 travis-ci 与 Codacy 一起使用,但 travis 返回以下错误: Please visit http://docs.codecov.io/docs/supported-lan
我正在使用 codacy 来监控代码质量,但很高兴看到在推送之前 codacy 会捕捉到什么。我看到它使用 eslint 和其他几种工具来决定捕获什么。有没有办法从 codacy 生成 .eslint
下面是我的代码。我不认为有任何问题。 我怎么能愚弄 codacy?如果我不能使用 obj[key] ,那么这到底是什么东西?我无法避免[] . handleClick = (e, titleProps
我是一名优秀的程序员,十分优秀!