-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored main branch #1
base: main
Are you sure you want to change the base?
Conversation
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.
Sourcery timed out performing refactorings.
Due to GitHub API limits, only the first 60 comments can be shown.
for i in trange(retries): | ||
|
||
for _ in trange(retries): |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function determine_scene_seed
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
@@ -95,6 +95,7 @@ def choose_forest_params(): | |||
'select_scale': uniform(0.03, 0.3) | |||
} | |||
return [tree_params() for _ in range(n_tree_species)] | |||
|
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.
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
)
geom = [] | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function FanBaseCoralFactory.add_radius
refactored with the following changes:
- Convert for loop into call to sum() (
sum-comprehension
)
if uniform(0, 1) < .25: | ||
base_hue = uniform(0, 1) | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function TreeBaseCoralFactory.twig_config
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
51dfa5f
to
8984d4b
Compare
Branch
main
refactored 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
main
branch, then run:Help us improve this pull request!