[go: nahoru, domu]

Skip to content
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

refactor Pythonic sake #1077

Merged
merged 61 commits into from
Mar 17, 2020
Merged
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
7e8f88d
simplify max fps pattern
mgaitan Feb 9, 2020
565a339
use all instead not any and non-empty list checking
mgaitan Feb 9, 2020
33da2ea
dont need to be lists to iterate
mgaitan Feb 9, 2020
a2a700b
replace hasattr by getattr
mgaitan Feb 9, 2020
328b765
give a generator instead a list
mgaitan Feb 9, 2020
a338db1
simple conditional assignation
mgaitan Feb 9, 2020
3a0d74f
set booleans to add readabiity
mgaitan Feb 9, 2020
bfbcb82
unsloppy code
mgaitan Feb 9, 2020
65914d0
use ternary expressions and flatten if/elif
mgaitan Feb 9, 2020
a8b0f8c
truthy object
mgaitan Feb 9, 2020
6deed31
simplify find_extension usage
mgaitan Feb 9, 2020
f276997
remove not used variable
mgaitan Feb 9, 2020
27dfd95
ternary expression
mgaitan Feb 9, 2020
dd58a6c
more on conditions
mgaitan Feb 9, 2020
678471c
reverse condition in a sake of readability
mgaitan Feb 9, 2020
4c365bf
etattr with default instead hasattr (flatten code)
mgaitan Feb 9, 2020
83420bc
simple credits parsing
mgaitan Feb 9, 2020
878c86c
space after operators
mgaitan Feb 9, 2020
8bede70
use iter
mgaitan Feb 9, 2020
1381c4e
pass generators instead list
mgaitan Feb 9, 2020
fb8c956
indenting
mgaitan Feb 9, 2020
d042b5b
indentation
mgaitan Feb 9, 2020
9e89197
more indention
mgaitan Feb 9, 2020
f7115dc
truthy check
mgaitan Feb 9, 2020
e92d86d
clean offset calculation
mgaitan Feb 9, 2020
b876f6d
explicit filter condition in a loop
mgaitan Feb 9, 2020
725ebb2
useless import
mgaitan Feb 9, 2020
346875f
use super
mgaitan Feb 9, 2020
f9b1c60
not explicity empty list checking
mgaitan Feb 9, 2020
c22f12a
bool condition
mgaitan Feb 9, 2020
c918082
use iter function
mgaitan Feb 9, 2020
f5fc14b
use cvsecs function
mgaitan Feb 9, 2020
eae4cd8
iter file directly
mgaitan Feb 9, 2020
31dbaeb
remove not used import
mgaitan Feb 9, 2020
ef752f7
documentation
mgaitan Feb 9, 2020
10acb50
reverted change on if condition
mgaitan Feb 9, 2020
dfed921
fix regression on blit_on
mgaitan Feb 10, 2020
905de12
fix test_setopacity
mgaitan Feb 10, 2020
346570b
fix bug in hill helper function
mgaitan Feb 10, 2020
83a4459
fix credits
mgaitan Feb 10, 2020
77a6768
remove pdb. shame on you
mgaitan Feb 10, 2020
7f2b6d2
safer check
mgaitan Feb 10, 2020
f3c1009
simplify comprenhension using a generator expression
mgaitan Feb 15, 2020
1f0a2ac
improved version of cvsecs function
mgaitan Feb 15, 2020
30567ff
refactor test_tools module using parametrize
mgaitan Feb 15, 2020
bbc65be
factorize skip as a decorator
mgaitan Feb 15, 2020
fe77e6d
fix regression in cvsecs
mgaitan Feb 15, 2020
0d66739
restore matplotlib test
mgaitan Feb 15, 2020
fc90b13
use a listcomp directly
mgaitan Feb 15, 2020
f3182d8
useless import
mgaitan Feb 15, 2020
ecc312e
correct skipif usage
mgaitan Feb 15, 2020
38a5671
Merge branch 'master' into pythonic
tburrows13 Feb 22, 2020
a535d93
Fix merge error
tburrows13 Feb 22, 2020
274daef
Merge branch 'master' into pythonic
tburrows13 Feb 26, 2020
9323f2f
zero could be a valid value
mgaitan Mar 5, 2020
09a076b
more valid value zero cases
mgaitan Mar 5, 2020
aac2b85
black code
mgaitan Mar 5, 2020
b46dc7d
correct set intersection
mgaitan Mar 5, 2020
bba1de3
r could be 0
mgaitan Mar 5, 2020
c8be628
explicit comparisons
mgaitan Mar 5, 2020
35649d9
fix regression on py2
mgaitan Mar 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
etattr with default instead hasattr (flatten code)
  • Loading branch information
mgaitan committed Feb 9, 2020
commit 4c365bf359c3ea7d00d18f9026cddcd875bfe49b
20 changes: 9 additions & 11 deletions moviepy/video/VideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,11 +938,10 @@ def fl_image(self, image_func, apply_to=None):
self.img = arr

for attr in apply_to:
if hasattr(self, attr):
a = getattr(self, attr)
if a is not None:
new_a = a.fl_image(image_func)
setattr(self, attr, new_a)
a = getattr(self, attr, None)
if a:
new_a = a.fl_image(image_func)
setattr(self, attr, new_a)

@outplace
def fl_time(self, time_func, apply_to=None,
Expand All @@ -956,13 +955,12 @@ def fl_time(self, time_func, apply_to=None,
masks or their audios). The result is still an ImageClip.
"""
if apply_to is None:
apply_to = ['mask', 'audio']
apply_to = ['mask', 'audio']
for attr in apply_to:
if hasattr(self, attr):
a = getattr(self, attr)
if a is not None:
new_a = a.fl_time(time_func)
setattr(self, attr, new_a)
a = getattr(self, attr, None)
if a:
new_a = a.fl_time(time_func)
setattr(self, attr, new_a)


# ##
Expand Down