Conversation
| if isinstance(p, type) \ | ||
| and issubclass(p, sympy.Symbol) \ | ||
| and any(isinstance(i, p) for i in self.free_symbols): | ||
| if (isinstance(p, type) and issubclass(p, sympy.Symbol) and |
| last = [ecls(lhs, rhs, implicit_dims=implicit_dims)] | ||
|
|
||
| return temps + last | ||
| return temps + [ecls(lhs, rhs, implicit_dims=implicit_dims)] |
|
|
||
| class LinearInterpolator(WeightedInterpolator): | ||
| class TabulatedInterpolator(WeightedInterpolator): | ||
| """Shared plumbing for schemes whose weights are tabulated on the host.""" |
There was a problem hiding this comment.
Todo: adjust docstring
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3031 +/- ##
==========================================
+ Coverage 83.89% 83.93% +0.03%
==========================================
Files 258 258
Lines 55605 55450 -155
Branches 4765 4744 -21
==========================================
- Hits 46652 46544 -108
+ Misses 8135 8093 -42
+ Partials 818 813 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| "due to excessive register pressure in one of the Operator " | ||
| "kernels. Try supplying a smaller `par-tile` value." | ||
| ) | ||
| "kernels. Try supplying a smaller `par-tile` value.") |
| "prevents the use of `tbc-tile` in realistic scenarios, but it " | ||
| "will be removed in future versions." | ||
| ) | ||
| "will be removed in future versions.") |
| 'linearize': False, | ||
| 'place-transfers': False | ||
| } | ||
| rcompile_registry = {'avoid_denormals': False, 'linearize': False, |
| byproduct = byproduct0.filter(key) | ||
|
|
||
| return irs, byproduct | ||
| return irs, byproduct0.filter(key) |
|
|
||
| return {'platform': self.platform.name, | ||
| 'compiler': compiler, | ||
| return {'platform': self.platform.name, 'compiler': compiler, |
| """ | ||
| key0 = lambda f: (f.is_TimeFunction and | ||
| f.save is not None and | ||
| key0 = lambda f: (f.is_TimeFunction and f.save is not None and |
| self.nbytes_consumed_arrays, | ||
| self.nbytes_consumed_memmapped | ||
| ) | ||
| mem_locations = (self.nbytes_consumed_functions, self.nbytes_consumed_arrays, |
JDBetteridge
left a comment
There was a problem hiding this comment.
Thanks, I hate it.
But in all seriousness, what's the point? It looks like we reduce the number of lines of code in the whole codebase by ~600 at the expense of:
- Readability “Programs must be written for people to read, and only incidentally for machines to execute.” Harold Abelson, Structure and Interpretation of Computer Programs
- Automatic merge and rebase functionality
- Spaghetti code, I'm thinking specifically of early/multiple returns "A single return statement at the end of a function creates a single, known point which is passed through at the termination of function execution.
The single-return structure is easier to change. If there is more to do after a
search, just add the statement(s) between the for loop and the return." C STYLE GUIDE, 1994, National Aeronautics and Space Administration (NASA)
The metric should not be the number of lines we remove. The goal of reducing the number of lines of code in a codebase should be eliminating redundant classes and functions by refining the abstractions and generally making the structure more elegant.
| 'Real', | ||
| 'Weights', | ||
| 'Conj', 'DiffDerivative', 'Differentiable', 'EvalDerivative', 'Imag', | ||
| 'IndexDerivative', 'IndexDerivativeProperty', 'LocalSum', 'Real', 'Weights', |
| fd_args = [] | ||
| for f in self._args_diff: | ||
| try: | ||
| with suppress(AttributeError): |
| and issubclass(p, sympy.Symbol) \ | ||
| and any(isinstance(i, p) for i in self.free_symbols): | ||
| if (isinstance(p, type) and issubclass(p, sympy.Symbol) and | ||
| any(isinstance(i, p) for i in self.free_symbols)): |
There was a problem hiding this comment.
This is less readable
| prio = getattr(expr, '_fd_priority', 0) | ||
| return max([prio] + [deep_priority(i) | ||
| for i in getattr(expr, '_args_diff', ())]) | ||
| return max([prio] + [deep_priority(i) for i in getattr(expr, '_args_diff', ())]) |
There was a problem hiding this comment.
@FabioLuporini doesn't like getattr, if you're going to touch lines of code you should probably fix them too
| other = self.func(*other)._eval_at(highest_priority(self)) | ||
| return self.func(other, *derivs) | ||
| other = self.func(*other)._eval_at(highest_priority(self)) | ||
| return self.func(other, *derivs) |
There was a problem hiding this comment.
I despise multiple returns and consider them the definition of spaghetti code. I'd much rather you consolidate and return once
| """Number of points in the domain region.""" | ||
| return DimensionTuple(*self.shape, getters=self.dimensions) | ||
|
|
||
| def _make_sizes(self, pairs): |
There was a problem hiding this comment.
This should be a free function and used in at least one other place to justify its existance
| for a, b in zip(row_indices, col_indices, strict=True) | ||
| ] | ||
| vec = [mat[a]*other_mat[b] | ||
| for a, b in zip(row_indices, col_indices, strict=True)] |
| cls = self.function._indexed_cls | ||
| except AttributeError: | ||
| cls = Indexed | ||
| cls = getattr(self.function, '_indexed_cls', Indexed) |
| "all dimensions are covered" | ||
| ) | ||
| raise ValueError(f"Cannot translate {self} with mapper {mapper} since not " | ||
| "all dimensions are covered") |
There was a problem hiding this comment.
No description provided.
| for i, j in zip(self._decomposition, self._size_inhalo.left, strict=True)] | ||
| right = [max(i.loc_abs_max+j-i.glb_max, 0) if i and not i.loc_empty else 0 | ||
| for i, j in zip(self._decomposition, self._size_inhalo.right, | ||
| strict=True)] |
There was a problem hiding this comment.
Let's make this bit less readable!
There was a problem hiding this comment.
I'm stopping here, I can't read anymore
|
Also, if you have time to feed this into a prompt, you probably have time to help me a bit more with my other PRs |
No description provided.