Sourcery refactored main branch#1
Conversation
|
|
||
| for i in trange(retries): | ||
|
|
||
| for _ in trange(retries): |
There was a problem hiding this comment.
Function find_flat_location refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore)
|
|
There was a problem hiding this comment.
Function compose_scene refactored with the following changes:
- Remove empty elif clause (
remove-pass-elif)
| if len(overrides) > 0: | ||
| if overrides: | ||
| print("Overriden parameters:", overrides) | ||
| output = list(overrides) | ||
| for i, o in enumerate(overrides): | ||
| if ('=' in o) and not any((c in o) for c in "\"'[]"): | ||
| if '=' in o and all(c not in o for c in "\"'[]"): |
There was a problem hiding this comment.
Function sanitize_gin_override refactored with the following changes:
- Simplify sequence length comparison (
simplify-len-comparison) - Invert any/all to simplify comparisons (
invert-any-all)
| f'Running tasks on an already generated scene, you need to specify --seed or results will' | ||
| f' not be view-consistent') | ||
| 'Running tasks on an already generated scene, you need to specify --seed or results will not be view-consistent' | ||
| ) |
There was a problem hiding this comment.
Function determine_scene_seed refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring)
| 'select_scale': uniform(0.03, 0.3) | ||
| } | ||
| return [tree_params() for _ in range(n_tree_species)] | ||
|
|
There was a problem hiding this comment.
Function compose_scene refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation) - Replace f-string with no interpolated values with string (
remove-redundant-fstring)
| for e in bm.edges: | ||
| if e.calc_length() > .04: | ||
| geom.append(e) | ||
| geom = [e for e in bm.edges if e.calc_length() > .04] |
There was a problem hiding this comment.
Function ElkhornBaseCoralFactory.cluster_displace refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension)
| count = 1 | ||
| for e in v.link_edges: | ||
| count += counts[e.other_vert(v).index] | ||
| count = 1 + sum(counts[e.other_vert(v).index] for e in v.link_edges) |
There was a problem hiding this comment.
Function FanBaseCoralFactory.add_radius refactored with the following changes:
- Convert for loop into call to sum() (
sum-comprehension)
| else: | ||
| base_hue = uniform(-.2, .3) % 1 | ||
| return base_hue | ||
| return uniform(0, 1) if uniform(0, 1) < .25 else uniform(-.2, .3) % 1 |
There was a problem hiding this comment.
Function CoralFactory.build_base_hue refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| major_config = { | ||
| return { | ||
| 'n': n_branch, | ||
| 'path_kargs': lambda idx: {'n_pts': n_major + 1, 'std': .4, 'momentum': .4, 'sz': uniform(.08, .1)}, | ||
| 'path_kargs': lambda idx: { | ||
| 'n_pts': n_major + 1, | ||
| 'std': 0.4, | ||
| 'momentum': 0.4, | ||
| 'sz': uniform(0.08, 0.1), | ||
| }, | ||
| 'spawn_kargs': lambda idx: { | ||
| 'init_vec': [span * np.cos(2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9)), | ||
| span * np.sin(2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9)), | ||
| math.sqrt(1 - span * span)]}, | ||
| 'children': [minor_config]} | ||
| return major_config | ||
| 'init_vec': [ | ||
| span | ||
| * np.cos( | ||
| 2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9) | ||
| ), | ||
| span | ||
| * np.sin( | ||
| 2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9) | ||
| ), | ||
| math.sqrt(1 - span * span), | ||
| ] | ||
| }, | ||
| 'children': [minor_config], | ||
| } |
There was a problem hiding this comment.
Function TreeBaseCoralFactory.bush_config refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| major_config = { | ||
| return { | ||
| 'n': n_branch, | ||
| 'path_kargs': lambda idx: { | ||
| 'n_pts': n_major * 2 + 1, | ||
| 'std': .4, | ||
| 'momentum': .4, | ||
| 'sz': uniform(.08, .1)}, | ||
| 'std': 0.4, | ||
| 'momentum': 0.4, | ||
| 'sz': uniform(0.08, 0.1), | ||
| }, | ||
| 'spawn_kargs': lambda idx: { | ||
| 'init_vec': [span * np.cos(2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9)), | ||
| span * np.sin(2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9)), | ||
| math.sqrt(1 - span * span)]}, | ||
| 'children': [minor_config]} | ||
| return major_config | ||
| 'init_vec': [ | ||
| span | ||
| * np.cos( | ||
| 2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9) | ||
| ), | ||
| span | ||
| * np.sin( | ||
| 2 * np.pi * idx / n_branch + uniform(-np.pi / 9, np.pi / 9) | ||
| ), | ||
| math.sqrt(1 - span * span), | ||
| ] | ||
| }, | ||
| 'children': [minor_config], | ||
| } |
There was a problem hiding this comment.
Function TreeBaseCoralFactory.twig_config refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
51dfa5f to
8984d4b
Compare
Branch
mainrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
mainbranch, then run:Help us improve this pull request!