-
-
Notifications
You must be signed in to change notification settings - Fork 686
Added mypy enable_error_code
sp check guideline
#4891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
de39912
2d7a327
81f74bf
59ac4f3
a3895c7
1ae758b
b04f766
dfdd7ff
160f279
0a42b57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,8 +78,7 @@ def _from_json(cls, snippet): | |
) | ||
|
||
def _unary_new_copy(self, child: pybamm.Symbol, perform_simplifications=True): | ||
"""See :meth:`pybamm.UnaryOperator._unary_new_copy()`.""" | ||
return self.__class__(child, self.broadcast_domain) | ||
pass # pragma: no cover | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In |
||
|
||
|
||
class PrimaryBroadcast(Broadcast): | ||
|
@@ -191,6 +190,10 @@ def reduce_one_dimension(self): | |
"""Reduce the broadcast by one dimension.""" | ||
return self.orphans[0] | ||
|
||
def _unary_new_copy(self, child: pybamm.Symbol, perform_simplifications=True): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these functions being repeated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned above now it needs to be overrided in child classes |
||
"""See :meth:`pybamm.UnaryOperator._unary_new_copy()`.""" | ||
return self.__class__(child, self.broadcast_domain) | ||
|
||
|
||
class PrimaryBroadcastToEdges(PrimaryBroadcast): | ||
"""A primary broadcast onto the edges of the domain.""" | ||
|
@@ -321,6 +324,10 @@ def reduce_one_dimension(self): | |
"""Reduce the broadcast by one dimension.""" | ||
return self.orphans[0] | ||
|
||
def _unary_new_copy(self, child: pybamm.Symbol, perform_simplifications=True): | ||
"""See :meth:`pybamm.UnaryOperator._unary_new_copy()`.""" | ||
return self.__class__(child, self.broadcast_domain) | ||
|
||
|
||
class SecondaryBroadcastToEdges(SecondaryBroadcast): | ||
"""A secondary broadcast onto the edges of a domain.""" | ||
|
@@ -438,6 +445,10 @@ def reduce_one_dimension(self): | |
"""Reduce the broadcast by one dimension.""" | ||
raise NotImplementedError | ||
|
||
def _unary_new_copy(self, child: pybamm.Symbol, perform_simplifications=True): | ||
"""See :meth:`pybamm.UnaryOperator._unary_new_copy()`.""" | ||
return self.__class__(child, self.broadcast_domain) | ||
|
||
|
||
class TertiaryBroadcastToEdges(TertiaryBroadcast): | ||
"""A tertiary broadcast onto the edges of a domain.""" | ||
|
@@ -463,7 +474,7 @@ def __init__( | |
self, | ||
child_input: Numeric | pybamm.Symbol, | ||
broadcast_domain: DomainType = None, | ||
auxiliary_domains: AuxiliaryDomainType = None, | ||
auxiliary_domains: AuxiliaryDomainType | str = None, | ||
broadcast_domains: DomainsType = None, | ||
name: str | None = None, | ||
): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add some information on why this was added?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've replaced
self.__ class __
with new_instance because earlier when we were usingself.__ class __
it showed a third arg was not getting passed:but this function was always getting called from instance of its child classes which don't need to pass 3 arguments, so i thought it was better to make a new_instance method which can be overrided in child classes
I've already added this in the PR description of previous sp-check-guidelines PR, should I add it here too? Or follow some different approach