Skip to content

Commit

Permalink
Merge branch 'master' into wass-contributions
Browse files Browse the repository at this point in the history
  • Loading branch information
skoudoro authored May 3, 2024
2 parents 79c81aa + 342bf69 commit 31b0ec4
Show file tree
Hide file tree
Showing 23 changed files with 756 additions and 309 deletions.
194 changes: 155 additions & 39 deletions fury/actor.py

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions fury/animation/tests/fares
Original file line number Diff line number Diff line change
@@ -1,55 +0,0 @@
# def myfun(x):
# if x > 0:
# return x*(myfun(x-1))
# else:
# return 1
# print(myfun(8))
# ل=4
# print(ل)
# x=lambda a,b,c:pow(b,c)
# print(x(5,6,7))

class myclass():

notallow = ['ahmed', 'omar']
usren = 0

def __init__(self, name, cname):
self.pname = name
self.ccname = cname
myclass.usren += 1

def __str__(self):
return f'collage name is {self.pname} , dof = {self.ccname}'

def print(self):
if self.pname in myclass.notallow:
print('not allowed')
else:
print(f'{self.pname} , {self.ccname}')

def allinfo():
print(f'the end of the class')

@classmethod
def usrenu(cls):
print(myclass.usren)


class student(myclass):

def __init__(self, name, cname, age):
super().__init__(name, cname)
self.age = age

def __str__(self):
return 'your name is {} ,course name = {}, your age is {}'.format(
self.pname, self.ccname, self.age
)


print('\n')
s1 = student('ahmed', 'c5', 34)
print(str(s1)+"\n")
c1 = myclass('edge1', 2004)
print(str(c1)+"\n")
9 changes: 6 additions & 3 deletions fury/colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ def orient2rgb(v):
orient = np.abs(np.divide(v, orientn, where=orientn != 0))
else:
raise IOError(
'Wrong vector dimension, It should be an array' ' with a shape (N, 3)'
'Wrong vector dimension, It should be an array'
' with a shape (N, 3)'
)

return orient
Expand All @@ -259,12 +260,14 @@ def line_colors(streamlines, cmap='rgb_standard'):
"""
if cmap == 'rgb_standard':
col_list = [
orient2rgb(streamline[-1] - streamline[0]) for streamline in streamlines
orient2rgb(streamline[-1] - streamline[0])
for streamline in streamlines
]

if cmap == 'boys_standard':
col_list = [
boys2rgb(streamline[-1] - streamline[0]) for streamline in streamlines
boys2rgb(streamline[-1] - streamline[0])
for streamline in streamlines
]

return np.vstack(col_list)
Expand Down
6 changes: 5 additions & 1 deletion fury/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ def matplotlib_figure_to_numpy(
arr = load_image(fname)
else:
fig.savefig(
fname, dpi=dpi, transparent=transparent, bbox_inches='tight', pad_inches=0
fname,
dpi=dpi,
transparent=transparent,
bbox_inches='tight',
pad_inches=0
)
arr = load_image(fname)

Expand Down
25 changes: 17 additions & 8 deletions fury/deprecator.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
"""
version_cmp = packaging.version.parse if have_pkg else None

if any([re.match(r'^[a-z, A-Z]', v) for v in [version_str, pkg_version_str]]):
if any([re.match(r'^[a-z, A-Z]', v)
for v in [version_str, pkg_version_str]]):
msg = 'Invalid version {0} or {1}'.format(version_str, pkg_version_str)
raise ValueError(msg)
elif version_cmp(version_str) > version_cmp(pkg_version_str):
Expand Down Expand Up @@ -186,7 +187,8 @@ def deprecate_with_version(
if until:
messages.append(
'* {0} {1} as of version: {2}'.format(
'Raises' if is_bad_version(until) else 'Will raise', error_class, until
'Raises' if is_bad_version(until)
else 'Will raise', error_class, until
)
)
message = '\n'.join(messages)
Expand All @@ -199,7 +201,8 @@ def deprecated_func(*args, **kwargs):
warnings.warn(message, warn_class, stacklevel=2)
return func(*args, **kwargs)

deprecated_func.__doc__ = _add_dep_doc(deprecated_func.__doc__, message)
deprecated_func.__doc__ = _add_dep_doc(deprecated_func.__doc__,
message)
return deprecated_func

return deprecator
Expand Down Expand Up @@ -381,11 +384,13 @@ def wrapper(*args, **kwargs):
if (since[i], until[i]) != ('', ''):
messages.append('')
if since[i]:
messages.append('* deprecated from version: ' + str(since[i]))
messages.append('* deprecated from version: ' +
str(since[i]))
if until[i]:
messages.append(
'* {0} {1} as of version: {2}'.format(
'Raises' if is_bad_version(until[i]) else 'Will raise',
'Raises' if is_bad_version(until[i])
else 'Will raise',
error_class,
until[i],
)
Expand Down Expand Up @@ -416,11 +421,14 @@ def wrapper(*args, **kwargs):
kwargs[key] = value

if n_name is not None:
message += '* Use argument "{}" instead.'.format(n_name)
message += '* Use argument "{}" instead.'.format(
n_name
)
elif alternative:
message += '* Use {} instead.'.format(alternative)

if until[i] and is_bad_version(until[i], version_comparator):
if until[i] and is_bad_version(until[i],
version_comparator):
raise error_class(message)
warnings.warn(message, warn_class, stacklevel=2)

Expand All @@ -429,7 +437,8 @@ def wrapper(*args, **kwargs):
elif not n_name and positions[i] and len(args) > positions[i]:
if alternative:
message += '* Use {} instead.'.format(alternative)
if until[i] and is_bad_version(until[i], version_comparator):
if until[i] and is_bad_version(until[i],
version_comparator):
raise error_class(message)

warnings.warn(message, warn_class, stacklevel=2)
Expand Down
Loading

0 comments on commit 31b0ec4

Please sign in to comment.