Skip to content

Commit 1125424

Browse files
committed
Removed ComposableFunction
1 parent c1a0794 commit 1125424

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

pythonforandroid/patching.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,22 @@
11
from os import uname
22

3-
class ComposableFunction(object):
4-
def __init__(self, function):
5-
self.func = function
6-
7-
def __call__(self, *args, **kwargs):
8-
return self.func(*args, **kwargs)
9-
10-
def __and__(self, f):
11-
return ComposableFunction(lambda *args, **kwargs: self(*args, **kwargs) and f(*args, **kwargs))
12-
13-
def __or__(self, f):
14-
return ComposableFunction(lambda *args, **kwargs: self(*args, **kwargs) or f(*args, **kwargs))
15-
163

174
def check_all(*callables):
185
def check(**kwargs):
196
return all(c(**kwargs) for c in callables)
20-
return ComposableFunction(check)
7+
return check
218

229

2310
def check_any(*callables):
2411
def check(**kwargs):
2512
return any(c(**kwargs) for c in callables)
26-
return ComposableFunction(check)
13+
return check
2714

2815

2916
def is_platform(platform):
3017
def is_x(**kwargs):
3118
return uname()[0] == platform
32-
return ComposableFunction(is_x)
19+
return is_x
3320

3421
is_linux = is_platform('Linux')
3522
is_darwin = is_platform('Darwin')
@@ -38,41 +25,41 @@ def is_x(**kwargs):
3825
def is_arch(xarch):
3926
def is_x(arch, **kwargs):
4027
return arch.arch == xarch
41-
return ComposableFunction(is_x)
28+
return is_x
4229

4330

4431
def is_api_gt(apiver):
4532
def is_x(recipe, **kwargs):
4633
return recipe.ctx.android_api > apiver
47-
return ComposableFunction(is_x)
34+
return is_x
4835

4936

5037
def is_api_gte(apiver):
5138
def is_x(recipe, **kwargs):
5239
return recipe.ctx.android_api >= apiver
53-
return ComposableFunction(is_x)
40+
return is_x
5441

5542

5643
def is_api_lt(apiver):
5744
def is_x(recipe, **kwargs):
5845
return recipe.ctx.android_api < apiver
59-
return ComposableFunction(is_x)
46+
return is_x
6047

6148

6249
def is_api_lte(apiver):
6350
def is_x(recipe, **kwargs):
6451
return recipe.ctx.android_api <= apiver
65-
return ComposableFunction(is_x)
52+
return is_x
6653

6754

6855
def is_api(apiver):
6956
def is_x(recipe, **kwargs):
7057
return recipe.ctx.android_api == apiver
71-
return ComposableFunction(is_x)
58+
return is_x
7259

7360

7461
def will_build(recipe_name):
7562
def will(recipe, **kwargs):
7663
return recipe_name in recipe.ctx.recipe_build_order
77-
return ComposableFunction(will)
64+
return will
7865

0 commit comments

Comments
 (0)